task_nl stringlengths 400 400 | difficulty int64 7 20 | turns listlengths 1 8 | success bool 1
class |
|---|---|---|---|
Petya has got an interesting flower. Petya is a busy person, so he sometimes forgets to water it. You are given n days from Petya's live and you have to determine what happened with his flower in the end.
The flower grows as follows:
* If the flower isn't watered for two days in a row, it dies.
* If the flower ... | 7 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "command detected. Output your command inside <bash>...",
"output": "ba... | true |
Monocarp wrote down two numbers on a whiteboard. Both numbers follow a specific format: a positive integer x with p zeros appended to its end.
Now Monocarp asks you to compare these two numbers. Can you help him?
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of testcases.
The first li... | 7 | [
{
"cmd": "cat <<'EOF' > /tmp/solution.py\nimport sys\ninput = sys.stdin.read\ndata = input().split()\n\nt = int(data[0])\nindex = 1\nfor _ in range(t):\n x1, p1 = map(int, data[index:index+2])\n index += 2\n x2, p2 = map(int, data[index:index+2])\n index += 2\n if x1 * 10**p1 < x2 * 10**p2:\n ... | true |
A string is called square if it is some string written twice in a row. For example, the strings "aa", "abcabc", "abab" and "baabaa" are square. But the strings "aaa", "abaaab" and "abcdabc" are not square.
For a given string s determine if it is square.
Input
The first line of input data contains an integer t (1 β€ t... | 7 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "cat <<'EOF' > /tmp/solution.py\nt = int(input())\nfor i in range(t):\n s = input()\n if s[:len(s)//2] == s[len(s)//2:]:\n print('YES')\n else:\n print('NO')\nEOF\npython3 /tmp/solution.py",
"output":... | true |
Luntik came out for a morning stroll and found an array a of length n. He calculated the sum s of the elements of the array (s= β_{i=1}^{n} a_i). Luntik calls a subsequence of the array a nearly full if the sum of the numbers in that subsequence is equal to s-1.
Luntik really wants to know the number of nearly full su... | 8 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "cat <<'EOF' > /tmp/solution.py\nt = int(input())\nfor _ in range(t):\n n = int(input())\n a = list(map(int,input().split()))\n s = sum(a)\n ... | true |
The robot is located on a checkered rectangular board of size n Γ m (n rows, m columns). The rows in the board are numbered from 1 to n from top to bottom, and the columns β from 1 to m from left to right.
The robot is able to move from the current cell to one of the four cells adjacent by side.
The sequence of comma... | 11 | [
{
"cmd": "cat <<'EOF' > /tmp/solution.py\ndef main():\n T = int(input())\n for _ in range(T):\n n, m = map(int, input().split())\n s = input()\n max_steps = 0\n best_start = 0\n for i in range(n*m):\n x, y = divmod(i, m)\n steps = 0\n for... | true |
Mr. Chanek has an array a of n integers. The prettiness value of a is denoted as:
$$$β_{i=1}^{n} {β_{j=1}^{n} {\gcd(a_i, a_j) β
\gcd(i, j)}}$$$
where \gcd(x, y) denotes the greatest common divisor (GCD) of integers x and y.
In other words, the prettiness value of an array a is the total sum of \gcd(a_i, a_j) β
\gcd(... | 13 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "cat <<'EOF' > /tmp/solution.py\nimport sys\n\nMOD = 10**9+7\n\ndef gcd(a, b):\n while(b):\n a, b = b, a % b\n return a\n\nn = int(input())\na = list(map(int,input().split()))\n\nans = 0\nfor i in range(n):\n fo... | true |
You are given a permutation p of n elements. A permutation of n elements is an array of length n containing each integer from 1 to n exactly once. For example, [1, 2, 3] and [4, 3, 5, 1, 2] are permutations, but [1, 2, 4] and [4, 3, 2, 1, 2] are not permutations. You should perform q queries.
There are two types of qu... | 14 | [
{
"cmd": "cat <<'EOF' > /tmp/solution.py\nimport sys\n\ndef main():\n n, q = map(int, input().split())\n p = list(map(int, input().split()))\n for _ in range(q):\n t, *a = map(int, input().split())\n if t == 1:\n x, y = a\n p[x-1], p[y-1] = p[y-1], p[x-1]\n el... | true |
Luntik has decided to try singing. He has a one-minute songs, b two-minute songs and c three-minute songs. He wants to distribute all songs into two concerts such that every song should be included to exactly one concert.
He wants to make the absolute difference of durations of the concerts as small as possible. The d... | 7 | [
{
"cmd": "cat <<'EOF' > /tmp/solution.py\nt = int(input())\nfor _ in range(t):\n a,b,c = map(int,input().split())\n total = a + 2*b + 3*c\n if total % 2 == 0:\n print(0)\n else:\n print(1)\nEOF\npython3 /tmp/solution.py",
"output": "Traceback (most recent call last):\n File \"/tmp... | true |
Monocarp wrote down two numbers on a whiteboard. Both numbers follow a specific format: a positive integer x with p zeros appended to its end.
Now Monocarp asks you to compare these two numbers. Can you help him?
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of testcases.
The first li... | 7 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "cat <<'EOF' > /tmp/solution.py\nt = int(input())\nfor _ in range(t):\n x1,p1 = map(int,input().split())\n x2,p2 = map(int,input().split())\n if x1 * (10**p1) == x2 * (10**p2):\n print(\"=\")\n elif x1 * (10*... | true |
A string is called square if it is some string written twice in a row. For example, the strings "aa", "abcabc", "abab" and "baabaa" are square. But the strings "aaa", "abaaab" and "abcdabc" are not square.
For a given string s determine if it is square.
Input
The first line of input data contains an integer t (1 β€ t... | 7 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd":... | true |
Monocarp is the coach of the Berland State University programming teams. He decided to compose a problemset for a training session for his teams.
Monocarp has n problems that none of his students have seen yet. The i-th problem has a topic a_i (an integer from 1 to n) and a difficulty b_i (an integer from 1 to n). All... | 10 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "command detected. Output your command inside <bash>...",
"output": "ba... | true |
Alice and Bob are playing a game. They are given an array A of length N. The array consists of integers. They are building a sequence together. In the beginning, the sequence is empty. In one turn a player can remove a number from the left or right side of the array and append it to the sequence. The rule is that the s... | 11 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "cat <<'EOF' > /tmp/solution.py\ndef main():\n n = int(input())\n arr = list(map(int, input().split()))\n \n left = [arr[0]]\n right = [arr[-1]]\n for i in range(1, n):\n if arr[i] > left[-1]:\n ... | true |
You have an array of integers (initially empty).
You have to perform q queries. Each query is of one of two types:
* "1 x" β add the element x to the end of the array;
* "2 x y" β replace all occurrences of x in the array with y.
Find the resulting array after performing all the queries.
Input
The first l... | 11 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "cat <<'EOF' > /tmp/solution.py\nq = int(input())\narr = []\nfor i in range(q):\n query = input().split()\n if query[0] == '1':\n arr.append(int(query[1]))\n elif query[0] == '2':\n for j in range(len(arr... | true |
Mr. Chanek has an array a of n integers. The prettiness value of a is denoted as:
$$$β_{i=1}^{n} {β_{j=1}^{n} {\gcd(a_i, a_j) β
\gcd(i, j)}}$$$
where \gcd(x, y) denotes the greatest common divisor (GCD) of integers x and y.
In other words, the prettiness value of an array a is the total sum of \gcd(a_i, a_j) β
\gcd(... | 13 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd":... | true |
Kuzya started going to school. He was given math homework in which he was given an array a of length n and an array of symbols b of length n, consisting of symbols '*' and '/'.
Let's denote a path of calculations for a segment [l; r] (1 β€ l β€ r β€ n) in the following way:
* Let x=1 initially. For every i from l to ... | 13 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "cat <<'EOF' > /tmp/solution.py\ndef count_simple_segments(n, a, b):\n total = 0\n for l in range(n):\n for r in range(l, n):\n calc_path = []\n x = 1\n for i in range(l, r+1):\n ... | true |
Mr. Chanek's city can be represented as a plane. He wants to build a housing complex in the city.
There are some telephone poles on the plane, which is represented by a grid a of size (n + 1) Γ (m + 1). There is a telephone pole at (x, y) if a_{x, y} = 1.
For each point (x, y), define S(x, y) as the square of the Euc... | 20 | [
{
"cmd": "cat <<'EOF' > /tmp/solution.py\ndef main():\n n, m = map(int,input().split())\n a = [list(map(int,input().strip())) for _ in range(n+1)]\n ans = 0\n for i in range(n+1):\n for j in range(m+1):\n ans += min([(i-x)**2+(j-y)**2 for x,y in [(x,y) for x in range(n+1) for y in ... | true |
Petya has got an interesting flower. Petya is a busy person, so he sometimes forgets to water it. You are given n days from Petya's live and you have to determine what happened with his flower in the end.
The flower grows as follows:
* If the flower isn't watered for two days in a row, it dies.
* If the flower ... | 7 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd":... | true |
Monocarp wrote down two numbers on a whiteboard. Both numbers follow a specific format: a positive integer x with p zeros appended to its end.
Now Monocarp asks you to compare these two numbers. Can you help him?
Input
The first line contains a single integer t (1 β€ t β€ 10^4) β the number of testcases.
The first li... | 7 | [
{
"cmd": "cat <<'EOF' > /tmp/solution.py\nt = int(input())\nfor _ in range(t):\n x1,p1 = map(int,input().split())\n x2,p2 = map(int,input().split())\n if x1 * (10 ** p1) < x2 * (10 ** p2):\n print('<')\n elif x1 * (10 ** p1) > x2 * (10 ** p2):\n print('>')\n else:\n print('='... | true |
A string is called square if it is some string written twice in a row. For example, the strings "aa", "abcabc", "abab" and "baabaa" are square. But the strings "aaa", "abaaab" and "abcdabc" are not square.
For a given string s determine if it is square.
Input
The first line of input data contains an integer t (1 β€ t... | 7 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "command detected. Output your command inside <bash>...",
"output": "bash: line 1: bash: No such file or directory\nHarness: /tmp/solution.py belum ada. Tulis file solusi dulu (heredoc).",
"match": false
},
{
"c... | true |
You had n positive integers a_1, a_2, ..., a_n arranged in a circle. For each pair of neighboring numbers (a_1 and a_2, a_2 and a_3, ..., a_{n - 1} and a_n, and a_n and a_1), you wrote down: are the numbers in the pair equal or not.
Unfortunately, you've lost a piece of paper with the array a. Moreover, you are afraid... | 7 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "command detected. Output your command inside <bash>...",
"output": "bash: line 1: bash: No such file or directory\nHarness: /tmp/solution.py belum ada. Tulis file solusi dulu (heredoc).",
"match": false
},
{
"c... | true |
You are given an array a of length n.
Let's define the eversion operation. Let x = a_n. Then array a is partitioned into two parts: left and right. The left part contains the elements of a that are not greater than x (β€ x). The right part contains the elements of a that are strictly greater than x (> x). The order of ... | 8 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "cat <<'EOF' > /tmp/solution.py\ndef main():\n for _ in range(int(input())):\n n = int(input())\n a = list(map(int, input().split()))\... | true |
Alice and Bob always had hard time choosing restaurant for the dinner. Previously they performed Eenie Meenie Miney Mo game, but eventually as their restaurant list grew, they had to create a new game. This new game starts as they write restaurant names on N cards and align the cards in one line. Before the game begins... | 8 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "cat <<'EOF' > /tmp/solution.py\ndef find_last_card(N,A,B,D_A,D_B):\n while N>1:\n if A>B:\n D_A,D_B = D_B,D_A\n if D_A==\"... | true |
Little Johnny Bubbles enjoys spending hours in front of his computer playing video games. His favorite game is Bubble Strike, fast-paced bubble shooting online game for two players.
Each game is set in one of the N maps, each having different terrain configuration. First phase of each game decides on which map the gam... | 9 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "cat <<'EOF' > /tmp/solution.py\nimport sys\n\nN, P = map(float, sys.stdin.readline().split())\n\nmaps_to_study = int(N * P + 0.5)\nprint(maps_to_study)\n\nEOF",
"output": "(no output)\nHarness: 0/1 public test pass. Gagal:... | true |
Alice and Bob are playing a game. They are given an array A of length N. The array consists of integers. They are building a sequence together. In the beginning, the sequence is empty. In one turn a player can remove a number from the left or right side of the array and append it to the sequence. The rule is that the s... | 11 | [
{
"cmd": "cat <<'EOF' > /tmp/solution.py\ndef find_winner(A):\n if len(A) % 2 == 0:\n return 'Bob'\n else:\n return 'Alice'\n\nn = int(input())\nA = list(map(int,input().split()))\nprint(find_winner(A))\nEOF\npython3 /tmp/solution.py",
"output": "Traceback (most recent call last):\n Fil... | true |
You have an array of integers (initially empty).
You have to perform q queries. Each query is of one of two types:
* "1 x" β add the element x to the end of the array;
* "2 x y" β replace all occurrences of x in the array with y.
Find the resulting array after performing all the queries.
Input
The first l... | 11 | [
{
"cmd": "cat <<'EOF' > /tmp/solution.py\nimport sys\ninput = sys.stdin.read\ndata = input().split()\nq = int(data[0])\narr = []\ni = 1\nfor _ in range(q):\n if data[i] == '1':\n arr.append(int(data[i + 1]))\n i += 2\n else:\n x = int(data[i + 1])\n y = int(data[i + 2])\n ... | true |
Mr. Chanek has an array a of n integers. The prettiness value of a is denoted as:
$$$β_{i=1}^{n} {β_{j=1}^{n} {\gcd(a_i, a_j) β
\gcd(i, j)}}$$$
where \gcd(x, y) denotes the greatest common divisor (GCD) of integers x and y.
In other words, the prettiness value of an array a is the total sum of \gcd(a_i, a_j) β
\gcd(... | 13 | [
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": null,
"output": "no <bash> tag",
"match": false
},
{
"cmd": "cat <<'EOF' > /tmp/solution.py\nimport math\nMOD = int(1e9 + 7)\n\ndef gcd... | true |
README.md exists but content is empty.
- Downloads last month
- 15