예제 #1
0
def listProblems(params, user):
    problems = []
    Problem.forEach(lambda prob: problems.append(ProblemCard(prob)))
    return Page(
        h2("Problems", cls="page-title"),
        div(cls="actions", contents=[
            h.button("+ Create Problem", cls="button create-problem", onclick="window.location='/problems/new'")
        ]),
        div(cls="problem-cards", contents=problems)
    )
예제 #2
0
def listProblems(params, user):
    problems = []
    Problem.forEach(lambda prob: problems.append(ProblemCard(prob)))
    return Page(
        h2("Problems", cls="page-title"),
        div(cls="actions",
            contents=[
                h.button("+ Create Problem",
                         cls="button create-problem",
                         onclick="window.location='/problems/new'")
            ]), div(cls="problem-cards", contents=problems))
def viewProblem(params, user):
    problem = Problem.get(params[0])
    
    if not problem:
        return ""

    if not user.isAdmin():
        # Hide the problems till the contest begins for non-admin users
        if not Contest.getCurrent():
            return ""
        if problem not in Contest.getCurrent().problems:
            return ""
    
    return Page(
        h.input(type="hidden", id="problem-id", value=problem.id),
        h2(problem.title, cls="page-title"),
        div(cls="problem-description", contents=[
            Card("Problem Statement", formatMD(problem.statement), cls="stmt"),
            Card("Input Format", formatMD(problem.input), cls="inp"),
            Card("Output Format", formatMD(problem.output), cls="outp"),
            Card("Constraints", formatMD(problem.constraints), cls="constraints"),
            div(cls="samples", contents=list(map(lambda x: getSample(x[0], x[1]), zip(problem.sampleData, range(problem.samples)))))
        ]),
        CodeEditor(),
        div(cls="align-right", contents=[
            h.button("Test Code", cls="button test-samples button-white"),
            h.button("Submit Code", cls="button submit-problem")
        ])
    )
예제 #4
0
def viewProblem(params, user):
    problem = Problem.get(params[0])
    
    if not problem:
        return ""

    if not user.isAdmin():
        # Hide the problems till the contest begins for non-admin users
        if not Contest.getCurrent():
            return ""
        if problem not in Contest.getCurrent().problems:
            return ""
    
    return Page(
        h.input(type="hidden", id="problem-id", value=problem.id),
        h2(problem.title, cls="page-title"),
        div(cls="problem-description", contents=[
            Card("Problem Statement", formatMD(problem.statement), cls="stmt"),
            Card("Input Format", formatMD(problem.input), cls="inp"),
            Card("Output Format", formatMD(problem.output), cls="outp"),
            Card("Constraints", formatMD(problem.constraints), cls="constraints"),       
            div(cls="samples", contents=list(map(lambda x: getSample(x[0], x[1]), zip(problem.sampleData, range(problem.samples)))))
        ]),
        CodeEditor(),
        div(cls="stmt card ui-sortable-handle", contents=[
            div(cls="card-header", contents=[h2("Custom Input", cls="card-title")]),
            div(cls="card-contents", contents=[h.textarea(id="custom-input", cls="col-12")])
        ]),
        div(cls="align-right",id="custom-code-text", contents=[
            h.button("Test Custom Code", cls="button test-custom button-white"),
            h.button("Test Code", cls="button test-samples button-white"),
            h.button("Submit Code", cls="button submit-problem")
        ])
    )
예제 #5
0
 def __init__(self, id=None):
     if id != None:
         details = getKey(f"/submissions/{id}/submission.json")
         self.id          = details["id"]
         self.user        = User.get(details["user"])
         self.problem     = Problem.get(details["problem"])
         self.timestamp   = int(details["timestamp"])
         self.language    = details["language"]
         self.code        = details["code"]
         self.type        = details["type"]
         self.results     = details["results"]
         self.inputs      = details["inputs"]
         self.outputs     = details["outputs"]
         self.errors      = details["errors"]
         self.answers     = details["answers"]
         self.result      = details["result"]
     else:
         self.id          = None
         self.user        = None
         self.problem     = None
         self.timestamp   = 0
         self.language    = None
         self.code        = None
         self.type        = None
         self.results     = []
         self.inputs      = []
         self.outputs     = []
         self.errors      = []
         self.answers     = []
         self.result      = []
