Dataset Viewer
Auto-converted to Parquet Duplicate
source
stringclasses
1 value
task_type
stringclasses
1 value
in_source_id
stringlengths
1
4
problem
stringlengths
488
6.07k
gold_standard_solution
stringlengths
19
30.1k
verification_info
dict
metadata
dict
problem_id
stringlengths
5
9
contaminated_aime_2024
bool
1 class
contaminated_aime_2025
bool
1 class
contaminated_math_500
bool
1 class
contaminated_gpqa
bool
1 class
contaminated_lcb
bool
2 classes
apps
verifiable_code
0
Solve the following coding problem using the programming language python: Polycarp has $n$ different binary words. A word called binary if it contains only characters '0' and '1'. For example, these words are binary: "0001", "11", "0" and "0011100". Polycarp wants to offer his set of $n$ binary words to play a game "...
```python for _ in range(int(input())): n = int(input()) mass = [] zo = 0 oz = 0 zz = 0 oo = 0 ozs = [] zos = [] ozss = set() zoss = set() for j in range(n): k = input() mass.append(k) if k[0] == '0' and k[-1] == '1': zoss.add(k) ...
{ "language": "python", "test_cases": [ { "input": "4\n4\n0001\n1000\n0011\n0111\n3\n010\n101\n0\n2\n00000\n00001\n4\n01\n001\n0001\n00001\n", "output": "1\n3 \n-1\n0\n\n2\n1 2 \n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1259/D" }
vfc_0
false
false
false
false
false
apps
verifiable_code
1
Solve the following coding problem using the programming language python: Mikhail walks on a Cartesian plane. He starts at the point $(0, 0)$, and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point $(0, 0)$, he can go to any of the following points in one move: $...
```python q=int(input()) for e in range(q): x,y,k=list(map(int,input().split())) x,y=abs(x),abs(y) x,y=max(x,y),min(x,y) if(x%2!=k%2): k-=1 y-=1 if(x>k): print(-1) continue if((x-y)%2): k-=1 x-=1 print(k) ```
{ "language": "python", "test_cases": [ { "input": "3\n2 2 3\n4 3 7\n10 1 9\n", "output": "1\n6\n-1\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1036/B" }
vfc_4
false
false
false
false
false
apps
verifiable_code
2
Solve the following coding problem using the programming language python: You are given three sequences: $a_1, a_2, \ldots, a_n$; $b_1, b_2, \ldots, b_n$; $c_1, c_2, \ldots, c_n$. For each $i$, $a_i \neq b_i$, $a_i \neq c_i$, $b_i \neq c_i$. Find a sequence $p_1, p_2, \ldots, p_n$, that satisfy the following conditi...
```python import sys import random from fractions import Fraction from math import * def input(): return sys.stdin.readline().strip() def iinput(): return int(input()) def finput(): return float(input()) def tinput(): return input().split() def linput(): return list(input()) def rinput(): ...
{ "language": "python", "test_cases": [ { "input": "5\n3\n1 1 1\n2 2 2\n3 3 3\n4\n1 2 1 2\n2 1 2 1\n3 4 3 4\n7\n1 3 3 1 1 1 1\n2 4 4 3 2 2 4\n4 2 2 2 4 4 2\n3\n1 2 1\n2 3 3\n3 1 2\n10\n1 1 1 2 2 2 3 3 3 1\n2 2 2 3 3 3 1 1 1 2\n3 3 3 1 1 1 2 2 2 3\n", "output": "1 2 3\n1 2 1 2\n1 3 4 1 2 1 4\n1 2 3\n...
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1408/A" }
vfc_8
false
false
false
false
true
apps
verifiable_code
3
Solve the following coding problem using the programming language python: You have $n$ barrels lined up in a row, numbered from left to right from one. Initially, the $i$-th barrel contains $a_i$ liters of water. You can pour water from one barrel to another. In one act of pouring, you can choose two different barrel...
```python def solve(): n, k = map(int,input().split()) lst = list(map(int,input().split())) lst.sort() ans = 0 for i in range(n - k - 1, n): ans += lst[i] print(ans) for i in range(int(input())): solve() ```
{ "language": "python", "test_cases": [ { "input": "2\n4 1\n5 5 5 5\n3 2\n0 0 0\n", "output": "10\n0\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1430/B" }
vfc_12
false
false
false
false
false
apps
verifiable_code
4
Solve the following coding problem using the programming language python: You are given a permutation $p=[p_1, p_2, \ldots, p_n]$ of integers from $1$ to $n$. Let's call the number $m$ ($1 \le m \le n$) beautiful, if there exists two indices $l, r$ ($1 \le l \le r \le n$), such that the numbers $[p_l, p_{l+1}, \ldots,...
```python for _ in range(int(input())): input() nums = [int(x) for x in input().split()] new_ar = list(zip(nums,[i for i in range(len(nums))])) new_ar.sort() maxx = new_ar[0][1] minn = new_ar[0][1] s="1" for j in range(1,len(new_ar)): if(new_ar[j][1]>maxx): maxx ...
{ "language": "python", "test_cases": [ { "input": "3\n6\n4 5 1 3 2 6\n5\n5 3 1 2 4\n4\n1 4 3 2\n", "output": "101011\n11111\n1001\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1265/B" }
vfc_16
false
false
false
false
false
apps
verifiable_code
5
Solve the following coding problem using the programming language python: The sequence of $m$ integers is called the permutation if it contains all integers from $1$ to $m$ exactly once. The number $m$ is called the length of the permutation. Dreamoon has two permutations $p_1$ and $p_2$ of non-zero lengths $l_1$ and...
```python def possible(a): ans = set() s = set() lmax = 0 for i in range(len(a)): lmax = max(lmax, a[i]) s.add(a[i]) if lmax == i + 1 and len(s) == i + 1: ans.add(i + 1) return ans t = int(input()) for case_num in range(t): n = int(input()) a = list(map(...
{ "language": "python", "test_cases": [ { "input": "6\n5\n1 4 3 2 1\n6\n2 4 1 3 2 1\n4\n2 1 1 3\n4\n1 3 3 1\n12\n2 1 3 4 5 6 7 8 9 1 10 2\n3\n1 1 1\n", "output": "2\n1 4\n4 1\n1\n4 2\n0\n0\n1\n2 10\n0\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1330/B" }
vfc_20
false
false
false
false
false
apps
verifiable_code
6
Solve the following coding problem using the programming language python: Arthur owns a ski resort on a mountain. There are $n$ landing spots on the mountain numbered from $1$ to $n$ from the top to the foot of the mountain. The spots are connected with one-directional ski tracks. All tracks go towards the foot of the...
```python import sys input = sys.stdin.readline for f in range(int(input())): n,m=list(map(int,input().split())) neig=[0]*n for i in range(n): neig[i]=[0] for i in range(m): a,b=list(map(int,input().split())) a-=1 b-=1 neig[a][0]+=1 neig[a].append(b) ...
{ "language": "python", "test_cases": [ { "input": "2\n4 6\n1 2\n1 3\n2 3\n2 4\n3 4\n3 4\n7 6\n1 2\n1 3\n2 4\n2 5\n3 6\n3 7\n", "output": "2\n3 4 \n4\n4 5 6 7 \n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1368/E" }
vfc_24
false
false
false
false
true
apps
verifiable_code
7
Solve the following coding problem using the programming language python: The only difference between easy and hard versions is constraints. Now elections are held in Berland and you want to win them. More precisely, you want everyone to vote for you. There are $n$ voters, and two ways to convince each of them to vo...
```python import sys def I(): return sys.stdin.readline().rstrip() class Heap: def __init__( self ): self.l = [ -1 ] self.n = 0 def n( self ): return self.n def top( self ): return self.l[ 1 ] def ins( self, x ): self.l.append( x ) n = len( self.l ) -...
{ "language": "python", "test_cases": [ { "input": "3\n3\n1 5\n2 10\n2 8\n7\n0 1\n3 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 8\n2 7\n4 4\n5 5\n", "output": "8\n0\n7\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1251/E2" }
vfc_28
false
false
false
false
false
apps
verifiable_code
8
Solve the following coding problem using the programming language python: You like playing chess tournaments online. In your last tournament you played $n$ games. For the sake of this problem, each chess game is either won or lost (no draws). When you lose a game you get $0$ points. When you win you get $1$ or $2$ po...
```python import sys input = sys.stdin.readline def main(): n, k = map(int, input().split()) string = input().strip() if "W" not in string: ans = min(n, k) * 2 - 1 print(max(ans, 0)) return L_s = [] cnt = 0 bef = string[0] ans = 0 for s in string: ...
{ "language": "python", "test_cases": [ { "input": "8\n5 2\nWLWLL\n6 5\nLLLWWL\n7 1\nLWLWLWL\n15 5\nWWWLLLWWWLLLWWW\n40 7\nLLWLWLWWWLWLLWLWWWLWLLWLLWLLLLWLLWWWLWWL\n1 0\nL\n1 1\nL\n6 1\nWLLWLW\n", "output": "7\n11\n6\n26\n46\n0\n1\n6\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1427/B" }
vfc_32
false
false
false
false
false
apps
verifiable_code
9
Solve the following coding problem using the programming language python: Alice and Bob play a game. They have a binary string $s$ (a string such that each character in it is either $0$ or $1$). Alice moves first, then Bob, then Alice again, and so on. During their move, the player can choose any number (not less tha...
```python for _ in range(int(input())): s = input() p = [i for i in s.split("0") if i!=""] p.sort(reverse=True) ans = 0 for i in range(0,len(p),2): ans+=len(p[i]) print(ans) ```
{ "language": "python", "test_cases": [ { "input": "5\n01111001\n0000\n111111\n101010101\n011011110111\n", "output": "4\n0\n6\n3\n6\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1398/B" }
vfc_36
false
false
false
false
false
apps
verifiable_code
10
Solve the following coding problem using the programming language python: Given a permutation $p$ of length $n$, find its subsequence $s_1$, $s_2$, $\ldots$, $s_k$ of length at least $2$ such that: $|s_1-s_2|+|s_2-s_3|+\ldots+|s_{k-1}-s_k|$ is as big as possible over all subsequences of $p$ with length at least $2$. ...
```python for _ in range(int(input())): # n, x = map(int, input().split()) n = int(input()) arr = list(map(int, input().split())) ans = [arr[0]] for i in range(1, n - 1): if arr[i - 1] < arr[i] and arr[i] > arr[i + 1]: ans.append(arr[i]) elif arr[i - 1] > arr[i] and arr[i...
{ "language": "python", "test_cases": [ { "input": "2\n3\n3 2 1\n4\n1 3 4 2\n", "output": "2\n3 1 \n3\n1 4 2 \n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1364/B" }
vfc_40
false
false
false
false
false
apps
verifiable_code
11
Solve the following coding problem using the programming language python: You have a string $s$ — a sequence of commands for your toy robot. The robot is placed in some cell of a rectangular grid. He can perform four commands: 'W' — move one cell up; 'S' — move one cell down; 'A' — move one cell left; 'D' — move o...
```python n = int(input()) def area(width, height) : return (width+1) * (height+1) def calcul(s1, c, s2) : maxx, maxy, minx, miny = 0, 0, 0, 0 x, y = 0, 0 for k in range(len(s1)) : if s1[k] == "W" : y += 1 if s1[k] == "S" : y -= 1 if s1[k] == "A" : ...
{ "language": "python", "test_cases": [ { "input": "3\nDSAWWAW\nD\nWA\n", "output": "8\n2\n4\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1202/C" }
vfc_44
false
false
false
false
false
apps
verifiable_code
12
Solve the following coding problem using the programming language python: Once again, Boris needs the help of Anton in creating a task. This time Anton needs to solve the following problem: There are two arrays of integers $a$ and $b$ of length $n$. It turned out that array $a$ contains only elements from the set $\{...
```python from math import * mod = 1000000007 for zz in range(int(input())): n = int(input()) a = [ int(i) for i in input().split()] b = [int(i) for i in input().split()] ha = True hp = False hm = False for i in range(n): if b[i] != a[i]: if b[i] > a[i]: ...
{ "language": "python", "test_cases": [ { "input": "5\n3\n1 -1 0\n1 1 -2\n3\n0 1 1\n0 2 2\n2\n1 0\n1 41\n2\n-1 0\n-1 -41\n5\n0 1 -1 1 -1\n1 1 -1 1 -1\n", "output": "YES\nNO\nYES\nYES\nNO\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1333/B" }
vfc_48
false
false
false
false
false
apps
verifiable_code
13
Solve the following coding problem using the programming language python: Your company was appointed to lay new asphalt on the highway of length $n$. You know that every day you can either repair one unit of the highway (lay new asphalt over one unit of the highway) or skip repairing. Skipping the repair is necessary...
```python for i in range(int(input())): n,g,b=map(int,input().split()) nn=(n+1)//2 print(max(nn+(nn-1)//g*b,n)) ```
{ "language": "python", "test_cases": [ { "input": "3\n5 1 1\n8 10 10\n1000000 1 1000000\n", "output": "5\n8\n499999500000\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1303/B" }
vfc_52
false
false
false
false
false
apps
verifiable_code
14
Solve the following coding problem using the programming language python: Vasya claims that he had a paper square. He cut it into two rectangular parts using one vertical or horizontal cut. Then Vasya informed you the dimensions of these two rectangular parts. You need to check whether Vasya originally had a square. I...
```python for _ in range(int(input())): a1, b1 = list(map(int, input().split())) a2, b2 = list(map(int, input().split())) if a1 > b1: a1, b1 = b1, a1 if a2 > b2: a2, b2 = b2, a2 flag = False if a1 == a2 and a1 == b1 + b2: flag = True if b1 == b2 and b1 == a1 + a2: ...
{ "language": "python", "test_cases": [ { "input": "3\n2 3\n3 1\n3 2\n1 3\n3 3\n1 3\n", "output": "Yes\nYes\nNo\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1351/B" }
vfc_56
false
false
false
false
false
apps
verifiable_code
15
Solve the following coding problem using the programming language python: Screen resolution of Polycarp's monitor is $a \times b$ pixels. Unfortunately, there is one dead pixel at his screen. It has coordinates $(x, y)$ ($0 \le x < a, 0 \le y < b$). You can consider columns of pixels to be numbered from $0$ to $a-1$, ...
```python from math import * zzz = int(input()) for zz in range(zzz): a, b, x, y = list(map(int, input().split())) print(max(x*b, (a-x-1)*b, y*a, (b - y - 1)*a)) ```
{ "language": "python", "test_cases": [ { "input": "6\n8 8 0 0\n1 10 0 3\n17 31 10 4\n2 1 0 0\n5 10 3 9\n10 10 4 8\n", "output": "56\n6\n442\n1\n45\n80\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1315/A" }
vfc_60
false
false
false
false
false
apps
verifiable_code
16
Solve the following coding problem using the programming language python: Polycarp, Arkady's friend, prepares to the programming competition and decides to write a contest. The contest consists of $n$ problems and lasts for $T$ minutes. Each of the problems is defined by two positive integers $a_i$ and $p_i$ — its dif...
```python from math import sqrt class pro(object): def __init__(self,dif,sc): self.dif=dif self.sc=sc def __lt__(self,other): return self.dif>other.dif T=int(input()) mul=[1] for i in range(100): mul.append(mul[i]*10/9) inf=1000000007 for t in range(T): n=int(input()) effi,...
{ "language": "python", "test_cases": [ { "input": "2\n4\n1.000 31.000\n12 3\n20 6\n30 1\n5 1\n3\n1.000 30.000\n1 10\n10 10\n20 8\n", "output": "7\n20\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1056/F" }
vfc_64
false
false
false
false
false
apps
verifiable_code
17
Solve the following coding problem using the programming language python: You are given an array $a_1, a_2 \dots a_n$. Calculate the number of tuples $(i, j, k, l)$ such that: $1 \le i < j < k < l \le n$; $a_i = a_k$ and $a_j = a_l$; -----Input----- The first line contains a single integer $t$ ($1 \le t \le 100...
```python class BIT(): def __init__(self,n): self.BIT=[0]*(n+1) self.num=n def query(self,idx): res_sum = 0 while idx > 0: res_sum += self.BIT[idx] idx -= idx&(-idx) return res_sum #Ai += x O(logN) def update(self,idx,x): while id...
{ "language": "python", "test_cases": [ { "input": "2\n5\n2 2 2 2 2\n6\n1 3 3 1 2 3\n", "output": "5\n2\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1400/D" }
vfc_68
false
false
false
false
false
apps
verifiable_code
18
Solve the following coding problem using the programming language python: The statement of this problem is the same as the statement of problem C2. The only difference is that, in problem C1, $n$ is always even, and in C2, $n$ is always odd. You are given a regular polygon with $2 \cdot n$ vertices (it's convex and h...
```python import math T = int(input()) for _ in range(T): n = int(input()) print(1/math.tan(math.pi/2/n)) ```
{ "language": "python", "test_cases": [ { "input": "3\n2\n4\n200\n", "output": "1.000000000\n2.414213562\n127.321336469\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1354/C1" }
vfc_72
false
false
false
false
true
apps
verifiable_code
19
Solve the following coding problem using the programming language python: The only difference between easy and hard versions is constraints. The BerTV channel every day broadcasts one episode of one of the $k$ TV shows. You know the schedule for the next $n$ days: a sequence of integers $a_1, a_2, \dots, a_n$ ($1 \le...
```python for _ in range(int(input())): n, k, d = list(map(int, input().split())) a = list(map(int, input().split())) s = {} for q in range(d): s[a[q]] = s.get(a[q], 0)+1 ans = len(s) for q in range(d, n): if s[a[q-d]] == 1: del s[a[q-d]] else: s[a...
{ "language": "python", "test_cases": [ { "input": "4\n5 2 2\n1 2 1 2 1\n9 3 3\n3 3 3 2 2 2 1 1 1\n4 10 4\n10 8 6 4\n16 9 8\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3\n", "output": "2\n1\n4\n5\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1225/B2" }
vfc_76
false
false
false
false
true
apps
verifiable_code
20
Solve the following coding problem using the programming language python: Gildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it. Gildong tries so hard to satisfy the customers that he even memorized all customers' preferred temperature ...
```python q = int(input()) for _ in range(q): n, m = list(map(int, input().split())) info = [list(map(int, input().split())) for i in range(n)] info = sorted(info) now =(m, m) time = 0 flag = True for i in range(n): t, l, h = info[i] l_now = now[0] - (t - time) h_now ...
{ "language": "python", "test_cases": [ { "input": "4\n3 0\n5 1 2\n7 3 5\n10 -1 0\n2 12\n5 7 10\n10 16 20\n3 -100\n100 0 0\n100 -50 50\n200 100 100\n1 100\n99 -100 0\n", "output": "YES\nNO\nYES\nNO\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1304/C" }
vfc_80
false
false
false
false
false
apps
verifiable_code
21
Solve the following coding problem using the programming language python: Among Johnny's numerous hobbies, there are two seemingly harmless ones: applying bitwise operations and sneaking into his dad's office. As it is usually the case with small children, Johnny is unaware that combining these two activities can get ...
```python t = int(input()) for _ in range(t): n = list(input().strip()) s = list(map(int, input().strip().split())) check = set(s) found = False for i in range(1, 1025): newset = set([e^i for e in s]) if check == newset: print(i) found = True bre...
{ "language": "python", "test_cases": [ { "input": "6\n4\n1 0 2 3\n6\n10 7 14 8 3 12\n2\n0 2\n3\n1 2 3\n6\n1 4 6 10 11 12\n2\n0 1023\n", "output": "1\n4\n2\n-1\n-1\n1023\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1362/B" }
vfc_84
false
false
false
false
false
apps
verifiable_code
22
Solve the following coding problem using the programming language python: Let's define the following recurrence: $$a_{n+1} = a_{n} + minDigit(a_{n}) \cdot maxDigit(a_{n}).$$ Here $minDigit(x)$ and $maxDigit(x)$ are the minimal and maximal digits in the decimal representation of $x$ without leading zeroes. For example...
```python import sys input = sys.stdin.readline for _ in range(int(input())): a, k = list(map(int, input().split())) for _ in range(k - 1): if '0' in str(a): break a += int(min(list(str(a)))) * int(max(list(str(a)))) print(a) ```
{ "language": "python", "test_cases": [ { "input": "8\n1 4\n487 1\n487 2\n487 3\n487 4\n487 5\n487 6\n487 7\n", "output": "42\n487\n519\n528\n544\n564\n588\n628\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1355/A" }
vfc_88
false
false
false
false
false
apps
verifiable_code
23
Solve the following coding problem using the programming language python: The only difference between easy and hard versions is constraints. Now elections are held in Berland and you want to win them. More precisely, you want everyone to vote for you. There are $n$ voters, and two ways to convince each of them to vo...
```python import heapq for _ in range(int(input())): n = int(input()) voters = [] for i in range(n): m,p = list(map(int, input().split())) voters.append((m, -p)) voters.sort() for i in range(n): voters[i] = (voters[i][0], -voters[i][1]) ans = 0 costs = [] heapq....
{ "language": "python", "test_cases": [ { "input": "3\n3\n1 5\n2 10\n2 8\n7\n0 1\n3 1\n1 1\n6 1\n1 1\n4 1\n4 1\n6\n2 6\n2 3\n2 8\n2 7\n4 4\n5 5\n", "output": "8\n0\n7\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1251/E1" }
vfc_92
false
false
false
false
false
apps
verifiable_code
24
Solve the following coding problem using the programming language python: Try guessing the statement from this picture: $3$ You are given a non-negative integer $d$. You have to find two non-negative real numbers $a$ and $b$ such that $a + b = d$ and $a \cdot b = d$. -----Input----- The first line contains $t$ (...
```python for _ in range(int(input())): d=int(input()) anws=False if d**2>=4*d: root=(d**2-4*d)**0.5 a=(d+root)/2 b=(d-root)/2 anws=True if anws: print("Y {:.9f} {:.9f}".format(a,b)) else: print("N") ```
{ "language": "python", "test_cases": [ { "input": "7\n69\n0\n1\n4\n5\n999\n1000\n", "output": "Y 67.985071301 1.014928699\nY 0.000000000 0.000000000\nN\nY 2.000000000 2.000000000\nY 3.618033989 1.381966011\nY 997.998996990 1.001003010\nY 998.998997995 1.001002005\n", "type": "stdin_stdout" ...
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1076/C" }
vfc_96
false
false
false
false
false
apps
verifiable_code
25
Solve the following coding problem using the programming language python: We are committed to the well being of all participants. Therefore, instead of the problem, we suggest you enjoy a piece of cake. Uh oh. Somebody cut the cake. We told them to wait for you, but they did it anyway. There is still some left, thoug...
```python import os from io import BytesIO import sys import threading sys.setrecursionlimit(10 ** 9) threading.stack_size(67108864) def main(): # input = BytesIO(os.read(0, os.fstat(0).st_size)).readline def ad(i, j): nonlocal g if j in g[i]: g[i].remove(j) g[j].re...
{ "language": "python", "test_cases": [ { "input": "3\n6\n3 6 5\n5 2 4\n5 4 6\n6 3 1\n6\n2 5 6\n2 5 1\n4 1 2\n1 3 5\n3\n1 2 3\n", "output": "1 6 4 2 5 3 \n4 2 3 1 \n1 4 2 6 5 3 \n3 4 2 1 \n1 3 2 \n1 \n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1282/E" }
vfc_100
false
false
false
false
false
apps
verifiable_code
26
Solve the following coding problem using the programming language python: You are given a special jigsaw puzzle consisting of $n\cdot m$ identical pieces. Every piece has three tabs and one blank, as pictured below. $\{3$ The jigsaw puzzle is considered solved if the following conditions hold: The pieces are arrang...
```python for _ in range(int(input())): n, m = list(map(int, input().split())) if n < m: n, m = m, n # n > m if m == 1: print("YES") continue if m == 2 and n == 2: print("YES") continue print("NO") ```
{ "language": "python", "test_cases": [ { "input": "3\n1 3\n100000 100000\n2 2\n", "output": "YES\nNO\nYES\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1345/A" }
vfc_104
false
false
false
false
false
apps
verifiable_code
27
Solve the following coding problem using the programming language python: There are $n$ positive integers $a_1, a_2, \dots, a_n$. For the one move you can choose any even value $c$ and divide by two all elements that equal $c$. For example, if $a=[6,8,12,6,3,12]$ and you choose $c=6$, and $a$ is transformed into $a=[...
```python tests = int(input()) for test in range(tests): n = int(input()) a = [int(i) for i in input().split()] d = {} for i in range(n): s = 0 while a[i] % 2 == 0: a[i] //= 2 s += 1 if a[i] in list(d.keys()): d[a[i]] = max(s, d[a[i]]) ...
{ "language": "python", "test_cases": [ { "input": "4\n6\n40 6 40 3 20 1\n1\n1024\n4\n2 4 8 16\n3\n3 1 7\n", "output": "4\n10\n4\n0\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1259/B" }
vfc_108
false
false
false
false
false
apps
verifiable_code
28
Solve the following coding problem using the programming language python: Acacius is studying strings theory. Today he came with the following problem. You are given a string $s$ of length $n$ consisting of lowercase English letters and question marks. It is possible to replace question marks with lowercase English l...
```python import sys INF = 10**20 MOD = 10**9 + 7 I = lambda:list(map(int,input().split())) from math import gcd from math import ceil from collections import defaultdict as dd, Counter from bisect import bisect_left as bl, bisect_right as br """ Facts and Data representation Constructive? Top bottom up down """ def ...
{ "language": "python", "test_cases": [ { "input": "6\n7\nabacaba\n7\n???????\n11\naba?abacaba\n11\nabacaba?aba\n15\nasdf???f???qwer\n11\nabacabacaba\n", "output": "Yes\nabacaba\nYes\nabacaba\nYes\nabazabacaba\nYes\nabacabazaba\nNo\nNo\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1379/A" }
vfc_112
false
false
false
false
false
apps
verifiable_code
29
Solve the following coding problem using the programming language python: You are given an array $a$ consisting of $n$ integers numbered from $1$ to $n$. Let's define the $k$-amazing number of the array as the minimum number that occurs in all of the subsegments of the array having length $k$ (recall that a subsegmen...
```python input=__import__('sys').stdin.readline for _ in range(int(input())): n=int(input()) s=list(map(int,input().split())) g=[[-1]for _ in range(n+1)] for i in range(n): g[s[i]].append(i) inf=10**10 ans=[-1]*n lstunused=n for i in range(1,n+1): g[i].append(n) mx=0 for j in range(1,len(g[i])): mx=...
{ "language": "python", "test_cases": [ { "input": "3\n5\n1 2 3 4 5\n5\n4 4 4 4 2\n6\n1 3 1 5 3 1\n", "output": "-1 -1 3 2 1 \n-1 4 4 4 2 \n-1 -1 1 1 1 1 \n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1417/C" }
vfc_116
false
false
false
false
false
apps
verifiable_code
30
Solve the following coding problem using the programming language python: You are given a string $s$ of even length $n$. String $s$ is binary, in other words, consists only of 0's and 1's. String $s$ has exactly $\frac{n}{2}$ zeroes and $\frac{n}{2}$ ones ($n$ is even). In one operation you can reverse any substring...
```python t = int(input()) for i in range(t): n = int(input()) s = input() ans = 0 for y in range(1, n): if s[y] == s[y-1]: ans += 1 print((ans + ans % 2) // 2) ```
{ "language": "python", "test_cases": [ { "input": "3\n2\n10\n4\n0110\n8\n11101000\n", "output": "0\n1\n2\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1437/B" }
vfc_120
false
false
false
false
false
apps
verifiable_code
31
Solve the following coding problem using the programming language python: Skier rides on a snowy field. Its movements can be described by a string of characters 'S', 'N', 'W', 'E' (which correspond to $1$ meter movement in the south, north, west or east direction respectively). It is known that if he moves along a pr...
```python DIR = {"N": (0, 1), "S": (0, -1), "W": (-1, 0), "E": (1, 0)} for t in range(int(input())): path = input() tracks = set() x, y = 0, 0 time = 0 for char in path: x1 = x + DIR[char][0] y1 = y + DIR[char][1] if (x, y, x1, y1) in tracks or (x1, y1, x, y) in tracks: time +...
{ "language": "python", "test_cases": [ { "input": "5\nNNN\nNS\nWWEN\nWWEE\nNWNWS\n", "output": "15\n6\n16\n12\n25\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1351/C" }
vfc_124
false
false
false
false
false
apps
verifiable_code
32
Solve the following coding problem using the programming language python: Lately, Mr. Chanek frequently plays the game Arena of Greed. As the name implies, the game's goal is to find the greediest of them all, who will then be crowned king of Compfestnesia. The game is played by two people taking turns, where Mr. Cha...
```python from sys import stdin, stdout from collections import defaultdict input = stdin.readline for _ in range(int(input())): n = int(input()) chanek = 0 flag = 1 while n>0: if n%4==0 and n!=4: if flag: chanek += 1 n-=1 flag = 0 else: n-=1 flag = 1 elif n%2: if flag: chanek +...
{ "language": "python", "test_cases": [ { "input": "2\n5\n6\n", "output": "2\n4\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1425/A" }
vfc_128
false
false
false
false
false
apps
verifiable_code
33
Solve the following coding problem using the programming language python: Numbers $1, 2, 3, \dots n$ (each integer from $1$ to $n$ once) are written on a board. In one operation you can erase any two numbers $a$ and $b$ from the board and write one integer $\frac{a + b}{2}$ rounded up instead. You should perform the ...
```python t=int(input()) for i in range(t): n=int(input()) print(2) print(n-1,n) for i in range(n-2,0,-1): print(i,i+2) ```
{ "language": "python", "test_cases": [ { "input": "1\n4\n", "output": "2\n4 3\n4 2\n3 1\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1430/C" }
vfc_132
false
false
false
false
false
apps
verifiable_code
34
Solve the following coding problem using the programming language python: You have a large electronic screen which can display up to $998244353$ decimal digits. The digits are displayed in the same way as on different electronic alarm clocks: each place for a digit consists of $7$ segments which can be turned on and o...
```python for _ in range(int(input())): n = int(input()) if(n%2): print("7"+"1"*((n-3)//2)) else: print("1"*(n//2)) ```
{ "language": "python", "test_cases": [ { "input": "2\n3\n4\n", "output": "7\n11\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1295/A" }
vfc_136
false
false
false
false
false
apps
verifiable_code
35
Solve the following coding problem using the programming language python: Young wilderness explorers set off to their first expedition led by senior explorer Russell. Explorers went into a forest, set up a camp and decided to split into groups to explore as much interesting locations as possible. Russell was trying to...
```python import sys input=sys.stdin.readline for _ in range(int(input())): N=int(input()) e=list(map(int,input().split())) e.sort() ans=0 val=0 g=0 for i in range(0,N): g+=1 val=e[i] if g>=val: ans+=1 g=0 val=0 print(ans) ``...
{ "language": "python", "test_cases": [ { "input": "2\n3\n1 1 1\n5\n2 3 1 2 2\n", "output": "3\n2\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1355/B" }
vfc_140
false
false
false
false
false
apps
verifiable_code
36
Solve the following coding problem using the programming language python: It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch. Marmot brought Mole n ordered piles of worms such that i-th pile contains a_{i} worms. He labeled all these worms with consecutive integers: worms in first pile ...
```python n=int(input()) a=list(map(int,input().split())) k=[] for i in range(n): for j in range(a[i]): k.append(i+1) m=int(input()) b=list(map(int,input().split())) for i in b: print(k[i-1]) ```
{ "language": "python", "test_cases": [ { "input": "5\n2 7 3 4 9\n3\n1 25 11\n", "output": "1\n5\n3\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/474/B" }
vfc_144
false
false
false
false
false
apps
verifiable_code
37
Solve the following coding problem using the programming language python: Yeah, we failed to make up a New Year legend for this problem. A permutation of length $n$ is an array of $n$ integers such that every integer from $1$ to $n$ appears in it exactly once. An element $y$ of permutation $p$ is reachable from ele...
```python 3 from math import factorial as fact N = 55 c = [1] for i in range(N): c.append(fact(i)) dp = [0] * N dp[0] = 1 for i in range(1, N): for j in range(i): dp[i] += dp[j] * c[i - j - 1] def get_kth_cycle(n, k): if n == 1: return [1] ans = [-1] * n ans[0] = n - 1 fin = [i for i in range(n)] fin[0] =...
{ "language": "python", "test_cases": [ { "input": "5\n3 3\n5 15\n4 13\n6 8\n4 2\n", "output": "2 1 3 \n3 1 2 5 4 \n-1\n1 2 6 3 4 5 \n1 2 4 3 \n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1279/E" }
vfc_148
false
false
false
false
false
apps
verifiable_code
38
Solve the following coding problem using the programming language python: Two players decided to play one interesting card game. There is a deck of $n$ cards, with values from $1$ to $n$. The values of cards are pairwise different (this means that no two different cards have equal values). At the beginning of the gam...
```python q = int(input()) for z in range(q): n, k1, k2 = map(int, input().split()) arr1 = list(map(int, input().split())) arr2 = list(map(int, input().split())) if max(arr1) > max(arr2): print('YES') else: print('NO') ```
{ "language": "python", "test_cases": [ { "input": "2\n2 1 1\n2\n1\n5 2 3\n2 3\n1 4 5\n", "output": "YES\nNO\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1270/A" }
vfc_152
false
false
false
false
false
apps
verifiable_code
39
Solve the following coding problem using the programming language python: After a long party Petya decided to return home, but he turned out to be at the opposite end of the town from his home. There are $n$ crossroads in the line in the town, and there is either the bus or the tram station at each crossroad. The cro...
```python t=int(input()) for tt in range(t): a,b,p=map(int,input().split()) s=input() n=len(s) cost = [0]*n cost[-1] = 0 typ = '' i=n-2 while i>=0: if s[i]==typ: cost[i] = cost[i+1] else: typ = s[i] cost[i] = cost[i+1] + (a if typ=='A'...
{ "language": "python", "test_cases": [ { "input": "5\n2 2 1\nBB\n1 1 1\nAB\n3 2 8\nAABBBBAABB\n5 3 4\nBBBBB\n2 1 1\nABABAB\n", "output": "2\n1\n3\n1\n6\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1315/B" }
vfc_156
false
false
false
false
false
apps
verifiable_code
40
Solve the following coding problem using the programming language python: You are given a sequence $a_1, a_2, \dots, a_n$, consisting of integers. You can apply the following operation to this sequence: choose some integer $x$ and move all elements equal to $x$ either to the beginning, or to the end of $a$. Note that...
```python def main(): from sys import stdin, stdout for _ in range(int(stdin.readline())): n = int(stdin.readline()) inp1 = [-1] * (n + 1) inp2 = [-1] * (n + 1) for i, ai in enumerate(map(int, stdin.readline().split())): if inp1[ai] < 0: inp1[ai] = i ...
{ "language": "python", "test_cases": [ { "input": "3\n7\n3 1 6 6 3 1 1\n8\n1 1 4 4 4 7 8 8\n7\n4 2 5 2 6 2 7\n", "output": "2\n0\n1\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1223/D" }
vfc_160
false
false
false
false
false
apps
verifiable_code
41
Solve the following coding problem using the programming language python: You are fed up with your messy room, so you decided to clean it up. Your room is a bracket sequence $s=s_{1}s_{2}\dots s_{n}$ of length $n$. Each character of this string is either an opening bracket '(' or a closing bracket ')'. In one operat...
```python t = int(input()) for tt in range(t): n,k=list(map(int,input().split())) s = input() ans = [] if s[0] == ')': for i in range(n): if s[i] == '(': ans.append([1,i+1]) s = s[i::-1] + s[i+1:] break for i in range(1,(k-1)*2): ...
{ "language": "python", "test_cases": [ { "input": "4\n8 2\n()(())()\n10 3\n))()()()((\n2 1\n()\n2 1\n)(\n", "output": "1\n5 7\n5\n1 3\n3 5\n5 7\n6 9\n7 10\n0\n1\n1 2\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1227/C" }
vfc_164
false
false
false
false
false
apps
verifiable_code
42
Solve the following coding problem using the programming language python: You are given a binary string $s$ (recall that a string is binary if each character is either $0$ or $1$). Let $f(t)$ be the decimal representation of integer $t$ written in binary form (possibly with leading zeroes). For example $f(011) = 3, f...
```python LOG = 20 def solve(s): n = len(s) res = 0 z = 0 for t in range(0, n): if s[t] == '0': z += 1 continue for l in range(1, min(LOG, n - t + 1)): x = int(s[t:t+l], 2) # print(l, t, x, l + z) if l + z >= x: res += 1 # print(t, l, x, res, z) z = 0 return res t = int(input()) whil...
{ "language": "python", "test_cases": [ { "input": "4\n0110\n0101\n00001000\n0001000\n", "output": "4\n3\n4\n3\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1217/C" }
vfc_168
false
false
false
false
true
apps
verifiable_code
43
Solve the following coding problem using the programming language python: Petya is preparing for his birthday. He decided that there would be $n$ different dishes on the dinner table, numbered from $1$ to $n$. Since Petya doesn't like to cook, he wants to order these dishes in restaurants. Unfortunately, all dishes a...
```python def check(M): sm = 0 for i in range(n): if a[i] > M: sm += b[i] return sm <= M gans = [] for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) L = 0 R = max(a) while R - L > 1: M ...
{ "language": "python", "test_cases": [ { "input": "4\n4\n3 7 4 5\n2 1 2 4\n4\n1 2 3 4\n3 3 3 3\n2\n1 2\n10 10\n2\n10 10\n1 2\n", "output": "5\n3\n2\n3\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1443/C" }
vfc_172
false
false
false
false
false
apps
verifiable_code
44
Solve the following coding problem using the programming language python: Today the kindergarten has a new group of $n$ kids who need to be seated at the dinner table. The chairs at the table are numbered from $1$ to $4n$. Two kids can't sit on the same chair. It is known that two kids who sit on chairs with numbers $...
```python t=int(input()) for you in range(t): n=int(input()) for i in range(n): print(4*n-2*i,end=" ") print() ```
{ "language": "python", "test_cases": [ { "input": "3\n2\n3\n4\n", "output": "8 6 \n12 10 8 \n16 14 12 10 \n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1443/A" }
vfc_176
false
false
false
false
false
apps
verifiable_code
45
Solve the following coding problem using the programming language python: Jett is tired after destroying the town and she wants to have a rest. She likes high places, that's why for having a rest she wants to get high and she decided to craft staircases. A staircase is a squared figure that consists of square cells. ...
```python import sys import random from fractions import Fraction from math import * def input(): return sys.stdin.readline().strip() def iinput(): return int(input()) def finput(): return float(input()) def tinput(): return input().split() def linput(): return list(input()) def rinput(): ...
{ "language": "python", "test_cases": [ { "input": "4\n1\n8\n6\n1000000000000000000\n", "output": "1\n2\n1\n30\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1419/B" }
vfc_180
false
false
false
false
false
apps
verifiable_code
46
Solve the following coding problem using the programming language python: Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P. While initializing, the b...
```python # # ------------------------------------------------ # ____ _ Generatered using # / ___| | | # | | __ _ __| | ___ _ __ ______ _ # | | / _` |/ _` |/ _ \ '_ \|_ / _` | # | |__| (_| | (_| | __/ | | |/ / (_| | # \____\____|\____|\...
{ "language": "python", "test_cases": [ { "input": "3\nRRRR\nRSP\nS\n", "output": "PPPP\nPPP\nR\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1380/B" }
vfc_184
false
false
false
false
false
apps
verifiable_code
47
Solve the following coding problem using the programming language python: This is the easy version of the problem. The difference between the versions is that the easy version has no swap operations. You can make hacks only if all versions of the problem are solved. Pikachu is a cute and friendly pokémon living in th...
```python import sys input = sys.stdin.readline from bisect import bisect_right bin_s = [1] while bin_s[-1] <= 10 ** 9: bin_s.append(bin_s[-1] * 2) def main(): n, q = map(int, input().split()) alst = list(map(int, input().split())) dp = [[-1, -1] for _ in range(n)] dp[0] = [alst[0], 0] for i,...
{ "language": "python", "test_cases": [ { "input": "3\n3 0\n1 3 2\n2 0\n1 2\n7 0\n1 2 5 4 3 6 7\n", "output": "3\n2\n9\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1420/C1" }
vfc_188
false
false
false
false
false
apps
verifiable_code
48
Solve the following coding problem using the programming language python: You are playing a very popular game called Cubecraft. Initially, you have one stick and want to craft $k$ torches. One torch can be crafted using one stick and one coal. Hopefully, you've met a very handsome wandering trader who has two trade o...
```python for haaghfj in range(int(input())): x,y,k = list(map(int,input().split())) print(k + (y * k + k - 1 +x-2) // (x - 1)) ```
{ "language": "python", "test_cases": [ { "input": "5\n2 1 5\n42 13 24\n12 11 12\n1000000000 1000000000 1000000000\n2 1000000000 1000000000\n", "output": "14\n33\n25\n2000000003\n1000000001999999999\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1418/A" }
vfc_192
false
false
false
false
false
apps
verifiable_code
49
Solve the following coding problem using the programming language python: Let's call some positive integer classy if its decimal representation contains no more than $3$ non-zero digits. For example, numbers $4$, $200000$, $10203$ are classy and numbers $4231$, $102306$, $7277420000$ are not. You are given a segment ...
```python import sys #sys.stdin=open("data.txt") input=sys.stdin.readline # this math tutorial is boring classy=set() for i in range(19): for j in range(i): for k in range(j): for a in range(10): # a=0 for good measure for b in range(10): for c in rang...
{ "language": "python", "test_cases": [ { "input": "4\n1 1000\n1024 1024\n65536 65536\n999999 1000001\n", "output": "1000\n1\n0\n2\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1036/C" }
vfc_196
false
false
false
false
false
apps
verifiable_code
50
Solve the following coding problem using the programming language python: Karlsson has recently discovered a huge stock of berry jam jars in the basement of the house. More specifically, there were $2n$ jars of strawberry and blueberry jam. All the $2n$ jars are arranged in a row. The stairs to the basement are exact...
```python for tcase in range(int(input())): n=int(input()) ls = list(map(int, input().split())) oneneed = 2*(n - ls.count(1)) ldct = {0:0} ctr = 0 eaten = 0 for i in range(n-1,-1,-1): eaten += 1 ctr += (1 if ls[i] == 2 else -1) if ctr not in ldct: ldct[ctr...
{ "language": "python", "test_cases": [ { "input": "4\n6\n1 1 1 2 2 1 2 1 2 1 1 2\n2\n1 2 1 2\n3\n1 1 1 1 1 1\n2\n2 1 1 1\n", "output": "6\n0\n6\n2\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/1278/C" }
vfc_200
false
false
false
false
true
apps
verifiable_code
51
Solve the following coding problem using the programming language python: There are n games in a football tournament. Three teams are participating in it. Currently k games had already been played. You are an avid football fan, but recently you missed the whole k games. Fortunately, you remember a guess of your frie...
```python def main(): t = int(input()) for z in range(t): n, k, d1, d2 = map(int, input().split()) if n % 3 != 0: print('no') continue f = 0 for i in [-1, +1]: for j in [-1, +1]: w = (k - i * d1 - j * d2) if f ==...
{ "language": "python", "test_cases": [ { "input": "5\n3 0 0 0\n3 3 0 0\n6 4 1 0\n6 3 3 0\n3 3 3 2\n", "output": "yes\nyes\nyes\nno\nno\n", "type": "stdin_stdout" } ] }
{ "difficulty": "interview", "problem_url": "https://codeforces.com/problemset/problem/451/C" }
vfc_204
false
false
false
false
false
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
11