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-00057-of-00128_80
The door of Snuke's laboratory is locked with a security code. The security code is a 4-digit number. We say the security code is hard to enter when it contains two consecutive digits that are the same. You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`. Constraint...
[{"code": "s = raw_input()\nans = 0\nfor i in range(3):\n if s[i]==s[i+1]:\n ans = 1\nif ans == 1:\n print \"Bad\"\nelse:\n print \"Good\"", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00057-of-00128_80__ref__0000", "source": ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00057-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "Bad"}, "input": {"kind": "stdin", "value": "1333"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00057-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-00057-of-00128_82
There are N robots and M exits on a number line. The N + M coordinates of these are all integers and all distinct. For each i (1 \leq i \leq N), the coordinate of the i-th robot from the left is x_i. Also, for each j (1 \leq j \leq M), the coordinate of the j-th exit from the left is y_j. Snuke can repeatedly perform ...
[{"code": "#include <cstdio>\n#include <algorithm>\nusing namespace std;\nconst int N=100010;\nconst int INF=1e9;\nconst int MOD=1e9+7;\nint n,m;\nint a[N],b[N];\nstruct Point{\n\tint x,y;\n\tfriend bool operator == (const Point &a,const Point &b){\n\t\treturn a.x==b.x&&a.y==b.y;\n\t}\n}p[N];\nint d[N],dcnt;\nint f[N];...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00057-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "1"}, "input": {"kind": "stdin", "value": "4 1\n1 2 4 5\n3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00057-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-00057-of-00128_83
We have N cards. A number a_i is written on the i-th card. Alice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first. The game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards...
[{"code": "input()\ncard=sorted(map(int,input().split()))[::-1]\nprint(sum(card[::2])-sum(card[1::2]))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00057-of-00128_83__ref__0000", "source": "benchmark"}, {"code": "n = int(input())\na = ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00057-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "18"}, "input": {"kind": "stdin", "value": "4\n20 18 2 18"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00057-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-00058-of-00128_2
In a company an emplopyee is paid as under: If his basic salary is less than Rs. 1500, then HRA = 10% of base salary and DA = 90% of basic salary. If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic salary. If the Employee's salary is input, write a program to find his gross sa...
[{"code": "#!/usr/bin/python\nfor i in range(input()):\n\tbasic=input()\n\tif basic<1500:\n\t\tgross=(basic+basic*0.1+basic*0.9)\n\telse:\n\t\tgross=(basic+500+basic*0.98)\n\tprint \"%g\" %gross", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.rie...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "2406\n20383.2\n2624\n"}, "input": {"kind": "stdin", "value": "3 \n1203\n10042\n1312"}, "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-00058-of-00128_3
The Little Elephant from the Zoo of Lviv likes listening to music. There are N songs, numbered from 1 to N, in his MP3-player. The song i is described by a pair of integers Bi and Li - the band (represented as integer) that performed that song and the length of that song in seconds. The Little Elephant is going to list...
[{"code": "import operator\nt = input()\nfor i in range(t):\n\ttable = {}\n\tremaining_table = []\n\tswtns1 = 0\n\tswtns2 = 0\n\tswtns = 0\n\tcount = 1\n\tn = input()\n\tfor j in range(n):\n\t\tb,l = map(int, raw_input().split())\n\t\tif b in table:\n\t\t\tif l < table[b]:\n\t\t\t\tremaining_table.append(table[b])\n\t\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "12\n16\n"}, "input": {"kind": "stdin", "value": "2\n3\n1 2\n2 2\n3 2\n3\n2 3\n1 2\n2 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-00058-of-00128_4
Polo, the Penguin, likes the XOR operation. Please read NOTE if you are not familiar with XOR operation. XOR-sum of a list of numbers is the result of XOR-ing all of them. XOR-sum of (A[1] XOR A[2] XOR ... XOR A[N]) is defined as A[1] XOR (A[2] XOR (A[3] XOR ( ... XOR A[N]))). He has an array A consisting of N integer...
[{"code": "#!/usr/bin/env python\n#-*- coding:utf-8 -*-\n\nimport random\n\n\ndef count_bits(n):\n res = 0\n while n:\n res += 1\n n >>= 1\n return res\n\n\nt = int(raw_input())\nfor _ in range(t):\n n = int(raw_input())\n lst = map(int, raw_input().split())\n #lst = [random.randint(0, (...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "6"}, "input": {"kind": "stdin", "value": "1\n2\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-00058-of-00128_5
Let's consider a triangle of numbers in which a number appears in the first line, two numbers appear in the second line, three in the third line, etc. Develop a program which will compute the largest of the sums of numbers that appear on the paths starting from the top towards the base, so that: on each path the next ...
[{"code": "t=input()\nfor i in range(t):\n n=input()\n prev_row=[]\n first_element=input()\n prev_row.append(first_element)\n for j in range(1,n):\n row=[int(k) for k in raw_input().split()]\n \n for l in range(1,len(row)-1):\n row[l]+=max(prev_row[l],prev_row[l-1])\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "5\n9\n"}, "input": {"kind": "stdin", "value": "2\n3\n1\n2 1\n1 2 3\n4 \n1 \n1 2 \n4 1 2\n2 3 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-00058-of-00128_68
Daenerys Targaryen set her eyes on The Kingdom of The North which is ruled by the House Stark. There is a huge market in the Castle of Winterfell that sells products of all prices starting from 1 coin i.e. there are products worth Rs 1, 2, 3 . . . 10^17 . Ned Stark is the Lord of Winterfell. He gives Daenerys some co...
[{"code": "t = input()\nls = 10**17\nfor _ in xrange(t):\n n = input()\n num = [int(i) for i in raw_input().split()]\n num.sort()\n x = 0\n for i in num:\n if(i<=x+1):\n x+=i\n x+=1\n if(x>ls):\n print -1\n else:\n print x", "is_known_correct": true, "language": "...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_68__public__0000", "expected_output": {"kind": "stdout", "value": "1024\n2"}, "input": {"kind": "stdin", "value": "2\n10\n1 2 4 8 16 32 64 128 256 512\n5\n1 3 4 5 7\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-00058-of-00128_77
Takahashi loves the number 7 and multiples of K. Where is the first occurrence of a multiple of K in the sequence 7,77,777,\ldots? (Also see Output and Sample Input/Output below.) If the sequence contains no multiples of K, print `-1` instead. Constraints * 1 \leq K \leq 10^6 * K is an integer. Input Input is giv...
[{"code": "n=int(input())\nf=0\nfor i in range(n):\n f=f*10+7\n f%=n\n if f==0:\n print(i+1)\n break\nelse:print(-1)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_77__ref__0000", "source": "benchmark"}, {"code": ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "-1"}, "input": {"kind": "stdin", "value": "2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00058-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-00058-of-00128_78
You are going to eat X red apples and Y green apples. You have A red apples of deliciousness p_1,p_2, \dots, p_A, B green apples of deliciousness q_1,q_2, \dots, q_B, and C colorless apples of deliciousness r_1,r_2, \dots, r_C. Before eating a colorless apple, you can paint it red or green, and it will count as a red o...
[{"code": "import java.io.*;\nimport java.util.*;\nimport java.lang.*;\n\npublic class Main {\n\tint mod = 1000000007;\n\n\tstatic FastScanner sc = new FastScanner();\n\n\tpublic static void main(String[] args) {\n\t\tout = new PrintWriter(new BufferedOutputStream(System.out));\n\t\tint x = sc.nextInt();\n\t\tint y = s...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "25"}, "input": {"kind": "stdin", "value": "2 2 2 2 2\n8 6\n9 1\n2 1"}, "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-00058-of-00128_80
You have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative. You can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used. You planned to make an apple pie using all of the apples, ...
[{"code": "n,l=map(int,input().split())\n\nif l <= 0:\n if -1 * l >= n:\n n -= 1\nelse:\n l += 1\n n -= 1\n\nprint(int(n*(2*l+n-1)/2))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_80__ref__0000", "source": "benchma...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "18"}, "input": {"kind": "stdin", "value": "5 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00058-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-00058-of-00128_81
In order to pass the entrance examination tomorrow, Taro has to study for T more hours. Fortunately, he can leap to World B where time passes X times as fast as it does in our world (World A). While (X \times t) hours pass in World B, t hours pass in World A. How many hours will pass in World A while Taro studies fo...
[{"code": "[a,b]=map(int, input().split())\nprint(a/b)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_81__ref__0000", "source": "benchmark"}, {"code": "import java.util.*;\n\npublic class Main {\n public static void mai...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "0.0100000000"}, "input": {"kind": "stdin", "value": "1 100"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00058-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-00058-of-00128_82
There is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.) What is the area of this yard excluding the roads? Find it. Constraints * A is an ...
[{"code": "a, b = map(int, input().split())\nprint(a*b - b - (a-1))", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_82__ref__0000", "source": "benchmark"}, {"code": "x, y = map(int, input().split())\nprint(x*y - x - y + 1)"...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "24"}, "input": {"kind": "stdin", "value": "5 7"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_82__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-00058-of-00128_83
We have a 3 \times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left. According to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\n#define rep(i,n) for(int i=0;i<n;i++)\n#define int long long\nsigned main(){\n\tint a,b,c,d,e,f,g,h,i;\n\tcin>>a>>b>>c>>d>>e>>f>>g>>h>>i;\n\tint j=a-b,k=b-c;\n\tif(j==d-e&&k==e-f&&j==g-h&&k==h-i)puts(\"Yes\");\n\telse puts(\"No\");\n\treturn 0;\n}\n", "is_known_...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00058-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "1 0 1\n2 1 2\n1 0 1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00058-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-00059-of-00128_2
Write a program to check whether a triangle is valid or not, when the three angles of the triangle are the inputs. A triangle is valid if the sum of all the three angles is equal to 180 degress. Input The first line contains an integer T, total number of testcases. Then follow T lines, each line contains three angl...
[{"code": "T = int(raw_input())\n\nfor i in range(T):\n a = map(int, raw_input().split())\n if (a[0]+a[1]+a[2]) == 180 and 0 not in a:\n print 'YES'\n else:\n print 'NO'", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riege...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00059-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "YES\nYES\nNO\n"}, "input": {"kind": "stdin", "value": "3 \n30 40 110\n45 45 90\n180 0 0"}, "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-00059-of-00128_77
An altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \leq i \leq N) is given to you as a character c_i; `R` stands for red and `W` stands for white. You can do the following two kinds of operations any number of times in any order: * Choose two stones (not nec...
[{"code": "N = int(input())\nS = input()\n\nr = S.count('R')\nans = r - S[:r].count('R')\nprint(ans)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00059-of-00128_77__ref__0000", "source": "benchmark"}, {"code": "n = int(input())\nc = in...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00059-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "2\nRR"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00059-of-00128_77__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-00059-of-00128_78
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below: * Consider writing a number on each vertex in the tree in the following manner: * First, write 1 on Vertex k. * Then, for each of the numbers 2, ..., N in this order, w...
[{"code": "def main():\n M=10**9+7\n N=10**5*2\n fac=[0]*(N+1)\n fac[0]=b=1\n for i in range(1,N+1):fac[i]=b=b*i%M\n inv=[0]*(N+1)\n inv[N]=b=pow(fac[N],M-2,M)\n for i in range(N,0,-1):inv[i-1]=b=b*i%M\n n,*t=open(0).read().split()\n n=int(n)\n e=[[]for _ in range(n)]\n for a,b in zi...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00059-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "2\n1\n1"}, "input": {"kind": "stdin", "value": "3\n1 2\n1 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00059-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-00059-of-00128_79
Given are a positive integer N and a string S of length N consisting of lowercase English letters. Determine whether the string is a concatenation of two copies of some string. That is, determine whether there is a string T such that S = T + T. Constraints * 1 \leq N \leq 100 * S consists of lowercase English letter...
[{"code": "import java.util.*;\n\npublic class Main{\n\npublic static void main(String[] args){\nScanner obj=new Scanner(System.in);\nint n=obj.nextInt();\nString g=obj.next();\nif(n%2!=0){\nSystem.out.println(\"No\");\n}else{\nint p=n/2;\nint q=p;\nint h=0;\nboolean flag=true;\n\nfor(;h<p;h++,q++){\n\nif(g.charAt(h)!=...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00059-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "No"}, "input": {"kind": "stdin", "value": "6\nabcadc"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00059-of-00128_79_...
{"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-00059-of-00128_80
You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D. Constraints * 1\leq A\leq B\leq 10^{18} * 1\leq C,D\leq 10^9 * All values in input are integers. Input Input is given from Standard Input in the following format: A B ...
[{"code": "import java.util.*;\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n long a = sc.nextLong();\n long b = sc.nextLong();\n long c = sc.nextLong();\n long d = sc.nextLong();\n long e = lcm(c,d);\n long count = b-a+1;\n count -= b/c -...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00059-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "532105071133627368"}, "input": {"kind": "stdin", "value": "314159265358979323 846264338327950288 419716939 937510582"}, "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-00059-of-00128_81
Determine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane. You can use the following theorem: Theorem: an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths...
[{"code": "#include<iostream>\nusing namespace std;\nint m,s,l,i,a;\nint main(){\n\tcin>>a;\n\twhile(a--){\n\t\tcin>>l;\n\t\tif(m<l)m=l;\n\t\ts+=l;}\n\tputs(s>m*2?\"Yes\":\"No\");}\n", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00059-of-0...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00059-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "4\n3 8 5 1"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00059-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-00059-of-00128_82
The number 105 is quite special - it is odd but still it has eight divisors. Now, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)? Constraints * N is an integer between 1 and 200 (inclusive). Input Input is given from Standard Input in the following...
[{"code": "#!/usr/bin/env python\n\nfrom collections import deque\nimport itertools as it\nimport sys\nimport math\n\nsys.setrecursionlimit(10000000)\nN = input()\n\nif N < 105:\n print 0\nelif N < 135:\n print 1\nelif N < 165:\n print 2\nelif N < 189:\n print 3\nelif N < 195:\n print 4\nelse:\n print...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00059-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "1"}, "input": {"kind": "stdin", "value": "105"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00059-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-00059-of-00128_83
Constraints * H is an integer between 2 and 50 (inclusive). * W is an integer between 2 and 50 (inclusive). * s_{i, j} is `.` or `#` (1 \leq i \leq H, 1 \leq j \leq W). * s_{1, 1} and s_{H, W} are `.`. Input Input is given from Standard Input in the following format: H W s_{1, 1}s_{1, 2}s_{1, 3} ... s_{1, W} s_{2,...
[{"code": "from collections import deque\nh,w = map(int,input().split())\nmaze = []\nvisited = [[0]*(w) for _ in range(h)]\nmx = 0\nfor _ in range(h):\n s = input()\n mx += s.count('.')\n maze.append(list(s))\nsy,sx = 0, 0\ngy, gx = h-1, w-1\nque = deque([(sy,sx,1)])\n\nwhile que:\n y,x,c = que.popleft()\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00059-of-00128_83__public__0000", "expected_output": {"kind": "stdout", "value": "209"}, "input": {"kind": "stdin", "value": "10 37\n.....................................\n...#...####...####..###...###...###..\n..#.#..#...#.##....#...#.#...#.#...#.\n..#.#..#...
{"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-00060-of-00128_0
Two cheeky thieves (Chef being one of them, the more talented one of course) have came across each other in the underground vault of the State Bank of Churuland. They are shocked! Indeed, neither expect to meet a colleague in such a place with the same intentions to carry away all the money collected during Churufest 2...
[{"code": "t=input()\nfor i in range(1,t+1):\n m,p= raw_input().split(' ')\n m=int(m)\n p=float(p)\n a=(10**9)*(1-(-p)**m)/(1+p)\n b=(10**9)*(p+(-p)**m)/(1+p)\n print a,b", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-0...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "1000000000.0 0.0\n500000000.0 500000000.0"}, "input": {"kind": "stdin", "value": "2\n1 0.5\n2 0.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-00060-of-00128_2
A certain grade of steel is graded according to the following conditions. Hardness must be greater than 50. Carbon content must be less than 0.7. Tensile strength must be greater than 5600. The grades are as follows: Grade is 10 if all three conditions are met. Grade is 9 if conditions (i) and (ii) are met. Grade ...
[{"code": "t= int(raw_input())\nfor i in range(t):\n h,c,t=map(float,raw_input().split())\n if h>50 and c<0.7 and t>5600:\n print \"10\"\n elif h>50 and c<0.7:\n print\"9\"\n elif c<0.7 and t>5600:\n print\"8\"\n elif h>50 and t>5600:\n print \"7\"\n elif h>50 or c<0.7 or t...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "10\n6\n6\n"}, "input": {"kind": "stdin", "value": "3 \n53 0.6 5602\n45 0 4500\n0 0 0"}, "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-00060-of-00128_3
Problem Statement Levy's conjecture, named after Hyman Levy, states that all odd integers greater than 5 can be represented as the sum of an odd prime number and an even semiprime. To put it algebraically, 2n + 1 = p + 2q always has a solution in primes p and q (not necessary to be distinct) for n > 2. (Source: Wikiped...
[{"code": "from math import sqrt\ndef sieve(n):\n\tL = [0 for i in range(n+1)]; s = int(sqrt(n)); P,S = {},[]; L[0],L[1] = 1,1\n\tfor i in range(2,s+1):\n\t\tif L[i] is 0:\n\t\t\tfor j in range(i*i,n+1,i): L[j] = 1\n\tfor i in range(len(L)):\n\t\tif L[i] is 0: P[i] = None; S.append(i)\n\treturn P,S\ndef precompute():\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "0\n1\n2\n"}, "input": {"kind": "stdin", "value": "3\n2\n7\n11"}, "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-00060-of-00128_4
Alice and Bob are meeting after a long time. As usual they love to play some math games. This times Alice takes the call and decides the game. The game is very simple, Alice says out an integer and Bob has to say whether the number is prime or not. Bob as usual knows the logic but since Alice doesn't give Bob much time...
[{"code": "import sys\na=[0]*1000001\nb=[0]*1000001\ndef sieve():\n for x in xrange(2,1000001):\n if a[x]==0:\n b[x]=1\n z=x\n while(z<1000001):\n a[z]=1\n z+=x\nsieve()\n\nt=int(raw_input())\ni=0\nwhile(i<t):\n n=int(raw_input())\n if b[n]=...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "yes\nyes\nno\nno\nyes\n"}, "input": {"kind": "stdin", "value": "5\n23\n13\n20\n1000\n99991"}, "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-00060-of-00128_5
Given an array of n non-negative integers: A1, A2, …, AN. Your mission is finding a pair of integers Au, Av (1 ≤ u < v ≤ N) such that (Au and Av) is as large as possible. And is a bit-wise operation which is corresponding to & in C++ and Java.   Input The first line of the input contains a single integer N. The ith ...
[{"code": "A=[]\nN=int(raw_input())\nfor count1 in range(0,N):\n a=int(raw_input())\n A.append(a)\nA.sort()\nsum=-1\nfor count1 in range(1,N):\n count2=count1-1\n temp_sum=A[count1]&A[count2]\n if(temp_sum>sum):\n sum=temp_sum\nprint(str(sum))", "is_known_correct": true, "language": "python", "met...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "8\n"}, "input": {"kind": "stdin", "value": "4\n2\n4\n8\n10"}, "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-00060-of-00128_70
Chris Gayle has a legacy of hitting sixes in his innings. He loves to hit sixes. Now in a particular match, he already know that he will face total of (N + 1) balls which means that he will get out on (N + 1)^th ball. So he has decided to hit sixes in each of the initial N balls. He will require some power Pi to hit a ...
[{"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'''\nfor i in range(input()):\n\tN,M = map(int,raw_input().strip().split())\n\tG = []\n\tP = []\n\tfor i in xrange(N):\n\t\tg,p= map(int,raw_input().strip().split())\n\t\tG...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_70__public__0000", "expected_output": {"kind": "stdout", "value": "YES\n"}, "input": {"kind": "stdin", "value": "1\n2 7\n3 6\n2 4\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-00060-of-00128_77
We have N logs of lengths A_1,A_2,\cdots A_N. We can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (0<t<L), it becomes two logs of lengths t and L-t. Find the shortest possible length of the longest log after at most K cuts, and print it a...
[{"code": "import java.io.*;\nimport java.util.*;\nimport java.math.*;\nimport static java.lang.Math.*;\n\npublic class Main {\n\n private static final FastScanner fs = new FastScanner();\n\n public static void main(String[] args) {\n // int t = fs.nextInt();\n int t = 1;\n for (int i = 1; i ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "5"}, "input": {"kind": "stdin", "value": "3 0\n3 4 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_77_...
{"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-00060-of-00128_78
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It c...
[{"code": "N,M=map(int,input().split())\nprint(int(N*(N-1)/2.0 + M*(M-1)/2.0) )", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_78__ref__0000", "source": "benchmark"}, {"code": "n,m = map(int,input().split())\nprint((n*(n-1...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "81"}, "input": {"kind": "stdin", "value": "13 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_78__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-00060-of-00128_79
There is a knight - the chess piece - at the origin (0, 0) of a two-dimensional grid. When the knight is at the square (i, j), it can be moved to either (i+1,j+2) or (i+2, j+1). In how many ways can the knight reach the square (X, Y)? Find the number of ways modulo 10^9 + 7. Constraints * 1 \leq X \leq 10^6 * 1 \l...
[{"code": "import java.util.Scanner;\n\npublic class Main {\n\tpublic static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint x = sc.nextInt();\n\t\tint y = sc.nextInt();\n\t\tint t3 = x * 2 - y;\n\t\tint s3 = y * 2 - x;\n\t\tsc.close();\n\t\tif(t3 < 0 || t3 % 3 != 0 || s3 < 0 || s3 % 3 !...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "151840682"}, "input": {"kind": "stdin", "value": "999999 999999"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00060-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-00060-of-00128_80
Kizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs. Let the current time be time 0. Kizahashi has N jobs numbered 1 to N. It takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B...
[{"code": "import java.util.Arrays;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tWork[] work = new Work[N];\n\t\tMain main = new Main();\n\t\tfor (int i=0;i<N;i++) {\n\t\t\tWork temp = main.new W...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "No"}, "input": {"kind": "stdin", "value": "3\n334 1000\n334 1000\n334 1000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.rieg...
{"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-00060-of-00128_81
We will play a one-player game using a number line and N pieces. First, we place each of these pieces at some integer coordinate. Here, multiple pieces can be placed at the same coordinate. Our objective is to visit all of the M coordinates X_1, X_2, ..., X_M with these pieces, by repeating the following move: Move...
[{"code": "import java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint N = sc.nextInt();\n\t\tint M = sc.nextInt();\n\t\tint x[] = new int[M];\n\t\tfor (int i = 0; i < M; i++) {...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "19"}, "input": {"kind": "stdin", "value": "3 7\n-10 -3 0 9 -100 2 17"}, "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-00060-of-00128_82
Mr. Infinity has a string S consisting of digits from `1` to `9`. Each time the date changes, this string changes as follows: * Each occurrence of `2` in S is replaced with `22`. Similarly, each `3` becomes `333`, `4` becomes `4444`, `5` becomes `55555`, `6` becomes `666666`, `7` becomes `7777777`, `8` becomes `888888...
[{"code": "import java.util.Scanner;\n\npublic class Main {\n\n private static Scanner sc = new Scanner(System.in);\n\n public static void main(String args[]) {\n\n String s = sc.nextLine();\n long k = sc.nextLong();\n\n int numOfOnes = 0;\n int ans = 1;\n\n for (char ch : s.toC...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00060-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "2"}, "input": {"kind": "stdin", "value": "299792458\n9460730472580800"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-0...
{"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-00061-of-00128_3
In Conway's Game of Life, cells in a grid are used to simulate biological cells. Each cell is considered to be either alive or dead. At each step of the simulation each cell's current status and number of living neighbors is used to determine the status of the cell during the following step of the simulation. In this o...
[{"code": "#program for one dimensional game of life\niteration = int(raw_input())\nmatch = [[0,1],[3,2],[5,4],[6,7]]\nposs = [[0,3,5,6],[1,2,4,7]]\nfor i in range(iteration):\n\tcount = 0\n\trow = raw_input()\n\tarr = poss[int(row[-1])]\n\tfor el in arr:\n\t\toutput = str(el % 2)\n\t\tcurrent = el\n\t\tfor j in range(...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00061-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "01100101\nMultiple solutions\nNo solution\n10010\n"}, "input": {"kind": "stdin", "value": "4\n00011101\n000\n000001\n11110"}, "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-00061-of-00128_5
Have you ever implemented a program adding two big integers that cannot be represented by the primitive data type of your programming language? The algorithm is just simulation of the column addition method that we have been taught in elementary school. Sometimes we forget the carry and the result is incorrect. In th...
[{"code": "t=int(raw_input())\nfor i in xrange(t):\n\tn=int(raw_input())\n\tprint (9*n -1 + 10.0**(-n))/18", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00061-of-00128_5__ref__0000", "source": "benchmark"}, {"code": "#!/usr/bin/python\n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00061-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "0.45\n0.945\n1.4445\n"}, "input": {"kind": "stdin", "value": "3\n1\n2\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-00061-of-00128_77
We have N colored balls arranged in a row from left to right; the color of the i-th ball from the left is c_i. You are given Q queries. The i-th query is as follows: how many different colors do the l_i-th through r_i-th balls from the left have? Constraints * 1\leq N,Q \leq 5 \times 10^5 * 1\leq c_i \leq N * 1\leq ...
[{"code": "import java.io.*;\nimport java.util.*;\nimport java.math.BigDecimal;\n\n@SuppressWarnings(\"unused\")\npublic class Main {\n FastScanner in;\n PrintWriter out;\n final static int MOD = (int)1e9+7;\n \n void solve(){\n int N = in.nextInt(), Q = in.nextInt();\n int[] c = in.nextInt...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00061-of-00128_77__public__0000", "expected_output": {"kind": "stdout", "value": "2\n3\n1"}, "input": {"kind": "stdin", "value": "4 3\n1 2 1 3\n1 3\n2 4\n3 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.rie...
{"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-00061-of-00128_78
A string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th charact...
[{"code": "s=input()\nn=len(s)\ns1=s[:n//2]\ns2=s[n//2+1:]\nif s1==s2 and s1==s1[::-1]:\n print(\"Yes\")\nelse:\n print(\"No\")", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00061-of-00128_78__ref__0000", "source": "benchmark"}, {...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00061-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "akasaka"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00061-of-00128_78__...
{"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-00061-of-00128_79
Takahashi is at an all-you-can-eat restaurant. The restaurant offers N kinds of dishes. It takes A_i minutes to eat the i-th dish, whose deliciousness is B_i. The restaurant has the following rules: * You can only order one dish at a time. The dish ordered will be immediately served and ready to eat. * You cannot or...
[{"code": "import java.util.*;\n\npublic class Main {\n static Dish[] dishes;\n static int[][] dp;\n\tpublic static void main (String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint t = sc.nextInt();\n\t\tdishes = new Dish[n];\n\t\tdp = new int[n][t + 1];\n\t\tfor (int i = ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00061-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "60"}, "input": {"kind": "stdin", "value": "3 60\n10 10\n10 20\n10 30"}, "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-00061-of-00128_80
There are N dots in a two-dimensional plane. The coordinates of the i-th dot are (x_i, y_i). We will repeat the following operation as long as possible: * Choose four integers a, b, c, d (a \neq c, b \neq d) such that there are dots at exactly three of the positions (a, b), (a, d), (c, b) and (c, d), and add a dot at...
[{"code": "import sys\ninput = sys.stdin.readline\nM = 10**5\n\nn = int(input())\nG = [[] for _ in range(2*M+1)]\nfor _ in range(n):\n x, y = map(int, input().split())\n G[x].append(y+M)\n G[y+M].append(x)\nseen = [False]*(2*M+1)\ndef dfs(v):\n stack = [v]\n seen[v] = True\n cnt_x, cnt_y = 0, 0\n while stack:\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00061-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "1"}, "input": {"kind": "stdin", "value": "3\n1 1\n5 1\n5 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00061-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-00061-of-00128_82
In Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east. A company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i). Takahashi the king is interested in the following Q matters: * The ...
[{"code": "n,m,q=map(int,input().split())\na=[[0 for _ in range(n)] for _ in range(n)]\n\nfor i in range(m):\n x,y=map(int,input().split())\n a[x-1][y-1]+=1\n \nfor j in range(n):\n for k in range(1,n):\n a[j][k]=a[j][k]+a[j][k-1]\n \nfor l in range(q):\n ans=0\n L,R=map(int,input().split())\n for g in ran...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00061-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "1\n1"}, "input": {"kind": "stdin", "value": "10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train....
{"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-00061-of-00128_84
We have an N \times N square grid. We will paint each square in the grid either black or white. If we paint exactly A squares white, how many squares will be painted black? Constraints * 1 \leq N \leq 100 * 0 \leq A \leq N^2 Inputs Input is given from Standard Input in the following format: N A Outputs Print...
[{"code": "s = input()\nb = input()\na = s * s\nprint a - b", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00061-of-00128_84__ref__0000", "source": "benchmark"}, {"code": "N = int(input()) ** 2\nA = int(input())\nprint(str(N - A))", "is_...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00061-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "5"}, "input": {"kind": "stdin", "value": "3\n4"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00061-of-00128_84__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-00062-of-00128_2
Three numbers A, B and C are the inputs. Write a program to find second largest among three numbers. Input The first line contains an integer T, total number of testcases. Then follow T lines, each line contains three integers A, B and C. Output Display the second largest among A, B and C. Constraints 1 ≤ T ≤ 100...
[{"code": "n=input()\nfor i in range(n):\n\ta=raw_input()\n\ts=str(a).split()\n\ts=[int(s[0]),int(s[1]),int(s[2])]\n\ts.sort ()\n\tprint s[1]", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_2__ref__0000", "source": "benchma...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "120\n312\n10\n"}, "input": {"kind": "stdin", "value": "3 \n120 11 400\n10213 312 10\n10 3 450"}, "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-00062-of-00128_4
Chef Datta likes betting in Indian Premier League very much. He has 10000 rupees. Today the match is between team A and team B. The winning probability of team A is PA, and hence winning probability of team B is PB = 1 − PA. Datta is free to bet any integral amount of money on any of the two teams as long as the total...
[{"code": "'''\nPredictopus\n\nProblem code: PREDICT\n\nChef Datta likes betting in Indian Premier League very much.\n\nHe has 10000 rupees. Today the match is between team A and team B.\nThe winning probability of team A is PA, and hence winning\nprobability of team B is PB = 1 - PA.\n\nDatta is free to bet any integr...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "10098.000000\n"}, "input": {"kind": "stdin", "value": "1\n0.510"}, "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-00062-of-00128_5
[Chopsticks (singular: chopstick) are short, frequently tapered sticks used in pairs of equal length, which are used as the traditional eating utensils of China, Japan, Korea and Vietnam. Originated in ancient China, they can also be found in some areas of Tibet and Nepal that are close to Han Chinese populations, as w...
[{"code": "arr=raw_input().split(\" \")\nn=int(arr[0])\nd=int(arr[1])\ninte=[]\ncount=0\nfor i in range(n):\n inte.append(int(raw_input()))\ninte.sort()\n#print inte \ni=0\nwhile i<n-1:\n \n if (inte[i+1]-inte[i])<=d:\n count+=1\n i+=2\n else:\n i+=1\nprint count", "is_known_correct":...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "2\n"}, "input": {"kind": "stdin", "value": "5 2\n1\n3\n3\n9\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-00062-of-00128_78
Given is a positive integer L. Find the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L. Constraints * 1 ≤ L ≤ 1000 * L is an integer. Input Input is given from Standard Input in the following format: L Output Print the maximum possible volume of a re...
[{"code": "N=int(input())\nprint((N**3)/27)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_78__ref__0000", "source": "benchmark"}, {"code": "n = int(input())\nm = n/3\nprint(m**3)", "is_known_correct": true, "language": "p...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "36926037.000000000000"}, "input": {"kind": "stdin", "value": "999"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00062...
{"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-00062-of-00128_79
We will create an artwork by painting black some squares in a white square grid with 10^9 rows and N columns. The current plan is as follows: for the i-th column from the left, we will paint the H_i bottommost squares and will not paint the other squares in that column. Before starting to work, you can choose at most K...
[{"code": "\n#include <bits/stdc++.h>\n#define rep(i, n) for (int i=0; i < n; i ++)\n#define rep1(i, n) for (int i=1; i <= n; i ++)\n#define _min(x, y) x = min(x, y)\n#define _max(x, y) x = max(x, y)\nusing namespace std;\n\n\nvector<vector<long long> > dp(305, vector<long long>(305, 300000000000));\nint main() {\n in...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_79__public__0000", "expected_output": {"kind": "stdout", "value": "4999999996"}, "input": {"kind": "stdin", "value": "10 0\n1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000"}, "metadata": {}, "visibility": "public"}, {"case_id"...
{"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-00062-of-00128_80
X and A are integers between 0 and 9 (inclusive). If X is less than A, print 0; if X is not less than A, print 10. Constraints * 0 \leq X, A \leq 9 * All values in input are integers. Input Input is given from Standard Input in the following format: X A Output If X is less than A, print 0; if X is not less th...
[{"code": "import java.util.*;\nimport java.util.stream.*;\n\npublic class Main {\n\n public static void main(String[] args) {\n Scanner in = new Scanner(System.in);\n System.out.println(in.nextInt() < in.nextInt() ? 0 : 10);\n }\n}\n", "is_known_correct": true, "language": "java", "metadata": {}, "solution_id"...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "10"}, "input": {"kind": "stdin", "value": "6 6"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00062-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-00062-of-00128_82
Takahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible. When all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user. Constraints * 1 \leq N,K \leq 100 * A...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\nint a,b;\nint main()\n{\n\tcin>>a>>b;\ncout << bool(a%b) << endl;\n\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_82__ref__0000", "source": "benchmark"}, {"code": ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "100 10"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_82__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-00062-of-00128_84
There are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i). Thus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N. In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the i-th type-A robot at coordinates (0, i), and the i-th t...
[{"code": "n=int(input())\nk=int(input())\nx=list(map(int,input().split()))\nans=0\nfor i in range(n):\n ans+=2*min(x[i],k-x[i])\n\nprint(ans)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_84__ref__0000", "source": "benc...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "4"}, "input": {"kind": "stdin", "value": "1\n10\n2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_84__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-00062-of-00128_85
Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right. We will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, b-a = c-b. Determine whether the arrangement of the poles is beautiful. Constraints * 1 \leq a,b,c \leq 10...
[{"code": "#include <iostream>\n\nusing namespace std;\n\nint main() {\n int A,B,C;\n cin >> A >> B>> C;\n\n cout << (B-A==C-B ? \"YES\" : \"NO\");\n return 0;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_85__ref...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "NO"}, "input": {"kind": "stdin", "value": "2 5 6"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00062-of-00128_85__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-00063-of-00128_0
A cricket team consists of 11 players and some are good at batting, others are good at bowling and some of them are good at both batting and bowling. The batting coach wants to select exactly K players having maximum possible sum of scores. Given the batting score of each of the 11 players, find the number of ways in w...
[{"code": "p = int(raw_input())\nfact = [];\nfact.append(1);\nfor i in range(1,12):\n\tt = fact[i-1]*i;\n\tfact.append(t);\nfor q in range(p):\t\n\tarr = map(int,raw_input().split());\n\tk = int(raw_input());\n\tarr.sort();\n\tarr.reverse();\n\tn = 0;\n\ti = k-1;\n\twhile i >= 0:\n\t\tif(arr[i] == arr[k-1]):\n\t\t\tn+=...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00063-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "1\n6\n"}, "input": {"kind": "stdin", "value": "2\n1 2 3 4 5 6 7 8 9 10 11\n3\n2 5 1 2 4 1 6 5 2 2 1\n6"}, "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-00063-of-00128_2
Chef is the head of commercial logging industry that recently bought a farm containing N trees. You are given initial height of the i-th tree by Hi and the rate of growth of height as Ri meters per month. For simplicity, you can assume that all the trees are perfect cylinders of equal radius. This allows us to consider...
[{"code": "def possible(x,l,w):\n sm=0\n for i in range(n):\n if((ini[i]+rate[i]*x)>=l):\n sm=sm+ini[i]+rate[i]*x\n if sm>=w:\n return 1\n else:\n return 0\nn,w,l=map(int,raw_input().split())\nini=[]\nrate=[]\nfor i in range(n):\n cur=map(int,raw_input().spli...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00063-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "7\n"}, "input": {"kind": "stdin", "value": "3 74 51\n2 2\n5 7\n2 9"}, "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-00063-of-00128_5
Andy and Bob are the only two delivery men of Pizza-chef store. Today, the store received N orders. It's known that the amount of tips may be different when handled by different delivery man. More specifically, if Andy takes the i^th order, he would be tipped Ai dollars and if Bob takes this order, the tip would be Bi ...
[{"code": "n,x,y = map(int,raw_input().split())\nn1 = [int(i) for i in raw_input().split()]\nn2 = [int(i) for i in raw_input().split()]\nnum = [n1[i]-n2[i] for i in xrange(n) ]\nnum.sort(reverse=True)\nmx = max(0,n-y)\nMx = min(n,x)\nxy = sum(n2)\nfor i in xrange(mx):\n xy += num[i]\nans = xy\nfor i in xrange(mx,Mx)...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00063-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "21\n"}, "input": {"kind": "stdin", "value": "5 3 3\n1 2 3 4 5\n5 4 3 2 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-00063-of-00128_78
We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. Constraint...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\n\n#define i64 long long int\n#define ran 202202\n\nint n;\nint a[ran];\nint s[ran];\n\nint main() {\n\tscanf(\"%d\", &n);\n\tfor(int i=0;i<n;i++) {\n\t\tscanf(\"%d\", &a[i]);\n\t\ts[a[i]]++;\n\t}\n\ti64 ans = 0;\n\tfor(int i=0;i<ran;i++)\n\t\tans += 1LL*s[i]*(s[...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00063-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "5\n7\n5\n7\n7\n5\n7\n5"}, "input": {"kind": "stdin", "value": "8\n1 2 1 4 2 1 4 1"}, "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-00063-of-00128_80
A ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \leq i \leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}. How many times will the ball make a bounce where the coordinate is at most X? Constraints * 1 \leq N \leq 100 * 1 \leq L_i ...
[{"code": "n, x = map(int, input().split())\nl = [int(i) for i in input().split()]\n\nd = 0\nc = 0\n\nfor i in l:\n\td += i\n\n\tif d <= x:\n\t\tc += 1\n\nprint(c+1)", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00063-of-00128_80__ref__...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00063-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "4"}, "input": {"kind": "stdin", "value": "4 9\n3 3 3 3"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00063-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-00063-of-00128_82
La Confiserie d'ABC sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes. Constraints * N is an integer between 1 and 10...
[{"code": "#include <iostream>\nusing namespace std;\n \nint\nmain()\n{\nint N;\n \ncin >> N;\n \nint n = 0;\nwhile(n <= N)\n{\nif((N-n) % 7 == 0)\n{\ncout << \"Yes\\n\";\nreturn 0;\n}\nn += 4;\n}\n \ncout << \"No\\n\";\n \nreturn 0;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "code...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00063-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "40"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00063-of-00128_82__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-00063-of-00128_84
Snuke is making sugar water in a beaker. Initially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations. * Operation 1: Pour 100A grams of water into the beaker. * Operation 2: Pour 100B grams of water into the beaker....
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\nint A,B,C,D,E,F;\nint w,s;\nint ans,anss;\ndouble maxn=-1;\nint main() {\n\tscanf(\"%d%d%d%d%d%d\",&A,&B,&C,&D,&E,&F);\n\tA*=100;B*=100;\n\tfor(int a=0;a<=F/A;a++)\n\t\tfor(int b=0;b<=(F-a*A)/B;b++)\n\t\t\tfor(int c=0;c<=(F-a*A-b*B)/C;c++)\n\t\t\t\tfor(int d=0;d...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00063-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "200 100"}, "input": {"kind": "stdin", "value": "1 2 1 2 100 1000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00063-...
{"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-00063-of-00128_85
Snuke signed up for a new website which holds programming competitions. He worried that he might forget his password, and he took notes of it. Since directly recording his password would cause him trouble if stolen, he took two notes: one contains the characters at the odd-numbered positions, and the other contains the...
[{"code": "a = raw_input()\nb = raw_input()\nc = \"\"\ncount = 0\nwhile count < len(b) :\n c += a[count]+b[count]\n count += 1\ntry:\n c += a[count]\nexcept:\n pass\nprint c", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-000...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00063-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "aattccooddeerrbreeggiunlnaerrccoonntteesstt"}, "input": {"kind": "stdin", "value": "atcoderbeginnercontest\natcoderregularcontest"}, "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-00064-of-00128_2
Chef changed the password of his laptop a few days ago, but he can't remember it today. Luckily, he wrote the encrypted password on a piece of paper, along with the rules for decryption. The encrypted password is a string S consists of ASCII printable characters except space (ASCII 33 - 126, in decimal notation, the sa...
[{"code": "def get_rules(num_rules):\n \"\"\"\n Read the input for num_rules times.\n Return - Dictionary with keys mapping\n to values.\n \"\"\"\n rules = {}\n for _ in xrange(num_rules):\n key, val = raw_input().split()\n rules[key] = val\n return rules\n\ndef decode_pas...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00064-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "3\n1800\n.001\n321.33098\n"}, "input": {"kind": "stdin", "value": "4\n2\n5 3\n3 1\n5\n0\n01800.00\n0\n0.00100\n3\nx 0\nd 3\n# .\n0xd21#dd098x"}, "metadata": {}, "visibility": "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
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00064-of-00128_5
Once Chef decided to divide the tangerine into several parts. At first, he numbered tangerine's segments from 1 to n in the clockwise order starting from some segment. Then he intended to divide the fruit into several parts. In order to do it he planned to separate the neighbouring segments in k places, so that he coul...
[{"code": "def solve():\n N, K, P = map(int, raw_input().split())\n pos = set()\n for k in xrange(K):\n l, r = map(int, raw_input().split())\n pos.add(r)\n okay = True\n for p in xrange(P):\n l, r = map(int, raw_input().split())\n if okay and r not in pos:\n okay = ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00064-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "Yes\nNo\n"}, "input": {"kind": "stdin", "value": "2\n10 3 2\n1 4\n5 5\n6 10\n1 5\n6 10\n10 3 1\n2 5\n10 1\n6 9\n1 10"}, "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-00064-of-00128_78
We have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares. The square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is `0`, and white if S_{i,j} is `1`. We will cut the bar some number of times to divide it into some number of blocks. In ea...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\n#define rep(i,a) for(int i=0;i<(a);i++)\nconst ll MOD=1000000007;\n//const ll MOD=998244353;\n\nint num[11];\nint pcnt,H,W,K;\nstring S[11];\nint sum[11];\n\nint judge(){\n rep(i,pcnt+1) sum[i]=0;\n int res=0,pre=0;\n rep(i,W){\n re...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00064-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "3"}, "input": {"kind": "stdin", "value": "4 10 4\n1110010010\n1000101110\n0011101001\n1101000111"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__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-00064-of-00128_80
There is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H). You are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the p...
[{"code": "w,h,x,y = map(int,input().split())\nprint(w*h/2)\nprint((x==w/2)*(y==h/2))\n", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00064-of-00128_80__ref__0000", "source": "benchmark"}, {"code": "import java.util.Scanner;\n\npublic c...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00064-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "3.000000 0"}, "input": {"kind": "stdin", "value": "2 3 1 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00064-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-00064-of-00128_82
Given an integer N, find the base -2 representation of N. Here, S is the base -2 representation of N when the following are all satisfied: * S is a string consisting of `0` and `1`. * Unless S = `0`, the initial character of S is `1`. * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\nint main(){\n int n;\n string s;\n cin>>n;\n if(!n){cout<<0;return 0;}\n while(n){\n if(n%2){s=\"1\"+s;n--;}\n else s=\"0\"+s;\n n/=(-2);\n }\n cout<<s;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontest...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00064-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "0"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00064-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-00064-of-00128_84
In Takahashi Kingdom, which once existed, there are N cities, and some pairs of cities are connected bidirectionally by roads. The following are known about the road network: * People traveled between cities only through roads. It was possible to reach any city from any other city, via intermediate cities if necessary...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\nint main() {\n int n;\n cin >> n;\n long long ans = 0;\n vector<vector<long long>> a(n, vector<long long>(n));\n for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin >> a[i][j];\n for(int i=0;i<n;i++) {\n for(int j=i+1;j<n;j++) {\n bool need = true;\n ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00064-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "3000000000"}, "input": {"kind": "stdin", "value": "3\n0 1000000000 1000000000\n1000000000 0 1000000000\n1000000000 1000000000 0"}, "metadata": {}, "visibility": "public"}, {"ca...
{"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-00064-of-00128_85
Snuke loves "paper cutting": he cuts out characters from a newspaper headline and rearranges them to form another string. He will receive a headline which contains one of the strings S_1,...,S_n tomorrow. He is excited and already thinking of what string he will create. Since he does not know the string on the headlin...
[{"code": "import java.io.*;\nimport java.util.*;\n\npublic class Main{\n\n\tstatic class FastReader{\n\t\tBufferedReader br;\n\t\tStringTokenizer st;\n\t\tpublic FastReader(){\n\t\t\tbr = new BufferedReader(new InputStreamReader(System.in));\n\t\t}\n\t\tpublic String next(){\n\t\t\ttry{\n\t\t\t\twhile(st==null||!st.ha...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00064-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "aac"}, "input": {"kind": "stdin", "value": "3\ncbaa\ndaacc\nacacac"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-0006...
{"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-00065-of-00128_2
Forgotten languages (also known as extinct languages) are languages that are no longer in use. Such languages were, probably, widely used before and no one could have ever imagined that they will become extinct at some point. Unfortunately, that is what happened to them. On the happy side of things, a language may be d...
[{"code": "for i in range(input()):\n NK = map(int, raw_input().split())\n strings = map(str, raw_input().split())\n phrases = []\n for j in range(NK[1]):\n phrases.append(map(str, raw_input().split()))\n for j in strings:\n out = \"NO\"\n for k in phrases:\n if j in k: \n...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00065-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "YES YES NO\nNO NO NO YES\n"}, "input": {"kind": "stdin", "value": "2\n3 2\npiygu ezyfo rzotm\n1 piygu\n6 tefwz tefwz piygu ezyfo tefwz piygu\n4 1\nkssdy tjzhy ljzym kegqz\n4 keg...
{"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-00065-of-00128_3
The Head Chef is studying the motivation and satisfaction level of his chefs . The motivation and satisfaction of a Chef can be represented as an integer . The Head Chef wants to know the N th smallest sum of one satisfaction value and one motivation value for various values of N . The satisfaction and motivation v...
[{"code": "def solve(a,b,num):\n\t# temp=[w for w in c]\n\t# heapify(temp)\n\t# for i in xrange(num):\n\t# \tans=heappop(temp)\n\t# \theapify(temp)\n\t# return ans\t\n\twhile(len(a)*len(b)>num):\n\t\tif len(a)==1 or len(b)==1:\n\t\t\tbreak\n\t\tif a[-1]>b[-1]:\n\t\t\ta.pop()\n\t\telse:\n\t\t\tb.pop()\n\tp=[]\n\tfor i i...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00065-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "7"}, "input": {"kind": "stdin", "value": "1\n3 1\n1 2 3\n4 5 6\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-00065-of-00128_4
Shridhar wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime numbers between two given numbers. Input The first line contains t, the number of test cases (less then or equal to 10). Followed by t lines which contain two numbers m and n (1 ≤ m ≤ n ≤ 1000000000, n-...
[{"code": "import sys\nimport math\ndef prime_gen(n1,n2):\n primes = []\n notprimes=[0]*(n2-n1+1)\n l=int(math.sqrt(n2))\n for i in xrange(2,l+1):\n j=n1//i\n while j*i<=n2:\n if j > 1 and j*i >= n1 :\n notprimes[j*i-n1] = 1\n j=j+1\n for i in xrange(n1,...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00065-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "2\n3\n5\n7\n3\n5\n"}, "input": {"kind": "stdin", "value": "2\n1 10\n3 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-00065-of-00128_5
Do you know that The Chef has a special interest in palindromes? Yes he does! Almost all of the dishes in his restaurant is named by a palindrome strings. The problem is that a name of a dish should not be too long, so The Chef has only limited choices when naming a new dish. For the given positive integer N, your ta...
[{"code": "from sys import stdin\nfrom math import ceil\nMOD=1000000007\ninv25=pow(25,MOD-2,MOD)\nt=int(stdin.readline())\nfor i in range(0,t):\n\tn=int(stdin.readline())\n\tk=(n+1)/2\n\tp26=pow(26,k,MOD)\n\tans = 52 * (p26-1) % MOD * inv25%MOD\n\tif n&1:\n\t\tans = (ans + MOD - p26)%MOD\n\tprint ans", "is_known_correc...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00065-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "26\n52\n728\n1404\n508533804\n"}, "input": {"kind": "stdin", "value": "5\n1\n2\n3\n4\n100"}, "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-00065-of-00128_78
Given are a sequence of N integers A_1, A_2, \ldots, A_N and a positive integer S. For a pair of integers (L, R) such that 1\leq L \leq R \leq N, let us define f(L, R) as follows: * f(L, R) is the number of sequences of integers (x_1, x_2, \ldots , x_k) such that L \leq x_1 < x_2 < \cdots < x_k \leq R and A_{x_1}+A_{...
[{"code": "import java.util.Arrays;\nimport java.util.Scanner;\n\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\t\tint S = sc.nextInt();\n\t\tint A[] = new int[N];\n\t\tfor(int i = 0 ; i < A.length ; ++i){\n\t\t\tA[i] = sc.nextInt(...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00065-of-00128_78__public__0000", "expected_output": {"kind": "stdout", "value": "152"}, "input": {"kind": "stdin", "value": "10 10\n3 1 4 1 5 9 2 6 5 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-00065-of-00128_80
You are given two integer sequences S and T of length N and M, respectively, both consisting of integers between 1 and 10^5 (inclusive). In how many pairs of a subsequence of S and a subsequence of T do the two subsequences are the same in content? Here the subsequence of A is a sequence obtained by removing zero or ...
[{"code": "#include <iostream>\n#include <vector>\n#include <algorithm>\n\nusing namespace std;\n\nconst int MOD = 1000 * 1000 * 1000 + 7;\n\nint main()\n{\n\tint N, M;\n\tcin >> N >> M;\n\n\tvector<int> S(N), T(M);\n\tfor (auto &x : S) cin >> x;\n\tfor (auto &x : T) cin >> x;\n\n\tvector<vector<long long>> dp(N + 1, v...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00065-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "191"}, "input": {"kind": "stdin", "value": "10 9\n9 6 5 7 5 9 8 5 6 7\n8 6 8 5 5 7 9 9 7"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_conte...
{"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-00065-of-00128_82
There are N boxes arranged in a row from left to right. The i-th box from the left contains A_i candies. You will take out the candies from some consecutive boxes and distribute them evenly to M children. Such being the case, find the number of the pairs (l, r) that satisfy the following: * l and r are both integers...
[{"code": "#include <iostream>\n#include <map>\n\nusing namespace std;\n\nint main()\n{\n uint64_t n, m;\n cin >> n >> m;\n map<uint64_t, uint64_t> mp;\n mp[0] = 1;\n uint64_t accumulate = 0;\n uint64_t ans = 0;\n for (auto i = 0; i < n; i++) {\n uint64_t v;\n cin >> v;\n accumulate += v;\n ans += mp...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00065-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "25"}, "input": {"kind": "stdin", "value": "10 400000000\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000"}, "metad...
{"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-00065-of-00128_84
We have a tree with N vertices. Vertex 1 is the root of the tree, and the parent of Vertex i (2 \leq i \leq N) is Vertex P_i. To each vertex in the tree, Snuke will allocate a color, either black or white, and a non-negative integer weight. Snuke has a favorite integer sequence, X_1, X_2, ..., X_N, so he wants to all...
[{"code": "#include<iostream>\n#include<cstdio>\n#include<cstring>\nconst int N=1002;\n\ninline void apn(int &a,int b){\n\tif(a>b)a=b;\n}\n\ninline char get_c(){\n\tstatic char buf[20000],*h,*t;\n\tif(h==t){\n\t\tt=(h=buf)+fread(buf,1,20000,stdin);\n\t}\n\treturn h==t?EOF:*h++;\n}\n\ninline int nxi(){\n\tint x=0;\n\tch...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00065-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "POSSIBLE"}, "input": {"kind": "stdin", "value": "3\n1 1\n4 3 2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00065-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-00065-of-00128_85
On a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis. Among the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i. Similarly, among the lines parallel to the y axis, the i-th from the left is represented by x = x_i. For ever...
[{"code": "\nimport java.util.Scanner;\n\npublic class Main {\n\n\tpublic static void main(String[] args) {\n\t\tMain main = new Main();\n\t\tmain.run();\n\t}\n\n\tlong MOD = 1000000007;\n\n\tpublic void run() {\n\t\tScanner sc = new Scanner(System.in);\n\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\n\t\tint...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00065-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "60"}, "input": {"kind": "stdin", "value": "3 3\n1 3 4\n1 3 6"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00065-of-0...
{"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-00066-of-00128_0
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market. She purchases the string A and tries to convert it to string B by...
[{"code": "for i in range(int(raw_input())):\n\ta = list(raw_input())\n\tb = list(raw_input())\n\td = []\n\tsumm = 0\n\tif len(list(set(a))) == 1:\n\t\tprint \"Unlucky Chef\"\n\telse:\n\t\tc = 0\n\t\tfor x in range(len(a)):\n\t\t\tif a[x] != b[x]:\n\t\t\t\tc = c + 1\n\t\t\t\td.append(int(a[x]))\n \n\t\tl1 = d.count(1)\...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00066-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "Lucky Chef\n2\nUnlucky Chef\n"}, "input": {"kind": "stdin", "value": "2\n101\n010\n1111\n1010"}, "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-00066-of-00128_1
Chef has a special affection for sets of binary strings of equal length which have same numbers of 1's. Given three integers n, k and m, your task is to find the the lexicographically m^th smallest string among strings which have length n and have k 1's. If no such string exists output -1. Tips: To see what lexic...
[{"code": "from math import *\n\ndef nCr(n, k):\n\tif ((k>n) or (k<0)):\n\t\treturn 0\n\tif (k==0):\n\t\treturn 1\n\tif (k==1):\n\t\treturn n\n\tif (k==n):\n\t\treturn 1\n\treturn factorial(n)/(factorial(n-k)*factorial(k))\n\ndef solve(m, n, k):\n\tglobal ans\n\tif (n==0):\n\t\treturn\n\tcheck = nCr(n-1, k)\n\tif (m <=...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00066-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "101\n"}, "input": {"kind": "stdin", "value": "1\n3 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-00066-of-00128_3
Today is the reunion of all chefs in the world. Our Chef wants to make this moment more happier. He arranged a mass wedding in this reunion. For this, he made a strange stage and drew two horizontal parallel lines on the stage. There are N unmarried male chefs in the reunion and he gave each male chef i an unique numbe...
[{"code": "\"\"\"\nShe's just like the first rays of sunshine,\nafter a stormy night.\n\"\"\"\ndef update_tree(bit,index,val):\n index += 1\n while index < len(bit):\n bit[index] += val\n index += index & -index\n return bit\ndef sum_till(bit,index):\n index += 1\n ans = 0\n while index ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00066-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "1"}, "input": {"kind": "stdin", "value": "3\n2 3\n3 6\n5 4"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00066-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
CODECHEF
[]
null
codecontests__test__code_contests_train.riegeli-00066-of-00128_5
You are given two strings A and B of the same length. Each string contains N Lower case Latin character (from 'a' to 'z'). A shift operation will remove the first character of a string and add the same character at the end of that string. For example after you perform a shift operation on a string 'abcd', the new strin...
[{"code": "'''\nKMP algorithm\n'''\n \n# making the table\ndef border(s):\n table={}\n table[0]=-1\n table[1]=0\n n=len(s)\n j=0\n for i in range(2,n+1):\n while s[i-1]!=s[j] and j!=-1:\n j=table[j]\n j+=1\n table[i]=j\n return table\n \n#searching\nn=input()\na=raw_...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00066-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "3\n"}, "input": {"kind": "stdin", "value": "5\nccadd\nbddcc"}, "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-00066-of-00128_80
There are N points in a two-dimensional plane. The initial coordinates of the i-th point are (x_i, y_i). Now, each point starts moving at a speed of 1 per second, in a direction parallel to the x- or y- axis. You are given a character d_i that represents the specific direction in which the i-th point moves, as follows:...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\nconst int maxn = 1e5 + 5, mod = 1e9 + 7;\nconst double inf = 1e18;\nstruct e{\n int x, y;\n double nx, ny;\n char p;\n}a[maxn];\nint n;\ndouble F(double mid)\n{\n double maxx = -inf, minx = inf, maxy = -inf, miny = inf;\n fo...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00066-of-00128_80__public__0000", "expected_output": {"kind": "stdout", "value": "0"}, "input": {"kind": "stdin", "value": "2\n0 3 D\n3 0 L"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00066-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-00066-of-00128_82
A programming competition site AtCode regularly holds programming contests. The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200. The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800. The contest after the ARC is called AG...
[{"code": "#include <iostream>\nusing namespace std;\nint main(){\nint a;\ncin>>a;\nif (a>=0&&a<1200){cout<<\"ABC\";}\nelse if(a>=1200&&a<2800){cout<<\"ARC\";}\nelse {cout<<\"AGC\";}\n}\n", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00066...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00066-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "ABC"}, "input": {"kind": "stdin", "value": "1199"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00066-of-00128_82__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-00066-of-00128_84
There are 2N balls in the xy-plane. The coordinates of the i-th of them is (x_i, y_i). Here, x_i and y_i are integers between 1 and N (inclusive) for all i, and no two balls occupy the same coordinates. In order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B. Then, he placed the type-A r...
[{"code": "//little jump frog txdy\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n#include <cmath>\n#include <iostream>\n#include <algorithm>\n#include <vector>\n#include <set>\n#include <map>\n#include <stack>\n#include <queue>\n#define rep(i,l,r) for(int i=(l);i<=(r);++i)\n#define per(i,r,l) for(int i=(r...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00066-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "4480"}, "input": {"kind": "stdin", "value": "4\n1 1\n2 2\n3 3\n4 4\n1 2\n2 1\n3 4\n4 3"}, "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-00066-of-00128_85
Let us consider the following operations on a string consisting of `A` and `B`: 1. Select a character in a string. If it is `A`, replace it with `BB`. If it is `B`, replace with `AA`. 2. Select a substring that is equal to either `AAA` or `BBB`, and delete it from the string. For example, if the first operation is ...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nconst int N = (int) 1e5 + 5;\n\nchar s[N], t[N];\nint q;\nint sus[N], sut[N];\n\nint main() {\n\tios_base :: sync_with_stdio(false); cin.tie(NULL);\n\tcin >> s + 1;\n\tcin >> t + 1;\n\tint ls = strlen(s + 1), lt = strlen(t + 1);\n\tfor (int i = 1; i <= ls; i+...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00066-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "YES\nYES\nYES\nYES\nYES\nYES\nNO\nNO\nNO\nNO"}, "input": {"kind": "stdin", "value": "AAAAABBBBAAABBBBAAAA\nBBBBAAABBBBBBAAAAABB\n10\n2 15 2 13\n2 13 6 16\n1 13 2 20\n4 20 3 20\...
{"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-00067-of-00128_0
Knights' tournaments were quite popular in the Middle Ages. A lot of boys were dreaming of becoming a knight, while a lot of girls were dreaming of marrying a knight on a white horse. In this problem we consider one of these tournaments. Let's us call a tournament binary, if it runs according to the scheme described...
[{"code": "import sys\n\ndef inverseMod(a, b):\n MOD = 1000000009\n if a == 1:\n return b\n div = MOD / a + 1\n return inverseMod((a * div) % MOD, (b * div) % MOD)\n\ndef solve():\n K, MOD = int(raw_input()), 1000000009\n if K == 1:\n print '2'\n print '2'\n else:\n half...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00067-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "0\n8\n16\n24"}, "input": {"kind": "stdin", "value": "2"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00067-of-00128_0_...
{"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-00067-of-00128_1
Little Chief loves math. Most of all, he loves equations. He can solve any equation in the whole world. Recently he found one interesting and easy equation x1^d+x2^d+x3^d ≡ m (mod N) Where x1, x2 and x3 are non negative integer numbers. But, as always, this was easy enough for him and he solved it in just a few seconds...
[{"code": "def fn():\n mod = 1000000007\n u,d,m,n = map(int,raw_input().split())\n \n a = []\n for i in range(3):\n t = []\n for j in range(n):\n t.append(0)\n a.append(t)\n \n for i in range(n):\n t1 = pow(i,d,n)\n t2 = (u-i)/n + 1\n t2 %= m...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00067-of-00128_1__public__0000", "expected_output": {"kind": "stdout", "value": "4\n1"}, "input": {"kind": "stdin", "value": "2\n2 2 3 5\n1 2013 3 31"}, "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-00067-of-00128_2
Nobody knows, but N frogs live in Chef's garden. Now they are siting on the X-axis and want to speak to each other. One frog can send a message to another one if the distance between them is less or equal to K. Chef knows all P pairs of frogs, which want to send messages. Help him to define can they or not! Note : Mo...
[{"code": "def f(x):\n return x[1]\nn, k, p= map(int, raw_input().split())\na = map(int, raw_input().split())\nl = [] #index, position, max_dist\nfor i in range(n):\n l.append([i, a[i], 0])\nl = sorted(l, key = f, reverse = True)\n#print l\nl[0][2] = l[0][1] + k\nfor i in range(1,n):\n if (l[i-1][1] - l[i][1] ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00067-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "Yes\nYes\nNo\n"}, "input": {"kind": "stdin", "value": "5 3 3\n0 3 8 5 12\n1 2\n1 3\n2 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-00067-of-00128_3
Mike is given an undirected graph G of N vertices and M edges. A non-negative integer Xi is assigned to the i'th vertex of G, for 1 ≤ i ≤ N. Mike was asked to assign labels to each edge of the graph so that the following condition is satisfied: Let's suppose that the j'th edge of G connects vertices Uj and Vj. Th...
[{"code": "import sys\nx = lambda : [int(n) for n in sys.stdin.readline().rstrip().split()]\ndef bfs(i, mode):\n stack = [i+1]\n while len(stack)!=0:\n current = stack.pop()\n if graph.has_key(current):\n for node in graph[current]:\n val = graph[current][node]^answer[curre...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00067-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "1 4 8 4 5"}, "input": {"kind": "stdin", "value": "5 4 2\n1 2 5\n1 3 9\n2 4 0\n2 5 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-00067-of-00128_4
DevuLand is a very strange place. There are n villages in it. Some of the villages are occupied by dinosaurs while the remaining ones by villagers. You are given the information of DevuLand by an array D of size n. If D[i] is non-negative, it means that there are D[i] villagers in that village. Otherwise, it means t...
[{"code": "# Devajit Asem\n# PRLADDU\nt = int(raw_input())\ndef display(a):\n for i in a:\n print i,\n print \nfor i in range(t):\n n = int(raw_input())\n D = map(int,raw_input().split())\n c=0\n k=0\n for i in xrange(n):\n c+=D[i]\n k+=abs(c)\n print k", "is_known_correct":...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00067-of-00128_4__public__0000", "expected_output": {"kind": "stdout", "value": "5\n5\n4\n"}, "input": {"kind": "stdin", "value": "3\n2\n5 -5\n2\n-5 5\n3\n1 2 -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-00067-of-00128_5
At the end of a busy day, The Chef and his assistants play a game together. The game is not just for fun but also used to decide who will have to clean the kitchen. The Chef is a Game Master, so his concern is how to manage the game but not how to win the game like his assistants do. The game requires players to find...
[{"code": "n=input()\nfor x in range(n):\n b=raw_input()\n c=b.split()\n for y in range(len(c)):\n c[y]=int(c[y])\n pos=c[1]\n for y in range(c[2]):\n d=raw_input()\n e,f=d.split()\n e=int(e)\n f=int(f)\n if(e<=pos and f>=pos):\n pos=e+f-pos\n print...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00067-of-00128_5__public__0000", "expected_output": {"kind": "stdout", "value": "1\n"}, "input": {"kind": "stdin", "value": "1\n5 2 3\n1 4\n3 5\n1 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-00067-of-00128_81
There is a right triangle ABC with ∠ABC=90°. Given the lengths of the three sides, |AB|,|BC| and |CA|, find the area of the right triangle ABC. It is guaranteed that the area of the triangle ABC is an integer. Constraints * 1 \leq |AB|,|BC|,|CA| \leq 100 * All values in input are integers. * The area of the triangl...
[{"code": "import java.util.*;\n\npublic class Main{\n public static void main(String[] args){\n Scanner sc = new Scanner(System.in);\n System.out.println(sc.nextInt() * sc.nextInt() /2);\n }\n}\n", "is_known_correct": true, "language": "java", "metadata": {}, "solution_id": "codecontests__test__cod...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00067-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "6"}, "input": {"kind": "stdin", "value": "3 4 5"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00067-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-00067-of-00128_82
You are given a string S. Each character of S is uppercase or lowercase English letter. Determine if S satisfies all of the following conditions: * The initial character of S is an uppercase `A`. * There is exactly one occurrence of `C` between the third character from the beginning and the second to last character (i...
[{"code": "#include<bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\n\n\nint main(){\n string s; cin >> s;\n string ans=\"AC\";\n int cnt=0;\n if(s[0]!='A') ans = \"WA\";\n\n for(int i=1; i<s.size(); i++){\n if(s[i]=='C' && 2<=i && i<=s.size()-2) cnt +=1;\n else if('A'<=s[i] &...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00067-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "WA"}, "input": {"kind": "stdin", "value": "AtCoCo"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00067-of-00128_82__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-00067-of-00128_84
It is September 9 in Japan now. You are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N? Constraints * 10≤N≤99 Input Input is given from Standard Input in the following format: N Output If 9 is contained in the decimal notation of N, print `Yes`; if not, print `No...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main(){\n int a; cin >> a;\n cout << ((a%10==9||a/10==9)?\"Yes\":\"No\") << endl;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00067-of-00128_84__ref__0000", "source": ...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00067-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "Yes"}, "input": {"kind": "stdin", "value": "29"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00067-of-00128_84__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-00067-of-00128_85
How many infinite sequences a_1, a_2, ... consisting of {{1, ... ,n}} satisfy the following conditions? * The n-th and subsequent elements are all equal. That is, if n \leq i,j, a_i = a_j. * For every integer i, the a_i elements immediately following the i-th element are all equal. That is, if i < j < k\leq i+a_i, a_j...
[{"code": "#include<cstdio>\nconst int N=1000005,P=1000000007;\nint n,f[N];\nint main()\n{\n\tscanf(\"%d\",&n);\n\tf[1]=n;\n\tf[2]=1ll*n*n%P;\n\tint sum=0;\n\tfor(int i=3;i<=n;i++)\n\t{\n\t\tsum=(sum+f[i-3])%P;\n\t\tf[i]=(f[i-1]+(n-1ll)*(n-1ll)+(n-i+2)+sum)%P;\n\t}\n\tprintf(\"%d\\n\",f[n]);\n\treturn 0;\n}\n", "is_kno...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00067-of-00128_85__public__0000", "expected_output": {"kind": "stdout", "value": "968545283"}, "input": {"kind": "stdin", "value": "654321"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00067-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-00068-of-00128_0
Consider an infinite full binary tree (each node has two children except the leaf nodes) defined as follows. For a node labelled v its left child will be labelled 2*v and its right child will be labelled 2*v+1. The root is labelled as 1. You are given N queries of the form i j. For each query, you have to print the len...
[{"code": "count=0\nt=int(raw_input())\nwhile(t>0):\n\t\t\t\ta,b=[int(x) for x in raw_input().split()]\n\t\t\t\twhile(a!=b):\n\t\t\t\t\t\t\tif(a>b):\n\t\t\t\t\t\t\t\t\ta=a/2\n\t\t\t\t\t\t\telse:\n\t\t\t\t\t\t\t\t b=b/2\n\t\t\t\t\t\t\tcount=count+1\n\t\t\t\t\t\t\n\t\t\t\tprint count\n\t\t\t\tcount=0\n\t\t\t\tt=t-1", "i...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00068-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "1\n2\n3\n"}, "input": {"kind": "stdin", "value": "3\n1 2\n2 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-00068-of-00128_2
Today is Chef's birthday. His mom has surprised him with truly fruity gifts: 2 fruit baskets. The first basket contains N apples, and the second one contains M oranges. Chef likes apples and oranges very much but he likes them equally, and therefore, wants to have the minimum possible difference between the number of a...
[{"code": "#fruit salad < samosas ? <VigzMv/>\nt=int(raw_input())\n \nfor x in range(t):\n n,m,k=map(int, raw_input().split())\n if abs(m-n)==0:\n print 0\n else:\n if k<abs(m-n):\n print abs(m-n)-k\n else:\n print 0", "is_known_correct": true, "language": "python", "...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00068-of-00128_2__public__0000", "expected_output": {"kind": "stdout", "value": "0\n2\n0\n"}, "input": {"kind": "stdin", "value": "3\n3 4 1\n5 2 1\n3 4 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-00068-of-00128_3
Kostya likes the number 4 much. Of course! This number has such a lot of properties, like: Four is the smallest composite number; It is also the smallest Smith number; The smallest non-cyclic group has four elements; Four is the maximal degree of the equation that can be solved in radicals; There is four-color theorem...
[{"code": "def luckyFour():\n\ttests = int(raw_input())\n\tfor t in xrange(tests):\n\t\tn = int(raw_input())\n\t\tcount = 0\n\t\twhile(n>0):\n\t\t\tif (n%10 == 4):\n\t\t\t\tcount+=1\n\t\t\tn = n/10\n\t\tprint count\n\nluckyFour()", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecont...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00068-of-00128_3__public__0000", "expected_output": {"kind": "stdout", "value": "4\n0\n1\n1\n0\n"}, "input": {"kind": "stdin", "value": "5\n447474\n228\n6664\n40\n81"}, "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-00068-of-00128_81
A sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows: * The first term s is given as input. * Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd. * a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1. Find the minimum integer m that satisfies the following conditio...
[{"code": "s=int(input())\na=[]\nans=1\nwhile True:\n a.append(s)\n if s%2==0:\n s//=2\n else:\n s=s*3+1\n ans+=1\n if s in a:\n print(ans)\n break", "is_known_correct": true, "language": "python", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00068-of-00128_81__ref__0...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00068-of-00128_81__public__0000", "expected_output": {"kind": "stdout", "value": "114"}, "input": {"kind": "stdin", "value": "54"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00068-of-00128_81__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-00068-of-00128_82
A programming competition site AtCode provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode. A user...
[{"code": "import java.util.*;\n\npublic class Main {\n\n static int MOD = 1000000007;\n public static void main(String[] args) {\n\n\n Scanner sc = new Scanner(System.in);\n int d=sc.nextInt(),g=sc.nextInt();\n int[] p = new int[d];\n int[] c = new int[d];\n int ans=Integer.MAX...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00068-of-00128_82__public__0000", "expected_output": {"kind": "stdout", "value": "66"}, "input": {"kind": "stdin", "value": "5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code...
{"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-00068-of-00128_84
Joisino is working as a receptionist at a theater. The theater has 100000 seats, numbered from 1 to 100000. According to her memo, N groups of audiences have come so far, and the i-th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive). How many people are sitting at the theater now? Constrai...
[{"code": "#include <bits/stdc++.h>\nusing namespace std;\n\nint main() {\n int n,l,r,x=0;\n cin>>n;\n for(int i=0;i<n;i++){\n cin>>l>>r;\n x += r-l+1;\n }\n cout << x << endl;\n}", "is_known_correct": true, "language": "cpp", "metadata": {}, "solution_id": "codecontests__test__code_contests_train.riegeli-00...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00068-of-00128_84__public__0000", "expected_output": {"kind": "stdout", "value": "7"}, "input": {"kind": "stdin", "value": "1\n24 30"}, "metadata": {}, "visibility": "public"}, {"case_id": "codecontests__test__code_contests_train.riegeli-00068-of-00128_84__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-00069-of-00128_0
Let's consider a rooted binary tree with the following properties: The number of nodes and edges in the tree is infinite The tree root is labeled by 1 A node labeled by v has two children: 2 × v (the left son of v) and 2 × v + 1 (the right son of v) Here is an image of the first several tree layers of such a tree: L...
[{"code": "for q in xrange(int(raw_input())):\n\tn, a, b = map(int, raw_input().split())\n\tna, nb = n, n\n\twhile (a!=b):\n\t\t#print a, b, na, nb, \"to\",\n\t\tif (a>b):\n\t\t\tif (a%2==0):\n\t\t\t\tna/=2\n\t\t\telse:\n\t\t\t\tna-=1\n\t\t\t\tna/=2\n\t\t\ta/=2\n\t\telse:\n\t\t\tif (b%2==0):\n\t\t\t\tnb/=2\n\t\t\telse:...
[{"case_id": "codecontests__test__code_contests_train.riegeli-00069-of-00128_0__public__0000", "expected_output": {"kind": "stdout", "value": "2\n10\n1"}, "input": {"kind": "stdin", "value": "3\n11 9 11\n10 2 2\n8 1 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