예제 #6
0
 def __init__(self, id=None):
     if id != None:
         details = getKey(f"/submissions/{id}/submission.json")
         self.id = details["id"]
         self.user = User.get(details["user"])
         self.problem = Problem.get(details["problem"])
         self.timestamp = int(details["timestamp"])
         self.language = details["language"]
         self.code = details["code"]
         self.type = details["type"]
         self.results = details["results"]
         self.inputs = details["inputs"]
         self.outputs = details["outputs"]
         self.errors = details["errors"]
         self.answers = details["answers"]
         self.result = details["result"]
     else:
         self.id = None
         self.user = None
         self.problem = None
         self.timestamp = 0
         self.language = None
         self.code = None
         self.type = None
         self.results = []
         self.inputs = []
         self.outputs = []
         self.errors = []
         self.answers = []
         self.result = []
def editContest(params, setHeader, user):
    id = params.get("id")
    contest = Contest.get(id) or Contest()

    contest.name = params["name"]
    contest.start = int(params["start"])
    contest.end = int(params["end"])
    contest.scoreboardOff = int(params["scoreboardOff"])
    contest.probInfoBlocks = params["probInfoBlocks"] == "True"
    contest.problems = [
        Problem.get(id) for id in json.loads(params["problems"])
    ]
    for i in contest.problems:
        i.contests[contest.id] = {
            "c": 0,
            "cpp": 0,
            "cs": 0,
            "java": 0,
            "python2": 0,
            "python3": 0,
            "ruby": 0,
            "vb": 0,
            "completed": []
        }
        i.save()
    if str(params["tieBreaker"]).lower() == "true":
        contest.tieBreaker = True
    else:
        contest.tieBreaker = False
    contest.save()

    return contest.id
예제 #8
0
def editContest(params, setHeader, user):
    id = params.get("id")
    contest = Contest.get(id) or Contest()

    contest.name     = params["name"]
    contest.start    = int(params["start"])
    contest.end      = int(params["end"])
    contest.scoreboardOff = int(params["scoreboardOff"])
    contest.problems = [Problem.get(id) for id in json.loads(params["problems"])]

    contest.save()

    return contest.id
예제 #9
0
def addSubmission(probId, lang, code, user, type):
    sub = Submission()
    sub.problem = Problem.get(probId)
    sub.language = lang
    sub.code = code
    sub.result = "pending"
    sub.user = user
    sub.timestamp = time.time() * 1000
    sub.type = type
    if type == "submit":
        sub.save()
    else:
        sub.id = str(uuid4())
    return sub
예제 #10
0
def addSubmission(probId, lang, code, user, type):
    sub = Submission()
    sub.problem = Problem.get(probId)
    sub.language = lang
    sub.code = code
    sub.result = "pending"
    sub.user = user
    sub.timestamp = time.time() * 1000
    sub.type = type
    if type == "submit":
        sub.save()
    else:
        sub.id = str(uuid4())
    return sub
def rejudgeAll(params, setHeader, user):
    probId = params["probId"]
    # curTime = params["curTime"]
    curTime = time.time() * 1000
    count = 0
    for contestant in filter(lambda c: not c.isAdmin(), User.all()):
        for sub in filter(
                lambda s: s.user.id == contestant.id and s.problem.id == probId
                and s.timestamp < curTime and s.result != "reject" and s.type
                != "test", Submission.all()):
            if os.path.exists(f"/tmp/{id}"):
                shutil.rmtree(f"/tmp/{id}")
            runCode(sub)
            count += 1
    return {"name": Problem.get(probId).title, "count": count}
