Search is not available for this dataset
problem_id string | problem string | answer string | test_cases string | eval_spec string | source string | source_platform string | original_domain string | category float64 |
|---|---|---|---|---|---|---|---|---|
codecontests__test__code_contests_train.riegeli-00046-of-00128_71 | The purpose of this problem is to verify whether the method you are using to read input data is sufficiently fast to handle problems branded with the enormous Input/Output warning. You are expected to be able to process at least 2.5MB of input data per second at runtime.
Karan likes stickers. All his stickers are rect... | [{"code": "'''\n# Read input from stdin and provide input before running code\n\nname = raw_input('What is your name?\\n')\nprint 'Hi, %s.' % name\n'''\nn = int(raw_input())\na = map(int,raw_input().split())\ncnt=0\nfor i in range(n):\n\tif a[i] < 300000000:\n\t\tcnt+=1\nprint cnt", "is_known_correct": true, "language"... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00046-of-00128_71__public__0000", "expected_output": {"kind": "stdout", "value": "1\n"}, "input": {"kind": "stdin", "value": "2\n18 400000000\n\nSAMPLE"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | HACKEREARTH | [] | null |
codecontests__test__code_contests_train.riegeli-00046-of-00128_77 | Takahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction.
More specifically, in one move, he can go from coordinate x to x + D or x - D.
He wants to make K moves so that the absolute value of the coordinate of the destination wil... | [{"code": "x,k,d=map(int,input().split())\nx=abs(x)\nm=min(k,x//d)\nx-=d*m\nk-=m\nk%=2\nx-=d*k\nprint(abs(x))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00046-of-00128_77__ref__0000", "source": "benchmark"}, {"code": "//package abc17... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00046-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "1000000000000000"}, "input": {"kind": "stdin", "value": "1000000000000000 1000000000000000 1000000000000000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontest... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00046-of-00128_78 | Consider sequences \\{A_1,...,A_N\\} of length N consisting of integers between 1 and K (inclusive).
There are K^N such sequences. Find the sum of \gcd(A_1, ..., A_N) over all of them.
Since this sum can be enormous, print the value modulo (10^9+7).
Here \gcd(A_1, ..., A_N) denotes the greatest common divisor of A_1... | [{"code": "#include <bits/stdc++.h>\n\n#define rep(i, n) for (int i = 0; i < (n); i++)\nusing namespace std;\ntypedef long long ll;\nconst ll mod = 1e9 + 7;\n\nint n, k;\n\nll modpow(ll a, ll b) {\n ll r = 1;\n while (b) {\n if (b & 1) r = r * a % mod;\n a = a * a % mod;\n b >>= 1;\n }\n return r;\n}\n\nll... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00046-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "742202979"}, "input": {"kind": "stdin", "value": "100000 100000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00046-o... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00046-of-00128_80 | N of us are going on a trip, by train or taxi.
The train will cost each of us A yen (the currency of Japan).
The taxi will cost us a total of B yen.
How much is our minimum total travel expense?
Constraints
* All values in input are integers.
* 1 \leq N \leq 20
* 1 \leq A \leq 50
* 1 \leq B \leq 50
Input
Input i... | [{"code": "n,a,b = map(int,input().split())\nprint(min(b,a*n))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00046-of-00128_80__ref__0000", "source": "benchmark"}, {"code": "#include \"bits/stdc++.h\"\nusing namespace std;\n\nint main()... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00046-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "7"}, "input": {"kind": "stdin", "value": "4 2 7"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00046-of-00128_80__publ... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00046-of-00128_82 | Find the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive). The order does not matter.
Constraints
* 2\leq K\leq 100
* K is an integer.
Input
Input is given from Standard Input in the following format:
K
Output
Print the number of ways to... | [{"code": "K = int(input())\nprint((K//2)*(-(-K//2)))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00046-of-00128_82__ref__0000", "source": "benchmark"}, {"code": "#include<iostream>\nusing namespace std;\nint main(){\n int a;\n cin>... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00046-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "9"}, "input": {"kind": "stdin", "value": "6"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00046-of-00128_82__public__... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00046-of-00128_83 | Takahashi and Aoki are playing a stone-taking game. Initially, there are N piles of stones, and the i-th pile contains A_i stones and has an associated integer K_i.
Starting from Takahashi, Takahashi and Aoki take alternate turns to perform the following operation:
* Choose a pile. If the i-th pile is selected and th... | [{"code": "#include<iostream>\n#include<algorithm>\nusing namespace std;\n\nconst int sq = 30000;\nint ans = 0, n;\n\nint sg(int x, int k) {\n\tif (x % k == 0)return x / k;\n\tif (x / k > sq)return sg(x - x / k - 1, k);\n\telse {\n\t\tint m1 = x % k;\n\t\treturn sg(x - max(x / k + 1, m1 - m1 % (x / k + 1)), k);\n\t}\n}... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00046-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "Takahashi"}, "input": {"kind": "stdin", "value": "4\n3141 59\n26535 897\n93 23\n8462 64"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contes... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00046-of-00128_85 | You are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between. Print the acronym formed from the uppercased initial letters of the words.
Constraints
* s_1, s_2 and s_3 are composed of lowercase English letters.
* 1 ≤ |s_i| ≤ 10 (1≤i≤3)
Input
Input is given from Stan... | [{"code": "import java.util.Scanner;\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String a=sc.next();\n String b=sc.next();\n String c=sc.next();\n String ans=\"\";\n ans+=a.charAt(0);\n ans+=b.charAt(0);\n ans+=c.ch... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00046-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "RRN"}, "input": {"kind": "stdin", "value": "resident register number"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00047-of-00128_2 | The most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this term gave the name to the cellular phone) and every phone connects to the BTS with the strongest signal (in a little simplified view). Of course, BTSes need some attention and techn... | [{"code": "noOfInputs = int(raw_input())\nfor x in range(noOfInputs):\n varInput = int(raw_input())\n flag = 0\n while varInput:\n varInput /= 5\n flag += varInput\n print flag", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_t... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00047-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "0\n14\n24\n253\n5861\n2183837\n"}, "input": {"kind": "stdin", "value": "6\n3\n60\n100\n1024\n23456\n8735373"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00047-of-00128_3 | The Little Elephant from the Zoo of Lviv is going to the Birthday Party of the Big Hippo tomorrow. Now he wants to prepare a gift for the Big Hippo.
He has N balloons, numbered from 1 to N. The i-th balloon has the color Ci and it costs Pi dollars. The gift for the Big Hippo will be any subset (chosen randomly, possi... | [{"code": "def fn():\n n,m = map(int, raw_input().split())\n tnum,tcost = [0 for i in range(41)], [0 for i in range(41)]\n for i in range(n):\n a,b = map(int, raw_input().split())\n tnum[a]+=1\n tcost[a]+=b\n num, cost = [], []\n for i in range(41):\n if tnum[i]:\n ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00047-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "11.000000000\n7.333333333"}, "input": {"kind": "stdin", "value": "2\n2 2\n1 4\n2 7\n2 1\n1 4\n2 7"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00047-of-00128_5 | You are given a string S of length N consisting only of 0s and 1s. You are also given an integer K.
You have to answer Q queries. In the i^th query, two integers Li and Ri are given. Then you should print the number of substrings of S[L, R] which contain at most K 0s and at most K 1s where S[L, R] denotes the substring... | [{"code": "def sumv(fr, to):\n num = to - fr + 1\n return (to + fr) * num / 2\nt = int(raw_input())\nfor i in xrange(t):\n n, k, q = map(int, raw_input().split())\n s = raw_input().rstrip()\n cnt = 0\n c1 = 0\n c0 = 0\n far = [0 for x in xrange(n)]\n for j in xrange(n):\n while (c0 == ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00047-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "8\n5\n7"}, "input": {"kind": "stdin", "value": "1\n8 2 3\n01110000\n1 4\n2 4\n5 8"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00047-of-00128_73 | Panda has become a scientist recently. In his laboratory, there are infinite number of chambers where a chamber number K is connected to a chamber number K-1.
The numbering of chambers start from 0. Initially, X number of particles are present in the chamber number 0. The number of particles present in chamber K is ... | [{"code": "'''\n# Read input from stdin and provide input before running code\n\nname = raw_input('What is your name?\\n')\nprint 'Hi, %s.' % name\n'''\nmx, mod = 1000013, 1000003\narr = [0]*mx\narr[0] = 1\nfor i in xrange(1, mx):\n arr[i] = i * arr[i-1]\n arr[i] %= mod\ntc = int(raw_input())\nwhile tc>0:... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00047-of-00128_73__public__0000", "expected_output": {"kind": "stdout", "value": "3\n2\n"}, "input": {"kind": "stdin", "value": "2\n1 3\n2 1\n\nSAMPLE"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | HACKEREARTH | [] | null |
codecontests__test__code_contests_train.riegeli-00047-of-00128_77 | Takahashi will play a game using a piece on an array of squares numbered 1, 2, \cdots, N. Square i has an integer C_i written on it. Also, he is given a permutation of 1, 2, \cdots, N: P_1, P_2, \cdots, P_N.
Now, he will choose one square and place the piece on that square. Then, he will make the following move some n... | [{"code": "n,k=map(int,input().split())\np=list(map(int,input().split()))\nc=list(map(int,input().split()))\nfor i in range(n):\n p[i]-=1\nans=max(c)\nfor i in range(n):\n f=i\n r=0\n l=[]\n while True:\n f=p[f]\n l.append(c[f])\n r+=c[f]\n if f==i:\n break\n t=0... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00047-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "29507023469"}, "input": {"kind": "stdin", "value": "10 58\n9 1 6 7 8 4 3 2 10 5\n695279662 988782657 -119067776 382975538 -151885171 -177220596 -169777795 37619092 389386780 98... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00047-of-00128_78 | Given is an integer sequence A_1, ..., A_N of length N.
We will choose exactly \left\lfloor \frac{N}{2} \right\rfloor elements from this sequence so that no two adjacent elements are chosen.
Find the maximum possible sum of the chosen elements.
Here \lfloor x \rfloor denotes the greatest integer not greater than x.
... | [{"code": "import java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) { //No MLE!\n\t\tScanner input = new Scanner(System.in);\n\t\tint N = input.nextInt(); \n\t\tlong[][] dp;\n\t\tlong[] arr = new long[N];\n\t\tfor (int i = 0; i < N; i++) {\n\t\t\tarr[i] = input.nextLong();\n\t\t}\n\t... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00047-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "295"}, "input": {"kind": "stdin", "value": "27\n18 -28 18 28 -45 90 -45 23 -53 60 28 -74 -71 35 -26 -62 49 -77 57 24 -70 -93 69 -99 59 57 -49"}, "metadata": {}, "visibility": "... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00047-of-00128_80 | There are N points in a D-dimensional space.
The coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).
The distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.
How many pairs (i, j) (i < j) are there such ... | [{"code": "def distance(a, b):\n\tcont = 0\n\tfor k in xrange(len(a)):\n\t\tcont += (a[k] - b[k]) * (a[k] - b[k])\n\treturn cont ** 0.5\nn, t = map(int, raw_input().split())\n\nar = []\n\nfor i in xrange(n):\n\tar.append(map(int, raw_input().split()))\n\t\ncont = 0\nfor k in xrange(n):\n\tfor l in xrange(k + 1, n):\n\t... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00047-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "2"}, "input": {"kind": "stdin", "value": "3 4\n-3 7 8 2\n-12 1 10 2\n-2 8 9 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.r... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00047-of-00128_82 | There is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order. (Assume that the positive x-axis points right, and the positive y-axis points up.)
Takahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4).
... | [{"code": "import java.util.*;\n \npublic class Main {\n\t\n public static void main(String[] args) {\n \tScanner sc = new Scanner(System.in);\n \tint x1 = sc.nextInt();\n \tint y1 = sc.nextInt();\n \tint x2 = sc.nextInt();\n \tint y2 = sc.nextInt();\n \tint x3 = x2 - (y2 - y1);\n \tint y3 = y2 ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00047-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "3 10 -1 7"}, "input": {"kind": "stdin", "value": "2 3 6 6"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00047-of-0012... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00047-of-00128_83 | In Japan, people make offerings called hina arare, colorful crackers, on March 3.
We have a bag that contains N hina arare. (From here, we call them arare.)
It is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow.
We have ... | [{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main() {\n int n; cin >> n;\n vector<char> s(n);\n string ans = \"Three\";\n for (auto& e: s) {\n cin >> e;\n if (e == 'Y') ans = \"Four\";\n }\n cout << ans << endl;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00047-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "Four"}, "input": {"kind": "stdin", "value": "6\nG W Y P Y W"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00047-of-00... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00047-of-00128_85 | You are given two positive integers A and B. Compare the magnitudes of these numbers.
Constraints
* 1 ≤ A, B ≤ 10^{100}
* Neither A nor B begins with a `0`.
Input
Input is given from Standard Input in the following format:
A
B
Output
Print `GREATER` if A>B, `LESS` if A<B and `EQUAL` if A=B.
Examples
Input
3... | [{"code": "import java.util.*;\nimport java.math.BigInteger;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tBigInteger A = sc.nextBigInteger();\n\t\tBigInteger B = sc.nextBigInteger();\n \n\t\tif(A.compareTo(B) > 0){\n\t\t System.out.println(\"GREA... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00047-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "GREATER"}, "input": {"kind": "stdin", "value": "36\n24"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00047-of-00128_8... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00048-of-00128_2 | A tutorial for this problem is now available on our blog. Click here to read it.
You are asked to calculate factorials of some small positive integers.
Input
An integer t, 1 ≤ t ≤ 100, denoting the number of testcases, followed by t lines, each containing a single integer n, 1 ≤ n ≤ 100.
Output
For each integer n ... | [{"code": "t=input()\n\nwhile t > 0:\n m=1\n x=input()\n for i in range(x):\n m=m * x\n x=x-1\n print m\n t=t-1", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00048-of-00128_2__ref__0000", "source": "b... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00048-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "1\n2\n120\n6\n"}, "input": {"kind": "stdin", "value": "4\n1\n2\n5\n3"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00048-of-00128_3 | Problem Statement
Little Elephant from Zoo of Lviv likes bamboo very much. He currently has n stems of bamboo, Hi - height of i-th stem of bamboo (0-based numeration).
Today inspector Andrii from World Bamboo Association is visiting the plantation. He doesn't like current situation. He wants the height of i-th stem t... | [{"code": "for _ in xrange(int(raw_input())):\n\tn = int(raw_input())\n\tl1 = map(int, raw_input().split())\n\tl2 = map(int, raw_input().split())\n\ts1 = sum(l1)\n\ts2 = sum(l2)\n\tif n == 1:\n\t\tif s2 > s1:\n\t\t\tprint -1\n\t\tif s2 == s1:\n\t\t\tprint 0\n\t\tif s1 > s2:\n\t\t\tprint s1 - s2\n\telif n == 2:\n\t\tif ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00048-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "-1\n1\n5"}, "input": {"kind": "stdin", "value": "3\n1\n1\n2\n2\n1 2\n2 1\n3\n3 2 2\n4 5 3"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00048-of-00128_77 | There are K items placed on a grid of squares with R rows and C columns. Let (i, j) denote the square at the i-th row (1 \leq i \leq R) and the j-th column (1 \leq j \leq C). The i-th item is at (r_i, c_i) and has the value v_i.
Takahashi will begin at (1, 1), the start, and get to (R, C), the goal. When he is at (i, ... | [{"code": "import java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.util.ArrayList;\nimport java.util.InputMismatchException;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.NoSuchElementException;\nimport java.util.stream.Lon... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00048-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "29"}, "input": {"kind": "stdin", "value": "2 5 5\n1 1 3\n2 4 20\n1 2 1\n1 3 4\n1 4 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00048-of-00128_78 | We have three boxes A, B, and C, each of which contains an integer.
Currently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.
We will now do the operations below in order. Find the content of each box afterward.
* Swap the contents of the boxes A and B
* Swap the contents of the boxes A and C
C... | [{"code": "X, Y, Z = map(int,input().split())\n\nprint(Z, X, Y)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00048-of-00128_78__ref__0000", "source": "benchmark"}, {"code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long l... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00048-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "100 100 100"}, "input": {"kind": "stdin", "value": "100 100 100"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00048-o... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00048-of-00128_80 | You are given two non-negative integers L and R. We will choose two integers i and j such that L \leq i < j \leq R. Find the minimum possible value of (i \times j) \mbox{ mod } 2019.
Constraints
* All values in input are integers.
* 0 \leq L < R \leq 2 \times 10^9
Input
Input is given from Standard Input in the fol... | [{"code": "l,r = map(int,input().split())\nr = min(r, l+4038)\nans = 2018\nfor i in range(l,r):\n for j in range(l+1,r+1):\n if ans > i*j%2019:\n ans = i*j%2019\nprint(ans)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.rieg... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00048-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "20"}, "input": {"kind": "stdin", "value": "4 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00048-of-00128_80__publi... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00048-of-00128_81 | You are given positive integers A and B.
If A is a divisor of B, print A + B; otherwise, print B - A.
Constraints
* All values in input are integers.
* 1 \leq A \leq B \leq 20
Input
Input is given from Standard Input in the following format:
A B
Output
If A is a divisor of B, print A + B; otherwise, print B -... | [{"code": "#include <bits/stdc++.h>\nint main() {\n int a, b;\n scanf(\"%d%d\", &a, &b);\n if (b % a == 0) printf(\"%d\\n\", a+b);\n else printf(\"%d\\n\", b-a);\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00048-of-00128_81__ref__... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00048-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "16"}, "input": {"kind": "stdin", "value": "4 12"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00048-of-00128_81__publ... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00048-of-00128_82 | You are given an integer L. Construct a directed graph that satisfies the conditions below. The graph may contain multiple edges between the same pair of vertices. It can be proved that such a graph always exists.
* The number of vertices, N, is at most 20. The vertices are given ID numbers from 1 to N.
* The number o... | [{"code": "#解説参照\nl=int(input())\nr=0\nwhile 2**(r+1)<=l:\n r+=1\nn=r+1\nans=[]\nfor i in range(r):\n ans.append((i+1,i+2,0))\n ans.append((i+1,i+2,2**i))\n\nfor t in range(n-1,0,-1):\n if l-2**(t-1)>=2**r:\n ans.append((t,n,l-2**(t-1)))\n l-=2**(t-1)\nprint(n,len(ans))\nfor a in ans:\n pri... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00048-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "8 10\n1 2 0\n2 3 0\n3 4 0\n1 5 0\n2 6 0\n3 7 0\n4 8 0\n5 6 1\n6 7 1\n7 8 1"}, "input": {"kind": "stdin", "value": "4"}, "metadata": {}, "visibility": "public"}, {"case_id": "co... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00048-of-00128_83 | There are N people. The name of the i-th person is S_i.
We would like to choose three people so that the following conditions are met:
* The name of every chosen person begins with `M`, `A`, `R`, `C` or `H`.
* There are no multiple people whose names begin with the same letter.
How many such ways are there to choo... | [{"code": "import java.util.HashMap;\nimport java.util.Scanner;\n\npublic class Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n HashMap<String,Long> namelist = new HashMap<>();\n String s = \"MARCH\";\n for(int i = ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00048-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "2"}, "input": {"kind": "stdin", "value": "5\nMASHIKE\nRUMOI\nOBIRA\nHABORO\nHOROKANAI"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00049-of-00128_3 | Asmany strings are strings of '0's and '1's that have as many 00 as 11. A string such as 00110001 consists of 3 "00" and
1 "11". Of course this is not an Asmany string. 0011, 1100, 000111000111 are Asmany strings. An L'th Asmany number is the number of
Asmany strings of length L for all positive integers L.
For esote... | [{"code": "import sys\n\ndp = set();\ndp.add(2)\ndp.add(4)\nprev = 2\nmax=10**1000\ni=2\n\nwhile i:\n\tcur=prev*4-(prev*2)/i\n\ti=i+1\n\tdp.add(cur)\n\tdp.add(cur*2)\n\tprev=cur\n\tif cur>max:\n\t\tbreak\n\nt=int(input());\nwhile t:\n\tt=t-1\n\tn=int(input());\n\tif n in dp:\n\t\tprint ('YES')\n\telse:\n\t\tprint ('NO'... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "NO\nYES\n"}, "input": {"kind": "stdin", "value": "2\n3\n4"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00049-of-00128_4 | In a far away dystopian world, the measure of the quality of a person’s life is the numbers of likes he gets for an article about their life. For a person to stay alive, he has to acquire at least L number of likes before D days pass.
People in this world employ various techniques to increase the number of likes.... | [{"code": "t=input()\nwhile t>0:\n l,d,s,c=map(int,raw_input().split())\n x=l*1.0/s\n if d==1:\n if s>=l:\n x=1\n else:\n x=0\n else:\n x=pow(x,1.0/(d-1.0))\n if (1+c)>=x:\n x=1\n else:\n x=0 \n if x==1:\n print \"ALIVE... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "ALIVE AND KICKING\nDEAD AND ROTTING\n"}, "input": {"kind": "stdin", "value": "2\n5 1 5 1\n10 2 2 2"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00049-of-00128_5 | Let's start from some definitions.
Strings A and B are called anagrams if it's possible to rearrange the letters of string A using all the original letters exactly once and achieve string B; in other words A and B are permutations of each other. For example, remote and meteor are anagrams, race and race are anagrams a... | [{"code": "import sys\nfrom collections import Counter\n\nnum = int(sys.stdin.readline().rstrip())\ntext = sys.stdin.readline().rstrip()\ncommon_dict = Counter(text)\n\nwhile num != 1:\n\ttext = sys.stdin.readline().rstrip()\n\tcount = Counter(text)\n\ttmp = {}\n\tfor key,val in common_dict.items():\n\t\tif key in coun... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "hp\n"}, "input": {"kind": "stdin", "value": "3\nhope\nelephant\npath"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-000... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00049-of-00128_76 | Today Omar has assignment problems from his math professor. Yes, Omar has infinite number of questions that he must solve today. The first problem went something like this.
Given N integers in the form of A_i where 1 ≤ i ≤ N, Omar wants to make each number A_i in the N numbers equal to M. To convert a number A_i to ... | [{"code": "import math\n\nt=int(raw_input())\nwhile t:\n\tt=t-1\n\tn = int(raw_input())\n\ta = map(int,raw_input().split())\n\ta.sort()\n\tm = 0\n\tx=n/2\n\tif n%2==0:\n\t\tm = int(math.ceil((a[x-1]+a[x])/float(2)))\n\telse:\n\t\tm = a[x]\n\tcost = 0\t\n\tfor i in a:\n\t\tcost+=abs(m-i)\n\tprint cost", "is_known_correc... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_76__public__0000", "expected_output": {"kind": "stdout", "value": "6\n"}, "input": {"kind": "stdin", "value": "1\n4\n1 2 4 5\n\nSAMPLE"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | HACKEREARTH | [] | null |
codecontests__test__code_contests_train.riegeli-00049-of-00128_77 | We have N strings of lowercase English letters: S_1, S_2, \cdots, S_N.
Takahashi wants to make a string that is a palindrome by choosing one or more of these strings - the same string can be chosen more than once - and concatenating them in some order of his choice.
The cost of using the string S_i once is C_i, and t... | [{"code": "#include <bits/stdc++.h>\n#define fi first\n#define se second\n#define pb push_back\nusing namespace std;\ntypedef long long ll;\ntypedef pair<int, int> pii;\n\nstruct state {\n string pref, suff;\n ll cost;\n\n int hash() {\n ll res = 0;\n for (int i=0;i<pref.length();i++) {\n ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "-1"}, "input": {"kind": "stdin", "value": "2\nabc 1\nab 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-0012... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00049-of-00128_78 | We have held a popularity poll for N items on sale. Item i received A_i votes.
From these N items, we will select M as popular items. However, we cannot select an item with less than \dfrac{1}{4M} of the total number of votes.
If M popular items can be selected, print `Yes`; otherwise, print `No`.
Constraints
* 1 \... | [{"code": "n,m=map(int,input().split())\na=list(map(int,input().split()))\nc=len([i for i in a if i>=sum(a)/(4*m)])\nprint(\"Yes\" if c>=m else \"No\")", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_78__ref__0000", "source... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "4 1\n5 4 2 1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00049-of-00128_79 | Given is a string S representing the day of the week today.
S is `SUN`, `MON`, `TUE`, `WED`, `THU`, `FRI`, or `SAT`, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.
After how many days is the next Sunday (tomorrow or later)?
Constraints
* S is `SUN`, `MON`, `TUE`, `WED`, `THU`,... | [{"code": "s=input()\nA=[\"\",\"SAT\",\"FRI\",\"THU\",\"WED\",\"TUE\",\"MON\",\"SUN\"]\nprint(A.index(s))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_79__ref__0000", "source": "benchmark"}, {"code": "SUN=7\nMON=6\nTUE=5... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "7"}, "input": {"kind": "stdin", "value": "SUN"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_79__public... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00049-of-00128_80 | There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.
Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).
When Mountain i (1 \leq i \l... | [{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main(){\n int n; cin>>n;\n vector<long long> a(n);\n long long x=0LL;\n for(int i=0; i<n; ++i){\n cin>>a[i];\n if(i%2==0)x+=a[i];\n else x-=a[i];\n }\n cout<<x<<\" \";\n x/=2;\n for(int i=0; i<n-1; ++i){\n x=a[i]-x;\n cout<<x*2<<\" ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "0 2000000000 0"}, "input": {"kind": "stdin", "value": "3\n1000000000 1000000000 0"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_tra... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00049-of-00128_81 | Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they like these foods or not.
The i-th person answered that he/she only l... | [{"code": "import java.util.*;\n\npublic class Main {\n public static void main(String[] args) throws Exception {\n Scanner sc = new Scanner(System.in);\n int n = Integer.parseInt(sc.next());\n int[] dish = new int[Integer.parseInt(sc.next())];\n for (int i = 0; i < n; i++) {\n ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "1"}, "input": {"kind": "stdin", "value": "3 4\n2 1 3\n3 1 2 3\n2 3 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00049-of-00128_83 | We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j).
The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}.
You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by... | [{"code": "h,w,d = map(int,input().split())\na = [0]*h\nfor i in range(h):\n a[i] = list(map(int,input().split()))\nnum = [[] for i in range(w*h+1)]\nfor i in range(h):\n for j in range(w):\n num[a[i][j]].append([i,j])\ns = [0]*(h*w+1)\nfor i in range(1,h*w-d+1):\n s[d+i] = s[i] + abs(num[d+i][0][0]-num... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "5"}, "input": {"kind": "stdin", "value": "3 3 2\n1 4 3\n2 5 7\n8 9 6\n1\n4 8"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.ri... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00049-of-00128_85 | Alice and Brown loves games. Today, they will play the following game.
In this game, there are two piles initially consisting of X and Y stones, respectively. Alice and Bob alternately perform the following operation, starting from Alice:
* Take 2i stones from one of the piles. Then, throw away i of them, and put the... | [{"code": "print('ABlriocwen'[-2<eval(input().replace(' ','-'))<2::2])", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_85__ref__0000", "source": "benchmark"}, {"code": "x,y=map(int,input().split());print(['Alice','Brown'][a... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "Brown"}, "input": {"kind": "stdin", "value": "0 0"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00049-of-00128_85__pu... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00050-of-00128_3 | The Little Elephant from the Zoo of Lviv currently is on the military mission. There are N enemy buildings placed in a row and numbered from left to right strating from 0. Each building i (except the first and the last) has exactly two adjacent buildings with indices i-1 and i+1. The first and the last buildings have j... | [{"code": "t = int(raw_input())\nfor _ in xrange(t):\n n = int(raw_input())\n S = raw_input()\n count = 0\n for i in xrange(1, n - 1):\n if S[i] == '0' and S[i - 1] == '0' and S[i + 1] == '0':\n count += 1\n if n != 1:\n if S[0] == '0' and S[1] == '0':\n count += 1\n ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00050-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "0\n1\n7\n"}, "input": {"kind": "stdin", "value": "3\n3\n010\n5\n10001\n7\n0000000"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00050-of-00128_4 | You are given a transparent three-dimensional table, the height equals to H and the base is a two-dimensional table N∙M.
The layers of the 3D table are numbered from 1 to H. Each layer is a two-dimensional table, the rows are numbered from 1 to N and the columns are numbered from 1 to M. A pair (i, j) (1 ≤ i ≤ N, 1 ≤ j... | [{"code": "#!/usr/bin/env python2.7\n\n\"\"\"painting.py: solution to http://www.codechef.com/problems/PNTNG\"\"\"\n\nimport sys\n\ndimensions = sys.stdin.readline().split(\" \")\nn, m, h = int(dimensions[0]), int(dimensions[1]), int(dimensions[2])\na = n*m\nlayers = []\nmaxsquares = 0\n\nfor i in xrange(0, h):\n la... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00050-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "Impossible\n"}, "input": {"kind": "stdin", "value": "2 2 3\n1 1\n1 2\n1 3"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00050-of-00128_49 | Dasha decided to bake a big and tasty layer cake. In order to do that she went shopping and bought n rectangular cake layers. The length and the width of the i-th cake layer were ai and bi respectively, while the height of each cake layer was equal to one.
From a cooking book Dasha learned that a cake must have a form ... | [{"code": "#coding:utf-8\n\nn = int(raw_input())\ncakes = []\nfor i in xrange(n):\n cakes.append(sorted(map(int, raw_input().split())))\n#print cakes\ncakes.sort(key = lambda x:x[0])\nans = 0\nw = []\nfor i in xrange(n-1,-1,-1):\n w.append(cakes[i][1])\n w.sort()\n for j in xrange(len(w)):\n tmp = ca... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00050-of-00128_49__public__0000", "expected_output": {"kind": "stdout", "value": "96\n6 4\n"}, "input": {"kind": "stdin", "value": "5\n5 12\n1 1\n4 6\n6 4\n4 6"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.r... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODEFORCES | [] | null |
codecontests__test__code_contests_train.riegeli-00050-of-00128_78 | Given any integer x, Aoki can do the operation below.
Operation: Replace x with the absolute difference of x and K.
You are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.
Constraints
* 0 ≤ N ≤ 10^{18}
* 1 ≤ K ≤ 10^{18}
* All valu... | [{"code": "import java.util.Scanner;\n\npublic class Main {\n\n public static void main(String[] args) {\n\n Scanner scan = new Scanner(System.in);\n \n long n = scan.nextLong();\n long k = scan.nextLong();\n \n long res = n % k;\n \n System.out.println(Math.min(Math.abs(res-k),res));\n } \n}"... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00050-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "1000000000000000000 1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00050-o... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00050-of-00128_79 | We have a string S consisting of uppercase English letters. Additionally, an integer N will be given.
Shift each character of S by N in alphabetical order (see below), and print the resulting string.
We assume that `A` follows `Z`. For example, shifting `A` by 2 results in `C` (`A` \to `B` \to `C`), and shifting `Y` ... | [{"code": "N = int(input())\nS = input()\n\nprint(''.join(chr((ord(c) - ord('A') + N) % 26 + ord('A')) for c in S))\n", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00050-of-00128_79__ref__0000", "source": "benchmark"}, {"code": "n = int... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00050-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "NOPQRSTUVWXYZABCDEFGHIJKLM"}, "input": {"kind": "stdin", "value": "13\nABCDEFGHIJKLMNOPQRSTUVWXYZ"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__c... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00050-of-00128_80 | There is a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and Vertex b_i, and the color and length of that edge are c_i and d_i, respectively. Here the color of each edge is represented by an integer between 1 and N-1 (inclusive). The same integer corresponds to the same color, and... | [{"code": "#include<bits/stdc++.h>\n#define LL long long\n#define MEM(x,y) memset(x,y,sizeof(x))\n#define MOD(x) ((x)%mod)\n#define mod 1000000007\n#define pb push_back\n#define STREAM_FAST ios::sync_with_stdio(false)\nusing namespace std;\nconst int maxn = 1e5 + 7;\nint head[maxn];\nstruct node{int v, next, c, w;}e[ma... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00050-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "130\n200\n60"}, "input": {"kind": "stdin", "value": "5 3\n1 2 1 10\n1 3 2 20\n2 4 4 30\n5 2 1 40\n1 100 1 4\n1 100 1 5\n3 1000 3 4"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00050-of-00128_81 | There are N monsters, numbered 1, 2, ..., N.
Initially, the health of Monster i is A_i.
Below, a monster with at least 1 health is called alive.
Until there is only one alive monster, the following is repeated:
* A random alive monster attacks another random alive monster.
* As a result, the health of the monster a... | [{"code": "#include<iostream>\nusing namespace std;\nint main(){\n int n,a,b,c,i=1;\n cin >> n;\n cin >> a;\n do{\n cin >> b;\n if(a<b){c=b;b=a;a=c;}\n while(a%b){\n c=b;b=a%b;a=c;\n }\n a=b;i++;\n }while(i<n);\n cout << a;\n return 0;\n}", "is_known_correct": true, "language": "cpp", "metada... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00050-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "1000000000"}, "input": {"kind": "stdin", "value": "3\n1000000000 1000000000 1000000000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contest... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00050-of-00128_82 | Takahashi throws N dice, each having K sides with all integers from 1 to K. The dice are NOT pairwise distinguishable. For each i=2,3,...,2K, find the following value modulo 998244353:
* The number of combinations of N sides shown by the dice such that the sum of no two different sides is i.
Note that the dice are ... | [{"code": "#include<iostream>\n#include<algorithm>\n\nusing namespace std;\ntypedef long long Int;\n#define MOD 998244353LL;\n\nInt cmemo[4000][4000];\n\nInt C(Int x, Int y){\n\tif(x < y)return 0;\n\tInt &res = cmemo[x][y];\n\tif(res != -1)return res;\n\tif(y == 0 || x == y)return res = 1;\n\treturn res = (C(x-1, y) + ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00050-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "149393349\n149393349\n668669001\n668669001\n4000002\n4000002\n4000002\n668669001\n668669001\n149393349\n149393349"}, "input": {"kind": "stdin", "value": "6 1000"}, "metadata": ... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00050-of-00128_85 | Alice lives on a line. Today, she will travel to some place in a mysterious vehicle. Initially, the distance between Alice and her destination is D. When she input a number x to the vehicle, it will travel in the direction of the destination by a distance of x if this move would shorten the distance between the vehicle... | [{"code": "#include <bits/stdc++.h>\n#define yabs(x) ((x<0)?(-(x)):(x))\n\nusing namespace std;\n\nconst int N=5e5+10,Inf=1e9+10;\n\nint n,D,Q,a[N],now[N],suf[N];\n\nvoid Init()\n{\n\tscanf(\"%d%d\",&n,&D);\n\tfor (int i=1;i<=n;++i) scanf(\"%d\",&a[i]);\n}\n\nvoid Solve()\n{\n\tnow[0]=D;\n\tfor (int i=1;i<=n;++i) now[i... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00050-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "YES\nYES\nYES\nYES\nYES"}, "input": {"kind": "stdin", "value": "5 9\n4 4 2 3 2\n5\n1 4 2 3 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_c... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00051-of-00128_0 | Problem Statement
Little Chef doesn't love math anymore. He loves Aleksandra.
Sashen'ka is nice. They spend all the time together. Even their birthdays they are celebrating together, because they were born on the same day :)
And now, this day is coming...
Chef know that most of all Sasha loves numbers, that's why... | [{"code": "import sys\nfrom bisect import bisect_left\n\n\ndef line_to_array():\n return map(int, sys.stdin.readline().strip().split(' '))\n\n\ndef main():\n \"\"\"\n x**y | y*log(x) | log(x)/x |\n |--log--> |--divide by (x*y)--> |--> f(n) = log(n)/n\n ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00051-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "1.000000\n1.500000\n0.000000"}, "input": {"kind": "stdin", "value": "3\n1\n3\n4\n2\n2 3\n1 4\n2\n2 4\n2 2"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00051-of-00128_3 | A Little Elephant and his friends from the Zoo of Lviv like candies very much.
There are N elephants in the Zoo. The elephant with number K (1 ≤ K ≤ N) will be happy if he receives at least AK candies. There are C candies in all in the Zoo.
The Zoo staff is interested in knowing whether it is possible to make all the... | [{"code": "t=int(raw_input())\nwhile t:\n t-=1\n n,c=map(int,raw_input().split())\n sum=0\n inp2=raw_input().split()\n for i in range(n):\n sum+=int(inp2[i])\n if sum<=c:\n print(\"Yes\")\n else:\n print(\"No\")", "is_known_correct": true, "language": "python", "metadata": {}, ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00051-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "Yes\nNo\n"}, "input": {"kind": "stdin", "value": "2\n2 3\n1 1\n3 7\n4 2 2"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00051-of-00128_4 | In poker, you have 5 cards. There are 10 kinds of poker hands (from highest to lowest):
royal flush - ace, king, queen, jack and ten, all in the same suit
straight flush - five cards of the same suit in sequence, such
as 10,9,8,7,6 of clubs; ace can be counted both as the highest card or as the
lowest card - A,2,3,4... | [{"code": "#kcahdog\nstraights=['23456','34567','45678','56789','6789T','789JT','89JQT','9JQKT','AJKQT','2345A']\nfor u in range(input()):\n cards=raw_input().split()\n flush=True\n #check for flush\n for i in range(4):\n if(cards[i][1]!=cards[i+1][1]):\n flush=False\n cards.sort()\n ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00051-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "royal flush\npair\nfull house\n"}, "input": {"kind": "stdin", "value": "3\nAH KH QH TH JH\nKH 5S 3C 5C 7D\nQH QD 2S QC 2C"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00051-of-00128_49 | Welcoming autumn evening is the best for walking along the boulevard and n people decided to do so.
The boulevard can be represented as the axis Ox. For every person there are three parameters characterizing the behavior: ti, si, fi — the moment of time when the i-th person starts walking, the start point and the end ... | [{"code": "n = input()\nlines = [map(int, raw_input().split()) for i in xrange(n)]\n\ndef greets(id1, id2):\n if id1 == id2:\n return False\n\n t1, s1, f1 = lines[id1]\n t2, s2, f2 = lines[id2]\n\n d1 = (f1>s1) - (f1<s1)\n d2 = (f2>s2) - (f2<s2)\n l1 = abs(f1-s1)\n l2 = abs(f2-s2)\n \n ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00051-of-00128_49__public__0000", "expected_output": {"kind": "stdout", "value": "2 2 2"}, "input": {"kind": "stdin", "value": "3\n3 2 4\n4 3 4\n3 6 4"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODEFORCES | [] | null |
codecontests__test__code_contests_train.riegeli-00051-of-00128_78 | A positive integer X is said to be a lunlun number if and only if the following condition is satisfied:
* In the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.
For example, 1234, 1, and 334 are lunlun numbers, while ... | [{"code": "k=int(input())\n\nq=[\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\nx=9\nfor i in q:\n if x>100000:\n break\n x+=1\n a=i[-1]\n for j in ([-1,0,1]):\n bb=int(a)+j\n if bb<10 and bb>=0:\n q.append(i+str(bb))\n\n\nprint(q[k-1])", "is_known_correct": true, "la... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00051-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "21"}, "input": {"kind": "stdin", "value": "13"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00051-of-00128_78__public... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00051-of-00128_79 | Given is a tree G with N vertices. The vertices are numbered 1 through N, and the i-th edge connects Vertex a_i and Vertex b_i.
Consider painting the edges in G with some number of colors. We want to paint them so that, for each vertex, the colors of the edges incident to that vertex are all different.
Among the colo... | [{"code": "#include <bits/stdc++.h>\nusing namespace std;\n \n#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);\n#define endl \"\\n\"\n#define int long long\n\nconst int N = 1e5 + 5;\n\nint n, k;\nint deg[N], ans[N];\nvector<pair<int, int> > g[N];\n\nvoid dfs(int u, int par, int c)\n{\n\tfor(auto &it:g[u])\... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00051-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "2\n1\n2"}, "input": {"kind": "stdin", "value": "3\n1 2\n2 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00051-of-00... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00051-of-00128_80 | You are given a 4-character string S consisting of uppercase English letters. Determine if S consists of exactly two kinds of characters which both appear twice in S.
Constraints
* The length of S is 4.
* S consists of uppercase English letters.
Input
Input is given from Standard Input in the following format:
S
... | [{"code": "#include <bits/stdc++.h>\nusing namespace std;\nint main() {\n char s[4];\n for(int i=0;i<4;++i) cin >> s[i];\n sort(s,s+4);\n if(s[0]==s[1]&&s[2]==s[3]&&s[1]!=s[2]) cout << \"Yes\" << endl;\n else cout << \"No\" << endl;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00051-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "FFEE"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00051-of-00128_80__pub... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00051-of-00128_81 | Find the largest integer that can be formed with exactly N matchsticks, under the following conditions:
* Every digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \leq A_i \leq 9).
* The number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respectiv... | [{"code": "import java.io.*; \nimport java.math.BigInteger;\nimport java.util.*;\n \npublic class Main {\n public static void main(String[] args) throws IOException {\n FastScanner sc = new FastScanner();\n int N = sc.nextInt();\n int M = sc.nextInt();\n int[] A = new int[M];\n for... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00051-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "71111111111111111111111111111111111111111111111111"}, "input": {"kind": "stdin", "value": "101 9\n9 8 7 6 5 4 3 2 1"}, "metadata": {}, "visibility": "public"}, {"case_id": "cod... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00051-of-00128_82 | You are given a permutation of 1,2,...,N: p_1,p_2,...,p_N. Determine if the state where p_i=i for every i can be reached by performing the following operation any number of times:
* Choose three elements p_{i-1},p_{i},p_{i+1} (2\leq i\leq N-1) such that p_{i-1}>p_{i}>p_{i+1} and reverse the order of these three.
Cons... | [{"code": "#include<cstdio>\n#include<algorithm>\nusing namespace std;\nint n,a[300005];\nint main(){\n\tscanf(\"%d\",&n);\n\tfor(int i=1;i<=n;++i)scanf(\"%d\",&a[i]);\n\tfor(int i=1,j=1;i<=n;i=j=j+1){\n\t\twhile(1){\n\t\t\tif(j+1>n||a[j+1]!=j+1)break;\n\t\t\tif(j+2>n||a[j+2]==j+2)break;\n\t\t\tj+=2;\n\t\t}\n\t\tfor(in... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00051-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "No"}, "input": {"kind": "stdin", "value": "6\n5\n3\n4\n1\n2\n6"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00051-of... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00051-of-00128_85 | You are in charge of controlling a dam. The dam can store at most L liters of water. Initially, the dam is empty. Some amount of water flows into the dam every morning, and any amount of water may be discharged every night, but this amount needs to be set so that no water overflows the dam the next morning.
It is know... | [{"code": "import java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.util.Arrays;\nimport java.util.InputMismatchException;\n\npublic class Main {\n\tstatic InputStream is;\n\tstatic PrintWriter out;\n\tstatic String INPUT = \"\";\n\t\n\tsta... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00051-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "1000000000.0000000\n666666669.6666666\n400000005.0000000\n293333338.8666667"}, "input": {"kind": "stdin", "value": "4 15\n1000000000 15\n9 5\n8 6\n7 4"}, "metadata": {}, "visib... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00052-of-00128_0 | Suraj, the Chief Prankster is back in action now and this time he has stolen the valentine's day gift given by Ashi (the love of Chef) to the Chef and ran away with it to Byteland.
Byteland is a not a regular place like Chef's town. The safest way from Chef's town to Byteland is through the path of tasty dishes. The pa... | [{"code": "arr = []\n\ndef check(ppl):\n\tfor i in range(0,len(arr)):\n\t\tif(arr[i][2]==-1):#magic dish\n\t\t\tppl -= arr[i][1]\n\t\telif(ppl>=arr[i][1]):#clan - applicable\n\t\t\t\tppl += arr[i][2]\n\treturn ppl\n\ndef binary_search(low,high):\n\twhile True:\n\t\t#print low,high\n\t\tif(low+1==high):\n\t\t\tbreak\n\t... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00052-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "5\n9\n6"}, "input": {"kind": "stdin", "value": "3\n10\n2 1 3 8 1\n0\n10\n2 1 3 8 5\n0\n10\n2 2 3 8 5\n3 1 2 1 4 3 2 9 1 1"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00052-of-00128_2 | Write a program to find the remainder when two given numbers are divided.
Input
The first line contains an integer T, total number of test cases. Then follow T lines, each line contains two Integers A and B.
Output
Find remainder when A is divided by B.
Constraints
1 ≤ T ≤ 1000
1 ≤ A,B ≤ 10000
Example
Input
3... | [{"code": "from sys import stdin, stdout\nt=int(input())\nfor i in range(t):\n A,B = map( int, stdin.readline().rstrip().split() )\n c=A%B\n print(c)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00052-of-00128_2__ref__0000", "... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00052-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "1\n100\n10\n"}, "input": {"kind": "stdin", "value": "3 \n1 2\n100 200\n10 40"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00052-of-00128_3 | Little Elephant from the Zoo of Lviv likes cards. He has N cards, each of which has one of 1000 colors. The colors are numbered from 1 to 1000.
Little Elephant and Big Hippo are playing the following game. At first Little Elephant takes some subset of cards, and Big Hippo takes the rest of them. Here, Little Elephant c... | [{"code": "'''\nCreated on Feb 22, 2013\n\n@author: anuvrat\n'''\n\nimport sys\n\nMODULATOR = 1000000007\n\nclass Memoize( object ):\n def __init__( self, f ):\n self.f, self.cache = f, {}\n\n def __call__( self, *args ):\n if not args in self.cache: self.cache[args] = self.f( *args )\n retur... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00052-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "4\n5"}, "input": {"kind": "stdin", "value": "2\n3\n1 2 3\n4\n1 1 3 2"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00052-of-00128_49 | Today Berland holds a lottery with a prize — a huge sum of money! There are k persons, who attend the lottery. Each of them will receive a unique integer from 1 to k.
The organizers bought n balls to organize the lottery, each of them is painted some color, the colors are numbered from 1 to k. A ball of color c corresp... | [{"code": "n,m=raw_input().split()\nn=int(n);m=int(m)\na=[int(i) for i in raw_input().split()]\ndiv = n/m\nres=0\ns=set(a)\n\nfor i in s:\n if (a.count(i) > div):\n res+=a.count(i)-div\nprint res", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contest... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00052-of-00128_49__public__0000", "expected_output": {"kind": "stdout", "value": "3\n"}, "input": {"kind": "stdin", "value": "8 4\n1 2 1 1 1 4 1 4"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00052-... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODEFORCES | [] | null |
codecontests__test__code_contests_train.riegeli-00052-of-00128_5 | Given an array A1,A2...AN, you have to print the size of the largest contiguous subarray such that
GCD of all integers in that subarray is 1.
Formally, For a subarray Ai,Ai+1...Aj where 1 ≤ i < j ≤ N to be valid: GCD(Ai,Ai+1...Aj) should be 1. You have to print the size of the largest valid subarray.
If no valid subarr... | [{"code": "\"\"\"\nhttp://www.codechef.com/COOK50/problems/SUBGCD\n\"\"\"\nfrom fractions import gcd\n\ndef GCD(L) :\n\t\"\"\"GCD of list L. length of list L is at least 2.\"\"\"\n\tans = L[0]\n\tfor i in xrange(1,len(L)) :\n\t\tans = gcd(ans,L[i])\n\t\tif ans == 1 : break\n\treturn ans\n\nT = int(raw_input())\nfor _ i... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00052-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "2\n-1\n"}, "input": {"kind": "stdin", "value": "2\n2\n7 2\n3\n2 2 4"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00052-of-00128_78 | Takahashi has decided to work on K days of his choice from the N days starting with tomorrow.
You are given an integer C and a string S. Takahashi will choose his workdays as follows:
* After working for a day, he will refrain from working on the subsequent C days.
* If the i-th character of S is `x`, he will not wor... | [{"code": "n,k,c=map(int, input().split())\ns = input()\nleftmost = []\ncursor = 0\nfor _ in range(k):\n while s[cursor] == 'x':\n cursor += 1\n leftmost.append(cursor)\n cursor += c+1\nrightmost = []\ncursor = n-1\nfor _ in range(k):\n while s[cursor] == 'x':\n cursor -= 1\n rightmost.appe... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00052-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "1\n5"}, "input": {"kind": "stdin", "value": "5 2 3\nooxoo"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00052-of-0012... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00052-of-00128_79 | Given are a sequence of N positive integers A_1, A_2, \ldots, A_N, and a positive integer K.
Find the number of non-empty contiguous subsequences in A such that the remainder when dividing the sum of its elements by K is equal to the number of its elements. We consider two subsequences different if they are taken from... | [{"code": "from collections import defaultdict\n\ndef gets():\n return list(map(int, input().split()))\n\nN, K = gets()\nA = gets()\n\nS = [0] * (N + 1)\nfor i in range(N):\n S[i + 1] = (S[i] + A[i] - 1) % K\n\ncnt = defaultdict(int)\nans = 0\ncnt[0] += 1\nfor i in range(1, N+1):\n if i - K >= 0:\n cnt[S[i - K]] ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00052-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "4"}, "input": {"kind": "stdin", "value": "5 4\n1 4 2 3 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00052-of-00128... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00052-of-00128_80 | We have a permutation p = {p_1,\ p_2,\ ...,\ p_n} of {1,\ 2,\ ...,\ n}.
Print the number of elements p_i (1 < i < n) that satisfy the following condition:
* p_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.
Constraints
* All values in input are integers.
* 3 \leq n \leq 20
* p... | [{"code": "N = int(input())\np = list(map(int,input().split()))\n\ns = 0\nfor i in range(1,N-1):\n s += p[i-1] < p[i] < p[i+1] or p[i-1] > p[i] > p[i+1]\n\nprint(s)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00052-of-00128_80__ref... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00052-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "5"}, "input": {"kind": "stdin", "value": "9\n9 6 3 2 5 8 7 4 1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00052-of... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00052-of-00128_82 | There is an N-car train.
You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."
Constraints
* 1 \leq N \leq 100
* 1 \leq i \leq N
Input
Input is given from Standard Input in the following format:
N i
O... | [{"code": "n,i = map(int,input().split())\nans = n+1-i\nprint(ans)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00052-of-00128_82__ref__0000", "source": "benchmark"}, {"code": "N, i = map(int, input().split())\nprint(N + 1 - i)\n", "is... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00052-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "1"}, "input": {"kind": "stdin", "value": "1 1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00052-of-00128_82__public... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00053-of-00128_0 | Teddy and Tracy like to play a game based on strings. The game is as follows. Initially, Tracy writes a long random string on a whiteboard. Then, each player starting with Teddy makes turn alternately. Each turn, the player must erase a contiguous substring that exists in the dictionary. The dictionary consists of N wo... | [{"code": "__author__ = 'robert'\nfrom collections import defaultdict\nimport sys\n\ndef solve(cache, between, i, j):\n if (i, j) in cache:\n return cache[(i, j)]\n if not between[(i, j)]:\n return 0\n if len(between[(i, j)]) == 1:\n return 1\n grundy_numbers = set()\n for word in be... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00053-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "Tracy\nTracy\nTeddy"}, "input": {"kind": "stdin", "value": "3\ncodechef\n2\ncode\nchef\nfoo\n1\nbar\nmississippi\n4\nssissi\nmippi\nmi\nppi"}, "metadata": {}, "visibility": "pub... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00053-of-00128_2 | Consider a currency system in which there are notes of seven denominations, namely, Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 50, Rs. 100. If the sum of Rs. N is input, write a program to computer smallest number of notes that will combine to give Rs. N.
Input
The first line contains an integer T, total number of testcases. T... | [{"code": "for x in range(int(raw_input())):\n\tvarAmount = int(raw_input())\n\ttotalNotes = 0\n\tfor denomination in [100, 50, 10, 5, 2, 1]:\n\t\tif varAmount != 0:\n\t\t\tvarNotes = varAmount//denomination\n\t\t\tvarAmount -= varNotes*denomination\n\t\t\ttotalNotes += varNotes\n\tprint totalNotes", "is_known_correct"... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00053-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "12\n5\n7\n"}, "input": {"kind": "stdin", "value": "3 \n1200\n500\n242"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00053-of-00128_3 | The Little Elephant from the Zoo of Lviv has an array A that consists of N positive integers. Let A[i] be the i-th number in this array (i = 1, 2, ..., N).
Find the minimal number x > 1 such that x is a divisor of all integers from array A. More formally, this x should satisfy the following relations:
A[1] mod x = 0... | [{"code": "from fractions import gcd\ndef divisors_min(r):\n if(r%2==0):\n return 2\n elif(r%3==0):\n return 3\n else:\n y=2\n i=5\n while i<pow(r,0.5)+1:\n if(r%i==0):\n return i\n i+=y\n y=6-y\n return r \ndef gcd2(l... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00053-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "2\n-1\n"}, "input": {"kind": "stdin", "value": "2\n3\n2 4 8\n3\n4 7 5"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00053-of-00128_4 | Farmer Feb has three fields with potatoes planted in them. He harvested x potatoes from the first field, y potatoes from the second field and is yet to harvest potatoes from the third field. Feb is very superstitious and believes that if the sum of potatoes he harvests from the three fields is a prime number (http://en... | [{"code": "import sys\n\nprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61,\n67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149,\n151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233,\n239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 3... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00053-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "1\n4\n"}, "input": {"kind": "stdin", "value": "2\n1 3\n4 3"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00053-of-00128_5 | Given an array A1, A2, ..., AN, count the number of subarrays of array A which are non-decreasing.
A subarray A[i, j], where 1 ≤ i ≤ j ≤ N is a sequence of integers Ai, Ai+1, ..., Aj.
A subarray A[i, j] is non-decreasing if Ai ≤ Ai+1 ≤ Ai+2 ≤ ... ≤ Aj. You have to count the total number of such subarrays.
Input
The fi... | [{"code": "n = int(raw_input())\nfor i in xrange(n):\n\tl = int(raw_input())\n\tlist_a = [0]\n\tprev = -1\n\tnumList = [int(x) for x in raw_input().split()]\n\tfor num in numList:\n\t\tif num >= prev:\n\t\t\tlist_a.append(list_a[-1] + 1)\n\t\telse:\n\t\t\tlist_a.append(1)\n\t\tprev = num\n\tprint sum(list_a)", "is_know... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00053-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "6\n1\n"}, "input": {"kind": "stdin", "value": "2\n4\n1 4 2 3\n1\n5"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00053-of-00128_78 | Given is a positive integer N.
We will choose an integer K between 2 and N (inclusive), then we will repeat the operation below until N becomes less than K.
* Operation: if K divides N, replace N with N/K; otherwise, replace N with N-K.
In how many choices of K will N become 1 in the end?
Constraints
* 2 \leq N ... | [{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main(){\n int64_t N;\n cin >> N;\n\n unordered_set<int64_t> divs;\n\n // 2以上であるN-1の約数,\n // Nの約数の一部を(N自身とsqrt(N)以下のものを試して)追加\n divs.insert(N);\n if(N-1 > 1){ divs.insert(N-1); }\n int64_t div= 2;\n while(div*div <= N){\n int cnt= 0;\n int64... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00053-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "9"}, "input": {"kind": "stdin", "value": "314159265358"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00053-of-00128_7... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00053-of-00128_80 | Takahashi made N problems for competitive programming. The problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).
He is dividing the problems into two categories by choosing an integer K, as follows:
* A problem with difficulty K or higher will be for ... | [{"code": "import java.util.*;\nimport java.util.Arrays;\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n \tint a[] = new int[n];\n \tint s = 0;\n \tfor (int i = 0; i < n; i++){\n \ta[i] = sc.nextInt();\n ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00053-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "8\n9 1 14 5 5 4 4 14"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00053-of... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00053-of-00128_82 | There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if... | [{"code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\nint main() {\n\tint h, w;\n\tcin >> h >> w;\n\tbool x[110] = { 0 }, y[110] = { 0 };\n\tvector<string>s(h);\n\tfor (int i = 0; i < h; i++) {\n\t\tcin >> s[i];\n\t}\n\tfor (int i = 0; i<h; i++) {\n\t\tfor (int j = 0; j<w; j++) {\n\t\t\tif (s... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00053-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "###\n###\n.##"}, "input": {"kind": "stdin", "value": "4 4\n##.#\n....\n##.#\n.#.#"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_tra... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00054-of-00128_0 | Akhil comes across a string S of length N. He started wondering about the smallest lexicographical subsequence of string S of length K.
A subsequence of a string is formed by deleting some characters (possibly none) from it's original string.
A string A is said to be lexicographically smaller than the string B of the s... | [{"code": "import heapq\n \ndef solve(s, k):\n res = []\n start_index = -1\n end_index = len(s) - k\n #choose the staring window\n h = [(y, x) for x, y in enumerate(s[:end_index])]\n heapq.heapify(h)\n\n for _ in range(k):\n # enlarge the window by increamenting one (character, pos_of_har... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00054-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "abc\nab"}, "input": {"kind": "stdin", "value": "2\nabdc\n3\nbacb\n2"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00054-of-00128_1 | Churu is taking the course called “Introduction to Data Structures”. Yesterday, he learned how to use a stack to check is a given parentheses expression is balanced or not. He finds it intriguing, and more importantly, he was given an assignment. The professor gave him a string S containing characters “(” and “)”, and ... | [{"code": "t=input()\nwhile t>0:\n t-=1\n n,k=map(int,raw_input().split())\n li=['0']*n\n flag=0\n while k>0:\n k-=1\n a,b=map(int,raw_input().split())\n for i in range(a,b+1,2):\n li[i]=\"(\"\n li[i+1]=\")\"\n for i in range(n):\n if li[i]=='0' and fl... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00054-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "()()\n(())"}, "input": {"kind": "stdin", "value": "2\n4 1\n0 3\n4 2\n0 3\n1 2"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00054-of-00128_2 | You're given an integer N. Write a program to calculate the sum of all the digits of N.
Input
The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer N.
Output
Calculate the sum of digits of N.
Constraints
1 ≤ T ≤ 1000
1 ≤ N ≤ 100000
Example
Inpu... | [{"code": "t=int(raw_input())\nwhile(t>0):\n\tn=[]\n\ta=raw_input()\n\tn=list(a)\n\tn=map(int,list(n))\n\tprint sum(n)\n\tt-=1", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00054-of-00128_2__ref__0000", "source": "benchmark"}, {"code": ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00054-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "15\n9\n8\n"}, "input": {"kind": "stdin", "value": "3 \n12345\n31203\n2123"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00054-of-00128_3 | Little Elephant from the Zoo of Lviv hates exams. Since Little Elephant lives in Ukraine, he is going to take exams called 'ZNO'. Help him.
There will be n tickets on the table. Each ticket has a number written on it. The i-th ticket can be numbered Ai with probability Pi percent and with probability 100-Pi percent it ... | [{"code": "#! /usr/bin/env python\n# -* - coding: UTF-8 -* -\nrounds = int(raw_input())\n\nA,B,P = [],[],[]\n\ndef main():\n for _ in range(rounds):\n tickets = int(raw_input())\n global A, B, P\n A,B,P = [],[],[]\n\n for _ in range(tickets):\n p, a, b = raw_input().split(\" \"... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00054-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "0.5\n0.3478\n"}, "input": {"kind": "stdin", "value": "2\n2\n50 1 2\n50 2 1\n3\n100 1 3\n47 2 1\n74 3 2"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00054-of-00128_78 | A string of length 6 consisting of lowercase English letters is said to be coffee-like if and only if its 3-rd and 4-th characters are equal and its 5-th and 6-th characters are also equal.
Given a string S, determine whether it is coffee-like.
Constraints
* S is a string of length 6 consisting of lowercase English l... | [{"code": "import java.util.*;\n\nclass Main {\n public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n String s = sc.next();\n if ((s.charAt(2) == s.charAt(3)) && (s.charAt(4) == s.charAt(5)))\n System.out.println(\"Yes\");\n else\n System... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00054-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "coffee"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00054-of-00128_78__p... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00054-of-00128_80 | There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.
First, Snuke will arrange the N balls in a row from left to right.
Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | [{"code": "import math\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn,k = map(int,input().split())\nfor i in range(1,k+1):\n if n - k + 1 >= i:\n print(comb(n - k + 1,i) * comb(k-1,i-1) % (10**9 + 7))\n else:\n print(0)\n \n ", "is_known_correct": ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00054-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "3\n6\n1"}, "input": {"kind": "stdin", "value": "5 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00054-of-00128_80__... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00054-of-00128_82 | There are N candles placed on a number line. The i-th candle from the left is placed on coordinate x_i. Here, x_1 < x_2 < ... < x_N holds.
Initially, no candles are burning. Snuke decides to light K of the N candles.
Now, he is at coordinate 0. He can move left and right along the line with speed 1. He can also light... | [{"code": "import java.util.*;\nimport static java.lang.Math.*;\nimport java.math.BigInteger;\n\npublic class Main {\n\tpublic static void main(String[] args){\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\t// 入力\n\t\tint n = sc.nextInt();\n\t\tint k = sc.nextInt();\n\t\tint[] x = new int[n];\n\t\tfor(int i = 0; ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00054-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "10"}, "input": {"kind": "stdin", "value": "8 5\n-9 -7 -4 -3 1 2 3 4"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-000... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00055-of-00128_1 | Today is Chef's birthday. His mom gifted him a truly lovable gift, a permutation of first N positive integers.
She placed the permutation on a very long table in front of Chef and left it for him to play with it. But as there was a lot of people coming and wishing him. It was interfering with his game which made him ve... | [{"code": "A = []\ndef series(n):\n return int(( n * (n + 1) ) / 2)\nt = input()\nwhile t > 0:\n n,k = list(map(int,raw_input().split()))\n if k != 0:\n A = list(map(int,raw_input().split()))\n A.append(n + 1)\n A.sort()\n s = 0\n i = 0\n if k == 0:\n s = series(n)\n else:\n ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00055-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "Mom\nChef"}, "input": {"kind": "stdin", "value": "2\n5 2\n3 5\n5 1\n1"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00055-of-00128_2 | Write a program, which takes an integer N and if the number is less than 10 then display "What an obedient servant you are!" otherwise print "-1".
Input
The first line contains an integer T, total number of testcases. Then follow T lines, each line contains an integer N.
Output
Output the given string or -1 depend... | [{"code": "t=int(raw_input())\nwhile t:\n t-=1\n n=int(raw_input())\n if n<10:\n print \"What an obedient servant you are!\"\n else:\n print \"-1\"", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00055-of-00128_2__ref__000... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00055-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "What an obedient servant you are!\n-1\nWhat an obedient servant you are!\n"}, "input": {"kind": "stdin", "value": "3 \n1\n12\n-5"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00055-of-00128_3 | Little Elephant likes lemonade.
When Little Elephant visits any room, he finds the bottle of the lemonade in that room that contains the greatest number of litres of lemonade and drinks it all.
There are n rooms (numbered from 0 to n-1), each contains Ci bottles. Each bottle has a volume (in litres). The first room v... | [{"code": "t = int(raw_input())\nfor q in xrange(t):\n\ts = raw_input().split();\n\tn = int(s[0])\n\tm = int(s[1])\n\trooms = map(int,raw_input().split());\n\tarr = [];\n\tcount = 0;\n\tfor p in xrange(n):\n\t\ta = map(int,raw_input().split());\n\t\ta = a[1:];\n\t\ta.sort();\n\t\tarr.append(a);\n\tfor i in xrange(m):\n... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00055-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "17\n22\n"}, "input": {"kind": "stdin", "value": "2\n3 3\n0 2 1\n3 1 2 3\n1 7\n2 4 7\n4 7\n0 1 3 0 1 0 0\n1 7\n3 9 4 5\n7 1 2 3 4 5 6 7\n1 1"}, "metadata": {}, "visibility": "pub... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00055-of-00128_5 | Little Elephant is playing a game with arrays. He is given an array A0, A1, ..., AN−1 of N integers. And then Q queries are given, each containing an integer K. He has to tell how many subarrays satisfy the condition: the function foo returns K when it is applied to the subarray.
In this problem, a subarray is defined ... | [{"code": "N = int(raw_input())\nA = map(int, raw_input().split(\" \"))\nmin_list = []\nfor i in xrange(N):\n for j in xrange(i,N):\n min_list.append(min(A[i:j+1]))\nfor _ in xrange(int(raw_input())):\n K = int(raw_input())\n print min_list.count(K)", "is_known_correct": true, "language": "python", "met... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00055-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "2\n2\n0\n8\n"}, "input": {"kind": "stdin", "value": "5\n4 1 2 3 4\n4\n3\n4\n6\n1"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00055-of-00128_78 | Takahashi loves gold coins. He gains 1000 happiness points for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.)
Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn?
(We as... | [{"code": "import java.util.*;\npublic class Main{\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n int a = in.nextInt();\n long x = (a/500)*1000;\n x+=((a%500)/5)*5;\n System.out.println(x);\n }\n}", "is_known_correct": true, "language": "java... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00055-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "0"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00055-of-00128_78__public__... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00055-of-00128_80 | Ken loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.
First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken-ken-pa. In one ken-ken-pa, he does th... | [{"code": "import java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Queue;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner in = new Scanner(System.in);\n\t\tint n = i... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00055-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "2"}, "input": {"kind": "stdin", "value": "4 4\n1 2\n2 3\n3 4\n4 1\n1 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00055-of-00128_82 | We will define the median of a sequence b of length M, as follows:
* Let b' be the sequence obtained by sorting b in non-decreasing order. Then, the value of the (M / 2 + 1)-th element of b' is the median of b. Here, / is integer division, rounding down.
For example, the median of (10, 30, 20) is 20; the median of ... | [{"code": "#include<cstdio>\n#include<cstring>\n#include<algorithm>\n#define ll long long\n#define int long long\n#define MN 100005\nusing namespace std;\ninline int in(){\n int x=0;bool f=0;char c;\n for (;(c=getchar())<'0'||c>'9';f=c=='-');\n for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0');\n ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00055-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "30"}, "input": {"kind": "stdin", "value": "3\n10 30 20"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00055-of-00128_8... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00056-of-00128_2 | While purchasing certain items, a discount of 10% is offered if the quantity purchased is more than 1000. If the quantity and price per item are input, write a program to calculate the total expenses.
Input
The first line contains an integer T, total number of test cases. Then follow T lines, each line contains inte... | [{"code": "DEBUG = False\n\ndef print_debug(s):\n if DEBUG: print str(s);\n\ndef calculate(quantity, price):\n return (quantity * price) * (0.9 if quantity > 1000 else 1.0)\n\ndef run():\n print_debug('Number of entries:')\n lines = int(raw_input())\n while (lines > 0):\n print_debug(\"Entry in fo... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "12000.000000\n200.000000\n21600.000000\n"}, "input": {"kind": "stdin", "value": "3 \n100 120\n10 20\n1200 20"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00056-of-00128_4 | Polo, the Penguin, likes numbers. He says that the goodness of a number is itself multiplied by the number of digits in it's decimal representation. For example, the goodness of the integer 474 is 474*3 = 1422.
Help him to count the sum of goodness of all integers from L to R, inclusive. Since the answer can be too lar... | [{"code": "import sys\nimport math\n\nt= int(sys.stdin.readline())\nwhile(t>0) :\n\tt = t-1\n\tl,r = sys.stdin.readline().split(' ')\n\tl = int(l)\n\tr = int(r)\n\tcat1 = int(math.log10(l));\n\tcat2 = int(math.log10(r));\n\tif cat1==cat2:\n\t\tsum = (r*(r+1)/2 - (l*(l-1)/2))*(cat1+1);\n\t\tprint sum%1000000007\n\telse... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "75\n"}, "input": {"kind": "stdin", "value": "1\n9 12"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00056-of-00128_68 | Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers:
•Emergency 911
•Vidhant 97625 99944
•Bob 91125 42682
In this case, it’s not possible to call Bob, because the central would direct your call to the emerg... | [{"code": "from sys import stdin\nt = int(stdin.readline())\nfor tt in xrange(t):\n\tn = int(stdin.readline())\n\ta = []\n\tfor i in xrange(n):\n\t\tx = stdin.readline().strip()\n\t\ta.append(x)\n\tvalid = 1\n\ta.sort()\n\tfor i in xrange(n-1):\n\t\tfor j in xrange(i+1,i+2):\n\t\t\tif a[j].startswith(a[i]):\n\t\t\t\tva... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_68__public__0000", "expected_output": {"kind": "stdout", "value": "NO\nYES"}, "input": {"kind": "stdin", "value": "2\n3\n911\n97625999\n91125426\n5\n113\n12340\n123440\n12345\n98346\n\nSAMPLE"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | HACKEREARTH | [] | null |
codecontests__test__code_contests_train.riegeli-00056-of-00128_71 | Today is Kriti's birthday but I forgot to bring a gift for her. She is very angry with me. I have an idea for a gift. She likes coding very much. Why not give her a problem to solve as her gift?
I know a problem but I am not sure whether its solvable or not.
The problem initially has N strings numbered 1 to N. The pr... | [{"code": "def hash_value(s):\n\ta = [ord(i)-97 for i in s]\n\tp = 0\n\tb = 0\n\t#hv = 10**9 + 7\n\tfor i in xrange(len(a)-1,-1,-1):\n\t\tp+=(a[i]*(26**b))\n\t\t#p%=hv\n\t\tb+=1\n\treturn p\nt = input()\nall_str = {}\nfor i in xrange(t):\n\txy = hash_value(raw_input())\n\tif xy in all_str:\n\t\tall_str[xy]+=[i]\n\telse... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_71__public__0000", "expected_output": {"kind": "stdout", "value": "1\n2\n0"}, "input": {"kind": "stdin", "value": "3\nabc\ndef\nabc\n3\n1 2 abc\n1 3 abc\n1 2 hgj\n\nSAMPLE"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | HACKEREARTH | [] | null |
codecontests__test__code_contests_train.riegeli-00056-of-00128_77 | You will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.
The current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?
Constraints
* -40 \leq X \leq 40
* X is an integer.
Input
Input is given from Standard Input in the follo... | [{"code": "#include<stdio.h>\nint main()\n{\n\tint n;\n\tscanf(\"%d\",&n);\n\tif(n<30) printf(\"No\\n\");\n\telse printf(\"Yes\\n\");\t\n} ", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_77__ref__0000", "source": "benchmark"}... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "No"}, "input": {"kind": "stdin", "value": "25"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_77__public... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00056-of-00128_78 | There is a circular pond with a perimeter of K meters, and N houses around them.
The i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond.
When traveling between these houses, you can only go around the pond.
Find the minimum distance that needs to ... | [{"code": "k,n=map(int,input().split())\nl=list(map(int, input().split()))\nm=k-(l[n-1]-l[0])\nfor i in range(1,n):\n\tm=max(m,l[i]-l[i-1])\nprint(k-m)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_78__ref__0000", "source... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "10"}, "input": {"kind": "stdin", "value": "20 3\n5 10 15"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00056-of-00128_80 | Find the number of sequences of length K consisting of positive integers such that the product of any two adjacent elements is at most N, modulo 10^9+7.
Constraints
* 1\leq N\leq 10^9
* ~~1~~ 2\leq K\leq 100 (fixed at 21:33 JST)
* N and K are integers.
Input
Input is given from Standard Input in the following forma... | [{"code": "import sys\ndef solve():\n N, K = map(int, input().split())\n MOD = 10**9 + 7\n\n U = []; V = []\n for x in range(1, int(N**.5)+1):\n U.append(x)\n if x < N//x:\n V.append(N//x)\n V.reverse(); U.extend(V)\n\n L = len(U)\n prv = 0\n R = []\n for x in U:\n ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "147"}, "input": {"kind": "stdin", "value": "10 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_80__pub... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00056-of-00128_82 | Let N be an even number.
There is a tree with N vertices. The vertices are numbered 1, 2, ..., N. For each i (1 \leq i \leq N - 1), the i-th edge connects Vertex x_i and y_i.
Snuke would like to decorate the tree with ribbons, as follows.
First, he will divide the N vertices into N / 2 pairs. Here, each vertex must ... | [{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nnamespace TYC\n{\n\ttypedef long long ll;\n\tconst int N = 5005, mod = 1e9 + 7;\n\n\tint n, F[N][N], V[N], Siz[N];\n\tvector<int> E[N];\n\n\tinline int read()\n\t{\n\t\tint x = 0, f = 0, ch = getchar();\n\t\twhile (!isdigit(ch))\n\t\t\tf |= (ch == '-'), ch = ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "2"}, "input": {"kind": "stdin", "value": "4\n1 2\n2 3\n3 4"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00056-of-001... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00056-of-00128_83 | E869120 has A 1-yen coins and infinitely many 500-yen coins.
Determine if he can pay exactly N yen using only these coins.
Constraints
* N is an integer between 1 and 10000 (inclusive).
* A is an integer between 0 and 1000 (inclusive).
Input
Input is given from Standard Input in the following format:
N
A
Output... | [{"code": "a = int(input())\nb = int(input())\nprint(\"Yes\" if (a % 500 <= b) else \"No\")\n", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_83__ref__0000", "source": "benchmark"}, {"code": "import java.util.Scanner;\n \np... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "No"}, "input": {"kind": "stdin", "value": "2763\n0"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00056-of-00128_83__p... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
codecontests__test__code_contests_train.riegeli-00057-of-00128_0 | Digory Kirke and Polly Plummer are two kids living next door to each other. The attics of the two houses are connected to each other through a passage. Digory's Uncle Andrew has been secretly doing strange things in the attic of his house, and he always ensures that the room is locked. Being curious, Digory suspects th... | [{"code": "test=int(raw_input())\nwhile test:\n s=raw_input()\n days=0\n count=0\n maximum=0\n for i in range(len(s)):\n if s[i] == '#':\n if count>maximum:\n days+=1\n maximum=count\n count=0\n else:\n count=0\n ... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00057-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "0\n2\n1\n2\n"}, "input": {"kind": "stdin", "value": "4\n####\n##.#..#\n##..#.#\n##.#....#"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00057-of-00128_2 | Write a program that takes in a letterclass ID of a ship and display the equivalent string class description of the given ID. Use the table below.
Class ID
Ship Class
B or b
BattleShip
C or c
Cruiser
D or d
Destroyer
F or f
Frigate
Input
The first line contains an integer T, total number of testcases. Then... | [{"code": "t=input()\nfor i in range(t):\n dic={'b':'BattleShip','B':'BattleShip','c':'Cruiser','C':'Cruiser','d':'Destroyer','D':'Destroyer','f':'Frigate','F':'Frigate'}\n s=raw_input()\n print dic[s]", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_co... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00057-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "BattleShip\nCruiser\nDestroyer\n"}, "input": {"kind": "stdin", "value": "3 \nB\nc\nD"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00057-of-00128_4 | Polo, the Penguin, has a lot of tests tomorrow at the university.
He knows that there are N different questions that will be on the tests. For each question i (i = 1..N), he knows C[i] - the number of tests that will contain this question, P[i] - the number of points that he will get for correctly answering this questi... | [{"code": "def knapsack(weights,values,maxw):\n n=len(weights)\n m=[]\n tmp=[]\n for i in xrange(0,maxw+1):\n\ttmp.append(0)\n m.append(tmp)\n for i in xrange(1,n):\n\ttmp=[]\n\tfor j in xrange(0,maxw+1):\n\t if j<weights[i]:\n\t\ttmp.append(m[i-1][j])\n\t else:\n\t\ttmp.append(max(m[i-1][j],m[i... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00057-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "11\n"}, "input": {"kind": "stdin", "value": "1\n3 7\n1 2 3\n2 3 5\n3 3 3"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00057-of-00128_5 | Given an array of N numbers, a pair of numbers is called good if difference between the two numbers is strictly less than D.
Find out maximum possible sum of all good disjoint pairs that can be made from these numbers.
Sum of X pairs is the sum of all 2*X numbers in the pairs.
Input
First line contains T, the number o... | [{"code": "'''\nCreated on 21-Jul-2015\n\n@author: Venkatesh\n'''\n\n\ndef read_int_list():\n return [int(x) for x in raw_input().split()]\n\n\ndef read_int():\n return int(raw_input())\n\n\ndef get_max_sum(nums, n, d):\n nums.sort(reverse=True)\n total, ind = 0, 0\n while ind+1 < n:\n diff = nums... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00057-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "8\n22\n37\n"}, "input": {"kind": "stdin", "value": "3\n3 3\n3 5 8\n4 3\n5 8 10 12\n5 3\n3 2 8 17 15"}, "metadata": {}, "visibility": "public"}] | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | CODECHEF | [] | null |
codecontests__test__code_contests_train.riegeli-00057-of-00128_78 | We have an undirected graph G with N vertices numbered 1 to N and N edges as follows:
* For each i=1,2,...,N-1, there is an edge between Vertex i and Vertex i+1.
* There is an edge between Vertex X and Vertex Y.
For each k=1,2,...,N-1, solve the problem below:
* Find the number of pairs of integers (i,j) (1 \leq i... | [{"code": "import java.util.*;\n\npublic class Main{\n\tpublic static void main(String[] arg){\n Scanner sc=new Scanner(System.in);\n int n=sc.nextInt(); \n int x=sc.nextInt();\n int y=sc.nextInt();\n int dp[][]=new int[n+1][n+1];\n dp[x][y]=1;\n for(int i=1;i<n;i++){\n for(i... | [{"case_id": "codecontests__test__code_contests_train.riegeli-00057-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "7\n8\n4\n2\n0\n0"}, "input": {"kind": "stdin", "value": "7 3 7"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00057-of... | {"comparison": {"case_sensitive": true, "numeric_tolerance": null, "strip_trailing_whitespace": true, "type": "exact_or_token_match"}, "entry_point": null, "eval_mode": "stdin_stdout", "language": "python", "memory_limit_mb": 512, "requires_special_judge": false, "timeout_seconds": 5, "unsupported_reason": null} | CodeContests | ATCODER | [""] | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.