problem.stresses, problem.saveStress, problem.deleteStress, problem.runStresses, problem.cancelStresses and problem.addStressCountertest for managing, running and inspecting problem stress tests.problem.issues, problem.addIssue and problem.updateIssue for reading, creating, commenting, closing, reopening, retyping and reassigning problem issues.problem.saveValidatorTest and problem.saveCheckerTest now normalize line breaks in passed text parameters to CRLF without adding a trailing EOL, treat EOL-equivalent values as duplicates, and clear the previous run result after every successful save.problem.saveStatement now rejects a name containing a line break (CR, LF, U+2028 or U+2029) instead of silently storing a multiline problem name.problem.materials and problem.setMaterial for viewing and changing publishable problem materials in the current working copy.problem.accesses and problem.setAccess for viewing and changing direct problem access.problem.statements now includes the boolean fields showInReview and showCautionsAndGrammaticalFixes; problem.saveStatement accepts them as optional parameters.skipDuplicatedTestsValidation to problem.info and problem.updateInfo.problem.note and problem.saveNote. The Problem object now returns note.problem.deleteTest with all-or-nothing pre-checks and structured failure details.problem.checkerTests now returns runVerdict and runComment when checker test run results are available.problem.validatorTests now returns runVerdict and runComment when validator test run results are available.problem.renderStatements to render statement and tutorial HTML/PDF files from the current working copy.problem.cautions to return structured problem cautions, package-readiness issues, latest package warnings and cached AI correction tips.problem.updateInfo now validates that timeLimit is divisible by 50.problem.clearScript, problem.previewTests, problem.enableTreatPointsFromCheckerAsPercent and problem.viewStatementResource.Use HTTP POST-requests:
Use problem URL and POST-parameters <login>, <password> and optionals <revision>, <type> to download a zip-file with problem package (you can use type=windows or type=linux). If the problem has the pin code, provide an optional POST-parameter <pin>. Example:
wget –post-data=login=vtapochkin&password=??? https://polygon.codeforces.com/p85dIBF/mmirzayanov/a-plus-b
Use problem URL + /problem.xml and POST-parameters <login>, <password> and optional <revision> to download a problem descriptor (much more faster, use it to check if new revision has been released). If the problem has the pin code, provide an optional POST-parameter <pin>. Example:
wget –post-data=login=vtapochkin&password=??? https://polygon.codeforces.com/p85dIBF/mmirzayanov/a-plus-b/problem.xml
Use ‘c/ContestUID/contest.xml’ and POST-parameters <login>, <password> to download a contest descriptor. If the contest has the pin code, provide an optional POST-parameter <pin>. Example:
wget –post-data=login=vtapochkin&password=??? https://polygon.codeforces.com/c/50431a121273b7e31f4200e7/contest.xml
To access Polygon API you just send a HTTP-request to address https://polygon.codeforces.com/api/{methodName} with method-specific parameters.
Most method calls return a JSON-object (if not specified otherwise) with three possible fields: status, comment and result.
Using Polygon API requires authorization. To authorize, you will need an API key, which can be generated on settings page. Each API key has two parameters: key and secret. To use the key you must add following parameters to your request.
apiKey - must be equal to key.time - current time in UNIX format (e.g., System.currentTimeMillis()/1000). If the difference between server time and time, specified in parameter, will be greater than 5 minutes, request will be denied.apiSig - signature to ensure that you know both key and secret. The first six characters of the apiSig parameter can be arbitrary. We recommend to choose them at random for each request. Let’s denote them as rand. The rest of the parameter is hexadecimal representation of SHA-512 hash-code of the following string: <rand>/<methodName>?param1=value1¶m2=value2…¶mN=valueN#<secret> where (param_1, value_1), (param_2, value_2), …, (param_n, value_n) are all the request parameters (including apiKey, time, but excluding apiSig) with corresponding values, sorted lexicographically first by param_i, then by value_i.Returns a list of problems, available to the user, according to search parameters.
showDeleted - bool, optional - show/hide deleted problems (defaults to false)id - problem id, optionalname - problem name, optionalowner - problem owner login, optionalA list of Problem objects.
Create a new empty problem. Returns a created Problem.
name - name of problem being createdTo access problem-specific API methods, add a problemId parameter to your request. The user must have access to the problem. Methods require at least READ access unless stated otherwise; problem.commitChanges, problem.saveNote and problem.buildPackage require WRITE access. problem.accesses requires effective WRITE or OWNER access, including access received through a user group. problem.setAccess requires direct WRITE or OWNER access; group access alone is insufficient. Administrators may use both access-management methods. problem.addIssue and problem.updateIssue require WRITE or OWNER access or the reviewer role. Translators may use only methods explicitly marked as available to translators. If the problem has the pin code, add the pin parameter to your request.
The problem-specific methods available to translators are problem.info, problem.statements, problem.renderStatements, problem.saveStatement, problem.statementResources, problem.viewStatementResource, problem.saveStatementResource, problem.issues, problem.addIssue and problem.updateIssue.
Returns the problem’s direct access-control entries. Both users and user groups are returned; groups are not expanded into their members. The method does not calculate each user’s effective access.
The method requires effective WRITE or OWNER access and is not available to translators. Access received through a user group is sufficient for this read-only method. The access list is stored immediately at problem level and is not part of the working copy.
None besides the common problemId and optional pin parameters.
A list of ProblemAccess objects sorted by login using case-sensitive string ordering.
For sample and example problems, only the owner entry is returned. Automatically created per-user READ entries of sample problems and the anonymous READ entry of example problems are intentionally omitted.
Example response:
{
"status": "OK",
"result": [
{"login": "@editors", "accessType": "WRITE"},
{"login": "alice", "accessType": "READ"},
{"login": "owner", "accessType": "OWNER"}
]
}
Idempotently sets one user’s direct access to the problem. Changes take effect immediately: repository permissions and the problem modification time are updated, and problem.commitChanges is not required.
The method requires direct WRITE or OWNER access and is not available to translators. Effective WRITE or OWNER access received only through a user group is insufficient. Administrators may use the method.
login - string - exact login of an existing user. User-group logins beginning with @ are not supported by this method.accessType - READ/WRITE/NONE - required direct access state. NONE removes the user’s direct access entry.READ and WRITE create a direct entry or change its type. NONE removes only the direct entry; access received through a user group remains effective.codeforces account is subject to Codeforces protection checks when enabled. If removal is prohibited or the status cannot be verified, the method returns FAILED with the reason and retains the direct entry.OWNER cannot be assigned. A direct owner cannot be downgraded or removed. A real READ or WRITE change is also rejected while the target user’s effective access is OWNER.READ/WRITE type change, the existing receiveEmails setting is preserved while reviewer, supervisor and translator roles are cleared. These role fields are not exposed by this API.A successful response has status OK and no result field:
{"status":"OK"}
The method returns HTTP 400 with status FAILED for an unknown user, an unsupported user-group login or accessType, insufficient direct access, an attempt to change ownership, a sample or example problem, an exceeded change rate limit, an invalid required pin, or an access removal rejected by the Codeforces protection check.
Returns a ProblemInfo object.
Update problem info. All parameters are optional.
inputFile - problem’s input file, optional; if specified, must be 1..64 characters, valid text and UTF-8outputFile - problem’s output file, optional; if specified, must be 1..64 characters, valid text and UTF-8interactive - boolean - is problem interactivewellFormed - boolean - is tests well-formedskipDuplicatedTestsValidation - boolean - whether to skip checking that tests are uniquetimeLimit - problem’s time limit in milliseconds, from 250 to 15000, must be divisible by 50memoryLimit - problem’s memory limit in MB, from 4 to 1024If both the effective input and output file names are equal ignoring case, the method returns status “FAILED”.
Returns problem note. This note is a problem-level user note and is not related to statement notes.
None
A string - the problem note, or an empty string if no note is set.
Saves problem note. This method updates the stored problem note immediately; it does not modify the working copy and does not require problem.commitChanges.
note - string - the problem note to save, up to 50 characters, valid text and UTF-8. Use an empty string to clear the note.Updates working copy.
Discards working copy.
Commits problem changes. All parameters are optional.
minorChanges - boolean - if true, no email notification will be sentmessage - problem’s commit messageA CommitResult object. If there are no changes, the top-level status is “OK” and the result contains committed=false, conflictOccurred=false and message="No changes". If commit fails, the top-level status is “FAILED” and comment contains the failure message.
Returns a map from language to a Statement object for that language.
Renders statements and tutorials from the current working copy. For each available statement language, the method returns independent HTML and PDF render results. Tutorials are returned only for languages where the current working copy has non-empty tutorial content.
The method requires READ access and is available to translators. If one HTML or PDF render fails or times out, the method still returns status “OK” and puts the error into that particular RenderResult. Each individual HTML/PDF render is limited to 1 minute.
If the whole request does not finish in 4 minutes, the method returns status “FAILED” with comment “Statement rendering did not finish in 4 minutes. Please repeat the request in 4 minutes.”
includeContent - boolean, optional - if true, successful render results include contentBase64; defaults to falseA RenderStatements object.
Update or create a problem’s statement. All parameters except for lang are optional.
lang (required) - statement’s languageencoding - statement’s encodingname - problem’s name in statement’s language, a single line: a value containing CR, LF, U+2028 or U+2029 is rejectedlegend - statement legend/main statement textinput - problem’s input formatoutput - problem’s output formatscoring - problem’s scoringinteraction - problem’s interaction protocol (only for interactive problems)notes - statement notestutorial - problem’s tutorialshowInReview - boolean - whether to show the statement in the problem reviewshowCautionsAndGrammaticalFixes - boolean - whether to show cautions and grammatical fixes for this statementReturns a list of statement resources for the problem.
None
A list of File objects.
Returns statement resource file. In case of success, this method does not return JSON, instead it returns the requested file with the corresponding mime-type set.
This method is available to translators.
name - statement resource file nameAdd or edit statement resource file.
This method is available to translators.
checkExisting - boolean, optional - if true, only adding files is allowedname - file namefile - file contentReturns the name of the currently set checker.
Returns the name of the currently set validator.
Returns an array containing the names of the currently set extra validators.
Returns the name of the currently set interactor.
Returns a list of validator tests for the problem.
None
A list of ValidatorTest objects.
Add or edit validator test. Line breaks in passed testInput are normalized to CRLF without adding a trailing EOL, and EOL-equivalent inputs are equal for duplicate checks. Every successful save clears the previous run result. In case of editing, all parameters except for testIndex are optional. In case of adding, all parameters except for testIndex, testInput and testVerdict are optional.
checkExisting - boolean, optional - if true, only adding validator’s test is allowedtestVerdict - VALID/INVALID - validator test verdicttestIndex - index of a validator testtestInput - input of a validator testtestGroup - optional - test group (groups should be enabled for the testset)testset - optional - testset nameReturns a list of checker tests for the problem.
None
A list of CheckerTest objects.
Adds or edits checker test. Line breaks in passed testInput, testOutput and testAnswer are normalized to CRLF without adding a trailing EOL, and EOL-equivalent values are equal for duplicate checks. Every successful save clears the previous run result. In case of editing, all parameters except for testIndex are optional. In case of adding, all parameters except for testIndex, testInput, testAnswer, testOutput and testVerdict are optional.
checkExisting - boolean, optional - if true, only adding checker test is allowedtestVerdict - OK/WRONG_ANSWER/PRESENTATION_ERROR/CRASHED - checker’s test verdicttestIndex - index of a checker testtestInput - input of a checker testtestOutput - output of a checker testtestAnswer - answer of a checker testReturns the list of resource, source and aux files. Method returns a JSON object with three fields: resourceFiles, sourceFiles and auxFiles, each of them is a list of File objects.
Returns the list of Solution objects.
Returns resource, source or aux file. In case of success, this method does not return JSON, instead it returns plain view of the file with the corresponding mime-type set.
type - resource/aux/source - requested file’s typename - file nameReturns solution file. In case of success, this method does not return JSON, instead in returns plain view of the solution file.
name - solution’s nameReturns script for generating tests. In case of success, this method does not return JSON, instead it returns plain view of the script.
testset - testset for which the script is requestedClears script for generating tests in the specified testset.
testset - testset for which the script should be clearedReturns tests for the given testset
testset - testset for which tests are requestednoInputs - boolean, optional - if true, returns tests without inputA list of Test objects.
Returns cached or currently available test previews for tests in the specified testset. If a preview is missing or stale, the method may start preview generation and return a TestPreview object without input and answer; repeat the request later to get generated data.
testset - testset for which tests should be previewedA list of TestPreview objects.
Returns generated test input. In case of success, this method does not return JSON, instead it returns plain view.
testset - testset of the testtestIndex - index of the testReturns generated test answer. In case of success, this method does not return JSON, instead it returns plain view.
testset - testset of the testtestIndex - index of the testUpdate validator.
validator - name of the validator (one of source files)Update checker.
checker - name of the checker (one of source files)Update interactor.
interactor - name of the interactor (one of source files)Add or edit resource, source or aux file. In case of editing, all parameters except for type and name are optional.
checkExisting - boolean, optional - if true, only adding files is allowedtype - file type (resource/source or aux)name - file namefile - file contentsourceType - optional - source type (in case of a source file)
In case of type=resource there some possible additional parameters:forTypes - optional - semicolon separated list of applicable file types (see ResourceAdvancedProperties)stages - optional - semicolon separated list of values COMPILE or RUN, meaning the phase when the resource is applicable (currently only stages=COMPILE is supported)assets - optional - semicolon separated list of values VALIDATOR, INTERACTOR, CHECKER, SOLUTION, meaning the asset types the resource is applicable (currently only assets=SOLUTION is supported)The parameters forTypes, stages, assets can be present only together (it means, all of them are absent or all of them are used at the same time). They can be used only for type=resource.
To delete ResourceAdvancedProperties of a resource file pass empty “forTypes=”.
Add or edit solution. In case of editing, all parameters except for name are optional.
checkExisting - boolean, optional - if true, only adding solutions is allowedname - solution namefile - solution contentsourceType - optional - source typetag - solution’s tag: MA (Main), OK, RJ, TL, TO (Time Limit or Accepted), TM (Time Limit or Memory Limit), WA, PE, ML, NR (Do not run), RE.Add or remove testset or test group extra tag for solution.
remove - boolean - if true - remove extra tag, if false - add extra tag.name - solution nametestset - optional - testset name for which edit extra tagtestGroup - optional - test group name for which edit extra tag
Exactly one from testset and testGroup should be specifiedtag - optional - when you add extra tag - solution’s extra tag: OK, RJ, TL, TO (Time Limit or Accepted), TM (Time Limit or Memory Limit), WA, PE, ML, NR (Do not run), RE.Edit script.
testset - testset of the scriptsource - script sourceAdd or edit test. In case of editing, all parameters except for testset and testIndex are optional.
checkExisting - boolean, optional - if true, only adding new test is allowedtestset - testset of the testtestIndex - index of the testtestInput - test inputtestGroup - optional - test group (groups should be enabled for the testset)testPoints - optional - test points (points should be enabled for the problem); non-negative double value less than 10^9 with at most 2 digits after a decimal pointtestDescription - optional - test descriptiontestUseInStatements - bool, optional - whether to use test in statementstestInputForStatements - optional - test input for viewing in the statementstestOutputForStatements - optional - test output for viewing in the statementsverifyInputOutputForStatements - bool, optional - whether to verify input and output for statementsDelete one or more tests from a testset.
The method first checks all requested tests and then deletes them. It returns “OK” only if every requested test was deleted. If at least one requested test can not be deleted during the pre-check, the method returns “FAILED” with a DeleteTestsResult object, comment “Some tests can not be deleted.” and does not delete any tests. DELETE_FAILED may occur after a successful pre-check during the actual deletion; if it occurs, the method returns comment “Some tests failed during deletion; problem state may be partially modified.” and some earlier tests may already have been deleted.
testset - testset of the test(s)testIndex - index of the test; you can specify multiple parameters with the same name testIndex to delete many tests from the same testsettestIndices - list of test indices, separated by a comma. It is an alternative for testIndex; use only one of these two waysSet test group for one or more tests. It expects that for specified testset test groups are enabled.
testset - testset of the test(s)testGroup - test group name to settestIndex - index of the test, you can specify multiple parameters with the same name testIndex to set test group to many tests of the same testset at the same time.testIndices - list of test indices, separated by a comma. It’s alternative for testIndex, you should use only one from these two waysEnable or disable test groups for the specified testset.
testset - testset to enable or disable groupsenable - bool - if it is true test groups become enabled, else test groups become disabledEnable or disable test points for the problem.
enable - bool - if it is true test points become enabled, else test points become disabledEnable or disable treating points returned by checker as percents.
If enable is true while test points are disabled for the problem, the method returns status “FAILED”.
enable - bool - if it is true checker points are treated as percents, else this behavior is disabledReturns test groups for the specified testset.
testset - testset namegroup - optional - test group nameA list of TestGroup objects.
Saves test group. Use if only to save a test group. If you want to create new test group, just add new test with such test group.
testset - testset namegroup - test group namepointsPolicy - optional - COMPLETE_GROUP or EACH_TEST (leaves old value if no specified)feedbackPolicy - optional - NONE, POINTS, ICPC or COMPLETE (leaves old value if no specified)dependencies - optional - string of group names from which group should depends on separated by a commaReturns tags for the problem.
None
A list of strings - tags for the problem.
Saves tags for the problem. Existed tags will be replaced by new tags.
tags - string of tags, separated by a comma. If you specified several same tags will be add only one of them.Returns problem general description.
None
A string - the problem general description.
Saves problem general description.
description - string - the problem general description to save. The description may be empty.Returns problem general tutorial.
None
A string - the problem general tutorial.
Saves problem general tutorial.
tutorial - string - the problem general tutorial to save. The tutorial may be empty.Returns the publishable material configurations from the current working copy. The result is sorted by material name using case-sensitive string ordering. The response is not paginated and may be large.
The method requires READ access, is not available to translators and rejects a working copy with conflicts. It returns stored legacy configurations without applying the stricter validation used by problem.setMaterial; consequently, a returned material can contain an empty item or a reference that has become invalid.
None besides the common problemId and optional pin parameters.
A list of Material objects. An empty list is returned when the problem has no materials.
Idempotently creates, fully replaces, renames or removes one publishable material in the current working copy. The method requires READ access, is not available to translators and rejects a working copy with conflicts. It does not commit the working copy; call problem.commitChanges separately to create a revision.
Use an HTTP POST request and send the parameters in the request body. In particular, do not put items into a query string.
name - string - required case-sensitive material name after saving, or the material to remove; must be a valid filename from 1 to 40 characters.originalName - string, optional - previous case-sensitive material name for an atomic rename; when non-empty, it must be a valid filename from 1 to 40 characters. An empty value is treated as absent.publishStrategy - NONE/WITH_TUTORIAL/WITH_STATEMENT - required when saving. NONE keeps the material but disables its publication; it does not remove the material.items - string - required when saving; a non-empty JSON array of MaterialItem objects, at most 262144 characters long.remove - boolean, optional - true removes name; false or an empty value saves it. Only the lowercase values true and false are accepted.originalName, the method replaces the material named name, or creates it if it does not exist.originalName, the method replaces that material and renames it to name. The destination must not be occupied by a different material.originalName is absent, name already exists and its complete configuration already matches the submitted one. If the destination differs or neither material exists, the request fails without changing either material.remove=true, removing an absent material is a successful no-op. Non-empty originalName, publishStrategy and items are forbidden in a removal request; empty values are treated as absent.The input must be standard JSON: comments, single-quoted strings and unquoted names or values are rejected. The JSON schema is strict: unknown fields are rejected. Each item must have type and exactly one compatible array, tests or names. Each test selector must have a non-empty testset and exactly one mode: an existing integer index from 1 through Polygon’s current maximum test index (currently 1000), all=true, or asInput=true. The optional booleans all and asInput default to false. An all=true selector requires the testset to contain at least one test. asInput=true is accepted only in TEST_ANSWERS and requires an effective non-empty TEST_INPUTS selection for the same testset in this material. Every referenced test, file and solution must exist when the material is saved, and the material as a whole must contain at least one effective item.
A legacy material with an invalid reference can still be returned by problem.materials, but it cannot be replaced or renamed through this method until the submitted configuration is corrected. A real change rewrites the complete stored material list; fields unknown to this Polygon version can therefore be lost from every material file. A no-op does not perform this rewrite.
At most 60 problem.setMaterial attempts per minute are allowed for each calling user, in addition to the common API rate limit. Invalid and no-op calls that pass the common problem checks also consume this method-specific limit.
A successful response has status OK and no result field:
{"status":"OK"}
The method returns HTTP 400 with status FAILED for invalid parameters or JSON, missing referenced objects, a rename collision or stale rename request, conflicts, an invalid required pin, or an exceeded rate limit.
Returns a list of Package objects - list all packages available for the problem.
None
Download a package as a zip-archive.
packageId - package idtype - string, optional - type of the package: “standard”, “linux” or “windows”. Standard packages don’t contain generated tests, but contain windows executables and scripts for windows and linux via wine. Linux packages contain generated tests, but don’t contain compiled binaries. Windows packages contain generated tests and compiled binaries for Windows. If not provided, “standard” is used.Starts to build a new Package.
full - bool - defines whether to build full package, contains “standard”, “linux” and “windows” packages, or only “standard”
Standard packages don’t contain generated tests, but contain windows executables and scripts for windows and linux via wine. Linux packages contain generated tests, but don’t contain compiled binaries. Windows packages contain generated tests and compiled binaries for Windows.verify - bool - if that parameter is true all solutions will be invoked on all tests to be sure that tags are valid. Stress tests will run the checker to verify its credibility.Returns structured warnings and package-readiness issues for the problem. Also returns cached “Correction tips from AI”, if available.
The method inspects the current working copy. The four caution arrays common, statement, structure and issues are always present and may be empty. If both a missing checker/validator caution and the corresponding missing tests caution are detected, the redundant missing tests caution is omitted: NO_CHECKER_TESTS is omitted when NO_CHECKER is present, and NO_VALIDATOR_TESTS is omitted when NO_VALIDATOR is present.
AI tips are read from Polygon cache only; this method does not start new AI requests. If problem metadata cannot be built, the method returns status “FAILED”.
The method requires READ access and is not available to translators.
None
A ProblemCautions object.
Returns all issues of the problem with their comments. Issues are stored at problem level and are not part of the working copy.
The method requires READ access and is available to translators.
None besides the common problemId and optional pin parameters.
A list of Issue objects sorted by modificationTimeSeconds in descending order. Times have one-second precision, so the order of issues or comments with equal times is not guaranteed; when polling for changes, compare the returned data rather than only the times.
Example response:
{
"status": "OK",
"result": [
{
"id": 1234,
"type": "BUG",
"status": "CLOSED",
"author": "alice",
"assignee": "bob",
"html": "<div class='markup'><p>Test 5 is invalid</p>\n</div>",
"creationTimeSeconds": 1790000000,
"modificationTimeSeconds": 1790003600,
"comments": [
{
"author": "bob",
"html": "<div class='markup'><p>Fixed in revision 12</p>\n</div>",
"creationTimeSeconds": 1790003600,
"status": "CLOSED"
}
]
}
]
}
Creates a new problem issue.
The method requires WRITE or OWNER access or the reviewer role and is available to translators.
type - DISCUSSION/ENHANCEMENT/BUG - issue typecontent - string - issue text in Markdown, 1..16384 characters, UTF-8assignee - string, optional - login of the user to assign the issue to; the user must have effective WRITE or OWNER access to the problemThe created Issue object with status OPENED and an empty comments list.
Updates an issue of the problem: changes its status, type and assignee and/or adds a comment. Like in the web interface, every successful request adds one entry to the issue history.
The method requires WRITE or OWNER access or the reviewer role and is available to translators.
issueId - id of an issue of this problemcomment - string, optional - comment text in Markdown, up to 16384 characters, UTF-8status - CLOSED/REOPENED, optional - new issue status. CLOSED is allowed for OPENED and REOPENED issues, REOPENED only for CLOSED issues. A CLOSED issue can be updated only together with status=REOPENED.type - DISCUSSION/ENHANCEMENT/BUG, optional - new issue typeassignee - string, optional - login of the new assignee with effective WRITE or OWNER access to the problem. An empty value removes the assignee; if the parameter is absent, the assignee is not changed.A type or assignee equal to the current one is not a change. The request must contain a non-blank comment or at least one change; otherwise it fails. Like in the web interface, each change is also described in the text of the history entry, for example [Status changed from OPEN to CLOSED], after the comment if it is given.
The updated Issue object with all its comments.
problem.commitChanges is not required.FAILED for invalid parameters, an invalid status transition, insufficient access, an exceeded rate limit or an invalid required pin. An unknown issue, an issue of another problem and a contest issue all produce Issue not found; an unknown assignee login and a user without WRITE access both produce User not found or has no write access to the problem.problem.issues before retrying.Returns the stresses of the problem with the latest run of each stress.
stressIndex - integer, optional - index of a stress (1..1000). If specified, only this stress is returned; use it to poll a running stress.A list of Stress objects in ascending order of index, [] if there are no stresses. The result is always a list, also when stressIndex is specified.
Creates a new stress or updates an existing one.
stressIndex - integer, optional - if the parameter is absent, a new stress is created with the smallest free index; otherwise the existing stress with this index is updated.scriptPattern - string, required on creation - generator script pattern, 1..1000 characters, for example gen 10 [5..100] abacaba. Each [a..b] is replaced with a random integer from the range on every iteration, several runs can be separated with |. All generators of the pattern must compile; if the strict run arguments validation is enabled for the problem, its rules apply.solutionNames - string, required on creation - comma-separated names of solutions to compare with the main correct solution. A solution must exist and must not have the tag DO_NOT_RUN. The main correct solution is the reference: it is added first if it is not listed. The order is kept, duplicates are ignored.timeLimit - integer, optional - time limit of a solution run, 250..15000 ms. Defaults to the problem time limit on creation.memoryLimit - integer, optional - memory limit of a solution run, 4..1024 MB. Defaults to the problem memory limit on creation.totalTimeLimit - integer, optional - duration of the stress run: 5000, 15000, 30000, 60000, 90000 or 120000 ms. Defaults to 60000 on creation. It is not a deadline for the result: a run may also wait in queues.testset - string, optional - testset context passed to validators, up to 32 lowercase letters, digits and underscores; the testset does not have to exist. An empty value clears it.group - string, optional - test group context passed to validators and assigned to the countertest by problem.addStressCountertest, up to 32 characters [0-9a-zA-Z-]. An empty value clears it.ignoreValidators - boolean, optional - disables the problem validator and the extra validators; the well-formed check, if it is enabled for the problem, still applies. false on creation.description - string, optional - up to 1000 characters. An empty value clears it.On update, parameters that are not specified keep their values. Every successful save creates a new version of the stress, so the result of its previous run is not returned anymore. A running stress is not cancelled by a save: its job finishes and the result is discarded, call problem.cancelStresses first to free invokers. Explicitly specified solutionNames detach the stress from the copies created with the Copy action of the web interface; other stresses are not changed. The input and output file names of a stress are taken from the problem on creation and are not changed by the API.
The saved Stress object without run.
Deletes a stress and the result of its run. Tests already added from the stress are kept. A running stress is not cancelled: its job finishes and the result is discarded, call problem.cancelStresses first to free invokers.
stressIndex - index of an existing stressStarts stresses asynchronously with the current files of the working copy. Poll problem.stresses for the result.
stressIndices - string, optional - comma-separated stress indices. If absent, all stresses of the problem are started.All indices are checked before anything is started. Stresses that are PENDING or RUNNING are not restarted; a new run of any other stress replaces its previous result. If the user is temporarily locked because of the load on invokers, the method fails with “The problem is locked for you” and starts nothing. Errors of the environment (for example, a deleted solution or an unset checker) are not checked in advance: they are reported in the run result as a FAILED or CRASHED verdict with a comment.
Cancels runs of stresses. Works even if the working copy has conflicts or the user is locked because of the load on invokers.
stressIndices - string, optional - comma-separated stress indices. If absent, all stresses of the problem.For a PENDING or RUNNING stress the run result is removed, so run disappears. Jobs not yet sent to invokers are cancelled; a job already running on an invoker may finish, its result is discarded and, as a rule, does not reappear. Stresses that are not running are skipped and keep their finished results.
Adds the countertest found by the latest finished run of a stress to the tests of a testset, like “Add to tests” in the web interface.
stressIndex - index of a stress whose latest finished run has a countertest (with any verdict)testset - name of an existing testsetThe test is generated by countertest.scriptLine, not by the possibly truncated input, using the current generators and validators. It gets the smallest free index, the group of the stress (if it is set) and a description that mentions the stress; it is not used in statements. A small generated input may be stored as a manual test. The call is synchronous: it waits for the test generation and validation.
The method fails if the testset already has a test with the same scriptLine. An equal input is detected by the usual check of manual tests, including the case when the added test is stored as a manual one; other equal inputs (for example, a large input generated by a different script line) are not detected.
The added Test.
problem.commitChanges. Run results are local to the working copy, are not committed and only the latest run of each stress is kept.problem.stresses and problem.cancelStresses work even if the working copy has conflicts; the other methods fail in this case.FAILED for invalid parameters, an unknown stress index, an unknown or DO_NOT_RUN solution, a problem without a main correct solution, an invalid script pattern or a generator that doesn’t compile, the limit of 1000 stresses, the lock because of the load on invokers (problem.runStresses), a missing countertest or a duplicate test (problem.addStressCountertest), insufficient access or an invalid required pin.problem.stresses (and problem.tests after problem.addStressCountertest) before retrying. For example, a failure in the middle of problem.runStresses may leave some stresses PENDING without a runner: cancel them with problem.cancelStresses and run again.To access contest methods, you have to include contestId parameter in your request. If the contest has the pin code, you need to include the parameter pin in your request.
Returns a list of Problem objects - problems of the contest.
Represents a polygon problem.
id - problem idowner - problem owner handlename - problem namenote - problem note set by users with write access (may be absent)deleted - boolean - is a problem deletedfavourite - boolean - is a problem in user’s favouritesaccessType - READ/WRITE/OWNER - user’s access type for the problemrevision - current problem revisionworkingCopyRevision - current working copy revision (may be absent)latestPackage - latest revision with package available (may be absent)modified - is the problem modified (does the working copy have uncommitted modifications)Represents one direct problem access-control entry returned by problem.accesses.
login - user login, or a user-group name prefixed with @accessType - READ/WRITE/OWNER - direct access type assigned to this user or groupThis object represents a stored direct entry, not a user’s computed effective access. Reviewer, supervisor, translator and email-notification flags are intentionally not returned.
Represents the problem’s general information.
inputFile - problem’s input fileoutputFile - problem’s output fileinteractive - boolean - is problem interactivewellFormed - boolean - is tests well-formedskipDuplicatedTestsValidation - boolean - whether checking that tests are unique is skippedtimeLimit - problem’s time limit in millisecondsmemoryLimit - problem’s memory limit in MBRepresents result of a problem.commitChanges call.
committed - boolean, whether changes were committedconflictOccurred - boolean, whether a conflict occurred while updating the working copy during commit processingmessage - human-readable commit result messageRepresents a problem’s statement.
encoding - statement’s encodingname - problem’s name in statement’s languagelegend - statement legend/main statement textinput - problem’s input formatoutput - problem’s output formatscoring - problem’s scoringinteraction - problem’s interaction protocol (only for interactive problems)notes - statement notestutorial - problem’s tutorialshowInReview - boolean - whether to show the statement in the problem reviewshowCautionsAndGrammaticalFixes - boolean - whether to show cautions and grammatical fixes for this statementRepresents rendered statements and tutorials for the current working copy.
revision - working copy revision used for renderingrenderingTimeSeconds - unix time in seconds when rendering result was producedstatements - list of RenderedStatement objects, one for each statement language; always present, may be emptytutorials - list of RenderedStatement objects for languages with non-empty tutorial content; always present, may be emptyRepresents rendered files for one language.
language - statement languagehtml - RenderResult object for HTML renderpdf - RenderResult object for PDF renderRepresents one HTML or PDF render result.
status - OK/FAILEDsha256 - SHA-256 hex digest of the rendered file; present when status is OKsizeBytes - rendered file size in bytes; present when status is OKcontentBase64 - rendered file content encoded as Base64; present only when status is OK and includeContent is truemessage - render error message; present when status is FAILEDRepresents a resource, source or aux file.
name - file namemodificationTimeSeconds - file’s modification time in unix formatlength - file lengthsourceType - (present only for source files) - source file typeresourceAdvancedProperties - (may be absent) Problem resource files can have extra property called resourceAdvancedProperties of type ResourceAdvancedPropertiesRepresents special properties of resource files. Basically, they stand for compile- or run-time resources for specific file types and asset types. The most important application is IOI-style graders. Example: {“forTypes”:”cpp.*”,”main”:false,”stages”:[“COMPILE”],”assets”:[“SOLUTION”]}
forTypes - colon or semicolon separated list of file types this resource if applied, wildcards are supported (example: “cpp.” or “pascal.;java.11”)main - currently reserved to be false,stages - array of possible string values COMPILE or RUN, meaning the phase when the resource is applicable,assets - array of possible string values VALIDATOR, INTERACTOR, CHECKER, SOLUTION, meaning the asset types the resource is applicable.Represents a problem solution.
name - solution namemodificationTimeSeconds - solution’s modification time in unix formatlength - solution lengthsourceType - source file typetag - solution tagRepresents a test for the problem.
index - test indexmanual - boolean - whether test is manual of generatedinput - lossy UTF-8 string view of test input (absent for generated tests)inputBase64 - exact Base64-encoded test input bytes (absent for generated tests and for manual tests without input)description - test description (may be absent)useInStatements - boolean - whether test is included in statementsscriptLine - script line for generating test (absent for manual tests)group - test group (may be absent)points - test points (may be absent)inputForStatement - input for statements (may be absent)outputForStatement - output for statements (may be absent)verifyInputOutputForStatements - boolean - whether to verify input and output for statements (may be absent)Represents structured failure details for problem.deleteTest.
failures - list of TestDeletionFailure objects; contains one item for each requested test that can not be deletedRepresents a test that can not be deleted.
index - requested test indexreason - DUPLICATE/NOT_FOUND/FREEMARKER_SCRIPT_TEST/DELETE_FAILEDmessage - human-readable failure messageRepresents preview data for one test.
id - internal preview id (may be absent)session - working copy sessioncreationTime - preview creation time, serialized as a legacy Gson date string (may be absent)updateTime - preview update time, serialized as a legacy Gson date string (may be absent)problemId - problem idtestset - testset nametestIndex - test indexdescription - test description (may be absent)useInStatements - boolean - whether test is included in statementsinput - generated preview input; may be absent while preview generation is pending; may contain an error message if preview generation failedinputSha1 - SHA-1 hash of generated preview input (may be absent)answer - generated preview answer; may be absent while preview generation is pending; may contain an error message if preview generation failedchangeAfterLastGenerate - boolean, whether the test changed after the last preview generationtestOverviewLog - test overview log (may be absent)Represents a test group in testset.
name - test group namepointsPolicy - test group points policy, COMPLETE_GROUP for the complete group points policy, EACH_TEST for the each test points policyfeedbackPolicy - test group feedback policy, COMPLETE for the complete feedback policy, ICPC for the first error feedback policy, POINTS for the only points feedback policy, NONE for no feedback policy.dependencies - list of group names from which this group depends on (may be empty)Represents one publishable material configuration in the current working copy.
name - case-sensitive material namepublishStrategy - NONE/WITH_TUTORIAL/WITH_STATEMENT - publication strategyitems - list of MaterialItem objectsRepresents one group of files or tests included in a material.
type - TEST_INPUTS/TEST_ANSWERS/RESOURCE_FILES/SOURCE_FILES/AUX_FILES/SOLUTIONS - item typetests - list of MaterialTest objects; present only for TEST_INPUTS and TEST_ANSWERSnames - list of case-sensitive file or solution names; present only for RESOURCE_FILES, SOURCE_FILES, AUX_FILES and SOLUTIONSAn individual tests or names list may be empty for compatibility with materials created by the web editor. When saving through problem.setMaterial, at least one item in the complete material must be effective and non-empty.
Represents one test selection inside a TEST_INPUTS or TEST_ANSWERS material item.
testset - case-sensitive testset nameindex - selected test index; present only for an individual-test selectionall - boolean - select all tests from the testsetasInput - boolean - for TEST_ANSWERS, reuse the selected input files for this testset as answer filesExactly one selection mode must be effective: index, all=true, or asInput=true. On input to problem.setMaterial, omitted all and asInput fields default to false, and index may be omitted or null for the other two modes.
Represents a package.
id - package’s idrevision - revision of the problem for which the package was createdcreationTimeSeconds - package’s creation time in unix formatstate - PENDING/RUNNING/READY/FAILED package’s statecomment - comment for the packagetype - type of the package: “standard”, “linux” or “windows”. Standard packages don’t contain generated tests, but contain windows executables and scripts for windows and linux via wine. Linux packages contain generated tests, but don’t contain compiled binaries. Windows packages contain generated tests and compiled binaries for Windows.Represents a validator’s test for the problem.
index - validator test indexinput - validator test inputexpectedVerdict - INVALID/VALID - expected verdict for the validator testtestset - validator test set (may be absent)group - validator test group (may be absent)runVerdict - VALID/INVALID/IN_QUEUE/CANT_RUN - validator test run verdict, if available; absent if the test has not been runrunComment - validator test run comment, if available; absent if unavailableRepresents a checker’s test for the problem.
index - checker test indexinput - checker test inputoutput - checker test outputanswer - checker test answerexpectedVerdict - OK/WRONG_ANSWER/CRASHED/PRESENTATION_ERROR - expected verdict for the checker’s testrunVerdict - checker test run verdict, if available; completed runs return raw checker interop verdict name; IN_QUEUE means the run has not finished yet; absent if the test has not been runrunComment - checker test run comment, if available; absent if unavailableRepresents structured cautions for the problem.
common - list of Caution objects with COMMON category; always present, may be emptystatement - list of Caution objects with STATEMENT category; always present, may be emptystructure - list of Caution objects with STRUCTURE category; always present, may be emptyissues - list of Caution objects with ISSUES category; always present, may be emptypackageReadinessIssues - list of PackageReadinessIssue objects found by package validation; always present, may be emptylatestPackageWarnings - list of package verification warning strings from the latest READY package; always present, may be emptyai - AiTips object with cached AI correction tips; always presentRepresents one problem caution.
type - caution type, for example NO_TAGS, NO_CHECKER, TESTSET_SEEMS_TO_BE_INCOMPLETE or OPENED_ISSUESseverity - SOFT/HARDcategory - COMMON/STATEMENT/STRUCTURE/ISSUESmessage - human-readable caution messageparameters - list of string parameters used to format the caution message; may be emptyRepresents a pre-package state issue collected by package validation.
type - package validation exception type, for example HAS_MODIFICATIONS, WORKING_COPY_IS_OUTDATED, CHECKER_IS_NOT_SET, NO_TESTS or INVALID_TEST_SCRIPTreason - optional exception context, for example a source file name or testset name; may be absentmessage - human-readable formatted package validation message; fixed for simple types such as HAS_MODIFICATIONS, CHECKER_IS_NOT_SET and NO_TESTS, and may include reason and/or an internal exception message for types such as INVALID_TEST_SCRIPTproblem.cautions uses fast package validation, so compile-only package checks are not included in packageReadinessIssues.
Represents cached “Correction tips from AI” for the problem.
disabled - boolean, whether AI tips are disabled for the problem; always presentstatements - list of StatementAiTip objects for statement languages with cached AI correction data; always present, may be emptyvalidator - SourceAiTip object with cached validator review comment; may be absent if there is no cached useful comment or if validator review is not applicablechecker - SourceAiTip object with cached checker review comment; may be absent if there is no cached useful comment or if checker review is not applicableIf disabled is true, statements is empty and validator and checker are absent. Internal UI confidence flags for AI tips are not returned.
Represents a cached AI correction tip for one statement language.
language - statement languagesource - normalized statement text used for the cached AI request; may be largesuggestion - suggested corrected statement text; absent when no suggestion is available, including when processing is trueprocessing - boolean, whether the cached AI request is still being processedIf processing is true, call problem.cautions later to check whether the suggestion has appeared.
Represents a cached AI review comment for a source file.
name - source file namecomment - raw cached AI review comment; may be largeRepresents a problem issue.
id - issue idtype - DISCUSSION/ENHANCEMENT/BUG - issue typestatus - OPENED/REOPENED/CLOSED - issue status (OPENED is shown as OPEN in the web interface)author - login of the issue authorassignee - login of the assignee (may be absent)html - issue text as HTML stored by Polygon: the Markdown passed in content is converted to HTML and sanitized when saved; the original Markdown is not storedcreationTimeSeconds - issue creation time in unix formatmodificationTimeSeconds - time of the last issue change in unix formatcomments - list of IssueComment objects in chronological order; always present, may be emptyRepresents an issue comment.
author - login of the comment authorhtml - comment text as HTML, see html in IssuecreationTimeSeconds - comment creation time in unix formatstatus - issue status set by this comment (absent if the comment did not change it)type - issue type set by this comment (absent if the comment did not change it)assignee - login of the assignee set by this comment (absent if the comment did not assign the issue; removing the assignee is not recorded)Represents a stress of the problem returned by problem.stresses and problem.saveStress.
index - stress index, 1..1000scriptPattern - generator script patternsolutionNames - list of solution names, including the main correct solutiontimeLimit - time limit of a solution run, msmemoryLimit - memory limit of a solution run, MBtotalTimeLimit - duration of the stress run, mstestset - testset context for validators (absent if not set)group - test group context for validators (absent if not set)ignoreValidators - boolean, whether the problem validator and the extra validators are disableddescription - stress description, may be emptyrun - StressRun object with the latest run of the current version of the stress; absent if the stress has not been run since its last save or the run was cancelledRepresents the latest run of a stress.
status - PENDING/RUNNING/FINISHED. RUNNING includes waiting in queues; the statistics is written only when the run finishes.verdict - only for FINISHED:
OK - the stress ran normally. countertest is present if a solution failed on a generated test; if it is absent, nothing was found within totalTimeLimit, which doesn’t prove that the solutions are correct.FAILED - the run itself failed (generator, validation of a generated test, the main solution and so on), see comment; countertest may contain the test on which it happened.CRASHED - an unexpected failure, see comment.Use countertest, not verdict, to find out whether a countertest was found.
comment - comment of the run (may be absent)judgedTestCount - number of judged tests, only for FINISHEDmaxConsumedTime - maximal consumed time of a solution run, ms, only for FINISHEDmaxConsumedMemory - maximal consumed memory of a solution run, bytes, only for FINISHED; the counters may be zero after an early failurecountertest - StressCountertest object (may be absent)Example problem.stresses response:
{
"status": "OK",
"result": [
{
"index": 1,
"scriptPattern": "gen 10 [5..100] abacaba",
"solutionNames": ["main.cpp", "wa.cpp"],
"timeLimit": 2000,
"memoryLimit": 256,
"totalTimeLimit": 60000,
"ignoreValidators": false,
"description": "small random tests",
"run": {
"status": "FINISHED",
"verdict": "OK",
"judgedTestCount": 412,
"maxConsumedTime": 31,
"maxConsumedMemory": 4194304,
"countertest": {
"input": "57\n3 1 4 1 5 ...",
"inputTruncated": true,
"scriptLine": "gen 10 57 abacaba 2f8a91",
"reports": [
{"solutionName": "wa.cpp", "verdict": "WRONG_ANSWER", "consumedTime": 15, "consumedMemory": 2097152,
"output": "12", "outputTruncated": false, "answer": "13", "answerTruncated": false,
"comment": "wrong answer expected 13, found 12"}
]
}
}
},
{
"index": 2,
"scriptPattern": "gen 1000 [1..1000000000]",
"solutionNames": ["main.cpp", "slow.cpp"],
"timeLimit": 2000,
"memoryLimit": 256,
"totalTimeLimit": 30000,
"testset": "tests",
"ignoreValidators": false,
"description": "",
"run": {"status": "RUNNING"}
}
]
}
Represents a countertest found by a stress run.
scriptLine - generator command line with the random values substituted; problem.addStressCountertest adds a test with itinput - test input, may be truncated; absent if the run failed before the input was received (for example, when a validator rejected the generated test)inputTruncated - boolean, whether input is truncatedreports - list of StressSolutionReport objects for the solutions that failed this test (may include the main solution); may be emptyRepresents the result of a solution on a countertest.
solutionName - solution nameverdict - WRONG_ANSWER, PRESENTATION_ERROR, TIME_LIMIT_EXCEEDED, MEMORY_LIMIT_EXCEEDED, IDLENESS_LIMIT_EXCEEDED, RUNTIME_ERROR, FAILED or CRASHED (the model also allows TIME_LIMIT_EXCEEDED_OR_ACCEPTED and TIME_LIMIT_EXCEEDED_OR_MEMORY_LIMIT_EXCEEDED)consumedTime - consumed time, msconsumedMemory - consumed memory, bytesoutput - output of the solution (may be absent or truncated)outputTruncated - boolean, whether output is truncatedanswer - answer of the main correct solution (may be absent or truncated)answerTruncated - boolean, whether answer is truncatedcomment - checker comment (may be absent)