예제 #12
0
def editContest(params, setHeader, user):
    id = params.get("id")
    contest = Contest.get(id) or Contest()

    contest.name = params["name"]
    contest.start = int(params["start"])
    contest.end = int(params["end"])
    contest.scoreboardOff = int(params["scoreboardOff"])
    contest.problems = [
        Problem.get(id) for id in json.loads(params["problems"])
    ]

    contest.save()

    return contest.id
예제 #13
0
 def __init__(self, id=None):
     if id != None:
         details = getKey(f"/contests/{id}/contest.json")
         self.id = details["id"]
         self.name = details["name"]
         self.start = int(details["start"])
         self.end = int(details["end"])
         self.scoreboardOff = int(details.get("scoreboardOff", self.end))
         self.problems = [Problem.get(id) for id in details["problems"]]
     else:
         self.id = None
         self.name = None
         self.start = None
         self.end = None
         self.scoreboardOff = None
         self.problems = None
예제 #14
0
 def __init__(self, id=None):
     if id != None:
         details       = getKey(f"/contests/{id}/contest.json")
         self.id       = details["id"]
         self.name     = details["name"]
         self.start    = int(details["start"])
         self.end      = int(details["end"])
         self.scoreboardOff = int(details.get("scoreboardOff", self.end))
         self.problems = [Problem.get(id) for id in details["problems"]]
     else:
         self.id = None
         self.name = None
         self.start = None
         self.end = None
         self.scoreboardOff = None
         self.problems = None            
예제 #15
0
def editContest(params, setHeader, user):
    id = params.get("id")
    contest = Contest.get(id) or Contest()

    contest.name     = params["name"]
    contest.start    = int(params["start"])
    contest.end      = int(params["end"])
    contest.scoreboardOff = int(params["scoreboardOff"])
    contest.problems = [Problem.get(id) for id in json.loads(params["problems"])]
    if str(params["tieBreaker"]).lower() == "true":
        contest.tieBreaker = True
    else:
        contest.tieBreaker = False

    contest.save()

    return contest.id
예제 #16
0
def viewProblem(params, user):
    problem = Problem.get(params[0])

    if not problem:
        return ""

    if not user.isAdmin():
        # Hide the problems till the contest begins for non-admin users
        if not Contest.getCurrent():
            return ""
        if problem not in Contest.getCurrent().problems:
            return ""

    cards = []
    if Contest.getCurrent() is None or Contest.getCurrent().probInfoBlocks:
        cards = [
            Card("Problem Statement", formatMD(problem.statement), cls="stmt"),
            Card("Input Format", formatMD(problem.input), cls="inp"),
            Card("Output Format", formatMD(problem.output), cls="outp"),
            Card("Constraints",
                 formatMD(problem.constraints),
                 cls="constraints"),
            Card("Time Limit",
                 formatMD(f"{problem.timeLimit} second" +
                          ("" if problem.timeLimit == 1 else "s")),
                 cls="constraints"),
        ]

    return Page(
        h.input(type="hidden", id="problem-id", value=problem.id),
        h2(problem.title, cls="page-title"),
        div(cls="problem-description",
            contents=[
                *cards,
                div(cls="samples",
                    contents=list(
                        map(lambda x: getSample(x[0], x[1]),
                            zip(problem.sampleData, range(problem.samples)))))
            ]), CodeEditor(),
        div(cls="align-right",
            contents=[
                h.button("Test Code", cls="button test-samples button-white"),
                h.button("Submit Code", cls="button submit-problem")
            ]))
예제 #17
0
    def __init__(self, id=None):
        if id != None:
            details = getKey(f"/contests/{id}/contest.json")
            self.id = details["id"]
            self.name = details["name"]
            self.start = int(details["start"])
            self.end = int(details["end"])
            self.scoreboardOff = int(details.get("scoreboardOff", self.end))
            self.probInfoBlocks = details["probInfoBlocks"] == "True"
            self.problems = [Problem.get(id) for id in details["problems"]]
            if str(details["tieBreaker"]).lower() == "true":
                self.tieBreaker = True
            else:
                self.tieBreaker = False

        else:
            self.id = None
            self.name = None
            self.start = None
            self.end = None
            self.scoreboardOff = None
            self.tieBreaker = False
            self.probInfoBlocks = True
            self.problems = None
