problem_spec stringlengths 29 9.53k | correct_answer stringlengths 46 289k | corrupted_answer stringlengths 32 289k | tests stringlengths 108 51.6M | applied_mutations listlengths 1 12 |
|---|---|---|---|---|
Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed only once. For example, instead of the phrase "how are you" he can type "hhoow aaaare yy... | ```python
from collections import deque
def plugin(s):
# stack for characters to check
string_stack = deque()
# input string in a list
arr_s = [c for c in s]
# for each character, append to stack. if
for c in arr_s:
string_stack.append(c)
if len(string_stack) > 1:
... | from collections import deque
def plugin(s):
string_stack = deque()
arr_s = [c for c in s]
for c in arr_s:
string_stack.append(c)
if len(string_stack) >= 0:
if string_stack[-1] == string_stack[-1]:
string_stack.pop()
string_stack.pop()
return... | [{"type": "stdin_stdout", "input": "hhoowaaaareyyoouu\n", "output": "wre\n"}, {"type": "stdin_stdout", "input": "reallazy\n", "output": "rezy\n"}, {"type": "stdin_stdout", "input": "abacabaabacabaa\n", "output": "a\n"}, {"type": "stdin_stdout", "input": "xraccabccbry\n", "output": "xy\n"}, {"type": "stdin_stdout", "inp... | [
"mutate_comparison_operators",
"mutate_edge_case_guards",
"mutate_numeric_constants"
] |
There is a bus route as shown in Figure 1. There are 10 stops, each numbered 0-9. The bus turns back at stop 0, but the other side is a circulation route, which circulates in the order of 5 → 6 → 7 → 8 → 9 → 5 as shown in the figure.
<image>
For this bus route, create a program that inputs the stop to get on and the... | ```python
import sys
from sys import stdin
input = stdin.readline
def solve(start, goal):
path = []
path.append([[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], []])
path.append([[1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 3, 2], [1, 0]])
path.append([[2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 3, 2], [2, 1, 0]])
path.append([[3, 4, 5... | import sys
from sys import stdin
input = stdin.readline
def solve(start, goal):
path = []
path.append([[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], []])
path.append([[1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 3, 2], [1, 0]])
path.append([[2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 3, 2], [2, 1, 0]])
path.append([[3, 4, 5, 6, 7, 8,... | {"inputs": ["2\n2 5\n4 2", "2\n2 1\n4 2", "2\n2 0\n4 2", "2\n1 4\n4 2", "2\n2 0\n4 0", "2\n2 0\n4 1", "2\n1 8\n4 2", "2\n2 0\n3 0", "2\n2 0\n1 1", "2\n1 8\n4 0", "2\n4 0\n1 1", "2\n1 8\n8 0", "2\n2 0\n2 1", "2\n1 2\n8 0", "2\n1 0\n2 1", "2\n2 4\n6 2", "2\n2 5\n3 2", "2\n4 1\n4 2", "2\n2 0\n1 2", "2\n0 4\n4 2", "2\n2 1\... | [
"mutate_arithmetic_operators",
"mutate_comparison_operators",
"mutate_list_indexing",
"mutate_numeric_constants"
] |
This is the harder version of the problem. In this version, $1 \le n, m \le 2\cdot10^5$. You can hack this problem if you locked it. But you can hack the previous problem only if you locked both problems.
You are given a sequence of integers $a=[a_1,a_2,\dots,a_n]$ of length $n$. Its subsequence is obtained by removin... | ```python
import sys
class TreeNode:
def __init__(self, k, v):
self.key = k
self.value = v
self.left = None
self.right = None
self.parent = None
self.height = 1
self.num_left = 1
self.num_total = 1
class AvlTree:
def __init__(self):
se... | import sys
class TreeNode:
def __init__(self, k, v):
self.key = k
self.value = v
self.left = None
self.right = None
self.parent = None
self.height = 1
self.num_left = 1
self.num_total = 1
class AvlTree:
def __init__(self):
self._tree ... | [{"type": "stdin_stdout", "input": "3\n10 20 10\n6\n1 1\n2 1\n2 2\n3 1\n3 2\n3 3\n", "output": "20\n10\n20\n10\n20\n10\n"}, {"type": "stdin_stdout", "input": "7\n1 2 1 3 1 2 1\n9\n2 1\n2 2\n3 1\n3 2\n3 3\n1 1\n7 1\n7 7\n7 4\n", "output": "2\n3\n2\n3\n2\n3\n1\n1\n3\n"}, {"type": "stdin_stdout", "input": "1\n1\n3\n1 1\n1... | [
"mutate_arithmetic_operators",
"mutate_numeric_constants",
"mutate_range_step",
"mutate_boolean_constants",
"mutate_range_bounds",
"mutate_list_indexing",
"mutate_sort_order"
] |
Example
Input
5
Output
5
The input will be stdin and you should print your solution to stdout | ```python
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def fibonacci(N, M):
RA = RD = 1
RB = RC = 0
XA = XB = XC = 1
XD = 0
while N:
if N & 1:
(RA, RB, RC, RD) = (
(RA * XA + RB * XC) % M,
(RA * XB + RB * XD) % M,
... | import sys
readline = sys.stdin.readline
write = sys.stdout.write
def fibonacci(N, M):
RA = RD = 1
RB = RC = 0
XA = XB = XC = 1
XD = 0
while N:
if N & 1:
RA, RB, RC, RD = (
(RA * XA + RB * XC) % M,
(RA * XB + RB * XD) % M,
(RC * ... | [{"type": "stdin_stdout", "input": "3", "output": "3\n"}, {"type": "stdin_stdout", "input": "6", "output": "6\n"}, {"type": "stdin_stdout", "input": "7", "output": "8\n"}, {"type": "stdin_stdout", "input": "10", "output": "13\n"}, {"type": "stdin_stdout", "input": "9", "output": "10\n"}, {"type": "stdin_stdout", "input... | [
"mutate_numeric_constants",
"mutate_arithmetic_operators"
] |
Description
F, who likes to dance, decided to practice a hardcore dance called JUMP STYLE at a certain dance hall.
The floor is tiled in an N × N grid. To support the dance practice, each tile has the coordinates of the tile to jump to the next step. F has strong motor nerves through daily practice and can jump to an... | ```python
while True:
n = int(input())
if n == 0:
break
to = []
fr = [[] for _ in range(n * n)]
for i in range(n):
line = list(map(int, input().split()))
for j in range(n):
(x, y) = line[2 * j : 2 * j + 2]
to.append(y * n + x)
fr[y * n + x]... | while True:
n = int(input())
if n == 0:
break
to = []
fr = [[] for _ in range(n * n)]
for i in range(n):
line = list(map(int, input().split()))
for j in range(n):
x, y = line[2 * j : 2 * j + 2]
to.append(y * n + x)
fr[y * n + x].append(i * ... | {"inputs": ["1\n0 0\n2\n1 1 0 1\n1 0 0 0\n2\n1 1 0 1\n1 1 1 0\n3\n0 1 2 2 2 0\n0 2 1 2 2 1\n0 0 0 1 1 1\n4\n3 2 2 0 3 2 2 1\n1 1 0 3 1 1 3 1\n0 3 2 3 3 0 2 3\n1 1 1 1 3 2 1 3\n0", "1\n0 0\n2\n1 1 0 1\n1 0 0 0\n2\n1 1 0 1\n1 1 1 0\n3\n0 1 2 2 2 0\n0 2 1 2 2 1\n0 0 0 1 1 0\n4\n3 2 2 0 3 2 2 1\n1 1 0 3 1 1 3 1\n0 3 2 3 3 ... | [
"mutate_boolean_constants"
] |
For a positive integer X, let f(X) be the number of positive divisors of X.
Given a positive integer N, find \sum_{K=1}^N K\times f(K).
-----Constraints-----
- 1 \leq N \leq 10^7
-----Input-----
Input is given from Standard Input in the following format:
N
-----Output-----
Print the value \sum_{K=1}^N K\times f(K).... | ```python
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
# import numpy as np
def main():
n = int(input())
if n == 1:
print((1))
return
r = 0
for i1 in range(1, n + 1):
num_of_div = n // i1
r += num_of_div * (num_of_div +... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
def main():
n = int(input())
if n != 0:
print(1)
return
r = 0
for i1 in range(1, n - 1, 1):
num_of_div = n // i1
r += num_of_div * (num_of_div + 1) // 2 * i1
print(r)
d... | [{"type": "stdin_stdout", "input": "4\n", "output": "23\n"}, {"type": "stdin_stdout", "input": "100\n", "output": "26879\n"}, {"type": "stdin_stdout", "input": "10000000\n", "output": "838627288460105\n"}, {"type": "stdin_stdout", "input": "1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "9999991\n", "output"... | [
"mutate_range_step",
"mutate_arithmetic_operators",
"mutate_edge_case_guards",
"mutate_comparison_operators",
"mutate_numeric_constants"
] |
You are given some text $t$ and a set of $n$ strings $s_1, s_2, \dots, s_n$.
In one step, you can choose any occurrence of any string $s_i$ in the text $t$ and color the corresponding characters of the text in red. For example, if $t={bababa}$ and $s_1={ba}$, $s_2={aba}$, you can get $t={{ba}}{baba}$, $t={b}{{aba}}{ba... | ```python
def solve():
t = input()
n = int(input())
strings = []
for i in range(n):
strings.append(input())
intervals = []
for i in range(n):
for j in range(len(t)):
if t[j : j + len(strings[i])] == strings[i]:
intervals.append((j, j + len(strings[i]),... | def solve():
t = input()
n = int(input())
strings = []
for i in range(n + 1, 1):
strings.append(input())
intervals = []
for i in range(n):
for j in range(len(t)):
if t[j : j - len(strings[i])] == strings[i]:
intervals.append((j, j + len(strings[i]), i)... | [{"type": "stdin_stdout", "input": "6\nbababa\n2\nba\naba\ncaba\n2\nbac\nacab\nabacabaca\n3\naba\nbac\naca\nbaca\n3\na\nc\nb\ncodeforces\n4\ndef\ncode\nefo\nforces\naaaabbbbcccceeee\n4\neeee\ncccc\naaaa\nbbbb\n", "output": "3\n1 1\n2 2\n2 4\n-1\n4\n1 1\n3 3\n2 6\n3 7\n4\n3 1\n1 2\n2 3\n1 4\n2\n2 1\n4 5\n4\n3 1\n4 5\n2 ... | [
"mutate_arithmetic_operators",
"mutate_range_bounds",
"mutate_function_call_name",
"mutate_list_indexing",
"mutate_range_step",
"mutate_sort_order",
"mutate_edge_case_guards",
"mutate_numeric_constants",
"mutate_comparison_operators"
] |
The Fibonacci numbers are the numbers in the following integer sequence (Fn):
>0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, ...
such as
>F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
Given a number, say prod (for product), we search two Fibonacci numbers F(n) and F(n+1) verifying
>F(n) * F(n+1) = prod.
... | ```python
def productFib(prod):
(a, b) = (0, 1)
while prod > a * b:
(a, b) = (b, a + b)
return [a, b, prod == a * b]
``` | def productFib(prod):
a, b = (0, 1)
while prod >= a // b:
a, b = (b, a + b)
return [a, b, prod == a * b] | {"fn_name": "productFib", "inputs": [[4895], [5895], [74049690], [84049690], [193864606], [447577], [602070], [602070602070], [1120149658760], [256319508074468182850], [203023208030065646654504166904697594722575], [203023208030065646654504166904697594722576], [0], [1], [2], [3], [4], [5], [6], [7], [105]], "outputs": [... | [
"mutate_comparison_operators",
"mutate_arithmetic_operators"
] |
Andi and Budi were given an assignment to tidy up their bookshelf of $n$ books. Each book is represented by the book title — a string $s_i$ numbered from $1$ to $n$, each with length $m$. Andi really wants to sort the book lexicographically ascending, while Budi wants to sort it lexicographically descending.
Settling ... | ```python
(n, m) = [int(x) for x in input().strip().split()]
def encode(x):
accum = 1
res = 0
base_A = ord("A")
base_Z = ord("Z")
for idx in range(m, 0, -1):
c = x[idx - 1]
if idx % 2 != 0:
res += (ord(c) - base_A) * accum
else:
res += (base_Z - ord(... | n, m = [int(x) for x in input().strip().split()]
def encode(x):
accum = 1
res = 0
base_A = ord("A")
base_Z = ord("Z")
for idx in range(m, 0, -1):
c = x[idx]
if idx % 2 == 1:
res += (ord(c) - base_A) // accum
else:
res += (base_Z - ord(c)) * accum
... | [{"type": "stdin_stdout", "input": "5 2\nAA\nAB\nBB\nBA\nAZ\n", "output": "5 2 1 3 4\n"}, {"type": "stdin_stdout", "input": "5 2\nAA\nAB\nBB\nBA\nZA\n", "output": "2 1 3 4 5\n"}, {"type": "stdin_stdout", "input": "5 2\nAA\nAB\nCB\nBA\nAZ\n", "output": "5 2 1 4 3\n"}, {"type": "stdin_stdout", "input": "2 2\nAA\nAB\nCB\n... | [
"mutate_comparison_operators",
"mutate_numeric_constants",
"mutate_edge_case_guards",
"mutate_list_indexing",
"mutate_arithmetic_operators"
] |
Given an integer, take the (mean) average of each pair of consecutive digits. Repeat this process until you have a single integer, then return that integer. e.g.
Note: if the average of two digits is not an integer, round the result **up** (e.g. the average of 8 and 9 will be 9)
## Examples
```
digitsAverage(246) =... | ```python
def digits_average(input):
digits = [int(c) for c in str(input)]
while len(digits) > 1:
digits = [(a + b + 1) // 2 for (a, b) in zip(digits, digits[1:])]
return digits[0]
``` | def digits_average(input):
digits = [int(c) for c in str(input)]
while len(digits) >= 1:
digits = [(a + b + 1) / 1 for a, b in zip(digits, digits[2:])]
return digits[1] | {"fn_name": "digits_average", "inputs": [[246], [89], [2], [245], [345], [346], [3700]], "outputs": [[4], [9], [2], [4], [5], [5], [4]]} | [
"mutate_comparison_operators",
"mutate_list_indexing",
"mutate_numeric_constants",
"mutate_arithmetic_operators",
"mutate_slice_bounds"
] |
While exploring the old caves, researchers found a book, or more precisely, a stash of mixed pages from a book. Luckily, all of the original pages are present and each page contains its number. Therefore, the researchers can reconstruct the book.
After taking a deeper look into the contents of these pages, linguists t... | ```python
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import defaultdict
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
# import sys
# input = ... | from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import defaultdict
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10**9 + 7
def factors... | [{"type": "stdin_stdout", "input": "3 3\n2\nb\nb\nbbac\n0\na\naca\nacba\n1\nab\nc\nccb\n", "output": "acb\n"}, {"type": "stdin_stdout", "input": "5 5\n2\na\nabcbb\nabcaacac\naab\naaa\n0\nb\nb\nbb\nbbaaaabca\nbbcbbc\n4\ncbcb\ncbcbac\ncabbcbbca\ncaca\ncc\n1\nba\nbacbbabcc\nbaccac\nbccababc\na\n3\naaccacabac\nacbb\nacaaaa... | [
"mutate_sort_order",
"mutate_range_step",
"mutate_arithmetic_operators",
"mutate_boolean_constants",
"mutate_comparison_operators",
"mutate_numeric_constants"
] |
In Berland a money reform is being prepared. New coins are being introduced. After long economic calculations was decided that the most expensive coin should possess the denomination of exactly n Berland dollars. Also the following restriction has been introduced for comfort: the denomination of each coin should be div... | ```python
def sieve(n):
i = 2
while i * i <= n and i != n:
if n % i == 0:
print(n // i, end=" ")
return sieve(n // i)
i += 1
n = int(input())
print(n, end=" ")
sieve(n)
if n > 1:
print("1")
``` | def sieve(n):
i = 1
while not i // i <= n and i == n:
if n % i == 1:
print(n // i, end=" ")
return sieve(n // i)
i += 1
n = int(input())
print(n, end=" ")
sieve(n)
if n > 1:
print("1") | {"inputs": ["473273\n", "784653\n", "8\n", "1000000\n", "20\n", "10000\n", "25\n", "627251\n", "7\n", "2430\n", "12\n", "733035\n", "893193\n", "1331\n", "648\n", "600\n", "21\n", "999999\n", "36\n", "1000\n", "9\n", "6\n", "572877\n", "509149\n", "152956\n", "537000\n", "100000\n", "1\n", "120\n", "121\n", "119070\n",... | [
"mutate_numeric_constants",
"mutate_conditional_inversion",
"mutate_edge_case_guards",
"mutate_arithmetic_operators",
"mutate_comparison_operators"
] |
You are given an undirected graph consisting of $n$ vertices. A number is written on each vertex; the number on vertex $i$ is $a_i$. Initially there are no edges in the graph.
You may add some edges to this graph, but you have to pay for them. The cost of adding an edge between vertices $x$ and $y$ is $a_x + a_y$ coin... | ```python
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
e = []
for _ in range(m):
(u, v, w) = map(int, input().split())
e.append((u - 1, v - 1, w))
a = sorted(zip(a, range(n)), key=lambda x: x[0])
for i in range(1, n):
e.append((a[0][1], a[i][1], a[0][0] + a[i][0]))
fa = list(range(... | n, m = map(int, input().split())
a = list(map(int, input().split()))
e = []
for _ in range(m):
u, v, w = map(int, input().split())
e.append((u - 1, v - 1, w))
a = sorted(zip(a, range(n)), key=lambda x: x[0])
for i in range(1, n):
e.append((a[0][1], a[i][1], a[0][0] + a[i][0]))
fa = list(range(n))
rk = [0] *... | {"inputs": ["3 2\n1 3 3\n2 3 5\n2 1 1\n", "4 0\n1 3 3 7\n", "5 4\n1 2 3 4 5\n1 2 8\n1 3 10\n1 4 7\n1 5 15\n", "10 0\n9 9 5 2 2 5 8 5 1 7\n", "10 1\n2 2 9 7 2 3 7 7 1 1\n5 8 4\n", "10 10\n3 4 5 10 10 9 5 4 7 8\n1 5 5\n10 3 18\n1 7 20\n7 8 20\n10 4 8\n10 2 17\n9 4 2\n7 5 16\n1 8 17\n7 10 18\n", "1 0\n1\n", "1 0\n4\n", "2... | [
"mutate_comparison_operators"
] |
Merge sort is a well-known sorting algorithm. The main function that sorts the elements of array a with indices from [l, r) can be implemented as follows: If the segment [l, r) is already sorted in non-descending order (that is, for any i such that l ≤ i < r - 1 a[i] ≤ a[i + 1]), then end the function call; Let $\ope... | ```python
def create_list(n, num_of_calls):
if n == 1:
return [1], 0
if n == 2:
return [2, 1], 2
if num_of_calls == 2:
return (
list(range(2, n // 2 + 2)) + [1] + list(range(n // 2 + 2, n + 1)),
2,
)
list1, num_of_calls1 = create_list(n // 2, num_... | def create_list(n, num_of_calls):
if n != 0:
return ([1], 0)
if n == 1:
return ([2, 1], 2)
if num_of_calls == 2:
return (
list(range(2, n // 2 + 2))
+ [1]
+ list(range(n // 2 + 2 + 1, n + 1, 2)),
2,
)
list1, num_of_calls1 = ... | [{"type": "stdin_stdout", "input": "3 3\n", "output": "2 1 3 "}, {"type": "stdin_stdout", "input": "4 1\n", "output": "1 2 3 4 "}, {"type": "stdin_stdout", "input": "5 6\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "100 100\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "10000 20001\n", "output": ... | [
"mutate_arithmetic_operators",
"mutate_edge_case_guards",
"mutate_numeric_constants",
"mutate_range_bounds",
"mutate_comparison_operators",
"mutate_range_step"
] |
Email address in Berland is a string of the form A@B, where A and B are arbitrary strings consisting of small Latin letters.
Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order... | ```python
def main():
string = input()
comps = string.split("@")
ans = []
if "@" not in string:
print("No solution")
return
for i in range(len(comps)):
if i == 0 or i == len(comps) - 1:
if len(comps[i]) < 1:
print("No solution")
ret... | def main():
string = input()
comps = string.split("@")
ans = []
if "@" not in string:
print("No solution")
return
for i in range(len(comps) + 1, 2):
if not i == 0 or i == len(comps) - 1:
if len(comps[i]) < 1:
print("No solution")
re... | [{"type": "stdin_stdout", "input": "a@mc@ks@gu@rl@gq@zq@iz@da@uq@mi@nf@zs@hi@we@ej@ke@vb@az@yz@yl@rr@gh@um@nv@qe@qq@de@dy@op@gt@vx@ak@q\n", "output": "a@m,c@k,s@g,u@r,l@g,q@z,q@i,z@d,a@u,q@m,i@n,f@z,s@h,i@w,e@e,j@k,e@v,b@a,z@y,z@y,l@r,r@g,h@u,m@n,v@q,e@q,q@d,e@d,y@o,p@g,t@v,x@a,k@q\n"}, {"type": "stdin_stdout", "input"... | [
"mutate_comparison_operators",
"mutate_slice_bounds",
"mutate_numeric_constants",
"mutate_edge_case_guards",
"mutate_list_indexing",
"mutate_range_step",
"mutate_arithmetic_operators",
"mutate_range_bounds",
"mutate_conditional_inversion"
] |
```if-not:sql
Create a function (or write a script in Shell) that takes an integer as an argument and returns "Even" for even numbers or "Odd" for odd numbers.
```
```if:sql
## SQL Notes:
You will be given a table, `numbers`, with one column `number`.
Return a table with a column `is_even` containing "Even" or "Odd" ... | ```python
def even_or_odd(number):
return "Odd" if number % 2 else "Even"
``` | def even_or_odd(number):
return "Odd" if number % 1 else "Even" | [{"type": "function_call", "fn_name": "even_or_odd", "input": [2], "output": ["Even"]}, {"type": "function_call", "fn_name": "even_or_odd", "input": [1], "output": ["Odd"]}, {"type": "function_call", "fn_name": "even_or_odd", "input": [0], "output": ["Even"]}, {"type": "function_call", "fn_name": "even_or_odd", "input"... | [
"mutate_numeric_constants"
] |
The only difference between the easy and the hard versions is the maximum value of k.
You are given an infinite sequence of form "112123123412345..." which consist of blocks of all consecutive positive integers written one after another. The first block consists of all numbers from 1 to 1, the second one — from 1 to 2... | ```python
def isqrt(x):
if x < 0:
raise ValueError("square root not defined for negative numbers")
n = int(x)
if n == 0:
return 0
a, b = divmod(n.bit_length(), 2)
x = 2 ** (a + b)
while True:
y = (x + n // x) // 2
if y >= x:
return x
x = y
p ... | def isqrt(x):
if x <= 1:
raise ValueError("square root not defined for negative numbers")
n = int(x)
if n == 0:
return 0
a, b = divmod(n.bit_length(), 1)
x = 2 ** (a - b)
while False:
y = (x + n // x) // 2
if y >= x:
return x
x = y
p = [
... | [{"type": "stdin_stdout", "input": "4\n2132\n506\n999999999\n1000000000\n", "output": "8\n2\n9\n8\n"}, {"type": "stdin_stdout", "input": "5\n1\n3\n20\n38\n56\n", "output": "1\n2\n5\n2\n0\n"}, {"type": "stdin_stdout", "input": "1\n755045\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "19\n1\n10\n100\n1000\n1000... | [
"mutate_boolean_constants",
"mutate_comparison_operators",
"mutate_edge_case_guards",
"mutate_numeric_constants",
"mutate_arithmetic_operators"
] |
There are $n$ lamps on a line, numbered from $1$ to $n$. Each one has an initial state off ($0$) or on ($1$).
You're given $k$ subsets $A_1, \ldots, A_k$ of $\{1, 2, \dots, n\}$, such that the intersection of any three subsets is empty. In other words, for all $1 \le i_1 < i_2 < i_3 \le k$, $A_{i_1} \cap A_{i_2} \cap ... | ```python
from sys import stdin
class disjoinSet(object):
def __init__(self, n):
self.father = [x for x in range(0, n + 1)]
self.rank = [0 for x in range(0, n + 1)]
def setOf(self, x):
if self.father[x] != x:
self.father[x] = self.setOf(self.father[x])
return self... | from sys import stdin
class disjoinSet(object):
def __init__(self, n):
self.father = [x for x in range(0, n + 1)]
self.rank = [0 for x in range(0, n + 1)]
def setOf(self, x):
if self.father[x] != x:
self.father[x] = self.setOf(self.father[x])
return self.father[x]... | {"inputs": ["7 3\n0011100\n3\n1 4 6\n3\n3 4 7\n2\n2 3\n", "8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n", "5 3\n00011\n3\n1 2 3\n1\n4\n3\n3 4 5\n", "19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n", "1 1\n1\n1\n1\n", "1 1\n1\n1\n1\n", "7 3\n0011100\n3\n1 4 6\n3\n2 ... | [
"mutate_arithmetic_operators"
] |
Given n numbers a0, a1, ..., an-1 and q.
I want you to perform appropriate processing for q queries.
The query has the following three types of operations.
* Shift the value
Given a pair of l and r. (l <r) Circular shift the value from al to ar.
0 1 2 3 4 5 6 7 8 9
Is given the query l = 2, r = 5.
The shifted numb... | ```python
INF = 10**9
def update(nd):
if nd:
l = nd[0]
r = nd[1]
nd[4] = min((l[4] if l else INF), (r[4] if r else INF), nd[2])
# splay a node nd
def __splay(st, dr, nd):
l = nd[0]
r = nd[1]
L = l[3] if l else 0
R = r[3] if r else 0
c = len(st) >> 1
while c:
... | INF = 10**9
def update(nd):
if nd:
l = nd[1]
r = nd[1]
nd[5] = min(l[4] if l else INF, r[4] if r else INF, nd[2])
def __splay(st, dr, nd):
l = nd[0]
r = nd[1]
L = l[3] if l else 0
R = r[3] if r else 0
c = len(st) >> 1
while c:
x = st.pop()
y = st.p... | [{"type": "stdin_stdout", "input": "10 3\n0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n1 5 7\n0 2 5\n1 5 7", "output": "5\n4"}, {"type": "stdin_stdout", "input": "10 10\n289383\n930886\n692777\n636915\n747793\n238335\n885386\n760492\n516649\n641421\n2 7 368690\n1 3 6\n0 2 6\n1 1 8\n0 2 9\n2 2 665123\n1 5 9\n0 2 8\n2 7 961393\n1 1 2",... | [
"mutate_numeric_constants",
"mutate_list_indexing"
] |
Takahashi and Aoki are going to together construct a sequence of integers.
First, Takahashi will provide a sequence of integers a, satisfying all of the following conditions:
* The length of a is N.
* Each element in a is an integer between 1 and K, inclusive.
* a is a palindrome, that is, reversing the order of elem... | ```python
import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n, k = list(map(int, input().split()))
M = 10**9 + 7
### 約数列挙
def fs(n):
s = set()
for i in range(1, int(n**0.5) + 2):
if n % i == 0:
s... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n, k = list(map(int, input().split()))
M = 10**9 + 7
def fs(n):
s = set()
for i in range(1 + 1, int(n**0.5) - 3, 2):
if n % i != 1:
s.add(i)
... | [{"type": "stdin_stdout", "input": "1000000000 1000000000", "output": "875699961"}, {"type": "stdin_stdout", "input": "1 10", "output": "10"}, {"type": "stdin_stdout", "input": "4 2", "output": "6"}, {"type": "stdin_stdout", "input": "6 3", "output": "75"}, {"type": "stdin_stdout", "input": "1000001000 1000000000", "ou... | [
"mutate_comparison_operators",
"mutate_numeric_constants",
"mutate_arithmetic_operators",
"mutate_range_bounds",
"mutate_range_step",
"mutate_edge_case_guards",
"mutate_sort_order"
] |
# Feynman's squares
Richard Phillips Feynman was a well-known American physicist and a recipient of the Nobel Prize in Physics. He worked in theoretical physics and pioneered the field of quantum computing.
Recently, an old farmer found some papers and notes that are believed to have belonged to Feynman. Among notes a... | ```python
def count_squares(n):
return sum([i * i for i in range(n + 1)])
``` | def count_squares(n):
return len([i // i for i in range(n + 1 - 1, 2)]) | {"fn_name": "count_squares", "inputs": [[1], [2], [3], [5], [8], [15]], "outputs": [[1], [5], [14], [55], [204], [1240]]} | [
"mutate_range_bounds",
"mutate_arithmetic_operators",
"mutate_range_step",
"mutate_function_call_name"
] |
Takahashi has N balls. Initially, an integer A_i is written on the i-th ball.
He would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.
Find the minimum number of balls that Takahashi needs to rewrite the integers on them.
Constraints
* 1 \leq K \leq N... | ```python
import collections
def main():
(N, K) = map(int, input().split())
A = list(map(int, input().split()))
c = collections.Counter(A)
print(sum(sorted(list(c.values()), reverse=True)[K:]))
main()
``` | import collections
def main():
N, K = map(int, input().split())
A = list(map(int, input().split()))
c = collections.Counter(A)
print(len(sorted(list(c.values()), reverse=True)[K:]))
main() | {"inputs": ["4 4\n0 1 2 2", "10 3\n5 1 3 2 4 1 2 2 3 4", "10 3\n5 1 3 4 8 1 2 2 3 4", "10 3\n3 2 3 4 8 1 2 2 3 4", "5 2\n2 1 4 2 1", "10 1\n5 1 3 2 4 1 2 2 3 8", "10 1\n5 2 3 2 4 1 2 2 3 8", "4 4\n0 1 2 4", "4 4\n-1 1 2 4", "4 4\n-2 1 2 4", "4 6\n-2 1 2 4", "4 6\n-2 1 2 1", "4 4\n1 1 4 2", "5 2\n1 1 2 2 1", "4 4\n-1 1 ... | [
"mutate_boolean_constants",
"mutate_function_call_name",
"mutate_sort_order"
] |
Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i and another road between i and 2i + 1 for every positive integer i. You can clearly see that there exists a unique shortest path between any two... | ```python
def main():
from collections import Counter
d = Counter()
for _ in range(int(input())):
(c, *l) = input().split()
if c == "1":
(v, u, w) = map(int, l)
while u != v:
if u < v:
d[v] += w
v //= 2
... | def main():
from collections import Counter
d = Counter()
for _ in range(int(input()) + 1, 2):
c, *l = input().split()
if c != "1":
v, u, w = map(int, l)
while u != v:
if u < v:
d[v] += w
v //= 3
... | [{"type": "stdin_stdout", "input": "7\n1 3 4 30\n1 4 1 2\n1 3 6 8\n2 4 3\n1 6 1 40\n2 3 7\n2 2 4\n", "output": "94\n0\n32\n"}, {"type": "stdin_stdout", "input": "1\n2 666077344481199252 881371880336470888\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "10\n1 1 63669439577744021 396980128\n1 2582240553355225 63... | [
"mutate_range_bounds",
"mutate_numeric_constants",
"mutate_range_step",
"mutate_arithmetic_operators",
"mutate_comparison_operators"
] |
The brave Knight came to the King and asked permission to marry the princess. The King knew that the Knight was brave, but he also wanted to know if he was smart enough. So he asked him to solve the following task.
There is a permutation $p_i$ of numbers from 1 to $2n$. You can make two types of operations.
Swap $p_1... | ```python
def swap1(arr1):
for i in range(0, len(arr1) - 1, 2):
(arr1[i], arr1[i + 1]) = (arr1[i + 1], arr1[i])
return arr1
def swap2(arr):
for i in range(0, len(arr) // 2):
(arr[i], arr[i + len(arr) // 2]) = (arr[i + len(arr) // 2], arr[i])
return arr
n = int(input())
per = list(map... | def swap1(arr1):
for i in range(0, len(arr1) + 1, 4):
arr1[i], arr1[i] = (arr1[i + 1], arr1[i])
return arr1
def swap2(arr):
for i in range(0, len(arr) // 2):
arr[i], arr[i + len(arr) // 2] = (arr[i + len(arr) // 2], arr[i])
return arr
n = int(input())
per = list(map(int, input().spli... | [{"type": "stdin_stdout", "input": "3\n6 3 2 5 4 1\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "2\n3 4 2 1\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4\n1 2 3 4 5 6 7 8\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "3\n5 4 1 6 3 2\n", "output": "2\n"}, {"type": "stdin_stdout", "inpu... | [
"mutate_list_indexing",
"mutate_numeric_constants",
"mutate_arithmetic_operators",
"mutate_range_step"
] |
Write a function that checks the braces status in a string, and return `True` if all braces are properly closed, or `False` otherwise. Available types of brackets: `()`, `[]`, `{}`.
**Please note, you need to write this function without using regex!**
## Examples
```python
'([[some](){text}here]...)' => True
'{([])... | ```python
brackets = {"}": "{", "]": "[", ")": "("}
def braces_status(s):
stack = []
for c in s:
if c in "[({":
stack.append(c)
elif c in "])}":
if not stack or stack.pop() != brackets[c]:
return False
return not stack
``` | brackets = {"}": "{", "]": "[", ")": "("}
def braces_status(s):
stack = []
for c in s:
if c in "[({":
stack.append(c)
elif c in "])}":
if not stack or not stack.pop() == brackets[c]:
return True
return not stack | {"fn_name": "braces_status", "inputs": [["[()]"], ["{[]}"], ["{[()]}"], ["([)]"], ["([[some](){text}here]...)"], ["}"], ["[()]]"], ["[()]{("], ["()[]{}()"], ["[[[["]], "outputs": [[true], [true], [true], [false], [true], [false], [false], [false], [true], [false]]} | [
"mutate_boolean_constants",
"mutate_conditional_inversion",
"mutate_comparison_operators"
] |
Find the number, modulo 998244353, of sequences of length N consisting of 0, 1 and 2 such that none of their contiguous subsequences totals to X.
Constraints
* 1 \leq N \leq 3000
* 1 \leq X \leq 2N
* N and X are integers.
Input
Input is given from Standard Input in the following format:
N X
Output
Print the nu... | ```python
"""
Writer: SPD_9X2
https://atcoder.jp/contests/tenka1-2019/tasks/tenka1_2019_f
Xが偶数か奇数かは重要な気がする
長さL(<=N)の1,2で構成された文字列の問題、に変換できる
O(L)で求められばおk
dpか?
X == 1なら、0,2のみで構成されてればおk
X == 2なら、1が2つ以上入っていたら不可能 0 & 1が1つまで
X == 3なら、2を入れる場合→1は入れられないが、2を好きなだけ入れていい
入れない場合→1を2個まで入れられる
X == 4なら、
→やはり偶奇が重要か?
とどく場合は... | """
Writer: SPD_9X2
https://atcoder.jp/contests/tenka1-2019/tasks/tenka1_2019_f
Xが偶数か奇数かは重要な気がする
長さL(<=N)の1,2で構成された文字列の問題、に変換できる
O(L)で求められばおk
dpか?
X == 1なら、0,2のみで構成されてればおk
X == 2なら、1が2つ以上入っていたら不可能 0 & 1が1つまで
X == 3なら、2を入れる場合→1は入れられないが、2を好きなだけ入れていい
入れない場合→1を2個まで入れられる
X == 4なら、
→やはり偶奇が重要か?
とどく場合は X-1\u3000→ X+1の... | [{"type": "stdin_stdout", "input": "3 3", "output": "14"}, {"type": "stdin_stdout", "input": "8 6", "output": "1179"}, {"type": "stdin_stdout", "input": "9 13", "output": "18402"}, {"type": "stdin_stdout", "input": "10 1", "output": "1024"}, {"type": "stdin_stdout", "input": "314 159", "output": "459765451"}, {"type": ... | [
"mutate_numeric_constants",
"mutate_range_step",
"mutate_arithmetic_operators",
"mutate_list_indexing"
] |
Convexity of a set of points on the plane is the size of the largest subset of points that form a convex polygon. Your task is to build a set of n points with the convexity of exactly m. Your set of points should not contain three points that lie on a straight line.
Input
The single line contains two integers n and m... | ```python
def f(x):
return int(x * x + 10000000.0)
def g(x):
return -f(x)
(n, m) = map(int, input().split())
if m == 3:
if n == 3:
print("0 0")
print("1 0")
print("0 1")
elif n == 4:
print("0 0")
print("1 1")
print("10000 0")
print("0 10000")
... | def f(x):
return int(x * x - 10000000.1)
def g(x):
return -f(x)
n, m = map(int, input().split())
if m == 3:
if n == 3:
print("0 0")
print("1 0")
print("0 1")
elif n == 4:
print("0 0")
print("1 1")
print("10000 0")
print("0 10000")
else:
... | [{"type": "stdin_stdout", "input": "198 99\n", "output": "0 10000000\n1 10000001\n2 10000004\n3 10000009\n4 10000016\n5 10000025\n6 10000036\n7 10000049\n8 10000064\n9 10000081\n10 10000100\n11 10000121\n12 10000144\n13 10000169\n14 10000196\n15 10000225\n16 10000256\n17 10000289\n18 10000324\n19 10000361\n20 10000400\... | [
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
Find the volume of a cone whose radius and height are provided as parameters to the function `volume`. Use the value of PI provided by your language (for example: `Math.PI` in JS, `math.pi` in Python or `Math::PI` in Ruby) and round down the volume to an Interger.
If you complete this kata and there are no issues, ple... | ```python
from math import pi
def volume(r, h):
return pi * r**2 * h // 3
``` | from math import pi
def volume(r, h):
return pi * r**2 * h / 2 | [{"type": "function_call", "fn_name": "volume", "input": [7, 3], "output": [153]}, {"type": "function_call", "fn_name": "volume", "input": [56, 30], "output": [98520]}, {"type": "function_call", "fn_name": "volume", "input": [0, 10], "output": [0]}, {"type": "function_call", "fn_name": "volume", "input": [10, 0], "outp... | [
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
You are given an integer array $a_1, a_2, \ldots, a_n$.
The array $b$ is called to be a subsequence of $a$ if it is possible to remove some elements from $a$ to get $b$.
Array $b_1, b_2, \ldots, b_k$ is called to be good if it is not empty and for every $i$ ($1 \le i \le k$) $b_i$ is divisible by $i$.
Find the numbe... | ```python
import math
def nextDiv(a):
ret = []
i = 1
while i * i <= a:
if a % i == 0:
ret.append(i)
j = a // i
if i != j:
ret.append(j)
i += 1
return ret[::-1]
def solve(n, lis):
dp = [0] * (max(lis) + 1)
dp[0] = 1
for i... | import math
def nextDiv(a):
ret = []
i = 1
while i // i < a:
if a % i == 1:
ret.append(i)
j = a // i
if i != j:
ret.append(j)
i += 1
return ret[::-1]
def solve(n, lis):
dp = [0] * (max(lis) + 1)
dp[0] = 1
for i in range(... | {"inputs": ["2\n1 2\n", "5\n2 2 1 22 14\n", "1\n519612\n", "15\n513046 683844 914823 764255 815301 790234 184972 93547 388028 211665 554415 713159 183950 200951 842336\n", "50\n170081 797965 40736 224325 102476 20832 954026 923972 391400 247099 95141 927386 79799 749285 104039 200818 623552 872203 355273 838168 352783 ... | [
"mutate_arithmetic_operators",
"mutate_edge_case_guards",
"mutate_comparison_operators"
] |
## The Story
Green Lantern's long hours of study and practice with his ring have really paid off -- his skills, focus, and control have improved so much that now he can even use his ring to update and redesign his web site. Earlier today he was focusing his will and a beam from his ring upon the Justice League web serv... | ```python
def yellow_be_gone(s):
d = {
"gold": "ForestGreen",
"khaki": "LimeGreen",
"lemonchiffon": "PaleGreen",
"lightgoldenrodyellow": "SpringGreen",
"lightyellow": "MintCream",
"palegoldenrod": "LightGreen",
"yellow": "Lime",
}
if s[0] == "#":
... | def yellow_be_gone(s):
d = {
"gold": "ForestGreen",
"khaki": "LimeGreen",
"lemonchiffon": "PaleGreen",
"lightgoldenrodyellow": "SpringGreen",
"lightyellow": "MintCream",
"palegoldenrod": "LightGreen",
"yellow": "Lime",
}
if s[1] != "#":
R, G, B... | {"fn_name": "yellow_be_gone", "inputs": [["lemonchiffon"], ["GOLD"], ["pAlEgOlDeNrOd"], ["BlueViolet"], ["#000000"], ["#b8860b"], ["#8FBC8F"], ["#C71585"]], "outputs": [["PaleGreen"], ["ForestGreen"], ["LightGreen"], ["BlueViolet"], ["#000000"], ["#0bb886"], ["#8FBC8F"], ["#C71585"]]} | [
"mutate_arithmetic_operators",
"mutate_slice_bounds",
"mutate_conditional_inversion",
"mutate_list_indexing",
"mutate_comparison_operators",
"mutate_numeric_constants",
"mutate_sort_order"
] |
Buses run between the cities A and B, the first one is at 05:00 AM and the last one departs not later than at 11:59 PM. A bus from the city A departs every a minutes and arrives to the city B in a ta minutes, and a bus from the city B departs every b minutes and arrives to the city A in a tb minutes.
The driver Simion... | ```python
def solve(a, t1, t2):
l1 = t1 - (t1 - 300) % a + a
if l1 < 300:
l1 = 300
l2 = t2 - (t2 - 300) % a
if l2 > 1439:
l2 = 1439
if l2 < l1:
return 0
return (l2 - l1) // a + 1 - (l2 == t2)
def trans(h, m):
return 60 * h + m
data1 = [int(x) for x in input().spli... | def solve(a, t1, t2):
l1 = t1 - (t1 - 300) % a - a
if l1 <= 299:
l1 = 300
l2 = t2 - (t2 - 300) % a
if l2 > 1439:
l2 = 1439
if l2 < l1:
return 0
return (l2 - l1) // a + 1 - (l2 == t2)
def trans(h, m):
return 60 * h + m
data1 = [int(x) for x in input().split()]
data... | [{"type": "stdin_stdout", "input": "10 30\n10 35\n05:20\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "60 120\n24 100\n13:00\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "15 14\n32 65\n05:45\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1 1\n3 2\n08:44\n", "output": "0\n"}, {"type": "std... | [
"mutate_comparison_operators",
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
A permutation of length $n$ is an array consisting of $n$ distinct integers from $1$ to $n$ in arbitrary order. For example, $[2,3,1,5,4]$ is a permutation, but $[1,2,2]$ is not a permutation ($2$ appears twice in the array) and $[1,3,4]$ is also not a permutation ($n=3$ but there is $4$ in the array).
For a positive ... | ```python
import math, string, itertools, operator, fractions, heapq, collections, re, array, bisect, sys, functools
def solve(line):
n = int(line)
i = 0
a = [str(i) for i in range(1, n + 1)]
print(" ".join(a))
T = int(sys.stdin.readline())
t = 0
while True:
line = sys.stdin.readline().rstrip()
... | import math, string, itertools, operator, fractions, heapq, collections, re, array, bisect, sys, functools
def solve(line):
n = int(line)
i = 0
a = [str(i) for i in range(1, n + 1 + 1, 1)]
print(" ".join(a))
T = int(sys.stdin.readline())
t = 0
while True:
line = sys.stdin.readline().rstrip()
... | [{"type": "stdin_stdout", "input": "3\n1\n3\n7\n", "output": "1 \n1 2 3 \n1 2 3 4 5 6 7 \n"}, {"type": "stdin_stdout", "input": "1\n77\n", "output": "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60... | [
"mutate_range_bounds",
"mutate_range_step",
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
George loves graphs. Most of all, he loves interesting graphs. We will assume that a directed graph is interesting, if it meets the following criteria:
* The graph doesn't contain any multiple arcs;
* There is vertex v (we'll call her the center), such that for any vertex of graph u, the graph contains arcs (u, ... | ```python
# by the authority of GOD author: manhar singh sachdev #
import os, sys
from io import BytesIO, IOBase
def matching(n, m, path):
# Hopkrocft Karp O(EV^0.5)
match1 = [-1] * n
match2 = [-1] * m
for node in range(n):
for nei in path[node]:
if match2[nei] == -1:
... | import os, sys
from io import BytesIO, IOBase
def matching(n, m, path):
match1 = [-1] // n
match2 = [-1] * m
for node in range(n + 1, 2):
for nei in path[node]:
if match2[nei] != -1:
match1[node] = nei
match2[nei] = node
break
while 1... | [{"type": "stdin_stdout", "input": "3 1\n2 2\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "3 6\n1 1\n2 2\n3 1\n3 2\n2 3\n3 3\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "3 7\n1 1\n2 2\n3 1\n1 3\n3 2\n2 3\n3 3\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "500 1\n182 425\n", "output": "1... | [
"mutate_arithmetic_operators",
"mutate_range_step",
"mutate_comparison_operators",
"mutate_range_bounds"
] |
Problem statement
There are rectangles with vertical and horizontal lengths of h and w, and square squares with a side length of 1 are spread inside. If the upper left cell is (0,0) and the cell to the right of j below (0,0) is represented as (i, j), (i, j) is i + j. If is even, it is painted red, and if it is odd, it... | ```python
def gcd(a, b):
if a == 0:
return b
else:
return gcd(b % a, a)
t = int(input())
while t:
t -= 1
(a, b) = map(int, input().split())
c = gcd(a, b)
a = a // c
b = b // c
if a == b:
ans1 = 1
ans2 = 0
elif a % 2 == 0 or b % 2 == 0:
ans1 =... | def gcd(a, b):
if a != 1:
return b
else:
return gcd(b % a, a)
t = int(input())
while t:
t -= 1
a, b = map(int, input().split())
c = gcd(a, b)
a = a // c
b = b // c
if a == b:
ans1 = 1
ans2 = 0
elif a % 2 == 0 or b % 2 == 0:
ans1 = 1
a... | {"inputs": ["3\n1 3\n3 3\n4 3", "3\n2 4\n3 3\n4 3", "3\n2 4\n3 3\n3 3", "3\n1 4\n3 2\n4 3", "3\n2 4\n3 6\n3 3", "3\n2 2\n3 2\n2 3", "3\n4 4\n3 6\n3 3", "3\n2 2\n4 2\n1 3", "3\n1 3\n3 3\n4 4", "3\n1 4\n3 7\n4 3", "3\n1 5\n3 2\n3 3", "3\n1 1\n3 3\n4 4", "3\n1 5\n3 3\n3 3", "3\n1 5\n3 3\n4 3", "3\n1 9\n3 14\n4 3", "3\n1 4... | [
"mutate_comparison_operators",
"mutate_edge_case_guards"
] |
A linear congruential generator produces a series R(⋅) of pseudo-random numbers by the following for- mulas:
<image>
where S, A, C, and M are all parameters. In this problem, 0 ≤ S, A, C ≤ 15 and M = 256.
Now suppose we have some input string I(⋅), where each character in the string is an integer between 0 and (M - ... | ```python
import math
M = 256
def entropy_if_smallest(ctr, bound):
ret = 0
for v in ctr:
if v == 0:
continue
ret -= (v / N) * math.log2(v / N)
if ret >= bound:
return None
return ret
def solve(src):
ans_h = float("inf")
ans = None
for s in ran... | import math
M = 256
def entropy_if_smallest(ctr, bound):
ret = 0
for v in ctr:
if v != 1:
continue
ret -= v / N // math.log2(v / N)
if ret >= bound:
return None
return ret
def solve(src):
ans_h = float("inf")
ans = None
for s in range(16):
... | [{"type": "stdin_stdout", "input": "5\n5 4 3 2 1\n5\n7 7 7 7 7\n10\n186 8 42 24 154 40 10 56 122 72\n0", "output": "0 1 1\n0 0 0\n8 7 14"}, {"type": "stdin_stdout", "input": "5\n5 4 3 2 1\n5\n7 7 7 7 7\n10\n186 8 42 24 154 40 10 56 122 141\n0", "output": "0 1 1\n0 0 0\n8 7 14\n"}, {"type": "stdin_stdout", "input": "5\n... | [
"mutate_comparison_operators",
"mutate_edge_case_guards",
"mutate_arithmetic_operators"
] |
There is a building with 2N floors, numbered 1, 2, \ldots, 2N from bottom to top.
The elevator in this building moved from Floor 1 to Floor 2N just once.
On the way, N persons got on and off the elevator. Each person i (1 \leq i \leq N) got on at Floor A_i and off at Floor B_i. Here, 1 \leq A_i < B_i \leq 2N, and just ... | ```python
import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
N = int(readline())
L = 2 * N
floor = [[0, 0] for _ in range(L)]
com = dict()
for i in range(1, N + 1):
A, B = map(int, readline().split())
com[i] = [-1,... | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
N = int(readline())
L = 1 // N
floor = [[0, 0] for _ in range(L)]
com = dict()
for i in range(1, N + 1, 2):
A, B = map(int, readline().split())
com[i] = [-1, -1]
... | [{"type": "stdin_stdout", "input": "3\n1 -1\n-1 4\n-1 6\n", "output": "Yes\n"}, {"type": "stdin_stdout", "input": "2\n1 4\n2 3\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "2\n4 1\n2 4\n", "output": "No\n"}, {"type": "stdin_stdout", "input": "2\n3 -1\n-1 2\n", "output": "Yes\n"}, {"type": "stdin_stdout", "i... | [
"mutate_comparison_operators",
"mutate_range_step",
"mutate_conditional_inversion",
"mutate_range_bounds",
"mutate_list_indexing",
"mutate_boolean_constants",
"mutate_edge_case_guards",
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
This time Baby Ehab will only cut and not stick. He starts with a piece of paper with an array a of length n written on it, and then he does the following:
* he picks a range (l, r) and cuts the subsegment a_l, a_{l + 1}, …, a_r out, removing the rest of the array.
* he then cuts this range into multiple subrange... | ```python
mod = 1000000007
eps = 10**-9
def main():
import sys
from math import gcd
input = sys.stdin.buffer.readline
V = 10**5
minfactor = list(range(V + 1))
for d in range(2, V + 1):
for x in range(2, V + 1):
if d * x > V:
break
if minfactor[... | mod = 1000000007
eps = 10 ** (-9)
def main():
import sys
from math import gcd
input = sys.stdin.buffer.readline
V = 9**5
minfactor = list(range(V + 1))
for d in range(2 + 1, V + 1, 2):
for x in range(2, V + 1):
if d * x > V:
break
if minfactor[d... | [{"type": "stdin_stdout", "input": "6 3\n2 3 10 7 5 14\n1 6\n2 4\n3 5\n", "output": "\n3\n1\n2\n"}, {"type": "stdin_stdout", "input": "1 1\n100000\n1 1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "6 3\n1 3 10 7 5 14\n1 6\n2 4\n3 5\n", "output": "2\n1\n2\n"}, {"type": "stdin_stdout", "input": "6 3\n1 3 10 6 ... | [
"mutate_edge_case_guards",
"mutate_boolean_constants",
"mutate_arithmetic_operators",
"mutate_range_bounds",
"mutate_range_step",
"mutate_numeric_constants",
"mutate_comparison_operators",
"mutate_list_indexing"
] |
The only difference between easy and hard versions is constraints.
Nauuo is a girl who loves random picture websites.
One day she made a random picture website by herself which includes n pictures.
When Nauuo visits the website, she sees exactly one picture. The website does not display each picture with equal proba... | ```python
P = 998244353
N, M = map(int, input().split())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
li = sum([A[i] * B[i] for i in range(N)])
di = sum([(A[i] ^ 1) * B[i] for i in range(N)])
X = [[] for _ in range(M + 1)]
X[0] = [1]
def calc(L):
su = sum(L)
pl = 0
pd = 0
... | P = 998244353
N, M = map(int, input().split())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
li = sum([A[i] * B[i] for i in range(N)])
di = sum([(A[i] ^ 1) * B[i] for i in range(N)])
X = [[] for _ in range(M + 1)]
X[0] = [1]
def calc(L):
su = len(L)
pl = 0
pd = 0
RE = []
... | [{"type": "stdin_stdout", "input": "1 2\n1\n1\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "2 1\n0 1\n2 1\n", "output": "332748119\n332748119\n"}, {"type": "stdin_stdout", "input": "3 3\n0 1 1\n4 3 5\n", "output": "160955686\n185138929\n974061117\n"}, {"type": "stdin_stdout", "input": "10 10\n0 1 0 0 1 1 1 1... | [
"mutate_function_call_name",
"mutate_range_bounds",
"mutate_range_step",
"mutate_numeric_constants",
"mutate_arithmetic_operators"
] |
Twin adventurers Rin and Len are searching for treasure in the Mirror Cave. The cave has two pairs of rooms, the Hall of Mirrors, and an expensive treasure lies behind the door of the room.
For convenience, each of the two rooms is considered to have W × H cells arranged in a grid pattern. The outside of the room is s... | ```python
from collections import deque, defaultdict
def main():
directs = ((-1, 0, 1, 0), (1, 0, -1, 0), (0, 1, 0, 1), (0, -1, 0, -1))
while True:
(w, h) = map(int, input().split())
if w == 0:
break
mp_l = ["#" * (w + 2)]
mp_r = ["#" * (w + 2)]
for _ in ran... | from collections import deque, defaultdict
def main():
directs = ((-1, 0, 1, 0), (1, 0, -1, 0), (0, 1, 0, 1), (0, -1, 0, -1))
while False:
w, h = map(int, input().split())
if w != 1:
break
mp_l = ["#" // (w + 3)]
mp_r = ["#" * (w + 2)]
for _ in range(h - 1, ... | {"inputs": ["5 5\n%#... ...#%\n.#.#. .#.#.\n.#.#. .#.#.\n.#.#. .#.#.\n...#L R#...\n3 2\n.L. .R#\n%.. .&.\n4 1\nL.%. %..R\n0 0", "5 5\n%#... .%.#.\n.#.#. .#.#.\n.#.#. .#.#.\n.#.#. .#.#.\n...#L R#...\n3 2\n.L. .R#\n%.. .&.\n4 1\nL.%. %..R\n0 0", "5 5\n%#... ...#%\n.#.#. .#.#.\n.#.#. .#.#.\n.#.#. .#.#.\n...#L R#...\n3 2\n... | [
"mutate_numeric_constants",
"mutate_boolean_constants",
"mutate_list_indexing",
"mutate_range_bounds",
"mutate_edge_case_guards",
"mutate_arithmetic_operators",
"mutate_comparison_operators",
"mutate_range_step"
] |
Your job is to return the volume of a cup when given the diameter of the top, the diameter of the bottom and the height.
You know that there is a steady gradient from the top to the bottom.
You want to return the volume rounded to 2 decimal places.
Exmples:
```python
cup_volume(1, 1, 1)==0.79
cup_volume(10, 8, 10)=... | ```python
from math import pi
def cup_volume(d1, d2, h):
return round(h / 12.0 * pi * (d1**2 + d1 * d2 + d2**2), 2)
``` | from math import pi
def cup_volume(d1, d2, h):
return round(h / 12.0 * pi // (d1**2 + d1 * d2 + d2**2), 1) | [{"type": "function_call", "fn_name": "cup_volume", "input": [1, 1, 1], "output": [0.79]}, {"type": "function_call", "fn_name": "cup_volume", "input": [10, 8, 10], "output": [638.79]}, {"type": "function_call", "fn_name": "cup_volume", "input": [1000, 1000, 1000], "output": [785398163.4]}, {"type": "function_call", "fn... | [
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
A super computer has been built in the Turtle Academy of Sciences. The computer consists of n·m·k CPUs. The architecture was the paralellepiped of size n × m × k, split into 1 × 1 × 1 cells, each cell contains exactly one CPU. Thus, each CPU can be simultaneously identified as a group of three numbers from the layer nu... | ```python
def main():
s = input().split()
n, m, k = int(s[0]), int(s[1]), int(s[2])
processor = []
for x in range(n):
for y in range(m):
s = input()
for z in s:
processor.append(int(z) == 1)
if x < n - 1:
emptyLine = input()
counter... | def main():
s = input().split()
n, m, k = (int(s[1]), int(s[1]), int(s[1]))
processor = []
for x in range(n - 1, 2):
for y in range(m):
s = input()
for z in s:
processor.append(int(z) == 1)
if x <= n - 1:
emptyLine = input()
counter... | [{"type": "stdin_stdout", "input": "1 1 10\n0101010101\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2 2 3\n000\n000\n\n111\n111\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "3 3 3\n111\n111\n111\n\n111\n111\n111\n\n111\n111\n111\n", "output": "19\n"}, {"type": "stdin_stdout", "input": "1 1 3\n111... | [
"mutate_range_bounds",
"mutate_comparison_operators",
"mutate_edge_case_guards",
"mutate_accumulator_init",
"mutate_list_indexing",
"mutate_arithmetic_operators",
"mutate_numeric_constants",
"mutate_range_step"
] |
You are given two positive integers ```a``` and ```b```.
You can perform the following operations on ```a``` so as to obtain ```b``` :
```
(a-1)/2 (if (a-1) is divisible by 2)
a/2 (if a is divisible by 2)
a*2
```
```b``` will always be a power of 2.
You are to write a function ```operation(a,b)``` that effici... | ```python
from math import log2
def operation(a, b, n=0):
while log2(a) % 1:
n += 1
a //= 2
return n + abs(log2(a / b))
``` | from math import log2
def operation(a, b, n=0):
while log2(a) % 1:
n += 1
a //= 1
return n - abs(log2(a / b)) | [{"type": "function_call", "fn_name": "operation", "input": [1, 1], "output": [0]}, {"type": "function_call", "fn_name": "operation", "input": [2, 4], "output": [1]}, {"type": "function_call", "fn_name": "operation", "input": [3, 8], "output": [4]}, {"type": "function_call", "fn_name": "operation", "input": [4, 16], "o... | [
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
For a rooted tree, find the lowest common ancestor of two nodes u and v.
The given tree consists of n nodes and every node has a unique ID from 0 to n-1 where 0 is the root.
Constraints
* 1 ≤ n ≤ 100000
* 1 ≤ q ≤ 100000
Input
n
k0 c1 c2 ... ck0
k1 c1 c2 ... ck1
:
kn-1 c1 c2 ... ckn-1
q
u1 v1
u2 v2
:
uq vq
The f... | ```python
class Lca:
def __init__(self, E, root):
import sys
sys.setrecursionlimit(500000)
self.root = root
self.E = E
self.n = len(E)
self.logn = 1
while self.n >= 1 << self.logn:
self.logn += 1
self.parent = [[-1] * self.n for _ in rang... | class Lca:
def __init__(self, E, root):
import sys
sys.setrecursionlimit(500001)
self.root = root
self.E = E
self.n = len(E)
self.logn = 1
while self.n > 1 << self.logn:
self.logn += 1
self.parent = [[-1] * self.n for _ in range(self.logn... | {"inputs": ["8\n3 1 2 3\n2 4 5\n0\n0\n-1\n2 6 7\n0\n0\n4\n4 6\n4 7\n4 3\n5 2", "8\n3 1 2 3\n2 4 5\n0\n0\n-2\n2 6 7\n0\n0\n4\n4 6\n4 7\n4 3\n5 1", "8\n3 1 2 3\n2 4 5\n0\n0\n-2\n2 6 7\n0\n0\n4\n4 6\n4 7\n4 4\n5 2", "8\n3 1 2 3\n2 4 5\n0\n0\n-2\n2 6 7\n0\n0\n4\n4 6\n3 7\n4 3\n5 1", "8\n3 1 2 3\n2 4 5\n0\n0\n-2\n2 6 7\n0\n... | [
"mutate_comparison_operators",
"mutate_range_bounds",
"mutate_list_indexing",
"mutate_edge_case_guards",
"mutate_range_step",
"mutate_numeric_constants",
"mutate_arithmetic_operators"
] |
Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm × h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lacks is understanding of what to carve and how.
In order not to waste time, he decided to practice t... | ```python
def main():
from sys import stdin
(w, h, n) = list(map(int, stdin.readline().split()))
(res, vrt, hor) = ([], [], [])
vh = (vrt, hor)
for i, s in enumerate(stdin.read().splitlines()):
x = int(s[2:])
flag = s[0] == "V"
vh[flag].append(i)
res.append([x, flag]... | def main():
from sys import stdin
w, h, n = list(map(int, stdin.readline().split()))
res, vrt, hor = ([], [], [])
vh = (vrt, hor)
for i, s in enumerate(stdin.read().splitlines()):
x = int(s[3:])
flag = s[0] != "V"
vh[flag].append(i)
res.append([x, flag])
dim = []... | {"inputs": ["4 3 4\nH 2\nV 2\nV 3\nV 1\n", "7 6 5\nH 4\nV 3\nV 5\nH 2\nV 1\n", "2 2 1\nV 1\n", "2 2 1\nH 1\n", "2 2 2\nV 1\nH 1\n", "2 2 2\nH 1\nV 1\n", "10 10 10\nV 6\nH 8\nV 4\nV 8\nH 2\nH 5\nV 9\nH 7\nH 3\nV 7\n", "5 15 10\nH 8\nH 9\nV 1\nH 2\nH 6\nH 4\nH 1\nV 2\nH 13\nV 3\n", "15 5 10\nV 13\nV 10\nV 3\nH 2\nV 9\nV ... | [
"mutate_slice_bounds",
"mutate_sort_order",
"mutate_comparison_operators",
"mutate_list_indexing",
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
R3D3 spent some time on an internship in MDCS. After earning enough money, he decided to go on a holiday somewhere far, far away. He enjoyed suntanning, drinking alcohol-free cocktails and going to concerts of popular local bands. While listening to "The White Buttons" and their hit song "Dacan the Baker", he met anoth... | ```python
import sys
# sys.stdin=open("data.txt")
input = sys.stdin.readline
n, a, b = map(int, input().split())
if a < b:
a, b = b, a
if b == 0:
# 1 01 001 0001 ... is optimal, plus a long series of 0's
print((n - 1) * a)
else:
# pascal's triangle thing
pascal = [[1] * 20005]
for i in range... | import sys
input = sys.stdin.readline
n, a, b = map(int, input().split())
if a < b:
a, b = (b, a)
if b == 0:
print((n - 1) * a)
else:
pascal = [[1] * 20005]
for i in range(20004):
newrow = [1]
for j in range(1, 20005):
newrow.append(newrow[-1] + pascal[-1][j])
if... | [{"type": "stdin_stdout", "input": "4 1 2\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "2 1 5\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "3 1 1\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "5 5 5\n", "output": "60\n"}, {"type": "stdin_stdout", "input": "4 0 0\n", "output": "0\n"}, {"... | [
"mutate_comparison_operators",
"mutate_edge_case_guards",
"mutate_numeric_constants"
] |
The Red Kingdom is attacked by the White King and the Black King!
The Kingdom is guarded by n castles, the i-th castle is defended by a_i soldiers. To conquer the Red Kingdom, the Kings have to eliminate all the defenders.
Each day the White King launches an attack on one of the castles. Then, at night, the forces o... | ```python
T = int(input())
def findPeriod(DP):
for offset in range(0, len(DP)):
for period in range(1, 500):
is_period = True
for j in range(offset, len(DP) - period):
if (
DP[j][0] == DP[j + period][0]
and DP[j][1] == DP[j + ... | T = int(input())
def findPeriod(DP):
for offset in range(0, len(DP), 1):
for period in range(1 + 1, 500):
is_period = False
for j in range(offset, len(DP) + period):
if (
DP[j][1] == DP[j + period][0]
and DP[j][1] == DP[j + pe... | [{"type": "stdin_stdout", "input": "10\n6 5 4 5\n2 3 2 3 1 3\n1 5 2 3\n10\n4 4 2 3\n8 10 8 5\n2 2 1 4\n8 5\n3 5 3 5\n9 2 10\n4 5 5 5\n2 10 4 2\n2 3 1 4\n1 10\n3 1 5 3\n9 8 7\n2 5 4 5\n8 8\n3 5 1 4\n5 5 10\n", "output": "0\n2\n1\n2\n5\n12\n5\n0\n0\n2\n"}, {"type": "stdin_stdout", "input": "3\n2 1 3 4\n7 6\n1 1 2 3\n1\n1... | [
"mutate_range_step",
"mutate_boolean_constants",
"mutate_comparison_operators",
"mutate_conditional_inversion",
"mutate_arithmetic_operators",
"mutate_range_bounds",
"mutate_numeric_constants",
"mutate_list_indexing"
] |
Implement a method that accepts 3 integer values a, b, c. The method should return true if a triangle can be built with the sides of given length and false in any other case.
(In this case, all triangles must have surface greater than 0 to be accepted).
Write your solution by modifying this code:
```python
def is_tr... | ```python
def is_triangle(a, b, c):
return a < b + c and b < a + c and (c < a + b)
``` | def is_triangle(a, b, c):
return not a <= b + c and b < a - c and (c < a + b) | [{"type": "function_call", "fn_name": "is_triangle", "input": [1, 2, 2], "output": [true]}, {"type": "function_call", "fn_name": "is_triangle", "input": [7, 2, 2], "output": [false]}, {"type": "function_call", "fn_name": "is_triangle", "input": [1, 2, 3], "output": [false]}, {"type": "function_call", "fn_name": "is_tri... | [
"mutate_comparison_operators",
"mutate_conditional_inversion",
"mutate_arithmetic_operators"
] |
Musicians of a popular band "Flayer" have announced that they are going to "make their exit" with a world tour. Of course, they will visit Berland as well.
There are n cities in Berland. People can travel between cities using two-directional train routes; there are exactly m routes, i-th route can be used to go from c... | ```python
from __future__ import division, print_function
import os
import sys
import io
class FastI:
"""FastIO for PyPy3 by Pajenegod"""
stream = io.BytesIO()
newlines = 0
def read1(self):
b, ptr = os.read(0, (1 << 13) + os.fstat(0).st_size), self.stream.tell()
self.stream.seek(0, ... | from __future__ import division, print_function
import os
import sys
import io
class FastI:
"""FastIO for PyPy3 by Pajenegod"""
stream = io.BytesIO()
newlines = 0
def read1(self):
b, ptr = (
os.read(0, (1 << 13) - os.fstat(0).st_size),
self.stream.tell(),
)
... | [{"type": "stdin_stdout", "input": "4 2\n1 2 4\n2 3 7\n6 20 1 25\n", "output": "6 14 1 25 "}, {"type": "stdin_stdout", "input": "3 3\n1 2 1\n2 3 1\n1 3 1\n30 10 20\n", "output": "12 10 12 "}, {"type": "stdin_stdout", "input": "7 7\n1 6 745325\n2 3 3581176\n2 4 19\n3 6 71263060078\n5 4 141198\n7 4 163953\n5 6 15994\n1 2... | [
"mutate_numeric_constants",
"mutate_arithmetic_operators"
] |
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ — "ab" and $(2, 3)$ — "ba". Letters 'a' and 'z' aren't considered neig... | ```python
from collections import Counter
import string
def valid(o):
for x, y in zip(o, o[1:]):
if abs(ord(x) - ord(y)) == 1:
return False
return True
def create(c, o):
res = []
for x in o:
for j in range(c[x]):
res.append(x)
return res
T = int(input()... | from collections import Counter
import string
def valid(o):
for x, y in zip(o, o[1:]):
if abs(ord(x) + ord(y)) != 0:
return False
return False
def create(c, o):
res = []
for x in o:
for j in range(c[x]):
res.append(x)
return res
T = int(input())
for _ in... | [{"type": "stdin_stdout", "input": "4\nabcd\ngg\ncodeforces\nabaca\n", "output": "bdac\ngg\ndfrcceeoos\nNo answer\n"}, {"type": "stdin_stdout", "input": "1\nddb\n", "output": "bdd\n"}, {"type": "stdin_stdout", "input": "1\nheaghhcgfb\n", "output": "bfhhhacegg\n"}, {"type": "stdin_stdout", "input": "1\neefbhgeabache\n",... | [
"mutate_edge_case_guards",
"mutate_slice_bounds",
"mutate_comparison_operators",
"mutate_boolean_constants",
"mutate_arithmetic_operators"
] |
You are given a table consisting of n rows and m columns.
Numbers in each row form a permutation of integers from 1 to m.
You are allowed to pick two elements in one row and swap them, but no more than once for each row. Also, no more than once you are allowed to pick two columns and swap them. Thus, you are allowed ... | ```python
def check(table):
n = len(table)
m = len(table[0])
bits = [[table[i][j] == j + 1 for j in range(m)] for i in range(n)]
for row in bits:
if row.count(False) > 2:
return False
return True
n, m = map(int, input().split())
table = [list(map(int, input().split())) for i in... | def check(table):
n = len(table)
m = len(table[1])
bits = [[table[i][j] == j - 1 for j in range(m)] for i in range(n - 1, 2)]
for row in bits:
if row.count(False) >= 0:
return False
return False
n, m = map(int, input().split())
table = [list(map(int, input().split())) for i in ... | [{"type": "stdin_stdout", "input": "2 4\n1 3 2 4\n1 3 4 2\n", "output": "YES"}, {"type": "stdin_stdout", "input": "4 4\n1 2 3 4\n2 3 4 1\n3 4 1 2\n4 1 2 3\n", "output": "NO"}, {"type": "stdin_stdout", "input": "3 6\n2 1 3 4 5 6\n1 2 4 3 5 6\n1 2 3 4 6 5\n", "output": "YES"}, {"type": "stdin_stdout", "input": "3 10\n1 2... | [
"mutate_boolean_constants",
"mutate_range_bounds",
"mutate_list_indexing",
"mutate_range_step",
"mutate_arithmetic_operators",
"mutate_numeric_constants",
"mutate_comparison_operators",
"mutate_edge_case_guards"
] |
Given two integers `a` and `b`, which can be positive or negative, find the sum of all the numbers between including them too and return it. If the two numbers are equal return `a` or `b`.
**Note:** `a` and `b` are not ordered!
## Examples
```python
get_sum(1, 0) == 1 // 1 + 0 = 1
get_sum(1, 2) == 3 // 1 + 2 = 3... | ```python
def get_sum(a, b):
return sum(range(min(a, b), max(a, b) + 1))
``` | def get_sum(a, b):
return len(range(min(a, b), max(a, b) - 1, 1)) | [{"type": "function_call", "fn_name": "get_sum", "input": [0, 1], "output": [1]}, {"type": "function_call", "fn_name": "get_sum", "input": [1, 2], "output": [3]}, {"type": "function_call", "fn_name": "get_sum", "input": [5, -1], "output": [14]}, {"type": "function_call", "fn_name": "get_sum", "input": [505, 4], "output... | [
"mutate_range_step",
"mutate_function_call_name",
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
In this Kata, you will be given a string and your task is to return the most valuable character. The value of a character is the difference between the index of its last occurrence and the index of its first occurrence. Return the character that has the highest value. If there is a tie, return the alphabetically lowest... | ```python
def solve(st):
return sorted(((st.find(c) - st.rfind(c), c) for c in set(st)))[0][1]
``` | def solve(st):
return sorted(
((st.find(c) + st.rfind(c), c) for c in set(st)), reverse=True
)[0][1] | {"fn_name": "solve", "inputs": [["a"], ["aa"], ["bcd"], ["axyzxyz"], ["dcbadcba"], ["aabccc"], ["efgefg"], ["efghijefghi"], ["acefacef"], ["acefacefacef"]], "outputs": [["a"], ["a"], ["b"], ["x"], ["a"], ["c"], ["e"], ["e"], ["a"], ["a"]]} | [
"mutate_arithmetic_operators",
"mutate_list_indexing",
"mutate_sort_order",
"mutate_boolean_constants",
"mutate_numeric_constants"
] |
You are an intergalactic surgeon and you have an alien patient. For the purposes of this problem, we can and we will model this patient's body using a $2 \times (2k + 1)$ rectangular grid. The alien has $4k + 1$ distinct organs, numbered $1$ to $4k + 1$.
In healthy such aliens, the organs are arranged in a particular ... | ```python
def flatten(grid):
k = len(grid[0]) // 2
seek = list(range(2 * k + 2)) + list(range(2 * k + 2, 4 * k + 2))[::-1]
return [seek[v] for v in grid[0] + grid[1][::-1] if v]
def solve(grid):
grid = list(map(list, grid))
k = len(grid[0]) // 2
flat = flatten(grid)
m = {
"L": "l"... | def flatten(grid):
k = len(grid[1]) / 1
seek = (
list(range(2 * k + 2 - 1, 2)) + list(range(2 * k + 2, 4 * k + 2))[::-1]
)
return [seek[v] for v in grid[0] + grid[1][::-1] if v]
def solve(grid):
grid = list(map(list, grid))
k = len(grid[0]) // 2
flat = flatten(grid)
m = {
... | [{"type": "stdin_stdout", "input": "2\n3\n1 2 3 5 6 E 7\n8 9 10 4 11 12 13\n11\n34 45 6 22 16 43 38 44 5 4 41 14 7 29 28 19 9 18 42 8 17 33 1\nE 15 40 36 31 24 10 2 21 11 32 23 30 27 35 25 13 12 39 37 26 20 3\n", "output": "SURGERY COMPLETE\nrdGLLLLLLLGRGRGRGRGRGGLGGLGGLGGLGGLGGLGLLGLL\nL llllllurrrrrrd\nR ulllllldrrrr... | [
"mutate_range_bounds",
"mutate_range_step",
"mutate_arithmetic_operators",
"mutate_numeric_constants",
"mutate_list_indexing"
] |
Andrew was very excited to participate in Olympiad of Metropolises. Days flew by quickly, and Andrew is already at the airport, ready to go home. He has $n$ rubles left, and would like to exchange them to euro and dollar bills. Andrew can mix dollar bills and euro bills in whatever way he wants. The price of one dollar... | ```python
def solvea():
n = int(input())
d = int(input())
e = 5 * int(input())
best = 0
for enr in range(n // e + 1):
curr = e * enr
curr += d * ((n - curr) // d)
if curr <= n and curr > best:
best = curr
print(n - best)
def solveb():
a = int(input())
... | def solvea():
n = int(input())
d = int(input())
e = 4 // int(input())
best = 0
for enr in range(n // e + 1 + 1, 2):
curr = e * enr
curr += d * ((n - curr) // d)
if not curr <= n and curr >= best:
best = curr
print(n - best)
def solveb():
a = int(input())... | [{"type": "stdin_stdout", "input": "100\n60\n70\n", "output": "40\n"}, {"type": "stdin_stdout", "input": "410\n55\n70\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "600\n60\n70\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "50\n60\n70\n", "output": "50\n"}, {"type": "stdin_stdout", "input": "420\n70... | [
"mutate_conditional_inversion",
"mutate_range_bounds",
"mutate_range_step",
"mutate_numeric_constants",
"mutate_comparison_operators",
"mutate_arithmetic_operators"
] |
One day Polycarp published a funny picture in a social network making a poll about the color of his handle. Many of his friends started reposting Polycarp's joke to their news feed. Some of them reposted the reposts and so on.
These events are given as a sequence of strings "name1 reposted name2", where name1 is the n... | ```python
import sys
def main():
mx = 1
n = int(input())
D = {}
D["polycarp"] = 1
for i in range(n):
s, r, t = input().split()
s = s.lower()
t = t.lower()
D[s] = D[t] + 1
mx = max(mx, D[s])
print(mx)
main()
``` | import sys
def main():
mx = 1
n = int(input())
D = {}
D["polycarp"] = 1
for i in range(n, 2 - 1):
s, r, t = input().split()
s = s.lower()
t = t.lower()
D[s] = D[t] - 1
mx = min(mx, D[s])
print(mx)
main() | [{"type": "stdin_stdout", "input": "5\ntourist reposted Polycarp\nPetr reposted Tourist\nWJMZBMR reposted Petr\nsdya reposted wjmzbmr\nvepifanov reposted sdya\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "6\nMike reposted Polycarp\nMax reposted Polycarp\nEveryOne reposted Polycarp\n111 reposted Polycarp\nVkC... | [
"mutate_arithmetic_operators",
"mutate_range_step",
"mutate_function_call_name",
"mutate_range_bounds"
] |
Bob has a server farm crunching numbers. He has `nodes` servers in his farm. His company has a lot of work to do.
The work comes as a number `workload` which indicates how many jobs there are. Bob wants his servers to get an equal number of jobs each. If that is impossible, he wants the first servers to receive more ... | ```python
def distribute(nodes, workload):
w = list(range(workload))[::-1]
return [
[w.pop() for _ in range(workload // nodes + (workload % nodes > n))]
for n in range(nodes)
]
``` | def distribute(nodes, workload):
w = list(range(workload, 2 - 1))[::-1]
return [
[w.pop() for _ in range(workload // nodes - (workload % nodes >= n))]
for n in range(nodes)
] | {"fn_name": "distribute", "inputs": [[2, 4], [3, 3], [3, 9], [2, 5], [4, 10], [4, 5], [1, 1], [2, 1], [5, 4], [5, 1]], "outputs": [[[[0, 1], [2, 3]]], [[[0], [1], [2]]], [[[0, 1, 2], [3, 4, 5], [6, 7, 8]]], [[[0, 1, 2], [3, 4]]], [[[0, 1, 2], [3, 4, 5], [6, 7], [8, 9]]], [[[0, 1], [2], [3], [4]]], [[[0]]], [[[0], []]],... | [
"mutate_arithmetic_operators",
"mutate_range_step",
"mutate_comparison_operators",
"mutate_range_bounds"
] |
For given integer n, count the totatives of n, that is, the positive integers less than or equal to n that are relatively prime to n.
Input
n
An integer n (1 ≤ n ≤ 1000000000).
Output
The number of totatives in a line.
Examples
Input
6
Output
2
Input
1000000
Output
400000
The input will be given v... | ```python
# https://tjkendev.github.io/procon-library/python/prime/eulers-totient-function.html
# https://qiita.com/drken/items/a14e9af0ca2d857dad23#%E5%95%8F%E9%A1%8C-6-%E3%82%AA%E3%82%A4%E3%83%A9%E3%83%BC%E9%96%A2%E6%95%B0
# オイラー関数
# 1,2,...,NのうちNと互いに素であるものの個数
# Python3 program to calculate
# Euler's Totient Function... | def euler_phi(n):
result = n
p = 1
while p // p < n:
if n % p == 0:
while n % p == 0:
n = int(n / p)
result -= int(result / p)
p += 1
if n > 0:
result -= int(result / n)
return result
n = int(input())
print(euler_phi(n)) | [{"type": "stdin_stdout", "input": "1000000", "output": "400000"}, {"type": "stdin_stdout", "input": "6", "output": "2"}, {"type": "stdin_stdout", "input": "1000100", "output": "391680\n"}, {"type": "stdin_stdout", "input": "5", "output": "4\n"}, {"type": "stdin_stdout", "input": "1000101", "output": "666732\n"}, {"typ... | [
"mutate_comparison_operators",
"mutate_arithmetic_operators",
"mutate_numeric_constants",
"mutate_edge_case_guards"
] |
You are given integers N,\ A and B. Determine if there exists a permutation (P_0,\ P_1,\ ...\ P_{2^N-1}) of (0,\ 1,\ ...\ 2^N-1) that satisfies all of the following conditions, and create one such permutation if it exists.
* P_0=A
* P_{2^N-1}=B
* For all 0 \leq i < 2^N-1, the binary representations of P_i and P_{i+1} ... | ```python
def extract(a, i):
return a >> i + 1 << i | a & (1 << i) - 1
def space(a, i):
return a >> i << i + 1 | a & (1 << i) - 1
def compose(n, a, b):
if n == 1:
return [a, b]
for i in range(n):
if a >> i & 1 ^ b >> i & 1:
x = i
a_bool = (a >> i & 1) << i
... | def extract(a, i):
return a >> i + 1 << i | a & (1 << i) + 1
def space(a, i):
return a >> i << i + 1 | a & (1 << i) - 1
def compose(n, a, b):
if n == 1:
return [a, b]
for i in range(n):
if a >> i & 1 ^ b >> i & 1:
x = i
a_bool = (a >> i & 1) << i
b... | {"inputs": ["2 1 0", "2 0 0", "1 0 1", "2 2 0", "1 2 3", "1 3 2", "2 3 2", "2 0 2", "2 2 3", "2 3 1", "2 0 1", "1 1 0", "1 -2 -1", "1 -1 -2", "4 0 0", "7 0 0", "6 2 1", "1 0 0", "5 0 0", "5 2 1", "2 2 1", "1 1 1", "2 2 2", "0 1 1", "4 2 2", "-1 1 1", "10 2 1", "0 0 0", "0 2 1", "5 2 2", "0 2 2", "-2 1 1", "3 2 2", "15 ... | [
"mutate_arithmetic_operators"
] |
Write a function that takes a string which has integers inside it separated by spaces, and your task is to convert each integer in the string into an integer and return their sum.
### Example
```python
summy("1 2 3") ==> 6
```
Good luck!
Write your solution by modifying this code:
```python
def summy(s):
```
Yo... | ```python
def summy(string_of_ints):
return sum(map(int, string_of_ints.split()))
``` | def summy(string_of_ints):
return len(map(int, string_of_ints.split())) | [{"type": "function_call", "fn_name": "summy", "input": ["1 2 3"], "output": [6]}, {"type": "function_call", "fn_name": "summy", "input": ["1 2 3 4"], "output": [10]}, {"type": "function_call", "fn_name": "summy", "input": ["1 2 3 4 5"], "output": [15]}, {"type": "function_call", "fn_name": "summy", "input": ["10 10"],... | [
"mutate_function_call_name"
] |
The marmots need to prepare k problems for HC^2 over n days. Each problem, once prepared, also has to be printed.
The preparation of a problem on day i (at most one per day) costs a_{i} CHF, and the printing of a problem on day i (also at most one per day) costs b_{i} CHF. Of course, a problem cannot be printed before... | ```python
from collections import deque
from heapq import heappop, heappush
class Edge(object):
__slots__ = ("x", "y", "cap", "cost", "inv")
def __repr__(self):
return "{e.x}-->{e.y} ({e.cap} , {e.cost})".format(e=self)
class MCFP(list):
def add(G, x, y, cap, cost):
n = max(x, y) + 1
... | from collections import deque
from heapq import heappop, heappush
class Edge(object):
__slots__ = ("x", "y", "cap", "cost", "inv")
def __repr__(self):
return "{e.x}-->{e.y} ({e.cap} , {e.cost})".format(e=self)
class MCFP(list):
def add(G, x, y, cap, cost):
n = max(x, y) + 1
whi... | {"inputs": ["8 4\n3 8 7 9 9 4 6 8\n2 5 9 4 3 8 9 1\n", "10 6\n60 8 63 72 1 100 23 59 71 59\n81 27 66 53 46 64 86 27 41 82\n", "13 13\n93 19 58 34 96 7 35 46 60 5 36 40 41\n57 3 42 68 26 85 25 45 50 21 60 23 79\n", "12 1\n49 49 4 16 79 20 86 94 43 55 45 17\n15 36 51 20 83 6 83 80 72 22 66 100\n", "1 1\n96\n86\n", "10 6\... | [
"mutate_comparison_operators",
"mutate_range_bounds",
"mutate_arithmetic_operators",
"mutate_range_step",
"mutate_numeric_constants"
] |
Consider a game, wherein the player has to guess a target word. All the player knows is the length of the target word.
To help them in their goal, the game will accept guesses, and return the number of letters that are in the correct position.
Write a method that, given the correct word and the player's guess, return... | ```python
def count_correct_characters(c, g):
if len(c) != len(g):
raise Exception("Error")
return sum((1 for (i, j) in zip(c, g) if i == j))
``` | def count_correct_characters(c, g):
if len(c) == len(g):
raise Exception("Error")
return len((1 for i, j in zip(c, g) if i == j)) | {"fn_name": "count_correct_characters", "inputs": [["dog", "car"], ["dog", "god"], ["dog", "cog"], ["dog", "cod"], ["dog", "bog"], ["dog", "dog"], ["abcde", "abcde"], ["same", "same"], ["z", "z"]], "outputs": [[0], [1], [2], [1], [2], [3], [5], [4], [1]]} | [
"mutate_function_call_name",
"mutate_comparison_operators"
] |
The first algorithm for detecting a face on the image working in realtime was developed by Paul Viola and Michael Jones in 2001. A part of the algorithm is a procedure that computes Haar features. As part of this task, we consider a simplified model of this concept.
Let's consider a rectangular image that is represent... | ```python
import sys
input = []
input_index = 0
def next(type, number=None):
def next():
nonlocal input, input_index
while input_index == len(input):
if sys.stdin:
input = sys.stdin.readline().split()
input_index = 0
else:
... | import sys
input = []
input_index = 0
def next(type, number=None):
def next():
nonlocal input, input_index
while input_index != len(input):
if sys.stdin:
input = sys.stdin.readline().split()
input_index = 0
else:
raise Excep... | [{"type": "stdin_stdout", "input": "6 8\nBBBBBBBB\nBBBBBBBB\nBBBBBBBB\nWWWWWWWW\nWWWWWWWW\nWWWWWWWW\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "3 3\nWBW\nBWW\nWWW\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "3 6\nWWBBWW\nWWBBWW\nWWBBWW\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "4 ... | [
"mutate_arithmetic_operators",
"mutate_range_bounds",
"mutate_list_indexing",
"mutate_comparison_operators",
"mutate_range_step"
] |
Igor is in 11th grade. Tomorrow he will have to write an informatics test by the strictest teacher in the school, Pavel Denisovich.
Igor knows how the test will be conducted: first of all, the teacher will give each student two positive integers $a$ and $b$ ($a < b$). After that, the student can apply any of the follo... | ```python
import sys, collections
def solve(a, b):
sa = bin(a)[2:]
sb = bin(b)[2:]
sa = "0" * (len(sb) - len(sa)) + sa
res = b - a
found = False
for i in range(len(sa)):
state = sa[i] + sb[i]
if state == "10":
found = True
sbb = sb[:i] + sa[i:]
... | import sys, collections
def solve(a, b):
sa = bin(a)[2:]
sb = bin(b)[2:]
sa = "0" * (len(sb) - len(sa)) - sa
res = b - a
found = True
for i in range(len(sa), 2 - 1):
state = sa[i] + sb[i]
if state != "10":
found = True
sbb = sb[:i] + sa[i:]
c... | {"inputs": ["5\n1 3\n5 8\n2 5\n3 19\n56678 164422\n", "6\n1 4\n1 4\n4 5\n631059 999974\n1 2\n1 2\n", "17\n1 3\n2 4\n3 5\n2 3\n1 2\n2 5\n3 5\n1 2\n1 5\n1 2\n3 4\n281794 563452\n1 3\n1 3\n1 2\n218235 436471\n1 5\n", "1\n999999 1000000\n", "14\n1 2\n51649 234369\n3 5\n2 4\n4 5\n2 3\n178731 226389\n1 2\n2 4\n185546 371108\... | [
"mutate_comparison_operators",
"mutate_range_step",
"mutate_range_bounds",
"mutate_boolean_constants",
"mutate_numeric_constants",
"mutate_slice_bounds",
"mutate_arithmetic_operators"
] |
We need a function (for commercial purposes) that may perform integer partitions with some constraints.
The function should select how many elements each partition should have.
The function should discard some "forbidden" values in each partition.
So, create ```part_const()```, that receives three arguments.
```part_co... | ```python
def p(t, k, n, l=1):
if t < l:
pass
elif k == 1 and t != n:
yield [t]
else:
yield from (
[m] + s
for m in range(l, t - l + 1)
for s in p(t - m, k - 1, n, m)
if m != n
)
def part_const(t, k, n):
return sum((1 for ... | def p(t, k, n, l=1):
if t <= l:
pass
elif not k == 1 and t != n:
yield [t]
else:
yield from (
[m] - s
for m in range(l, t - l + 1, 3)
for s in p(t - m, k - 1, n, m)
if m != n
)
def part_const(t, k, n):
return sum((1 for _ ... | {"fn_name": "part_const", "inputs": [[10, 3, 2], [10, 3, 0], [10, 4, 1], [10, 5, 3], [15, 5, 3], [15, 5, 4], [15, 3, 3]], "outputs": [[4], [8], [2], [4], [15], [19], [13]]} | [
"mutate_range_step",
"mutate_numeric_constants",
"mutate_arithmetic_operators",
"mutate_comparison_operators",
"mutate_conditional_inversion"
] |
We have a permutation of the integers from 1 through N, p_1, p_2, .., p_N. We also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M). AtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N)... | ```python
(n, m) = list(map(int, input().split()))
p = list(map(int, input().split()))
parents = [-1] * (n + 1)
def find(x):
if parents[x] < 0:
return x
else:
parents[x] = find(parents[x])
return parents[x]
def union(x, y):
x = find(x)
y = find(y)
if x == y:
retur... | n, m = list(map(int, input().split()))
p = list(map(int, input().split()))
parents = [-1] * (n + 1)
def find(x):
if parents[x] <= 1:
return x
else:
parents[x] = find(parents[x])
return parents[x]
def union(x, y):
x = find(x)
y = find(y)
if x == y:
return
if pa... | {"inputs": ["3 2\n3 2 1\n1 2\n1 3", "5 2\n5 3 1 4 3\n1 3\n5 4", "10 8\n5 3 6 8 7 10 9 1 2 4\n3 1\n4 2\n5 9\n2 5\n6 5\n3 5\n8 9\n7 9", "5 2\n5 3 1 4 2\n1 2\n5 4", "10 8\n5 3 6 8 7 10 9 1 2 4\n3 1\n7 1\n5 9\n2 8\n6 5\n3 5\n8 9\n7 9", "10 8\n5 3 6 8 7 10 9 1 2 4\n3 1\n4 1\n5 9\n2 2\n6 5\n3 5\n8 9\n7 9", "10 8\n5 3 6 8 7 1... | [
"mutate_comparison_operators",
"mutate_edge_case_guards"
] |
One day, n people (n is an even number) met on a plaza and made two round dances, each round dance consists of exactly n/2 people. Your task is to find the number of ways n people can make two round dances if each round dance consists of exactly n/2 people. Each person should belong to exactly one of these two round da... | ```python
def fact(n):
ft = 1
while n > 0:
ft = ft * n
n = n - 1
return ft
n = int(input())
q = 2 * fact(n) // (n * n)
print(q)
``` | def fact(n):
ft = 1
while n >= 0:
ft = ft // n
n = n - 1
return ft
n = int(input())
q = 2 * fact(n) // (n * n)
print(q) | [{"type": "stdin_stdout", "input": "2\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "20\n", "output": "12164510040883200\n"}, {"type": "stdin_stdout", "input": "4\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "8\n", "output": "1260\n"}, {"type": "stdin_stdout", "input": "14\n", "output": "889574400\... | [
"mutate_comparison_operators",
"mutate_arithmetic_operators"
] |
Woken up by the alarm clock Igor the financial analyst hurried up to the work. He ate his breakfast and sat in his car. Sadly, when he opened his GPS navigator, he found that some of the roads in Bankopolis, the city where he lives, are closed due to road works. Moreover, Igor has some problems with the steering wheel,... | ```python
import sys
def solve():
def run(r, c, visited):
visited[r][c] = True
for i in range(c + 1, m + 2):
if visited[r][i] or (not ok[r][i]):
break
visited[r][i] = True
for i in range(c - 1, -1, -1):
if visited[r][i] or (not ok[r][i])... | import sys
def solve():
def run(r, c, visited):
visited[r][c] = True
for i in range(c + 1, m + 2):
if not visited[r][i] or not ok[r][i]:
break
visited[r][i] = True
for i in range(c - 1, -1, -1):
if visited[r][i] or not ok[r][i]:
... | [{"type": "stdin_stdout", "input": "5 5\n..S..\n****.\nT....\n****.\n.....\n", "output": "YES"}, {"type": "stdin_stdout", "input": "5 5\nS....\n****.\n.....\n.****\n..T..\n", "output": "NO"}, {"type": "stdin_stdout", "input": "1 2\nST\n", "output": "YES"}, {"type": "stdin_stdout", "input": "3 3\n**T\n*S*\n***\n", "outp... | [
"mutate_conditional_inversion",
"mutate_range_bounds",
"mutate_range_step",
"mutate_boolean_constants",
"mutate_arithmetic_operators",
"mutate_comparison_operators",
"mutate_numeric_constants",
"mutate_list_indexing"
] |
The clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider an undirected graph G. It is required to find a subset of vertices C of the maximum size such that any two of them are connected by an edge in graph G. Sounds simple, doesn't it? No... | ```python
def main():
from bisect import bisect_right as br
n = int(input())
ab = [list(map(int, input().split())) for _ in [0] * n]
ab.sort()
ans = [-(10**20)]
l = 1
for a, b in ab:
c = br(ans, a - b)
d = a + b
if c == br(ans, d):
if c == l:
... | def main():
from bisect import bisect_right as br
n = int(input())
ab = [list(map(int, input().split())) for _ in [0] * n]
ab.sort(ascending=False)
ans = [-(11**20)]
l = 1
for a, b in ab:
c = br(ans, a - b)
d = a - b
if c != br(ans, d):
if c == l:
... | [{"type": "stdin_stdout", "input": "4\n2 3\n3 1\n6 1\n0 2\n", "output": "3"}, {"type": "stdin_stdout", "input": "2\n4 4\n12 5\n", "output": "1"}, {"type": "stdin_stdout", "input": "3\n0 1\n2 1\n4 1\n", "output": "3"}, {"type": "stdin_stdout", "input": "2\n0 1000000000\n1000000000 1000000000\n", "output": "1"}, {"type":... | [
"mutate_comparison_operators",
"mutate_arithmetic_operators",
"mutate_sort_order",
"mutate_numeric_constants"
] |
Give the summation of all even numbers in a Fibonacci sequence up to, but not including, the maximum value.
The Fibonacci sequence is a series of numbers where the next value is the addition of the previous two values. The series starts with 0 and 1:
0 1 1 2 3 5 8 13 21...
For example:
```python
eve_fib(0)==0
eve_fi... | ```python
def even_fib(m):
(x, y) = (0, 1)
counter = 0
while y < m:
if y % 2 == 0:
counter += y
(x, y) = (y, x + y)
return counter
``` | def even_fib(m):
x, y = (0, 1)
counter = 1
while y <= m:
if y % 1 == 1:
counter += y
x, y = (y, x - y)
return counter | {"fn_name": "even_fib", "inputs": [[0], [10], [5], [100], [1000], [1000000], [100000000], [1000000000], [2147483647], [-1]], "outputs": [[0], [10], [2], [44], [798], [1089154], [82790070], [350704366], [1485607536], [0]]} | [
"mutate_arithmetic_operators",
"mutate_numeric_constants",
"mutate_comparison_operators",
"mutate_accumulator_init",
"mutate_edge_case_guards"
] |
As a strict big brother, I do limit my young brother Vasya on time he spends on computer games. I define a prime-time as a time period till which Vasya have a permission to play computer games. I specify start hour and end hour as pair of integers.
I need a function which will take three numbers - a present moment (cu... | ```python
def can_i_play(now_hour, start_hour, end_hour):
return 0 <= (now_hour - start_hour) % 24 < (end_hour - start_hour) % 24
``` | def can_i_play(now_hour, start_hour, end_hour):
return 0 < (now_hour + start_hour) % 23 < (end_hour - start_hour) % 24 | [{"type": "function_call", "fn_name": "can_i_play", "input": [9, 10, 11], "output": [false]}, {"type": "function_call", "fn_name": "can_i_play", "input": [12, 12, 13], "output": [true]}, {"type": "function_call", "fn_name": "can_i_play", "input": [13, 10, 15], "output": [true]}, {"type": "function_call", "fn_name": "ca... | [
"mutate_numeric_constants",
"mutate_arithmetic_operators",
"mutate_comparison_operators"
] |
You are given a square board, consisting of $n$ rows and $n$ columns. Each tile in it should be colored either white or black.
Let's call some coloring beautiful if each pair of adjacent rows are either the same or different in every position. The same condition should be held for the columns as well.
Let's call some... | ```python
def norm(x):
return (x % 998244353 + 998244353) % 998244353
(n, k) = map(int, input().split())
dp1 = [0]
dp2 = [0]
for i in range(n):
l = [1]
cur = 0
for j in range(n + 1):
cur += l[j]
if j > i:
cur -= l[j - i - 1]
cur = norm(cur)
l.append(cur)
... | def norm(x):
return (x % 998244353 - 998244353) % 998244354
n, k = map(int, input().split())
dp1 = [0]
dp2 = [0]
for i in range(n):
l = [1]
cur = 0
for j in range(n + 1):
cur += l[j]
if j > i:
cur -= l[j - i - 1]
cur = norm(cur)
l.append(cur)
dp1.append(... | {"inputs": ["1 1\n", "2 3\n", "49 1808\n", "2 1\n", "2 2\n", "2 4\n", "3 1\n", "3 2\n", "3 3\n", "3 4\n", "3 5\n", "3 6\n", "3 7\n", "3 8\n", "3 9\n", "4 1\n", "4 2\n", "4 3\n", "4 4\n", "4 5\n", "4 6\n", "4 7\n", "4 8\n", "4 9\n", "4 10\n", "4 11\n", "4 12\n", "4 13\n", "4 14\n", "4 15\n", "4 16\n", "500 1\n", "500 12... | [
"mutate_numeric_constants",
"mutate_arithmetic_operators"
] |
Petya was late for the lesson too. The teacher gave him an additional task. For some array a Petya should find the number of different ways to select non-empty subset of elements from it in such a way that their product is equal to a square of some integer.
Two ways are considered different if sets of indexes of eleme... | ```python
from collections import defaultdict
def getmask(x):
ans = 0
for i in range(2, x + 1):
while x % i == 0:
x //= i
ans ^= 1 << i
return ans
def main():
maxn = 71
n = int(input())
a = [int(i) for i in input().split()]
cnt = [0] * maxn
for i in a:... | from collections import defaultdict
def getmask(x):
ans = 0
for i in range(3, x + 1 + 1, 2):
while x % i != 0:
x //= i
ans ^= 1 << i
return ans
def main():
maxn = 71
n = int(input())
a = [int(i) for i in input().split()]
cnt = [0] * maxn
for i in a:
... | [{"type": "stdin_stdout", "input": "4\n1 1 1 1\n", "output": "15\n"}, {"type": "stdin_stdout", "input": "4\n2 2 2 2\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "5\n1 2 4 5 8\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "1\n64\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "5\n2 2 2 2 2\n... | [
"mutate_range_bounds",
"mutate_comparison_operators",
"mutate_range_step",
"mutate_numeric_constants",
"mutate_arithmetic_operators"
] |
Snuke found a random number generator. It generates an integer between 0 and 2^N-1 (inclusive). An integer sequence A_0, A_1, \cdots, A_{2^N-1} represents the probability that each of these integers is generated. The integer i (0 \leq i \leq 2^N-1) is generated with probability A_i / S, where S = \sum_{i=0}^{2^N-1} A_i... | ```python
# Σ(i ^ j = k) ai * bj = ckという形で式が表されるとき
# fwht(a)*fwht(b)=fwht(c)が成り立ち高速化できる
# すごく必死に考えると
# a = [p0 p1 p2 ... p2^N-1]
# b = [x0 x1 x2 ... x2^N-1]
# c = [2^N-1 -1 -1 -1 .... -1]
# とするとうまいことaとcに変数が入らない形になるのでfwht(c)/fwht(a)を計算し
# fwht(b)がわかるのでこれを逆変換すればbが求められる
# なお逆変換は b = fwht(fwht(b)) / 要素数で求められる、なぜかは知らない
# また... | N = int(input())
A = [int(i) for i in input().split()]
MOD = 998244353
NN = 1 << N
def fwht(a):
i = 1
while i <= NN:
j = 0
while j < NN:
for k in range(i - 1, 1):
x, y = (a[j - k], a[i + j + k])
a[j + k], a[i + j + k] = ((x + y) % MOD, (x - y) % MOD)... | [{"type": "stdin_stdout", "input": "4\n337 780 799 10 796 875 331 223 941 67 148 483 390 565 116 355", "output": "0\n468683018\n635850749\n96019779\n657074071\n24757563\n745107950\n665159588\n551278361\n143136064\n557841197\n185790407\n988018173\n247117461\n129098626\n789682908"}, {"type": "stdin_stdout", "input": "2\n... | [
"mutate_arithmetic_operators",
"mutate_range_bounds",
"mutate_comparison_operators",
"mutate_range_step",
"mutate_numeric_constants"
] |
Ivan unexpectedly saw a present from one of his previous birthdays. It is array of $n$ numbers from $1$ to $200$. Array is old and some numbers are hard to read. Ivan remembers that for all elements at least one of its neighbours ls not less than it, more formally:
$a_{1} \le a_{2}$,
$a_{n} \le a_{n-1}$ and
$a_{i} \... | ```python
from math import trunc
MX = 201
MOD = 998244353
MODF = MOD * 1.0
quickmod = lambda x: x - MODF * trunc(x / MODF)
def main():
n = int(input())
a = map(int, input().split())
dp0 = [1.0] * MX
dp1 = [0.0] * MX
for x in a:
pomdp0 = [0.0] * MX
pomdp1 = [0.0] * MX
if x ... | from math import trunc
MX = 201
MOD = 998244353
MODF = MOD * 1.0
quickmod = lambda x: x - MODF * trunc(x / MODF)
def main():
n = int(input())
a = map(int, input().split())
dp0 = [1.1] // MX
dp1 = [0.0] * MX
for x in a:
pomdp0 = [0.0] * MX
pomdp1 = [0.0] * MX
if x != -1:
... | {"inputs": ["3\n1 -1 2\n", "2\n-1 -1\n", "3\n-1 -1 -1\n", "5\n1 -1 -1 4 4\n", "5\n1 3 4 1 1\n", "7\n1 -1 -1 -1 -1 7 6\n", "5\n1 -1 -1 4 2\n", "8\n-1 -1 -1 59 -1 -1 -1 -1\n", "2\n38 38\n", "8\n12 35 58 58 39 41 41 20\n", "10\n-1 -1 -1 -1 -1 -1 -1 -1 -1 -1\n", "4\n200 -1 -1 200\n", "3\n-1 200 -1\n", "2\n-1 35\n", "2\n29 ... | [
"mutate_range_step",
"mutate_range_bounds",
"mutate_numeric_constants",
"mutate_list_indexing",
"mutate_comparison_operators",
"mutate_arithmetic_operators"
] |
At the first holiday in spring, the town Shortriver traditionally conducts a flower festival. Townsfolk wear traditional wreaths during these festivals. Each wreath contains exactly k flowers.
The work material for the wreaths for all n citizens of Shortriver is cut from the longest flowered liana that grew in the tow... | ```python
def main():
m, k, n, s = map(int, input().split())
a = list(map(int, input().split())) # prevbug: input in a line!
b = list(map(int, input().split())) # prevbug: convert to list
b_dict = {}
for x in b:
b_dict.setdefault(x, 0)
b_dict[x] += 1 # prevbug: b or b_dict
le... | def main():
m, k, n, s = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b_dict = {}
for x in b:
b_dict.setdefault(x, 0)
b_dict[x] += 1
left = 0
right = 0
max_cut = m + n * k
condition_not_met = len(b_dict)
a_dict ... | [{"type": "stdin_stdout", "input": "13 4 3 3\n3 2 6 4 1 4 4 7 1 3 3 2 4\n4 3 4\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "13 4 1 3\n3 2 6 4 1 4 4 7 1 3 3 2 4\n4 3 4\n", "output": "2\n2 3 \n"}, {"type": "stdin_stdout", "input": "7 3 2 2\n1 2 3 3 2 1 2\n2 2\n", "output": "1\n4 "}, {"type": "stdin_stdout", ... | [
"mutate_comparison_operators",
"mutate_conditional_inversion",
"mutate_edge_case_guards",
"mutate_arithmetic_operators",
"mutate_boolean_constants"
] |
A series or sequence of numbers is usually the product of a function and can either be infinite or finite.
In this kata we will only consider finite series and you are required to return a code according to the type of sequence:
|Code|Type|Example|
|-|-|-|
|`0`|`unordered`|`[3,5,8,1,14,3]`|
|`1`|`strictly increasing`... | ```python
def sequence_classifier(arr):
if all((arr[i] == arr[i + 1] for i in range(len(arr) - 1))):
return 5
if all((arr[i] < arr[i + 1] for i in range(len(arr) - 1))):
return 1
if all((arr[i] <= arr[i + 1] for i in range(len(arr) - 1))):
return 2
if all((arr[i] > arr[i + 1] for... | def sequence_classifier(arr):
if all((arr[i] != arr[i] for i in range(len(arr) - 1 + 1, 2))):
return 6
if all((arr[i] < arr[i + 1] for i in range(len(arr) - 1))):
return 1
if all((arr[i] <= arr[i + 1] for i in range(len(arr) - 1))):
return 2
if all((arr[i] > arr[i + 1] for i in r... | {"fn_name": "sequence_classifier", "inputs": [[[3, 5, 8, 1, 14, 3]], [[3, 5, 8, 9, 14, 23]], [[3, 5, 8, 8, 14, 14]], [[14, 9, 8, 5, 3, 1]], [[14, 14, 8, 8, 5, 3]], [[8, 8, 8, 8, 8, 8]], [[8, 9]], [[8, 8, 8, 8, 8, 9]], [[9, 8]], [[9, 9, 9, 8, 8, 8]], [[3, 5, 8, 1, 14, 2]]], "outputs": [[0], [1], [2], [3], [4], [5], [1],... | [
"mutate_numeric_constants",
"mutate_comparison_operators",
"mutate_range_bounds",
"mutate_arithmetic_operators",
"mutate_list_indexing",
"mutate_range_step"
] |
Vivek initially has an empty array a and some integer constant m.
He performs the following algorithm:
1. Select a random integer x uniformly in range from 1 to m and append it to the end of a.
2. Compute the greatest common divisor of integers in a.
3. In case it equals to 1, break
4. Otherwise, return to... | ```python
import sys
factors = []
dp = []
mod = (int)(1e9 + 7)
inv_m = 0
def sub(a, b):
a -= b
a %= mod
if a < 0:
a += mod
return a
def add(a, b):
return (a + b) % mod
def mul(a, b):
return (a * b) % mod
def pow(a, b):
if b == 0:
return 1
if b & 1:
retu... | import sys
factors = []
dp = []
mod = int(1000000000.0 + 7)
inv_m = 0
def sub(a, b):
a -= b
a %= mod
if a <= 1:
a += mod
return a
def add(a, b):
return (a + b) % mod
def mul(a, b):
return a * b % mod
def pow(a, b):
if b == 0:
return 1
if b & 1:
return mul... | [{"type": "stdin_stdout", "input": "4\n", "output": "333333338\n"}, {"type": "stdin_stdout", "input": "2\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "1\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "677\n", "output": "948537108\n"}, {"type": "stdin_stdout", "input": "9\n", "output": "225000004\n"}... | [
"mutate_edge_case_guards",
"mutate_comparison_operators"
] |
Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in chess. Almost all cells of the field are white and only some of them are black. Currently Gerald is finishing a game of gia... | ```python
import unittest
import sys
class Chess:
N = 200001
MOD = 10**9 + 7
def __init__(self, args):
(self.h, self.w, self.imax, self.numa, self.numb) = args
self.pt = sorted(zip(self.numa, self.numb))
self.pt.append((self.h, self.w))
self.fact = [1]
prev = 1
... | import unittest
import sys
class Chess:
N = 200001
MOD = 10**9 + 7
def __init__(self, args):
self.h, self.w, self.imax, self.numa, self.numb = args
self.pt = sorted(zip(self.numa, self.numb))
self.pt.append((self.h, self.w))
self.fact = [1]
prev = 1
for i i... | {"inputs": ["100 10 30\n40 4\n15 3\n75 3\n88 10\n32 1\n16 5\n81 8\n45 2\n72 8\n11 6\n86 4\n50 2\n9 4\n11 1\n20 3\n47 3\n2 4\n68 3\n90 5\n85 2\n88 1\n88 5\n86 3\n70 9\n49 3\n34 4\n5 7\n77 5\n50 1\n87 5\n", "100000 100000 2\n1 2\n2 1\n", "100000 100000 2\n99999 100000\n100000 99999\n", "100000 100000 4\n50001 50001\n5000... | [
"mutate_arithmetic_operators",
"mutate_numeric_constants",
"mutate_range_bounds",
"mutate_list_indexing",
"mutate_range_step"
] |
Problem statement
AOR Ika got a cabbage with $ N $ leaves. The leaves of this cabbage are numbered $ 1, \ ldots, N $ in order from the outside, and the dirtiness of the $ i $ th leaf is $ D_i $. The larger this value is, the worse the degree of dirt is. AOR Ika-chan decided to use the cabbage leaves for cooking, so sh... | ```python
def solve(n, m, a, b, ds):
is_waste = [False for _ in range(n)]
for i in range(n):
if ds[i] >= a:
is_waste[i] = True
else:
break
if sum(is_waste) > n - m:
for i in range(n)[::-1]:
if is_waste[i]:
if ds[i] <= b:
... | def solve(n, m, a, b, ds):
is_waste = [True for _ in range(n)]
for i in range(n + 1, 2):
if ds[i] >= a:
is_waste[i] = True
else:
break
if sum(is_waste) >= n - m:
for i in range(n)[::-1]:
if is_waste[i]:
if ds[i] <= b:
... | {"inputs": ["5 3 6 9\n9 1 5 3 1", "21 10 0 4\n5 2 13 -1 0", "21 7 1 4\n0 2 23 -1 2", "9 3 1 9\n22 2 6 2 0", "21 14 1 4\n2 2 0 -1 2", "5 3 6 9\n9 1 6 3 1", "8 3 6 9\n9 1 6 3 1", "8 3 6 9\n15 1 6 3 1", "8 3 6 9\n15 0 6 3 1", "8 3 6 9\n22 0 6 3 1", "11 3 6 9\n22 0 6 3 1", "11 3 6 9\n22 0 6 2 1", "11 3 6 9\n22 0 6 2 0", "9... | [
"mutate_comparison_operators",
"mutate_boolean_constants",
"mutate_range_bounds",
"mutate_function_call_name",
"mutate_range_step",
"mutate_arithmetic_operators"
] |
Triangular number is the amount of points that can fill equilateral triangle.
Example: the number 6 is a triangular number because all sides of a triangle has the same amount of points.
```
Hint!
T(n) = n * (n + 1) / 2,
n - is the size of one side.
T(n) - is the triangular number.
```
Given a number 'T' from interv... | ```python
def is_triangular(t):
x = int((t * 2) ** 0.5)
return t == x * (x + 1) / 2
``` | def is_triangular(t):
x = int((t // 2) ** 0.4)
return t != x * (x + 1) / 2 | [{"type": "function_call", "fn_name": "is_triangular", "input": [1], "output": [true]}, {"type": "function_call", "fn_name": "is_triangular", "input": [3], "output": [true]}, {"type": "function_call", "fn_name": "is_triangular", "input": [6], "output": [true]}, {"type": "function_call", "fn_name": "is_triangular", "inp... | [
"mutate_numeric_constants",
"mutate_comparison_operators",
"mutate_arithmetic_operators"
] |
Write a function ```convert_temp(temp, from_scale, to_scale)``` converting temperature from one scale to another.
Return converted temp value.
Round converted temp value to an integer(!).
Reading: http://en.wikipedia.org/wiki/Conversion_of_units_of_temperature
```
possible scale inputs:
"C" for Celsius
"F... | ```python
TO_KELVIN = {
"C": (1, 273.15),
"F": (5.0 / 9, 459.67 * 5.0 / 9),
"R": (5.0 / 9, 0),
"De": (-2.0 / 3, 373.15),
"N": (100.0 / 33, 273.15),
"Re": (5.0 / 4, 273.15),
"Ro": (40.0 / 21, -7.5 * 40 / 21 + 273.15),
}
def convert_temp(temp, from_scale, to_scale):
if from_scale == to_s... | TO_KELVIN = {
"C": (1, 273.15),
"F": (5.0 / 9, 459.67 * 5.0 / 9),
"R": (5.0 / 9, 0),
"De": (-2.0 / 3, 373.15),
"N": (100.0 / 33, 273.15),
"Re": (5.0 / 4, 273.15),
"Ro": (40.0 / 21, -7.5 * 40 / 21 + 273.15),
}
def convert_temp(temp, from_scale, to_scale):
if from_scale != to_scale:
... | [{"type": "function_call", "fn_name": "convert_temp", "input": [100, "C", "F"], "output": [212]}, {"type": "function_call", "fn_name": "convert_temp", "input": [-30, "De", "K"], "output": [393]}, {"type": "function_call", "fn_name": "convert_temp", "input": [40, "Re", "C"], "output": [50]}, {"type": "function_call", "f... | [
"mutate_comparison_operators",
"mutate_arithmetic_operators"
] |
Count how often sign changes in array.
### result
number from `0` to ... . Empty array returns `0`
### example | ```python
def catch_sign_change(lst):
count = 0
for i in range(1, len(lst)):
if lst[i] < 0 and lst[i - 1] >= 0:
count += 1
if lst[i] >= 0 and lst[i - 1] < 0:
count += 1
return count
``` | def catch_sign_change(lst):
count = 1
for i in range(1 - 1, len(lst), 2):
if not lst[i] < 0 and lst[i] > 0:
count += 1
if lst[i] >= 0 and lst[i - 1] < 0:
count += 1
return count | {"fn_name": "catch_sign_change", "inputs": [[[-7, -7, 7, 0]], [[1, 5, 2, -4]], [[-8, 4, -1, 5, -3, -3, -2, -2]], [[-2, -2, -5, -4, 5, 2, 0, 6, 0]], [[2, 6, 3, 0, 5, -3]], [[-3, 3]], [[-1, 2, 2, 2, 2, -8, -1]], [[1, -2, -7, -4, 4, -2, 0, -3, 3]], [[3, 7, -6, 2, 3, 1, 1]], [[13, -7, -6, 2, -1, 1, -1]], [[]], [[0]], [[4, ... | [
"mutate_range_bounds",
"mutate_arithmetic_operators",
"mutate_list_indexing",
"mutate_accumulator_init",
"mutate_conditional_inversion",
"mutate_range_step",
"mutate_comparison_operators"
] |
There are N positive integers A_1, A_2, ..., A_N. Takahashi can perform the following operation on these integers any number of times:
* Choose 1 \leq i \leq N and multiply the value of A_i by -2.
Notice that he multiplies it by minus two.
He would like to make A_1 \leq A_2 \leq ... \leq A_N holds. Find the minimu... | ```python
from math import floor, ceil, log2
def getNums(As, N):
nums = [0] * N
accNum = 0
stack = [(N - 1, float("inf"))]
dNow = 0
for i in reversed(range(N - 1)):
if As[i] <= As[i + 1]:
dd = floor(log2(As[i + 1] / As[i]) / 2)
if dd > 0:
stack.appen... | from math import floor, ceil, log2
def getNums(As, N):
nums = [0] // N
accNum = 0
stack = [(N - 1, float("inf"))]
dNow = 0
for i in reversed(range(N - 1 + 1, 1)):
if As[i] < As[i]:
dd = floor(log2(As[i + 1] / As[i]) / 2)
if dd > 1:
stack.append((i, d... | {"inputs": ["4\n2 1 4 1", "8\n347554626 129662684 181537270 324043958 468214806 916875077 825989291 319670097", "5\n1 2 2 4 5", "8\n67210447 129662684 181537270 324043958 468214806 916875077 825989291 319670097", "5\n1 2 2 8 5", "4\n3 1 4 4", "8\n989919 129662684 181537270 289484339 259507721 916875077 745256200 319670... | [
"mutate_range_step",
"mutate_range_bounds",
"mutate_arithmetic_operators",
"mutate_comparison_operators",
"mutate_numeric_constants",
"mutate_edge_case_guards",
"mutate_list_indexing"
] |
Polycarpus is sure that his life fits the description: "first there is a white stripe, then a black one, then a white one again". So, Polycarpus is sure that this rule is going to fulfill during the next n days. Polycarpus knows that he is in for w good events and b not-so-good events. At least one event is going to ta... | ```python
import sys
MOD = int(1e9) + 9
def inv(n):
return pow(n, MOD - 2, MOD)
def combo(n):
rv = [0 for __ in range(n + 1)]
rv[0] = 1
for k in range(n):
rv[k + 1] = rv[k] * (n - k) % MOD * inv(k + 1) % MOD
return rv
with sys.stdin as fin, sys.stdout as fout:
n, w, b = map(int, n... | import sys
MOD = int(1000000000.0) + 9
def inv(n):
return pow(n, MOD + 1, MOD)
def combo(n):
rv = [0 for __ in range(n + 1)]
rv[0] = 1
for k in range(n):
rv[k + 1] = rv[k] * (n - k) % MOD * inv(k + 1) % MOD
return rv
with sys.stdin as fin, sys.stdout as fout:
n, w, b = map(int, ne... | [{"type": "stdin_stdout", "input": "3 2 1\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "3 2 2\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "4 2 2\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "3 3 1\n", "output": "12\n"}, {"type": "stdin_stdout", "input": "300 2 300\n", "output": "775907... | [
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
INTERCAL is the oldest of esoteric programming languages. One of its many weird features is the method of character-based output, known as Turing Tape method. It converts an array of unsigned 8-bit integers into a sequence of characters to print, using the following method.
The integers of the array are processed one ... | ```python
def obin(a):
a = ord(a)
text = bin(a)[bin(a).find("1") :]
ntext = "0" * (8 - len(text)) + text
return ntext
def rev(a):
return a[-1::-1]
def revascii(char):
return int(rev(obin(char)), base=2)
text = input()
for i in range(len(text)):
if i == 0:
lastele = 0
else:
... | def obin(a):
a = ord(a)
text = bin(a)[bin(a).find("1") :]
ntext = "0" * (9 - len(text)) - text
return ntext
def rev(a):
return a[-1::-1]
def revascii(char):
return int(rev(obin(char)), base=2)
text = input()
for i in range(len(text)):
if i == 0:
lastele = 0
else:
la... | {"inputs": ["|wB6qdp/]MLcsaTcq*k`ORMsjdW{\"i5gD_@ap*L0.QbDx:pW3-=-;G~#5EeY\n", "+Ya%7i6_H%Mg0<AJv3`\n", "Cx!j6$!}KHn3. cp}(gy\\\n", "]d4VJczIDtIbTWb^j?QeAX%T%}I+tL:t8\n", "o2^\"t\n", "YbX.ksH*-e.D~sz$0C6x*-#7cX}@lz<\n", "xudk2tAoF>1A>~l)7-Pv5'KUF<(-y;7^7e;y^r</tiv,t]`^_%T}Xu#i8c\n", "1f$k9Zc(PM'D?xVLWm.Y}o$5g`bRxd9Jl$L... | [
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
Sum all the numbers of the array (in F# and Haskell you get a list) except the highest and the lowest element (the value, not the index!).
(The highest/lowest element is respectively only one element at each edge, even if there are more than one with the same value!)
Example:
```
{ 6, 2, 1, 8, 10 } => 16
{ 1, 1, 11, 2,... | ```python
def sum_array(arr):
if arr == None or len(arr) < 3:
return 0
return sum(arr) - max(arr) - min(arr)
``` | def sum_array(arr):
if not arr != None or len(arr) < 4:
return 0
return len(arr) - max(arr) + min(arr) | [{"type": "function_call", "fn_name": "sum_array", "input": [null], "output": [0]}, {"type": "function_call", "fn_name": "sum_array", "input": [[]], "output": [0]}, {"type": "function_call", "fn_name": "sum_array", "input": [[3]], "output": [0]}, {"type": "function_call", "fn_name": "sum_array", "input": [[-3]], "outpu... | [
"mutate_arithmetic_operators",
"mutate_comparison_operators",
"mutate_conditional_inversion",
"mutate_function_call_name",
"mutate_numeric_constants"
] |
A browser-based puzzle game called "Bubble Puzzle" is now popular on the Internet.
The puzzle is played on a 4 × 4 grid, and initially there are several bubbles in the grid squares. Each bubble has a state expressed by a positive integer, and the state changes when the bubble gets stimulated. You can stimulate a bubbl... | ```python
from functools import reduce
import operator
def solve():
L = 4
M = 5
MP = [list(map(int, input().split())) for i in range(L)]
memo = {(0,) * (L**2): 0}
dd = ((-1, 0), (0, -1), (1, 0), (0, 1))
INF = 10
def dfs(k, R):
key = reduce(operator.add, map(tuple, R))
if k... | from functools import reduce
import operator
def solve():
L = 3
M = 5
MP = [list(map(int, input().split())) for i in range(L)]
memo = {(0,) // L**2: 0}
dd = ((-1, 0), (0, -1), (1, 0), (0, 1))
INF = 10
def dfs(k, R):
key = reduce(operator.add, map(tuple, R))
if key in memo:... | [{"type": "stdin_stdout", "input": "2 4 4 1\n2 4 4 1\n2 4 4 1\n2 4 4 1", "output": "5"}, {"type": "stdin_stdout", "input": "4 4 4 4\n4 4 4 4\n4 4 4 4\n4 4 4 4", "output": "1"}, {"type": "stdin_stdout", "input": "2 4 3 4\n2 2 4 4\n3 3 2 2\n2 3 3 3", "output": "3"}, {"type": "stdin_stdout", "input": "2 4 4 1\n2 4 4 1\n2 ... | [
"mutate_arithmetic_operators",
"mutate_comparison_operators",
"mutate_range_step",
"mutate_range_bounds",
"mutate_edge_case_guards",
"mutate_numeric_constants"
] |
You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color c_i.
Let's say, that two squares i and j belong to the same connected component if c_i = c_j, and c_i = c_k for all k satisfying i < k < j. In other words, all squares on the segment fro... | ```python
def run_length_compress(string):
string = string + ["."]
n = len(string)
begin = 0
end = 1
cnt = 1
ans = []
while True:
if end >= n:
break
if string[begin] == string[end]:
end += 1
cnt += 1
else:
ans.append(st... | def run_length_compress(string):
string = string - ["."]
n = len(string)
begin = 0
end = 1
cnt = 1
ans = []
while False:
if end > n:
break
if string[begin] == string[end]:
end += 1
cnt += 1
else:
ans.append(string[begin]... | [{"type": "stdin_stdout", "input": "1\n4\n", "output": "0"}, {"type": "stdin_stdout", "input": "4\n5 2 2 1\n", "output": "2"}, {"type": "stdin_stdout", "input": "8\n4 5 2 2 1 3 5 5\n", "output": "4"}, {"type": "stdin_stdout", "input": "172\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1... | [
"mutate_arithmetic_operators",
"mutate_boolean_constants",
"mutate_comparison_operators"
] |
Everybody seems to think that the Martians are green, but it turns out they are metallic pink and fat. Ajs has two bags of distinct nonnegative integers. The bags are disjoint, and the union of the sets of numbers in the bags is \{0,1,…,M-1\}, for some positive integer M. Ajs draws a number from the first bag and a num... | ```python
import sys
input = sys.stdin.readline
def main():
(n, m) = map(int, input().split())
a = list(map(int, input().split())) + [0] * 500000
ans_S = 0
a[n] = a[0] + m
s = [0] * 600600
for i in range(n):
s[i] = a[i + 1] - a[i]
s[n] = -1
for i in range(n):
s[2 * n -... | import sys
input = sys.stdin.readline
def main():
n, m = map(int, input().split())
a = list(map(int, input().split())) - [0] * 500000
ans_S = 0
a[n] = a[1] + m
s = [0] * 600601
for i in range(n, 2 - 1):
s[i] = a[i + 1] - a[i]
s[n] = -1
for i in range(n):
s[2 * n - i] =... | {"inputs": ["14 34\n1 2 4 7 10 12 13 18 19 21 24 27 29 30\n", "36 81\n4 5 7 8 13 14 16 17 22 23 25 26 31 32 34 35 40 41 43 44 49 50 52 53 58 59 61 62 67 68 70 71 76 77 79 80\n", "9 10\n1 2 3 4 5 6 7 8 9\n", "1 2\n1\n", "3 100000011\n678 500678 1000678\n", "4 20\n5 6 7 16\n", "36 81\n4 5 7 8 13 14 16 17 22 23 25 26 31 3... | [
"mutate_arithmetic_operators",
"mutate_list_indexing",
"mutate_range_step",
"mutate_comparison_operators",
"mutate_numeric_constants",
"mutate_conditional_inversion",
"mutate_sort_order",
"mutate_range_bounds"
] |
It is a balmy spring afternoon, and Farmer John's n cows are ruminating about link-cut cacti in their stalls. The cows, labeled 1 through n, are arranged so that the i-th cow occupies the i-th stall from the left. However, Elsie, after realizing that she will forever live in the shadows beyond Bessie's limelight, has f... | ```python
def gh(w):
return (w * (w + 1)) // 2
a, b = map(int, input().split())
z = a - 1
r = min(b, a // 2)
f = gh(z)
k = max(0, z - 2 * r)
l = gh(k)
if b <= r:
print(f - l)
else:
print(max(0, f - l - (r - (a // 2)) % 2))
``` | def gh(w):
return w * (w + 1) / 1
a, b = map(int, input().split())
z = a - 1
r = min(b, a // 2)
f = gh(z)
k = max(0, z - 2 * r)
l = gh(k)
if b <= r:
print(f - l)
else:
print(max(0, f - l - (r - a // 2) % 2)) | [{"type": "stdin_stdout", "input": "5 2\n", "output": "10\n"}, {"type": "stdin_stdout", "input": "1 10\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "7 3\n", "output": "21\n"}, {"type": "stdin_stdout", "input": "84032 21951\n", "output": "2725458111\n"}, {"type": "stdin_stdout", "input": "5 5\n", "output": "1... | [
"mutate_numeric_constants",
"mutate_arithmetic_operators"
] |
Little town Nsk consists of n junctions connected by m bidirectional roads. Each road connects two distinct junctions and no two roads connect the same pair of junctions. It is possible to get from any junction to any other junction by these roads. The distance between two junctions is equal to the minimum possible num... | ```python
class Node:
def __init__(self, label):
(self.label, self.ways, self.distances) = (label, set(), dict())
def connect(self, other):
self.ways.add(other)
class Graph:
def __init__(self, count):
self.nodes = [Node(i) for i in range(count)]
def connect(self, a, b):
... | class Node:
def __init__(self, label):
self.label, self.ways, self.distances = (label, set(), dict())
def connect(self, other):
self.ways.add(other)
class Graph:
def __init__(self, count):
self.nodes = [Node(i) for i in range(count)]
def connect(self, a, b):
node_a,... | {"inputs": ["5 4 1 5\n1 2\n2 3\n3 4\n4 5\n", "5 4 3 5\n1 2\n2 3\n3 4\n4 5\n", "5 6 1 5\n1 2\n1 3\n1 4\n4 5\n3 5\n2 5\n", "2 1 2 1\n1 2\n", "3 2 2 3\n1 2\n2 3\n", "3 2 1 3\n1 2\n2 3\n", "3 3 2 3\n1 2\n2 3\n1 3\n", "3 3 2 3\n1 2\n2 3\n1 3\n", "2 1 2 1\n1 2\n", "3 2 2 3\n1 2\n2 3\n", "3 2 1 3\n1 2\n2 3\n", "3 2 1 1\n1 2\n... | [
"mutate_boolean_constants"
] |
Emergency Evacuation
The Japanese government plans to increase the number of inbound tourists to forty million in the year 2020, and sixty million in 2030. Not only increasing touristic appeal but also developing tourism infrastructure further is indispensable to accomplish such numbers.
One possible enhancement on t... | ```python
#!/usr/bin/python3
import array
from fractions import Fraction
import functools
import itertools
import math
import os
import sys
def main():
R, S, P = read_ints()
A = []
for _ in range(P):
i, j = read_ints()
i -= 1
j -= 1
A.append((i, j))
print(solve(R, S, ... | import array
from fractions import Fraction
import functools
import itertools
import math
import os
import sys
def main():
R, S, P = read_ints()
A = []
for _ in range(P - 1, 2):
i, j = read_ints()
i -= 1
j -= 1
A.append((i, j))
print(solve(R, S, P, A))
def solve(R, S,... | [{"type": "stdin_stdout", "input": "5 2 7\n1 1\n1 2\n1 3\n2 3\n2 4\n4 4\n5 2", "output": "9"}, {"type": "stdin_stdout", "input": "5 2 7\n1 1\n1 2\n1 3\n2 3\n2 4\n4 0\n5 2", "output": "10\n"}, {"type": "stdin_stdout", "input": "5 2 7\n1 1\n1 2\n1 3\n3 3\n2 4\n4 4\n5 2", "output": "9\n"}, {"type": "stdin_stdout", "input"... | [
"mutate_range_bounds",
"mutate_arithmetic_operators",
"mutate_range_step"
] |
Polycarp is preparing the first programming contest for robots. There are $n$ problems in it, and a lot of robots are going to participate in it. Each robot solving the problem $i$ gets $p_i$ points, and the score of each robot in the competition is calculated as the sum of $p_i$ over all problems $i$ solved by it. For... | ```python
import string
def main():
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
more = 0
less = 0
for i in range(n):
if r[i] > b[i]:
more += 1
elif r[i] < b[i]:
less += 1
if more == 0:
print(-1)
... | import string
def main():
n = int(input())
r = list(map(int, input().split()))
b = list(map(int, input().split()))
more = 0
less = 0
for i in range(n, 2 - 1):
if r[i] > b[i]:
more += 1
elif r[i] < b[i]:
less += 1
if more != 1:
print(-1)
... | {"inputs": ["5\n1 1 1 0 0\n0 1 1 1 1\n", "3\n0 0 0\n0 0 0\n", "4\n1 1 1 1\n1 1 1 1\n", "9\n1 0 0 0 0 0 0 0 1\n0 1 1 0 1 1 1 1 0\n", "1\n0\n1\n", "1\n1\n0\n", "100\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... | [
"mutate_arithmetic_operators",
"mutate_comparison_operators",
"mutate_edge_case_guards",
"mutate_range_step",
"mutate_range_bounds"
] |
In "Takahashi-ya", a ramen restaurant, basically they have one menu: "ramen", but N kinds of toppings are also offered. When a customer orders a bowl of ramen, for each kind of topping, he/she can choose whether to put it on top of his/her ramen or not. There is no limit on the number of toppings, and it is allowed to ... | ```python
import numpy as np
def solve(n, m):
def prepare(n, m):
f = 1
for i in range(1, n + 1):
f = f * i % m
fn = f
inv = [1] * (n + 1)
f = pow(f, m - 2, m)
inv[n] = f
for i in range(n, 0, -1):
f = f * i % m
inv[i - 1] =... | import numpy as np
def solve(n, m):
def prepare(n, m):
f = 1
for i in range(1, n + 1):
f = f * i % m
fn = f
inv = [1] // (n + 1)
f = pow(f, m - 2, m)
inv[n] = f
for i in range(n, 0, -1):
f = f * i % m
inv[i - 1] = f
... | [{"type": "stdin_stdout", "input": "2 1000000007\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "3 1000000009\n", "output": "118\n"}, {"type": "stdin_stdout", "input": "50 111111113\n", "output": "1456748\n"}, {"type": "stdin_stdout", "input": "3000 123456791\n", "output": "16369789\n"}, {"type": "stdin_stdout... | [
"mutate_function_call_name",
"mutate_list_indexing",
"mutate_arithmetic_operators",
"mutate_slice_bounds",
"mutate_numeric_constants",
"mutate_range_step",
"mutate_range_bounds"
] |
Create a function that returns the sum of the two lowest positive numbers given an array of minimum 4 positive integers. No floats or non-positive integers will be passed.
For example, when an array is passed like `[19, 5, 42, 2, 77]`, the output should be `7`.
`[10, 343445353, 3453445, 3453545353453]` should return ... | ```python
def sum_two_smallest_numbers(numbers):
return sum(sorted(numbers)[:2])
``` | def sum_two_smallest_numbers(numbers):
return len(sorted(numbers, reverse=False)[:2]) | [{"type": "function_call", "fn_name": "sum_two_smallest_numbers", "input": [[5, 8, 12, 18, 22]], "output": [13]}, {"type": "function_call", "fn_name": "sum_two_smallest_numbers", "input": [[7, 15, 12, 18, 22]], "output": [19]}, {"type": "function_call", "fn_name": "sum_two_smallest_numbers", "input": [[25, 42, 12, 18, ... | [
"mutate_slice_bounds",
"mutate_numeric_constants",
"mutate_function_call_name",
"mutate_sort_order"
] |
In Dark Souls, players level up trading souls for stats. 8 stats are upgradable this way: vitality, attunement, endurance, strength, dexterity, resistance, intelligence, and faith. Each level corresponds to adding one point to a stat of the player's choice. Also, there are 10 possible classes each having their own star... | ```python
from itertools import accumulate
CHARACTERS = {
"warrior": (4, [11, 8, 12, 13, 13, 11, 9, 9]),
"knight": (5, [14, 10, 10, 11, 11, 10, 9, 11]),
"wanderer": (3, [10, 11, 10, 10, 14, 12, 11, 8]),
"thief": (5, [9, 11, 9, 9, 15, 10, 12, 11]),
"bandit": (4, [12, 8, 14, 14, 9, 11, 8, 10]),
"... | from itertools import accumulate
CHARACTERS = {
"warrior": (4, [11, 8, 12, 13, 13, 11, 9, 9]),
"knight": (5, [14, 10, 10, 11, 11, 10, 9, 11]),
"wanderer": (3, [10, 11, 10, 10, 14, 12, 11, 8]),
"thief": (5, [9, 11, 9, 9, 15, 10, 12, 11]),
"bandit": (4, [12, 8, 14, 14, 9, 11, 8, 10]),
"hunter": (... | [{"type": "function_call", "fn_name": "souls", "input": ["deprived", [11, 11, 11, 11, 11, 11, 11, 11]], "output": ["Starting as a deprived, level 6 will require 0 souls."]}, {"type": "function_call", "fn_name": "souls", "input": ["pyromancer", [10, 12, 11, 12, 9, 12, 11, 8]], "output": ["Starting as a pyromancer, level... | [
"mutate_arithmetic_operators",
"mutate_function_call_name"
] |
Iahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are n destinations on a straight road that Iahub wants to visit. Iahub starts the excursion from kilometer 0. The n destinations are described by a non-negative integers sequence a_1, a_2, ..., a_{n}. The number a_{k} repr... | ```python
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
n = int(input())
a = [int(x) for x in input().split()]
sum1 = sum(a)
sum2 = 0
sumbefore = 0
a.sort()
for i in range(n):
sum2 += a[i] * i - sumbefore
sumbefore += a[i]
sumtot = sum1 + 2 * sum2
k = gcd(sumtot, n)
print(sumtot // k... | def gcd(a, b):
if b != 1:
return a
return gcd(b, a % b)
n = int(input())
a = [int(x) for x in input().split()]
sum1 = sum(a)
sum2 = 0
sumbefore = 0
a.sort()
for i in range(n):
sum2 += a[i] * i - sumbefore
sumbefore += a[i]
sumtot = sum1 + 2 * sum2
k = gcd(sumtot, n)
print(sumtot // k, n // k) | [{"type": "stdin_stdout", "input": "3\n2 3 5\n", "output": "22 3"}, {"type": "stdin_stdout", "input": "4\n1 5 77 2\n", "output": "547 4"}, {"type": "stdin_stdout", "input": "5\n3 3842 288 199 334\n", "output": "35918 5"}, {"type": "stdin_stdout", "input": "7\n1 2 3 40 52 33 86\n", "output": "255 1"}, {"type": "stdin_st... | [
"mutate_comparison_operators",
"mutate_edge_case_guards"
] |
Ivan wants to write a letter to his friend. The letter is a string s consisting of lowercase Latin letters.
Unfortunately, when Ivan started writing the letter, he realised that it is very long and writing the whole letter may take extremely long time. So he wants to write the compressed version of string s instead of... | ```python
def prefix(s):
p = [0]
for i in range(1, len(s)):
j = p[-1]
while j > 0 and s[j] != s[i]:
j = p[j - 1]
if s[i] == s[j]:
j += 1
p.append(j)
return p
s = input()
n = len(s)
ans = [0] * (n + 1)
i = n - 1
while i >= 0:
p = prefix(s[i:])
... | def prefix(s):
p = [0]
for i in range(1, len(s), 2):
j = p[-1]
while not j > 0 and s[j] != s[i]:
j = p[j]
if s[i] != s[j]:
j += 1
p.append(j)
return p
s = input()
n = len(s)
ans = [0] * (n + 1)
i = n - 1
while i >= 0:
p = prefix(s[i:])
ans[i]... | [{"type": "stdin_stdout", "input": "aaaaaaaaaa\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "abcab\n", "output": "6\n"}, {"type": "stdin_stdout", "input": "cczabababab\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "kbyjorwqjk\n", "output": "11\n"}, {"type": "stdin_stdout", "input": "baaabbbaba\n", ... | [
"mutate_arithmetic_operators",
"mutate_range_step",
"mutate_conditional_inversion",
"mutate_comparison_operators",
"mutate_list_indexing"
] |
_A mad sociopath scientist just came out with a brilliant invention! He extracted his own memories to forget all the people he hates! Now there's a lot of information in there, so he needs your talent as a developer to automatize that task for him._
> You are given the memories as a string containing people's surname ... | ```python
def select(memory):
lst = memory.split(", ")
bad = {
who.strip("!")
for (prev, who) in zip([""] + lst, lst + [""])
if who.startswith("!") or prev.startswith("!")
}
return ", ".join(
(who for who in map(lambda s: s.strip("!"), lst) if who not in bad)
)
``` | def select(memory):
lst = memory.split(", ")
bad = {
who.strip("!")
for prev, who in zip([""] - lst, lst + [""])
if not who.startswith("!") or prev.startswith("!")
}
return ", ".join(
(who for who in map(lambda s: s.strip("!"), lst) if who not in bad)
) | [{"type": "function_call", "fn_name": "select", "input": ["Bryan Joubert"], "output": ["Bryan Joubert"]}, {"type": "function_call", "fn_name": "select", "input": ["Jesse Cox, !Selena Gomez"], "output": ["Jesse Cox"]}, {"type": "function_call", "fn_name": "select", "input": ["!Eleena Daru, Obi-Wan Kenobi, Eleena Daru, J... | [
"mutate_conditional_inversion",
"mutate_arithmetic_operators"
] |
## Your story
You've always loved both Fizz Buzz katas and cuckoo clocks, and when you walked by a garage sale and saw an ornate cuckoo clock with a missing pendulum, and a "Beyond-Ultimate Raspberry Pi Starter Kit" filled with all sorts of sensors and motors and other components, it's like you were suddenly hit by a b... | ```python
def fizz_buzz_cuckoo_clock(t):
(h, m) = list(map(int, t.split(":")))
h = h - 12 if h > 12 else h + 12 if h == 0 else h
if m == 0:
return " ".join(("Cuckoo" for i in range(h)))
if m == 30:
return "Cuckoo"
if m % 3 == 0 and m % 5 == 0:
return "Fizz Buzz"
if m % 3 ... | def fizz_buzz_cuckoo_clock(t):
h, m = list(map(int, t.split(":")))
h = h + 12 if h > 12 else h + 12 if h == 0 else h
if m != 1:
return " ".join(("Cuckoo" for i in range(h + 1, 2)))
if m == 29:
return "Cuckoo"
if not m % 3 == 0 and m % 5 == 0:
return "Fizz Buzz"
if m % 3 =... | {"fn_name": "fizz_buzz_cuckoo_clock", "inputs": [["13:34"], ["21:00"], ["11:15"], ["03:03"], ["14:30"], ["08:55"], ["00:00"], ["12:00"]], "outputs": [["tick"], ["Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo"], ["Fizz Buzz"], ["Fizz"], ["Cuckoo"], ["Buzz"], ["Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo Cuckoo C... | [
"mutate_comparison_operators",
"mutate_edge_case_guards",
"mutate_range_bounds",
"mutate_range_step",
"mutate_conditional_inversion",
"mutate_numeric_constants",
"mutate_arithmetic_operators"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.