예제 #18
0
def editContest(params, user):
    id = params[0] if params else None
    contest = Contest.get(id)
    
    title = "New Contest"
    chooseProblem = ""
    existingProblems = []
    start = time.time() * 1000
    end = (time.time() + 3600) * 1000
    if contest:
        title = contest.name
        start = contest.start
        end = contest.end
        scoreboardOff = contest.scoreboardOff
        chooseProblem = div(cls="actions", contents=[
            h.button("+ Choose Problem", cls="button", onclick="chooseProblemDialog()")
        ])

        problems = [ProblemCard(prob) for prob in contest.problems]
        problemOptions = [h.option(prob.title, value=prob.id) for prob in Problem.all() if prob not in contest.problems]

        existingProblems = [
            Modal(
                "Choose Problem",
                h.select(cls="form-control problem-choice", contents=[
                    h.option("-"),
                    *problemOptions
                ]),
                div(
                    h.button("Cancel", **{"type":"button", "class": "button button-white", "data-dismiss": "modal"}),
                    h.button("Add Problem", **{"type":"button", "class": "button", "onclick": "chooseProblem()"})
                )
            ),
            div(cls="problem-cards", contents=problems)
        ]
    
    return Page(
        h.input(type="hidden", id="contest-id", value=id),
        h.input(type="hidden", id="pageId", value="Contest"),
        h2(title, cls="page-title"),
        chooseProblem,
        Card("Contest Details", div(cls="contest-details", contents=[
            h.form(cls="row", contents=[
                div(cls="form-group col-12", contents=[
                    h.label(**{"for": "contest-name", "contents":"Name"}),
                    h.input(cls="form-control", name="contest-name", id="contest-name", value=title)
                ]),
                h.input(type="hidden", id="start", value=start),
                div(cls="form-group col-6", contents=[
                    h.label(**{"for": "contest-start-date", "contents":"Start Date"}),
                    h.input(cls="form-control", name="contest-start-date", id="contest-start-date", type="date")
                ]),
                div(cls="form-group col-6", contents=[
                    h.label(**{"for": "contest-start-time", "contents":"Start Time"}),
                    h.input(cls="form-control", name="contest-start-time", id="contest-start-time", type="time")
                ]),
                h.input(type="hidden", id="end", value=end),
                div(cls="form-group col-6", contents=[
                    h.label(**{"for": "contest-end-date", "contents":"End Date"}),
                    h.input(cls="form-control", name="contest-end-date", id="contest-end-date", type="date")
                ]),
                div(cls="form-group col-6", contents=[
                    h.label(**{"for": "contest-end-time", "contents":"End Time"}),
                    h.input(cls="form-control", name="contest-end-time", id="contest-end-time", type="time")
                ]),
                h.input(type="hidden", id="scoreboardOff", value=scoreboardOff),
                div(cls="form-group col-6"),
                div(cls="form-group col-6", contents=[
                    h.label(**{"for": "scoreboard-off-time", "contents":"Turn Scoreboard Off Time"}),
                    h.input(cls="form-control", name="scoreboard-off-time", id="scoreboard-off-time", type="time")
                ])
            ]),
            div(cls="align-right col-12", contents=[
                h.button("Save", cls="button", onclick="editContest()")
            ])
        ])),
        *existingProblems
    )
예제 #19
0
def editContest(params, user):
    id = params[0] if params else None
    contest = Contest.get(id)

    title = "New Contest"
    chooseProblem = ""
    existingProblems = []
    start = time.time() * 1000
    end = (time.time() + 3600) * 1000
    scoreboardOff = end
    if contest:
        title = contest.name
        start = contest.start
        end = contest.end

        scoreboardOff = contest.scoreboardOff
        chooseProblem = div(cls="actions",
                            contents=[
                                h.button("+ Choose Problem",
                                         cls="button",
                                         onclick="chooseProblemDialog()")
                            ])

        problems = [ProblemCard(prob) for prob in contest.problems]
        problemOptions = [
            h.option(prob.title, value=prob.id) for prob in Problem.all()
            if prob not in contest.problems
        ]

        existingProblems = [
            Modal(
                "Choose Problem",
                h.select(cls="form-control problem-choice",
                         contents=[h.option("-"), *problemOptions]),
                div(
                    h.button(
                        "Cancel", **{
                            "type": "button",
                            "class": "button button-white",
                            "data-dismiss": "modal"
                        }),
                    h.button(
                        "Add Problem", **{
                            "type": "button",
                            "class": "button",
                            "onclick": "chooseProblem()"
                        }))),
            div(cls="problem-cards", contents=problems)
        ]

    return Page(
        h.input(type="hidden", id="contest-id", value=id),
        h.input(type="hidden", id="pageId", value="Contest"),
        h2(title, cls="page-title"), chooseProblem,
        Card(
            "Contest Details",
            div(cls="contest-details",
                contents=[
                    h.form(
                        cls="row",
                        contents=[
                            div(cls="form-group col-12",
                                contents=[
                                    h.label(**{
                                        "for": "contest-name",
                                        "contents": "Name"
                                    }),
                                    h.input(cls="form-control",
                                            name="contest-name",
                                            id="contest-name",
                                            value=title)
                                ]),
                            h.input(type="hidden", id="start", value=start),
                            div(cls="form-group col-6",
                                contents=[
                                    h.label(
                                        **{
                                            "for": "contest-start-date",
                                            "contents": "Start Date"
                                        }),
                                    h.input(cls="form-control",
                                            name="contest-start-date",
                                            id="contest-start-date",
                                            type="date")
                                ]),
                            div(cls="form-group col-6",
                                contents=[
                                    h.label(
                                        **{
                                            "for": "contest-start-time",
                                            "contents": "Start Time"
                                        }),
                                    h.input(cls="form-control",
                                            name="contest-start-time",
                                            id="contest-start-time",
                                            type="time")
                                ]),
                            h.input(type="hidden", id="end", value=end),
                            div(cls="form-group col-6",
                                contents=[
                                    h.label(
                                        **{
                                            "for": "contest-end-date",
                                            "contents": "End Date"
                                        }),
                                    h.input(cls="form-control",
                                            name="contest-end-date",
                                            id="contest-end-date",
                                            type="date")
                                ]),
                            div(cls="form-group col-6",
                                contents=[
                                    h.label(
                                        **{
                                            "for": "contest-end-time",
                                            "contents": "End Time"
                                        }),
                                    h.input(cls="form-control",
                                            name="contest-end-time",
                                            id="contest-end-time",
                                            type="time")
                                ]),
                            h.input(type="hidden",
                                    id="scoreboardOff",
                                    value=scoreboardOff),
                            div(cls="form-group col-6",
                                contents=[
                                    h.label(
                                        **{
                                            "for": "scoreboard-tie-breaker",
                                            "contents":
                                            "Sample Data Breaks Ties"
                                        }),
                                    h.select(
                                        cls="form-control",
                                        name="scoreboard-tie-breaker",
                                        id="scoreboard-tie-breaker",
                                        contents=[
                                            *[
                                                h.option(text,
                                                         value=val,
                                                         selected="selected")
                                                if contest.tieBreaker == val
                                                else h.option(text, value=val)
                                                for text, val in zip(
                                                    ("On", "Off"), (True,
                                                                    False))
                                            ]
                                        ])
                                ]),
                            div(cls="form-group col-6",
                                contents=[
                                    h.label(
                                        **{
                                            "for": "scoreboard-off-time",
                                            "contents":
                                            "Turn Scoreboard Off Time"
                                        }),
                                    h.input(cls="form-control",
                                            name="scoreboard-off-time",
                                            id="scoreboard-off-time",
                                            type="time")
                                ])
                        ]),
                    div(cls="align-right col-12",
                        contents=[
                            h.button("Save",
                                     cls="button",
                                     onclick="editContest()")
                        ])
                ])), *existingProblems)
예제 #20
0
def editProblem(params, user):
    probId = params[0]
    prob = Problem.get(probId)
    return Page(
        h.input(type="hidden", id="prob-id", value=probId),
        h.input(type="hidden", id="pageId", value="Problem"),
        h2(prob.title, cls="page-title"),
        div(cls="actions",
            contents=[
                h.button("View Problem",
                         cls="button",
                         onclick=f"window.location='/problems/{probId}'"),
                h.button("+ Create Test Data",
                         cls="button",
                         onclick="createTestDataDialog()")
            ]),
        Card(
            "Problem Details",
            div(cls="problem-details",
                contents=[
                    h.form(
                        cls="row",
                        contents=[
                            div(cls="form-group col-12",
                                contents=[
                                    h.label(
                                        **{
                                            "for": "problem-title",
                                            "contents": "Title"
                                        }),
                                    h.input(cls="form-control",
                                            name="problem-title",
                                            id="problem-title",
                                            value=prob.title)
                                ]),
                            div(cls="form-group col-12",
                                contents=[
                                    h.label(
                                        **{
                                            "for": "problem-description",
                                            "contents": "Description"
                                        }),
                                    h.textarea(cls="form-control",
                                               name="problem-description",
                                               id="problem-description",
                                               contents=escape(
                                                   prob.description))
                                ]),
                            div(cls="form-group col-12 rich-text",
                                contents=[
                                    h.label(
                                        **{
                                            "for": "problem-statement",
                                            "contents": "Problem Statement"
                                        }),
                                    h.textarea(cls="form-control",
                                               name="problem-statement",
                                               id="problem-statement",
                                               contents=escape(prob.statement))
                                ]),
                            div(cls="form-group col-12 rich-text",
                                contents=[
                                    h.label(
                                        **{
                                            "for": "problem-input",
                                            "contents": "Input Format"
                                        }),
                                    h.textarea(cls="form-control",
                                               name="problem-input",
                                               id="problem-input",
                                               contents=escape(prob.input))
                                ]),
                            div(cls="form-group col-12 rich-text",
                                contents=[
                                    h.label(
                                        **{
                                            "for": "problem-output",
                                            "contents": "Output Format"
                                        }),
                                    h.textarea(cls="form-control",
                                               name="problem-output",
                                               id="problem-output",
                                               contents=escape(prob.output))
                                ]),
                            div(cls="form-group col-12 rich-text",
                                contents=[
                                    h.label(
                                        **{
                                            "for": "problem-constraints",
                                            "contents": "Constraints"
                                        }),
                                    h.textarea(cls="form-control",
                                               name="problem-constraints",
                                               id="problem-constraints",
                                               contents=escape(
                                                   prob.constraints))
                                ]),
                            div(cls="form-group col-6",
                                contents=[
                                    h.label(
                                        **{
                                            "for": "problem-time-limit",
                                            "contents": "Time Limit (seconds)"
                                        }),
                                    h.input(cls="form-control",
                                            type="number",
                                            name="problem-time-limit",
                                            id="problem-time-limit",
                                            value=prob.timeLimit)
                                ]),
                            div(cls="form-group col-6",
                                contents=[
                                    h.label(
                                        **{
                                            "for": "problem-samples",
                                            "contents":
                                            "Number of Sample Cases"
                                        }),
                                    h.input(cls="form-control",
                                            type="number",
                                            name="problem-samples",
                                            id="problem-samples",
                                            value=prob.samples)
                                ]),
                        ]),
                    div(cls="align-right col-12",
                        contents=[
                            h.button("Save",
                                     cls="button",
                                     onclick="editProblem()")
                        ])
                ])),
        Modal(
            "Create Test Data",
            div(
                h.h5("Input"),
                h.textarea(
                    rows="5",
                    cls="test-data-input col-12 monospace margin-bottom"),
                h.h5("Output"),
                h.textarea(rows="5", cls="test-data-output col-12 monospace")),
            div(
                h.button(
                    "Cancel", **{
                        "type": "button",
                        "class": "button button-white",
                        "data-dismiss": "modal"
                    }),
                h.button(
                    "Add Test Data", **{
                        "type": "button",
                        "class": "button",
                        "onclick": "createTestData()"
                    }))),
        div(cls="test-data-cards",
            contents=list(
                map(
                    TestDataCard,
                    zip(range(prob.tests), prob.testData,
                        [prob.samples] * prob.tests)))))
예제 #21
0
def editProblem(params, user):
    probId = params[0]
    prob = Problem.get(probId)
    return Page(
        h.input(type="hidden", id="prob-id", value=probId),
        h.input(type="hidden", id="pageId", value="Problem"),
        h2(prob.title, cls="page-title"),
        div(cls="actions", contents=[
            h.button("View Problem", cls="button", onclick=f"window.location='/problems/{probId}'"),
            h.button("+ Create Test Data", cls="button", onclick="createTestDataDialog()")
        ]),
        Card("Problem Details", div(cls="problem-details", contents=[
            h.form(cls="row", contents=[
                div(cls="form-group col-12", contents=[
                    h.label(**{"for": "problem-title", "contents":"Title"}),
                    h.input(cls="form-control", name="problem-title", id="problem-title", value=prob.title)
                ]),
                div(cls="form-group col-12", contents=[
                    h.label(**{"for": "problem-description", "contents":"Description"}),
                    h.textarea(cls="form-control", name="problem-description", id="problem-description", contents=escape(prob.description))
                ]),
                div(cls="form-group col-12 rich-text", contents=[
                    h.label(**{"for": "problem-statement", "contents":"Problem Statement"}),
                    h.textarea(cls="form-control", name="problem-statement", id="problem-statement", contents=escape(prob.statement))
                ]),
                div(cls="form-group col-12 rich-text", contents=[
                    h.label(**{"for": "problem-input", "contents":"Input Format"}),
                    h.textarea(cls="form-control", name="problem-input", id="problem-input", contents=escape(prob.input))
                ]),
                div(cls="form-group col-12 rich-text", contents=[
                    h.label(**{"for": "problem-output", "contents":"Output Format"}),
                    h.textarea(cls="form-control", name="problem-output", id="problem-output", contents=escape(prob.output))
                ]),
                div(cls="form-group col-12 rich-text", contents=[
                    h.label(**{"for": "problem-constraints", "contents":"Constraints"}),
                    h.textarea(cls="form-control", name="problem-constraints", id="problem-constraints", contents=escape(prob.constraints))
                ]),
                div(cls="form-group col-12", contents=[
                    h.label(**{"for": "problem-samples", "contents":"Number of Sample Cases"}),
                    h.input(cls="form-control", type="number", name="problem-samples", id="problem-samples", value=prob.samples)
                ]),
            ]),
            div(cls="align-right col-12", contents=[
                h.button("Save", cls="button", onclick="editProblem()")
            ])
          ])),
        Modal(
            "Create Test Data",
            div(
                h.h5("Input"),
                h.textarea(rows="5", cls="test-data-input col-12 monospace margin-bottom"),
                h.h5("Output"),
                h.textarea(rows="5", cls="test-data-output col-12 monospace")
            ),
            div(
                h.button("Cancel", **{"type":"button", "class": "button button-white", "data-dismiss": "modal"}),
                h.button("Add Test Data", **{"type":"button", "class": "button", "onclick": "createTestData()"})
            )
        ),
        div(cls="test-data-cards", contents=list(map(TestDataCard, zip(range(prob.tests), prob.testData, [prob.samples] * prob.tests))))
    )