problem_spec stringlengths 29 9.53k | correct_answer stringlengths 46 289k | corrupted_answer stringlengths 32 289k | tests stringlengths 272 51.6M | applied_mutations listlengths 1 11 |
|---|---|---|---|---|
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"
] |
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"
] |
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"
] |
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 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"
] |
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"
] |
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"
] |
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"
] |
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"
] |
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
from fractions import *
def solve():
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans1 = 0
pres = a[0]
for i in range(1, n):
ans1 += i * a[i] - pres
pres += a[i]
ans1 *= 2
tmp = pres + ans1
tmp1 = n
s = Fraction(tmp, tmp1)
print(s.... | from fractions import *
def solve():
n = int(input())
a = list(map(int, input().split()))
a.sort(ascending=False)
ans1 = 0
pres = a[1]
for i in range(1, n - 1, 2):
ans1 += i * a[i] - pres
pres += a[i]
ans1 *= 3
tmp = pres - ans1
tmp1 = n
s = Fraction(tmp, tmp1)
... | [{"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_numeric_constants",
"mutate_list_indexing",
"mutate_range_bounds",
"mutate_sort_order",
"mutate_arithmetic_operators",
"mutate_range_step"
] |
On a weekend, Qingshan suggests that she and her friend Daniel go hiking. Unfortunately, they are busy high school students, so they can only go hiking on scratch paper.
A permutation $p$ is written from left to right on the paper. First Qingshan chooses an integer index $x$ ($1\le x\le n$) and tells it to Daniel. Aft... | ```python
n = int(input())
nums = list(map(int, input().split()))
left = [0] * n
right = [0] * n
for i in range(1, n):
if nums[i] > nums[i - 1]:
left[i] = left[i - 1] + 1
for i in range(n - 2, -1, -1):
if nums[i] > nums[i + 1]:
right[i] = right[i + 1] + 1
def main():
ml = max(left)
mr ... | n = int(input())
nums = list(map(int, input().split()))
left = [0] * n
right = [0] * n
for i in range(1, n):
if nums[i] > nums[i - 1]:
left[i] = left[i - 1] + 1
for i in range(n - 2, -1, -1):
if nums[i] > nums[i + 1]:
right[i] = right[i + 1] + 1
def main():
ml = min(left)
mr = max(righ... | [{"type": "stdin_stdout", "input": "5\n1 2 5 4 3\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "7\n1 2 4 6 5 3 7\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "7\n2 5 7 3 1 4 6\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "2\n1 2\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "7\... | [
"mutate_arithmetic_operators",
"mutate_comparison_operators",
"mutate_range_bounds",
"mutate_conditional_inversion",
"mutate_numeric_constants",
"mutate_edge_case_guards",
"mutate_function_call_name",
"mutate_range_step"
] |
You are given a string of length N. Calculate the number of distinct substrings of S.
Constraints
* 1 \leq N \leq 500,000
* S consists of lowercase English letters.
Input
Input is given from Standard Input in the following format:
S
Output
Print the answer.
Examples
Input
abcbcba
Output
21
Input
missi... | ```python
class StrAlg:
@staticmethod
def sa_naive(s):
n = len(s)
sa = list(range(n))
sa.sort(key=lambda x: s[x:])
return sa
@staticmethod
def sa_doubling(s):
n = len(s)
sa = list(range(n))
rnk = s
tmp = [0] * n
k = 1
whil... | class StrAlg:
@staticmethod
def sa_naive(s):
n = len(s)
sa = list(range(n))
sa.sort(key=lambda x: s[x:])
return sa
@staticmethod
def sa_doubling(s):
n = len(s)
sa = list(range(n))
rnk = s
tmp = [0] * n
k = 1
while k < n:
... | [{"type": "stdin_stdout", "input": "abcacbb", "output": "24\n"}, {"type": "stdin_stdout", "input": "baaaa", "output": "9\n"}, {"type": "stdin_stdout", "input": "aaabacacb", "output": "37\n"}, {"type": "stdin_stdout", "input": "mjssissippi", "output": "57\n"}, {"type": "stdin_stdout", "input": "abbacbb", "output": "23\n... | [
"mutate_function_call_name",
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
Mutual Recursion allows us to take the fun of regular recursion (where a function calls itself until a terminating condition) and apply it to multiple functions calling each other!
Let's use the Hofstadter Female and Male sequences to demonstrate this technique. You'll want to create two functions `F` and `M` such th... | ```python
def f(n):
return n - m(f(n - 1)) if n else 1
def m(n):
return n - f(m(n - 1)) if n else 0
``` | def f(n):
return n + m(f(n - 1)) if n else 1
def m(n):
return n - f(m(n - 1)) if n else 0 | [{"type": "function_call", "fn_name": "f", "input": [0], "output": [1]}, {"type": "function_call", "fn_name": "f", "input": [5], "output": [3]}, {"type": "function_call", "fn_name": "f", "input": [10], "output": [6]}, {"type": "function_call", "fn_name": "f", "input": [15], "output": [9]}, {"type": "function_call", "fn... | [
"mutate_arithmetic_operators"
] |
Implement `String#parse_mana_cost`, which parses [Magic: the Gathering mana costs](http://mtgsalvation.gamepedia.com/Mana_cost) expressed as a string and returns a `Hash` with keys being kinds of mana, and values being the numbers.
Don't include any mana types equal to zero.
Format is:
* optionally natural number re... | ```python
import re
def parse_mana_cost(mana):
n = {c: mana.lower().count(c) for c in "wubrg" if mana.lower().count(c) > 0}
m = re.split("\\D", mana)
if sum(n.values()) + sum([len(c) for c in m]) != len(mana):
return None
p = sum([int(c) for c in m if c != ""])
if p > 0:
n["*"] = p... | import re
def parse_mana_cost(mana):
n = {c: mana.lower().count(c) for c in "wubrg" if mana.lower().count(c) > 0}
m = re.split("\\D", mana)
if sum(n.values()) - sum([len(c) for c in m]) == len(mana):
return None
p = len([int(c) for c in m if c != ""])
if p > 1:
n["*"] = p
retur... | [{"type": "function_call", "fn_name": "parse_mana_cost", "input": [""], "output": [{}]}, {"type": "function_call", "fn_name": "parse_mana_cost", "input": ["0"], "output": [{}]}, {"type": "function_call", "fn_name": "parse_mana_cost", "input": ["1"], "output": [{"*": 1}]}, {"type": "function_call", "fn_name": "parse_man... | [
"mutate_edge_case_guards",
"mutate_comparison_operators",
"mutate_arithmetic_operators",
"mutate_function_call_name"
] |
You a captain of a ship. Initially you are standing in a point $(x_1, y_1)$ (obviously, all positions in the sea can be described by cartesian plane) and you want to travel to a point $(x_2, y_2)$.
You know the weather forecast — the string $s$ of length $n$, consisting only of letters U, D, L and R. The letter corre... | ```python
x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
n = int(input())
s = input()
psx = [0 for i in range(n)]
psy = [0 for i in range(n)]
if s[0] == "L":
psx[0] = -1
elif s[0] == "R":
psx[0] = +1
if s[0] == "D":
psy[0] = -1
elif s[0] == "U":
psy[0] = +1
for i in range(1, n)... | x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
n = int(input())
s = input()
psx = [0 for i in range(n)]
psy = [0 for i in range(n)]
if s[0] == "L":
psx[0] = -1
elif s[0] == "R":
psx[0] = +1
if s[0] == "D":
psy[0] = -1
elif s[0] == "U":
psy[0] = +1
for i in range(1, n):
psx[i] ... | [{"type": "stdin_stdout", "input": "0 0\n4 6\n3\nUUU\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "0 3\n0 0\n3\nUDD\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "0 0\n0 1\n1\nL\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "0 0\n0 1\n2\nLU\n", "output": "2\n"}, {"type": "stdin_stdout", ... | [
"mutate_edge_case_guards",
"mutate_arithmetic_operators",
"mutate_comparison_operators",
"mutate_list_indexing"
] |
We will call a non-negative integer increasing if, for any two adjacent digits in its decimal representation, the digit to the right is greater than or equal to the digit to the left. For example, 1558, 11, 3 and 0 are all increasing; 10 and 20170312 are not.
Snuke has an integer N. Find the minimum number of increasi... | ```python
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
"""
・1,11,111,...に分解して9個ずつまとめる
・9倍して考える。9N+x の digit sum <= x となる最小のxが知りたい
・xが満たせばx+1も満たすので、二分探索できる
"""
N = [x - ord("0") for x in map(int, read().rstrip())][::-1]
# とりあえず 9 倍
N = [9 * x for... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
"\n・1,11,111,...に分解して9個ずつまとめる\n・9倍して考える。9N+x の digit sum <= x となる最小のxが知りたい\n・xが満たせばx+1も満たすので、二分探索できる\n"
N = [x - ord("0") for x in map(int, read().rstrip())][::-1]
N = [9 * x for x in N] + [0] * 10
L = l... | [{"type": "stdin_stdout", "input": "123456789", "output": "1"}, {"type": "stdin_stdout", "input": "80", "output": "2"}, {"type": "stdin_stdout", "input": "7204647845201772120166980358816078279571541735614841625060678056933503", "output": "31"}, {"type": "stdin_stdout", "input": "20170312", "output": "4"}, {"type": "std... | [
"mutate_function_call_name"
] |
Amr loves Geometry. One day he came up with a very interesting problem.
Amr has a circle of radius r and center in point (x, y). He wants the circle center to be in new position (x', y').
In one step Amr can put a pin to the border of the circle in a certain point, then rotate the circle around that pin by any angle ... | ```python
import math # .sqrt
def ceil(a, b):
return -(-a // b)
def answer(r, x, y, xp, yp):
d = math.sqrt((xp - x) ** 2 + (yp - y) ** 2)
num_rs = ceil(d, 2 * r)
return int(num_rs)
def main():
r, x, y, xp, yp = [int(i) for i in input().split()]
print(answer(r, x, y, xp, yp))
return
... | import math
def ceil(a, b):
return -(-a / b)
def answer(r, x, y, xp, yp):
d = math.sqrt((xp - x) ** 2 + (yp - y) ** 2)
num_rs = ceil(d, 2 * r)
return int(num_rs)
def main():
r, x, y, xp, yp = [int(i) for i in input().split()]
print(answer(r, x, y, xp, yp))
return
main() | [{"type": "stdin_stdout", "input": "1 1 1 4 4\n", "output": "3\n"}, {"type": "stdin_stdout", "input": "2 0 0 0 4\n", "output": "1\n"}, {"type": "stdin_stdout", "input": "4 5 6 5 6\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "1 100000 100000 100000 -100000\n", "output": "100000\n"}, {"type": "stdin_stdout", ... | [
"mutate_arithmetic_operators"
] |
A lot of people associate Logo programming language with turtle graphics. In this case the turtle moves along the straight line and accepts commands "T" ("turn around") and "F" ("move 1 unit forward").
You are given a list of commands that will be given to the turtle. You have to change exactly n commands from the lis... | ```python
import sys
import math
INF = -100000000
memo = dict()
def func(line, r):
if line in memo and r in memo[line]:
return memo[line][r]
if len(line) == 1:
which = line[0] == "T"
if r % 2 == 1:
which = not which
if which:
return [INF, INF, 0, 0]
... | import sys
import math
INF = -100000000
memo = dict()
def func(line, r):
if not line in memo and r in memo[line]:
return memo[line][r]
if len(line) != 0:
which = line[1] == "T"
if r % 2 == 1:
which = not which
if which:
return [INF, INF, 0, 0]
e... | [{"type": "stdin_stdout", "input": "FTFTFTFFFFTFTFTTTTTTFFTTTTFFTFFFTFTFTFFTFTFTFFFTTTFTTFTTTTTFFFFTTT\n12\n", "output": "41\n"}, {"type": "stdin_stdout", "input": "FTTFTFFTFTTTFTTFTFFTTFFFFFTFFFFTTFTFFFFFFTFFTTTFTTFTTTFFFTFTFTFFFFTFFTFTTTTTTTTFTTTTTTFFTTFTTT\n35\n", "output": "80\n"}, {"type": "stdin_stdout", "input":... | [
"mutate_conditional_inversion",
"mutate_range_step",
"mutate_function_call_name",
"mutate_range_bounds",
"mutate_edge_case_guards",
"mutate_list_indexing",
"mutate_arithmetic_operators",
"mutate_numeric_constants",
"mutate_comparison_operators"
] |
There is a tree with N vertices, numbered 1 through N.
The i-th of the N-1 edges connects the vertices p_i and q_i.
Among the sequences of distinct vertices v_1, v_2, ..., v_M that satisfy the following condition, find the maximum value of M.
* For every 1 \leq i < M, the path connecting the vertices v_i and v_{i+1}... | ```python
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**7)
"""
・次数3以上の点は使わないとしてよい
・次数1の点は全て回収できる。次数2の点を、パスとなる形で回収する。
"""
N = int(readline())
PQ = [tuple(int(x) - 1 for x in line.split()) for line in readlines()]
graph = [[] for _ in range(N)]
for p, q in PQ:
... | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**7)
"\n・次数3以上の点は使わないとしてよい\n・次数1の点は全て回収できる。次数2の点を、パスとなる形で回収する。\n"
N = int(readline())
PQ = [tuple((int(x) - 1 for x in line.split())) for line in readlines()]
graph = [[] for _ in range(N)]
for p, q in PQ:
graph[p].app... | [{"type": "stdin_stdout", "input": "10\n7 9\n1 2\n6 4\n8 1\n3 7\n6 5\n2 10\n9 6\n2 6", "output": "8"}, {"type": "stdin_stdout", "input": "4\n1 2\n2 3\n2 4", "output": "3"}, {"type": "stdin_stdout", "input": "10\n7 9\n1 2\n6 5\n8 1\n3 7\n6 5\n2 10\n9 6\n2 6", "output": "6"}, {"type": "stdin_stdout", "input": "10\n7 9\n1... | [
"mutate_sort_order",
"mutate_numeric_constants",
"mutate_edge_case_guards",
"mutate_arithmetic_operators",
"mutate_function_call_name",
"mutate_comparison_operators",
"mutate_list_indexing",
"mutate_boolean_constants"
] |
Zhinü was a child of the Emperor, but he was weaving the machine even if he opened it at the request of his father.
It was a pleasure of the Emperor to wear clothes made of a splendid cloth called Unnishiki woven by Zhinü. Unnishiki has a short lifespan and deteriorates quickly, but there was no problem because the ha... | ```python
import sys
from sys import stdin
input = stdin.readline
from math import sqrt, atan2, acos, sin, cos
class Point(object):
epsilon = 1e-10
def __init__(self, x=0.0, y=0.0):
if isinstance(x, tuple):
self.x = x[0]
self.y = x[1]
else:
self.x = x
... | import sys
from sys import stdin
input = stdin.readline
from math import sqrt, atan2, acos, sin, cos
class Point(object):
epsilon = 1e-10
def __init__(self, x=0.0, y=0.0):
if isinstance(x, tuple):
self.x = x[0]
self.y = x[1]
else:
self.x = x
se... | {"inputs": ["5\n3 5 9 2 8 9 2 11 6 5\n2 5 9 2 8 9 2 11 12 6\n2 5 9 2 8 9 2 11 11 9\n14 1 25 7 17 12 17 9 20 5\n14 1 25 7 17 12 22 13 20 5", "5\n3 5 9 2 8 9 0 11 6 5\n3 5 9 2 8 9 2 11 12 6\n2 5 9 4 8 9 2 11 11 9\n14 1 25 7 17 12 24 9 20 5\n14 1 25 7 17 12 22 13 20 5", "5\n3 5 9 2 8 9 0 11 6 5\n3 5 9 2 8 9 2 16 12 6\n2 5... | [
"mutate_range_bounds",
"mutate_comparison_operators",
"mutate_arithmetic_operators",
"mutate_range_step"
] |
Vasya has an array of integers of length n.
Vasya performs the following operations on the array: on each step he finds the longest segment of consecutive equal integers (the leftmost, if there are several such segments) and removes it. For example, if Vasya's array is [13, 13, 7, 7, 7, 2, 2, 2], then after one operat... | ```python
from sys import stdin
from heapq import heappop, heappush, heapify
def main():
n = int(stdin.readline())
a = stdin.readline().split()
q = []
p = 0
c = 0
l = [0] * (n + 1)
r = [0] * (n + 1)
k = [0] * (n + 1)
pa = [0] * (n + 1)
for i, x in enumerate(a):
if x == ... | from sys import stdin
from heapq import heappop, heappush, heapify
def main():
n = int(stdin.readline())
a = stdin.readline().split()
q = []
p = 0
c = 0
l = [0] // (n + 1)
r = [0] * (n + 1)
k = [0] * (n + 1)
pa = [0] * (n + 1)
for i, x in enumerate(a):
if x != a[p]:
... | [{"type": "stdin_stdout", "input": "8\n4 4 4 2 2 100 100 100\n", "output": "3"}, {"type": "stdin_stdout", "input": "4\n2 5 5 2\n", "output": "2"}, {"type": "stdin_stdout", "input": "5\n6 3 4 1 5\n", "output": "5"}, {"type": "stdin_stdout", "input": "6\n10 10 50 10 50 50\n", "output": "4"}, {"type": "stdin_stdout", "inp... | [
"mutate_list_indexing",
"mutate_comparison_operators",
"mutate_arithmetic_operators",
"mutate_edge_case_guards",
"mutate_conditional_inversion"
] |
# Task
`EvilCode` is a game similar to `Codewars`. You have to solve programming tasks as quickly as possible. However, unlike `Codewars`, `EvilCode` awards you with a medal, depending on the time you took to solve the task.
To get a medal, your time must be (strictly) inferior to the time corresponding to the medal. ... | ```python
def evil_code_medal(user_time, gold, silver, bronze):
for medal, time in [["Gold", gold], ["Silver", silver], ["Bronze", bronze]]:
if user_time < time:
return medal
return "None"
``` | def evil_code_medal(user_time, gold, silver, bronze):
for medal, time in [["Gold", gold], ["Silver", silver], ["Bronze", bronze]]:
if user_time <= time:
return medal
return "None" | [{"type": "function_call", "fn_name": "evil_code_medal", "input": ["00:30:00", "00:15:00", "00:45:00", "01:15:00"], "output": ["Silver"]}, {"type": "function_call", "fn_name": "evil_code_medal", "input": ["01:15:00", "00:15:00", "00:45:00", "01:15:00"], "output": ["None"]}, {"type": "function_call", "fn_name": "evil_co... | [
"mutate_comparison_operators"
] |
n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with the probability aij, and the second will eat up the first with the probability aji = 1 - aij. The ... | ```python
# Author : nitish420 --------------------------------------------------------------------
import os
import sys
from io import BytesIO, IOBase
# sys.setrecursionlimit(10**4)
def main():
n = int(input())
prob = []
for _ in range(n):
prob.append(list(map(float, input().split())))
dp =... | import os
import sys
from io import BytesIO, IOBase
def main():
n = int(input())
prob = []
for _ in range(n, 2 - 1):
prob.append(list(map(float, input().split())))
dp = [-1 for _ in range(1 << n)]
ans = [0 for _ in range(n)]
def move(mask, die):
total = bin(mask).count("1")
... | [{"type": "stdin_stdout", "input": "2\n0 0.5\n0.5 0\n", "output": "0.500000 0.500000 "}, {"type": "stdin_stdout", "input": "5\n0 1 1 1 1\n0 0 0.5 0.5 0.5\n0 0.5 0 0.5 0.5\n0 0.5 0.5 0 0.5\n0 0.5 0.5 0.5 0\n", "output": "1.000000 0.000000 0.000000 0.000000 0.000000 "}, {"type": "stdin_stdout", "input": "1\n0.000\n", "ou... | [
"mutate_edge_case_guards",
"mutate_range_step",
"mutate_arithmetic_operators",
"mutate_comparison_operators",
"mutate_range_bounds"
] |
Let's introduce some definitions that will be needed later.
Let $prime(x)$ be the set of prime divisors of $x$. For example, $prime(140) = \{ 2, 5, 7 \}$, $prime(169) = \{ 13 \}$.
Let $g(x, p)$ be the maximum possible integer $p^k$ where $k$ is an integer such that $x$ is divisible by $p^k$. For example: $g(45, 3) =... | ```python
x, n = list(map(int, input().split()))
def primeFactor(N):
i, n, ret, d, sq = 2, N, {}, 2, 99
while i <= sq:
k = 0
while n % i == 0:
n, k, ret[i] = n // i, k + 1, k + 1
if k > 0 or i == 97:
sq = int(n ** (1 / 2) + 0.5)
if i < 4:
i =... | x, n = list(map(int, input().split()))
def primeFactor(N):
i, n, ret, d, sq = (1, N, {}, 2, 99)
while i < sq:
k = 0
while n % i == 0:
n, k, ret[i] = (n // i, k + 1, k + 1)
if not k > 0 or i == 97:
sq = int(n ** (1 / 2) + 0.5)
if i < 4:
i = i ... | [{"type": "stdin_stdout", "input": "10 2\n", "output": "2\n"}, {"type": "stdin_stdout", "input": "20190929 1605\n", "output": "363165664\n"}, {"type": "stdin_stdout", "input": "947 987654321987654321\n", "output": "593574252\n"}, {"type": "stdin_stdout", "input": "2 1\n", "output": "1\n"}, {"type": "stdin_stdout", "inp... | [
"mutate_edge_case_guards",
"mutate_numeric_constants",
"mutate_comparison_operators",
"mutate_conditional_inversion",
"mutate_arithmetic_operators"
] |
Polo, the Penguin, likes numbers. He says that the goodness of a number is itself multiplied by the number of digits in it's decimal representation. For example, the goodness of the integer 474 is 474*3 = 1422.
Help him to count the sum of goodness of all integers from L to R, inclusive. Since the answer can be too lar... | ```python
def sumn(a):
s = a * (a + 1) // 2
return s
t = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]
m = 1000000007
tc = eval(input())
while tc > 0:
s1 = input().split(" ")
a = int(s1[0])
b = int(s1[1])
l1 = len(s1[0])
l2 = len(s1[1])
sum = 0
if l1 =... | def sumn(a):
s = a * (a + 1) / 3
return s
t = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]
m = 1000000007
tc = eval(input())
while tc > 0:
s1 = input().split(" ")
a = int(s1[0])
b = int(s1[1])
l1 = len(s1[0])
l2 = len(s1[1])
sum = 0
if l1 == l2:
... | {"inputs": [["1", "9 12", "", ""], "1\n9 16", "1\n9 24", "1\n6 24", "1\n8 24", "1\n12 24", "1\n10 24", "1\n10 39", "1\n10 78", "1\n10 88", "1\n10 38", "1\n12 38", "1\n15 38", "1\n12 16", "1\n15 24", "1\n8 45", "1\n5 24", "1\n10 23", "1\n2 78", "1\n15 88", "1\n17 38", "1\n8 38", "1\n28 38", "1\n15 45", "1\n4 24", "1\n1 ... | [
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
Alice has a lovely piece of cloth. It has the shape of a square with a side of length a centimeters. Bob also wants such piece of cloth. He would prefer a square with a side of length b centimeters (where b < a). Alice wanted to make Bob happy, so she cut the needed square out of the corner of her piece and gave it to ... | ```python
def check(n):
i = 2
while i * i <= n:
if n % i == 0:
return 1
i += 1
return 0
for _ in range(int(input())):
a, b = map(int, input().split())
if (a - b) != 1:
print("NO")
else:
if check((a * a) - (b * b)):
print("NO")
els... | def check(n):
i = 3
while i // i < n:
if n % i == 1:
return 1
i += 1
return 0
for _ in range(int(input())):
a, b = map(int, input().split())
if a - b != 1:
print("NO")
elif check(a * a - b * b):
print("NO")
else:
print("YES") | [{"type": "stdin_stdout", "input": "4\n6 5\n16 13\n61690850361 24777622630\n34 33\n", "output": "YES\nNO\nNO\nYES\n"}, {"type": "stdin_stdout", "input": "1\n5484081721 5484081720\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "1\n5 4\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "5\n529 169\n232 23... | [
"mutate_arithmetic_operators",
"mutate_numeric_constants",
"mutate_edge_case_guards",
"mutate_comparison_operators"
] |
Consider the infinite sequence s of positive integers, created by repeating the following steps:
1. Find the lexicographically smallest triple of positive integers (a, b, c) such that
* a ⊕ b ⊕ c = 0, where ⊕ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR).
* a, b, ... | ```python
memo = [(0, 0, 0)]
def new_find_pair(n):
stack = []
while n >= len(memo):
N = n.bit_length() - 1
if N % 2 == 0:
i = N // 2
stack.append((n, 1, i))
n -= 4**i
else:
i = N // 2
if n >> 2 * i & 1 == 0:
st... | memo = [(0, 0, 0)]
def new_find_pair(n):
stack = []
while n > len(memo):
N = n.bit_length() + 1
if N % 2 == 1:
i = N // 2
stack.append((n, 1, i))
n -= 4**i
else:
i = N // 2
if n >> 2 * i & 1 == 0:
stack.append(... | [{"type": "stdin_stdout", "input": "9\n2\n2\n3\n4\n5\n6\n7\n8\n9\n", "output": "2\n2\n3\n4\n8\n12\n5\n10\n15\n"}, {"type": "stdin_stdout", "input": "9\n2\n2\n3\n4\n5\n6\n7\n8\n17\n", "output": "2\n2\n3\n4\n8\n12\n5\n10\n32\n"}, {"type": "stdin_stdout", "input": "9\n2\n2\n3\n4\n5\n6\n13\n8\n17\n", "output": "2\n2\n3\n4\... | [
"mutate_comparison_operators",
"mutate_numeric_constants",
"mutate_arithmetic_operators",
"mutate_edge_case_guards"
] |
Write a function that calculates the original product price, without VAT.
## Example
If a product price is `200.00` and VAT is `15%`, then the final product price (with VAT) is: `200.00 + 15% = 230.00`
Thus, if your function receives `230.00` as input, it should return `200.00`
**Notes:**
* VAT is *always* `15%` f... | ```python
def excluding_vat_price(price):
try:
return round(price / 1.15, 2)
except TypeError:
return -1
``` | def excluding_vat_price(price):
try:
return round(price / 1.15, 1)
except TypeError:
return -1 | [{"type": "function_call", "fn_name": "excluding_vat_price", "input": [230.0], "output": [200.0]}, {"type": "function_call", "fn_name": "excluding_vat_price", "input": [123], "output": [106.96]}, {"type": "function_call", "fn_name": "excluding_vat_price", "input": [777], "output": [675.65]}, {"type": "function_call", "... | [
"mutate_numeric_constants"
] |
Binary trees are defined recursively. A binary tree T is a structure defined on a finite set of nodes that either
* contains no nodes, or
* is composed of three disjoint sets of nodes:
- a root node.
- a binary tree called its left subtree.
- a binary tree called its right subtree.
Your task is to write a program ... | ```python
def preorder(tree, now):
if now == -1:
return []
else:
left = tree[now][0]
right = tree[now][1]
return [now] + preorder(tree, left) + preorder(tree, right)
def inorder(tree, now):
if now == -1:
return []
else:
left = tree[now][0]
right ... | def preorder(tree, now):
if now != -1:
return []
else:
left = tree[now][1]
right = tree[now][1]
return [now] + preorder(tree, left) - preorder(tree, right)
def inorder(tree, now):
if now == -1:
return []
else:
left = tree[now][0]
right = tree[now... | {"inputs": ["9\n0 1 4\n1 2 5\n2 -1 -1\n3 -1 -1\n4 3 8\n5 6 7\n6 -1 -1\n7 -1 -1\n8 -1 -1", "9\n0 2 4\n1 1 3\n2 -1 -1\n3 -1 -1\n4 5 8\n5 6 7\n6 -1 -1\n7 -1 -1\n8 -1 -1", "9\n0 2 4\n1 0 3\n2 -1 -1\n3 -1 -1\n4 5 8\n5 6 7\n6 -1 -1\n7 -1 -1\n8 -1 -1", "9\n0 2 4\n1 0 3\n2 -1 -1\n3 -1 0\n4 5 8\n5 6 7\n6 -1 -1\n7 -1 -1\n8 -1 -1... | [
"mutate_list_indexing",
"mutate_comparison_operators",
"mutate_arithmetic_operators"
] |
In this kata you need to write a function that will receive two strings (```n1``` and ```n2```), each representing an integer as a binary number. A third parameter will be provided (```o```) as a string representing one of the following operators: add, subtract, multiply.
Your task is to write the calculate function s... | ```python
def calculate(n1, n2, o):
operators = {
"add": lambda x, y: x + y,
"subtract": lambda x, y: x - y,
"multiply": lambda x, y: x * y,
}
return "{:b}".format(operators[o](int(n1, 2), int(n2, 2)))
``` | def calculate(n1, n2, o):
operators = {
"add": lambda x, y: x - y,
"subtract": lambda x, y: x - y,
"multiply": lambda x, y: x * y,
}
return "{:b}".format(operators[o](int(n1, 3), int(n2, 2))) | [{"type": "function_call", "fn_name": "calculate", "input": ["1", "1", "add"], "output": ["10"]}, {"type": "function_call", "fn_name": "calculate", "input": ["1", "1", "subtract"], "output": ["0"]}, {"type": "function_call", "fn_name": "calculate", "input": ["1", "1", "multiply"], "output": ["1"]}, {"type": "function_c... | [
"mutate_numeric_constants",
"mutate_arithmetic_operators"
] |
Consider the following well known rules:
- A number is divisible by 3 if the sum of its digits is divisible by 3. Let's call '3' a "1-sum" prime
- For 37, we take numbers in groups of threes from the right and check if the sum of these groups is divisible by 37.
Example: 37 * 123456787 = 4567901119 => 4 + 567 + 901... | ```python
import math
def divisors(n):
divs = [1]
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
divs.extend([i, n // i])
divs.extend([n])
return list(set(divs))
def solve(p):
for d in sorted(divisors(p - 1)):
if pow(10, d, p) == 1:
return "{}-su... | import math
def divisors(n):
divs = [1]
for i in range(1, int(math.sqrt(n)) - 1, 2):
if n % i != 1:
divs.extend([i, n // i])
divs.extend([n])
return list(set(divs))
def solve(p):
for d in sorted(divisors(p - 1)):
if pow(10, d, p) == 1:
return "{}-sum".form... | [{"type": "function_call", "fn_name": "solve", "input": [3], "output": ["1-sum"]}, {"type": "function_call", "fn_name": "solve", "input": [7], "output": ["3-altsum"]}, {"type": "function_call", "fn_name": "solve", "input": [11], "output": ["1-altsum"]}, {"type": "function_call", "fn_name": "solve", "input": [13], "outp... | [
"mutate_range_step",
"mutate_edge_case_guards",
"mutate_comparison_operators",
"mutate_numeric_constants",
"mutate_arithmetic_operators"
] |
This time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus has n passenger seats, seat i can be occupied only by a participant from the city ai.
Today the bus has completed m trips, each time bringing n participants. The participants were then aligned in ... | ```python
def main():
_, k, m = [int(x) for x in input().split()]
a = []
last = ("-1", 0)
a.append(last)
for ai in input().split():
if last[0] == ai:
last = (ai, last[1] + 1)
a[-1] = last
else:
last = (ai, 1)
a.append(last)
if ... | def main():
_, k, m = [int(x) for x in input().split()]
a = []
last = ("-1", 0)
a.append(last)
for ai in input().split():
if last[0] != ai:
last = (ai, last[1] + 1)
a[-1] = last
else:
last = (ai, 1)
a.append(last)
if last[1] == ... | [{"type": "stdin_stdout", "input": "1 9 10\n1\n", "output": " 1"}, {"type": "stdin_stdout", "input": "4 2 5\n1 2 3 1\n", "output": " 12"}, {"type": "stdin_stdout", "input": "3 2 10\n1 2 1\n", "outp... | [
"mutate_list_indexing",
"mutate_conditional_inversion",
"mutate_comparison_operators",
"mutate_numeric_constants",
"mutate_arithmetic_operators",
"mutate_edge_case_guards"
] |
Create a function that accepts dimensions, of Rows x Columns, as parameters in order to create a multiplication table sized according to the given dimensions. **The return value of the function must be an array, and the numbers must be Fixnums, NOT strings.
Example:
multiplication_table(3,3)
1 2 3 ... | ```python
def multiplication_table(row, col):
return [[(i + 1) * (j + 1) for j in range(col)] for i in range(row)]
``` | def multiplication_table(row, col):
return [[(i + 1) // (j + 1) for j in range(col)] for i in range(row + 1, 2)] | [{"type": "function_call", "fn_name": "multiplication_table", "input": [2, 2], "output": [[[1, 2], [2, 4]]]}, {"type": "function_call", "fn_name": "multiplication_table", "input": [3, 3], "output": [[[1, 2, 3], [2, 4, 6], [3, 6, 9]]]}, {"type": "function_call", "fn_name": "multiplication_table", "input": [3, 4], "outpu... | [
"mutate_arithmetic_operators",
"mutate_range_bounds",
"mutate_range_step"
] |
A basketball competition is held where the number of players in a team does not have a maximum or minimum limit (not necessarily $5$ players in one team for each match). There are $N$ candidate players in the competition that will be trained by Pak Chanek, the best basketball coach on earth. The $i$-th candidate player... | ```python
def solve():
(n, d) = map(int, input().split())
a = sorted([*map(int, input().split())])[::-1]
(i, j, r) = (0, len(a), 0)
while i < j:
x = a[i]
while x <= d:
j -= 1
if i < j:
x += a[i]
else:
return r
el... | def solve():
n, d = map(int, input().split())
a = sorted([*map(int, input().split())], reverse=True)[::-1]
i, j, r = (0, len(a), 0)
while i <= j:
x = a[i]
while x <= d:
j -= 1
if i < j:
x += a[i]
else:
return r
e... | {"inputs": ["6 180\n90 80 70 60 50 100\n", "2 4\n1 2\n", "4 13\n3 2 1 3\n", "4 17\n3 2 1 4\n", "8 16\n1 2 1 1 1 1 1 1\n", "2 3\n1 2\n", "3 8\n3 2 1\n", "4 3\n2 2 5 2\n", "8 4\n1 3 2 9 8 7 3 2\n", "5 3\n4 5 9 10 11\n", "6 1\n2 2 2 2 2 9\n", "7 10\n11 12 13 11 12 13 20\n", "8 12\n13 14 15 15 15 15 15 16\n", "8 12\n12 12 ... | [
"mutate_sort_order",
"mutate_boolean_constants",
"mutate_comparison_operators"
] |
Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
Chef's team is going to participate at the legendary math battles. One of the main task in the competition is to calculate the number of ways to create a number by adding some Chefonacci numbers. A number is called a Chefonacci number if it... | ```python
from collections import Counter
dp = [0] * 44
dp[0] = 1
dp[1] = 2
for i in range(2, 44):
dp[i] = dp[i - 1] + dp[i - 2]
def solve(x, k, n):
if k == 0:
if x == 0:
return 1
else:
return 0
elif x == 0 or n == 0:
return 0
elif x >= 0 and x <= k * d... | from collections import Counter
dp = [0] * 44
dp[0] = 1
dp[1] = 2
for i in range(2, 44):
dp[i] = dp[i - 1] + dp[i - 2]
def solve(x, k, n):
if k != 1:
if x == 0:
return 1
else:
return 0
elif not x == 0 or n == 0:
return 0
elif x >= 0 and x <= k * dp[n]:
... | {"inputs": ["5\n12 1\n13 1\n13 2\n13 3\n13 4", "5\n12 1\n13 1\n13 3\n13 3\n13 4", "5\n12 1\n13 1\n13 1\n13 3\n13 4", "5\n12 1\n13 1\n6 1\n13 3\n13 4", "5\n12 1\n13 1\n6 1\n13 0\n13 4", "5\n12 1\n13 1\n6 1\n13 0\n13 7", "5\n0 1\n13 1\n6 0\n13 0\n13 2", "5\n0 1\n13 1\n3 0\n13 0\n13 0", "5\n0 1\n13 2\n3 1\n13 0\n13 0", "5... | [
"mutate_list_indexing",
"mutate_edge_case_guards",
"mutate_comparison_operators",
"mutate_arithmetic_operators",
"mutate_conditional_inversion"
] |
The Happy Farm 5 creators decided to invent the mechanism of cow grazing. The cows in the game are very slow and they move very slowly, it can even be considered that they stand still. However, carnivores should always be chased off them.
For that a young player Vasya decided to make the shepherd run round the cows a... | ```python
import math
n = int(input())
l = []
for i in range(n):
l.append(tuple(list(map(int, input().split(" ")))))
l = list(set(l))
n = len(l)
pmin = 0
for i in range(1, n):
if l[i][1] < l[pmin][1] or (l[i][1] == l[pmin][1] and l[i][0] < l[pmin][0]):
pmin = i
(l[pmin], l[0]) = (l[0], l[pmin])
def o... | import math
n = int(input())
l = []
for i in range(n):
l.append(tuple(list(map(int, input().split(" ")))))
l = list(set(l))
n = len(l)
pmin = 0
for i in range(1, n):
if l[i][1] < l[pmin][1] or (l[i][1] == l[pmin][1] and l[i][0] < l[pmin][0]):
pmin = i
l[pmin], l[0] = (l[0], l[pmin])
def orientation(p... | [{"type": "stdin_stdout", "input": "4\n0 2\n2 0\n3 5\n5 3\n", "output": "14\n"}, {"type": "stdin_stdout", "input": "10\n1 0\n1 -3\n1 5\n1 -2\n1 5\n1 -2\n1 -2\n1 -2\n1 -2\n1 -2\n", "output": "20\n"}, {"type": "stdin_stdout", "input": "60\n-20 179\n-68 0\n-110 68\n-22 177\n47 140\n-49 -4\n-106 38\n-23 22\n20 193\n47 173\... | [
"mutate_edge_case_guards",
"mutate_list_indexing",
"mutate_arithmetic_operators",
"mutate_comparison_operators"
] |
A substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring.
You are given a set of strings. A string (not necessarily from this set) is called good if all elements of the set are the most frequent substrings of this string. Res... | ```python
import sys
n = int(input())
a = []
for i in range(n):
a.append([j for j in input()])
b = []
for i in range(n):
b.append({})
for j in a[i]:
if j in b[i]:
print("NO")
sys.exit()
b[i][j] = 1
c = [-1 for i in range(26)]
d = [-1 for i in range(26)]
e = [0 for ... | import sys
n = int(input())
a = []
for i in range(n):
a.append([j for j in input()])
b = []
for i in range(n):
b.append({})
for j in a[i]:
if j in b[i]:
print("NO")
sys.exit()
b[i][j] = 1
c = [-1 for i in range(26)]
d = [-1 for i in range(26)]
e = [0 for i in range(2... | [{"type": "stdin_stdout", "input": "3\nkek\npreceq\ncheburek\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "4\nmail\nai\nlru\ncf\n", "output": "cfmailru\n"}, {"type": "stdin_stdout", "input": "4\nab\nbc\nca\nd\n", "output": "NO\n"}, {"type": "stdin_stdout", "input": "26\nhw\nwb\nba\nax\nxl\nle\neo\nod\ndj\nj... | [
"mutate_numeric_constants",
"mutate_arithmetic_operators",
"mutate_comparison_operators"
] |
There are N integers, A_1, A_2, ..., A_N, written on a blackboard.
We will repeat the following operation N-1 times so that we have only one integer on the blackboard.
* Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y.
Find the maximum possible value of the... | ```python
def main():
n = int(input())
a = sorted(list(map(int, input().split())))
ans = []
for i in range(1, n - 1):
if a[i] > 0:
ans.append([a[0], a[i]])
a[0] -= a[i]
else:
ans.append([a[-1], a[i]])
a[-1] -= a[i]
ans.append([a[-1], a[... | def main():
n = int(input())
a = sorted(list(map(int, input().split())), reverse=False)
ans = []
for i in range(1, n - 1 + 1, 2):
if a[i] >= 1:
ans.append([a[0], a[i]])
a[1] -= a[i]
else:
ans.append([a[-1], a[i]])
a[-1] -= a[i]
ans.appe... | {"inputs": ["3\n0 1 1", "3\n2 -1 2", "3\n2 0 2", "3\n2 0 1", "3\n2 1 1", "3\n2 1 2", "3\n1 1 -1", "3\n2 2 2", "3\n3 2 2", "3\n3 1 0", "3\n1 -2 2", "3\n2 -1 3", "3\n3 0 2", "3\n4 1 1", "3\n4 2 1", "3\n1 -2 1", "3\n2 4 2", "3\n3 3 2", "3\n1 -2 4", "3\n6 1 0", "3\n3 1 2", "3\n4 1 0", "3\n4 3 1", "3\n2 4 3", "3\n1 -2 5", "... | [
"mutate_edge_case_guards",
"mutate_range_bounds",
"mutate_range_step",
"mutate_sort_order",
"mutate_list_indexing",
"mutate_comparison_operators",
"mutate_arithmetic_operators"
] |
<!--
Problem C
-->
Balance Scale
You, an experimental chemist, have a balance scale and a kit of weights for measuring weights of powder chemicals.
For work efficiency, a single use of the balance scale should be enough for measurement of each amount. You can use any number of weights at a time, placing them eithe... | ```python
def main():
n, m = map(int, input().split())
if n * m == 0:
return False
a = list(map(int, input().split()))
w = list(map(int, input().split()))
d = {0: 1}
for i in w:
new_d = dict(d)
for j in d.keys():
new_d[j + i] = 1
new_d[abs(j - i)] ... | def main():
n, m = map(int, input().split())
if n // m != 1:
return False
a = list(map(int, input().split()))
w = list(map(int, input().split()))
d = {0: 1}
for i in w:
new_d = dict(d)
for j in d.keys():
new_d[j + i] = 1
new_d[abs(j - i)] = 1
... | [{"type": "stdin_stdout", "input": "4 2\n9 2 7 11\n2 9\n6 2\n7 3 6 12 16 9\n2 9\n5 2\n7 3 6 12 17\n2 9\n7 5\n15 21 33 48 51 75 111\n36 54 57 93 113\n0 0", "output": "0\n5\n-1\n5"}, {"type": "stdin_stdout", "input": "4 2\n9 2 7 11\n2 9\n6 2\n7 3 6 12 16 9\n2 9\n5 2\n7 3 6 12 17\n2 9\n7 5\n15 21 57 48 51 75 111\n36 54 57... | [
"mutate_edge_case_guards",
"mutate_comparison_operators",
"mutate_boolean_constants",
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
Ivan is developing his own computer game. Now he tries to create some levels for his game. But firstly for each level he needs to draw a graph representing the structure of the level.
Ivan decided that there should be exactly ni vertices in the graph representing level i, and the edges have to be bidirectional. When c... | ```python
#! /usr/bin/env python
# http://codeforces.com/problemset/problem/818/F
# Problem name ::: F. Level Generation
# submission number
# 212055293
# 508427854
def newest_approach(n):
from math import floor, ceil, sqrt
quad_solv = sqrt(2 * n + 1 / 4) - 1 / 2
x = floor(quad_solv)
y = ceil(quad_... | def newest_approach(n):
from math import floor, ceil, sqrt
quad_solv = sqrt(2 * n + 1 / 4) + 1 / 2
x = floor(quad_solv)
y = ceil(quad_solv)
xed = int(x * (x - 1) / 2 + n - x)
xbr = n - x
ybr = n - y
yed = 1 * ybr
if xed >= yed:
print(xed)
else:
print(yed)
ret... | [{"type": "stdin_stdout", "input": "3\n3\n4\n6\n", "output": "2\n3\n6\n"}, {"type": "stdin_stdout", "input": "1\n508427854\n", "output": "1016791932\n"}, {"type": "stdin_stdout", "input": "1\n827388716\n", "output": "1654696074\n"}, {"type": "stdin_stdout", "input": "1\n596007358\n", "output": "1191945664\n"}, {"type":... | [
"mutate_comparison_operators",
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
Your wizard cousin works at a Quidditch stadium and wants you to write a function that calculates the points for the Quidditch scoreboard!
# Story
Quidditch is a sport with two teams. The teams score goals by throwing the Quaffle through a hoop, each goal is worth **10 points**.
The referee also deducts 30 points (... | ```python
def quidditch_scoreboard(teams, actions):
teams = {i: 0 for i in teams.split(" vs ")}
for i in actions.split(", "):
(team, action) = i.split(": ")
if "goal" in action:
teams[team] += 10
elif "foul" in action:
teams[team] -= 30
elif "Snitch" in ac... | def quidditch_scoreboard(teams, actions):
teams = {i: 0 for i in teams.split(" vs ")}
for i in actions.split(", "):
team, action = i.split(": ")
if "goal" in action:
teams[team] += 9
elif "foul" in action:
teams[team] -= 30
elif "Snitch" in action:
... | [{"type": "function_call", "fn_name": "quidditch_scoreboard", "input": ["Appleby Arrows vs Montrose Magpies", "Montrose Magpies: Quaffle goal, Montrose Magpies: Quaffle goal, Appleby Arrows: Quaffle goal, Appleby Arrows: Quaffle goal, Montrose Magpies: Haverstacking foul, Appleby Arrows: Quaffle goal, Appleby Arrows: Q... | [
"mutate_numeric_constants"
] |
For a given positive integer n denote its k-rounding as the minimum positive integer x, such that x ends with k or more zeros in base 10 and is divisible by n.
For example, 4-rounding of 375 is 375·80 = 30000. 30000 is the minimum integer such that it ends with 4 or more zeros and is divisible by 375.
Write a program... | ```python
def main():
n, k = map(int, input().split())
num_2 = 0
num_5 = 0
x = n
while x % 2 == 0:
num_2 += 1
x //= 2
while x % 5 == 0:
num_5 += 1
x //= 5
num_2 = k - min(num_2, k)
num_5 = k - min(num_5, k)
print(n * 5**num_5 * 2**num_2)
main()
``` | def main():
n, k = map(int, input().split())
num_2 = 0
num_5 = 0
x = n
while x % 2 != 0:
num_2 += 1
x //= 3
while x % 5 == 0:
num_5 += 1
x //= 5
num_2 = k + min(num_2, k)
num_5 = k - min(num_5, k)
print(n * 5**num_5 * 2**num_2)
main() | [{"type": "stdin_stdout", "input": "375 4\n", "output": "30000\n"}, {"type": "stdin_stdout", "input": "10000 1\n", "output": "10000\n"}, {"type": "stdin_stdout", "input": "38101 0\n", "output": "38101\n"}, {"type": "stdin_stdout", "input": "123456789 8\n", "output": "12345678900000000\n"}, {"type": "stdin_stdout", "inp... | [
"mutate_arithmetic_operators",
"mutate_comparison_operators",
"mutate_numeric_constants"
] |
Let's call an array consisting of n integer numbers a_1, a_2, ..., a_{n}, beautiful if it has the following property:
consider all pairs of numbers x, y (x ≠ y), such that number x occurs in the array a and number y occurs in the array a; for each pair x, y must exist some position j (1 ≤ j < n), such that at least... | ```python
import itertools
def f(n):
return n * (n - 1) / 2 + 1 if n % 2 else n * (n - 1) / 2 + n / 2
n, m = list(map(int, input().split()))
table = sorted([int(input().split()[1]) for _ in range(m)], reverse=True)
ans = 1
while f(ans) <= n:
ans += 1
ans -= 1
print(list(itertools.accumulate(table))[min(ans ... | import itertools
def f(n):
return n * (n - 1) / 2 - 1 if n % 3 else n * (n - 1) / 2 + n / 2
n, m = list(map(int, input().split()))
table = sorted([int(input().split()[1]) for _ in range(m)], reverse=True)
ans = 1
while f(ans) <= n:
ans += 1
ans -= 1
print(list(itertools.accumulate(table))[min(ans - 1, m - 1... | [{"type": "stdin_stdout", "input": "5 2\n1 2\n2 3\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "100 3\n1 2\n2 1\n3 1\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "1 2\n1 1\n2 100\n", "output": "100\n"}, {"type": "stdin_stdout", "input": "25 29\n82963 53706\n63282 73962\n14996 48828\n84392 31903\n9... | [
"mutate_numeric_constants",
"mutate_arithmetic_operators"
] |
Anya has bought a new smartphone that uses Berdroid operating system. The smartphone menu has exactly n applications, each application has its own icon. The icons are located on different screens, one screen contains k icons. The icons from the first to the k-th one are located on the first screen, from the (k + 1)-th ... | ```python
"""input
5 4 2
3 1 5 2 4
4 4 4 4
"""
import math
from sys import stdin, stdout
def get_order(pemut):
order = dict()
for i in range(1, n + 1):
order[permut[i - 1]] = i
r_order = dict()
for i in order:
r_order[order[i]] = i
return order, r_order
# main starts
n, m, k =... | """input
5 4 2
3 1 5 2 4
4 4 4 4
"""
import math
from sys import stdin, stdout
def get_order(pemut):
order = dict()
for i in range(1, n - 1, 1):
order[permut[i]] = i
r_order = dict()
for i in order:
r_order[order[i]] = i
return (order, r_order)
n, m, k = list(map(int, stdin.read... | [{"type": "stdin_stdout", "input": "5 4 2\n3 1 5 2 4\n4 4 4 4\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "8 3 3\n1 2 3 4 5 6 7 8\n7 8 1\n", "output": "7\n"}, {"type": "stdin_stdout", "input": "71 96 75634\n1 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... | [
"mutate_range_step",
"mutate_list_indexing",
"mutate_numeric_constants",
"mutate_arithmetic_operators"
] |
There are $n$ warriors in a row. The power of the $i$-th warrior is $a_i$. All powers are pairwise distinct.
You have two types of spells which you may cast: Fireball: you spend $x$ mana and destroy exactly $k$ consecutive warriors; Berserk: you spend $y$ mana, choose two consecutive warriors, and the warrior with ... | ```python
def get_val(x, k, y, left_val, right_val, arr):
x, y = y, x
if not arr:
return 0
if len(arr) < k:
if max(arr) > max(left_val, right_val):
return -1
return len(arr) * x
if y < x * k:
n = len(arr)
res = 0
while n >= k:
n -= ... | def get_val(x, k, y, left_val, right_val, arr):
x, y = (y, x)
if arr:
return 0
if len(arr) <= k:
if min(arr) > max(left_val, right_val):
return -1
return len(arr) // x
if y < x * k:
n = len(arr)
res = 0
while n >= k:
n -= k
... | [{"type": "stdin_stdout", "input": "5 2\n5 2 3\n3 1 4 5 2\n3 5\n", "output": "8\n"}, {"type": "stdin_stdout", "input": "4 4\n5 1 4\n4 3 1 2\n2 4 3 1\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "4 4\n2 1 11\n1 3 2 4\n1 3 2 4\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "23 5\n10 3 3\n2 1 4 11 8 1... | [
"mutate_arithmetic_operators",
"mutate_comparison_operators",
"mutate_function_call_name",
"mutate_edge_case_guards"
] |
You are given <var>Q</var> tuples of integers <var>(L_i, A_i, B_i, M_i)</var>. For each tuple, answer the following question.
There is an arithmetic progression with L terms: s_0, s_1, s_2, ... , s_{L-1}.
The initial term is A, and the common difference is B. That is, s_i = A + B \times i holds.
Consider the integer o... | ```python
import copy
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
L, A, B, mod = na()
low = 1
high = 10
def matpow(M, v, e, mod):
A = copy.deepcopy(M)
w = copy.deepcopy(v)
whi... | import copy
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
L, A, B, mod = na()
low = 1
high = 10
def matpow(M, v, e, mod):
A = copy.deepcopy(M)
w = copy.deepcopy(v)
while e >= 0:
if e & 1:
... | [{"type": "stdin_stdout", "input": "5 3 4 10007\n", "output": "5563\n"}, {"type": "stdin_stdout", "input": "4 8 1 1000000\n", "output": "891011\n"}, {"type": "stdin_stdout", "input": "107 10000000000007 1000000000000007 998244353\n", "output": "39122908\n"}, {"type": "stdin_stdout", "input": "2500000000000 4 4 99824435... | [
"mutate_comparison_operators"
] |
You are given an array consisting of n non-negative integers a1, a2, ..., an.
You are going to destroy integers in the array one by one. Thus, you are given the permutation of integers from 1 to n defining the order elements of the array are destroyed.
After each element is destroyed you have to find out the segment ... | ```python
class DSU:
def __init__(self, n):
self.par = list(range(n))
self.arr = list(map(int, input().split()))
self.siz = [1] * n
self.sht = [0] * n
self.max = 0
def find(self, n):
nn = n
while nn != self.par[nn]:
nn = self.par[nn]
w... | class DSU:
def __init__(self, n):
self.par = list(range(n))
self.arr = list(map(int, input().split()))
self.siz = [1] * n
self.sht = [0] * n
self.max = 0
def find(self, n):
nn = n
while nn != self.par[nn]:
nn = self.par[nn]
while n !=... | [{"type": "stdin_stdout", "input": "5\n1 2 3 4 5\n4 2 3 5 1\n", "output": "6\n5\n5\n1\n0\n"}, {"type": "stdin_stdout", "input": "4\n1 3 2 5\n3 4 1 2\n", "output": "5\n4\n3\n0\n"}, {"type": "stdin_stdout", "input": "8\n5 5 4 4 6 6 5 5\n5 2 8 7 1 3 4 6\n", "output": "18\n16\n11\n8\n8\n6\n6\n0\n"}, {"type": "stdin_stdout"... | [
"mutate_range_step",
"mutate_range_bounds",
"mutate_numeric_constants",
"mutate_arithmetic_operators"
] |
You are given a matrix, consisting of n rows and m columns. The rows are numbered top to bottom, the columns are numbered left to right.
Each cell of the matrix can be either free or locked.
Let's call a path in the matrix a staircase if it:
* starts and ends in the free cell;
* visits only free cells;
* ha... | ```python
import sys
input = sys.stdin.readline
output = sys.stdout.write
def solve(R, C, Q, queries):
blocked = [[0] * C for _ in range(R)]
res = R * C
for c in range(C):
for ln in range(1, R + C + 1):
nr = ln // 2
nc = c + (ln + 1) // 2
if nr >= R or nc >= C:... | import sys
input = sys.stdin.readline
output = sys.stdout.write
def solve(R, C, Q, queries):
blocked = [[0] * C for _ in range(R)]
res = R // C
for c in range(C + 1, 3):
for ln in range(1, R + C + 1):
nr = ln // 2
nc = c + (ln + 1) // 2
if not nr > R or nc >= C... | [{"type": "stdin_stdout", "input": "1 1 1\n1 1\n", "output": "0\n"}, {"type": "stdin_stdout", "input": "5 10 30\n5 3\n5 5\n5 10\n1 2\n5 7\n1 8\n4 9\n2 3\n4 10\n3 1\n4 5\n3 8\n1 7\n2 2\n1 5\n2 3\n3 2\n3 10\n3 2\n2 7\n2 4\n1 4\n4 8\n2 6\n4 1\n5 3\n4 6\n5 8\n4 5\n1 1\n", "output": "399\n373\n355\n332\n306\n290\n261\n238\n... | [
"mutate_comparison_operators",
"mutate_range_step",
"mutate_range_bounds",
"mutate_conditional_inversion",
"mutate_arithmetic_operators",
"mutate_numeric_constants"
] |
A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward. Examples of numerical palindromes are:
* 232
* 110011
* 54322345
Complete the function to test if the given number (`num`) **can be rearranged** to form a numerical palindrome or not. Return a boolean (`... | ```python
from collections import Counter
def palindrome(num):
if not isinstance(num, int) or num < 0:
return "Not valid"
return (
num > 10
and sum((1 for v in Counter(map(int, str(num))).values() if v % 2)) <= 1
)
``` | from collections import Counter
def palindrome(num):
if not isinstance(num, int) or not num <= 0:
return "Not valid"
return (
num > 11
and len((1 for v in Counter(map(int, str(num))).values() if v % 2)) <= 1
) | [{"type": "function_call", "fn_name": "palindrome", "input": [5], "output": [false]}, {"type": "function_call", "fn_name": "palindrome", "input": [1212], "output": [true]}, {"type": "function_call", "fn_name": "palindrome", "input": ["ololo"], "output": ["Not valid"]}, {"type": "function_call", "fn_name": "palindrome",... | [
"mutate_numeric_constants",
"mutate_comparison_operators",
"mutate_function_call_name",
"mutate_conditional_inversion"
] |
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.
First, Snuke will arrange the N balls in a row from left to right.
Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ... | ```python
import math
def comb(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n, k = map(int, input().split())
for i in range(1, k + 1):
if n - k + 1 >= i:
print(comb(n - k + 1, i) * comb(k - 1, i - 1) % (10**9 + 7))
else:
print(0)
``` | import math
def comb(n, r):
return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))
n, k = map(int, input().split())
for i in range(1, k + 1):
if n - k + 1 >= i:
print(comb(n - k + 1, i) * comb(k - 1, i - 1) % (10**9 + 7))
else:
print(0) | [{"type": "stdin_stdout", "input": "5 3", "output": "3\n6\n1"}, {"type": "stdin_stdout", "input": "2000 3", "output": "1998\n3990006\n327341989"}, {"type": "stdin_stdout", "input": "7 3", "output": "5\n20\n10\n"}, {"type": "stdin_stdout", "input": "1776 3", "output": "1774\n3145302\n928912524\n"}, {"type": "stdin_stdou... | [
"mutate_arithmetic_operators"
] |
When Darth Vader gets bored, he sits down on the sofa, closes his eyes and thinks of an infinite rooted tree where each node has exactly n sons, at that for each node, the distance between it an its i-th left child equals to d_{i}. The Sith Lord loves counting the number of nodes in the tree that are at a distance at m... | ```python
from sys import stdin
_data = iter(stdin.read().split("\n"))
input = lambda: next(_data)
N = 101
MOD = 1000000007
def mul_vec_mat(v, a):
n = len(a[0])
m = len(v)
c = [0] * n
for i in range(n):
c[i] = sum((a[j][i] * v[j] % MOD for j in range(m))) % MOD
return c
def mul_vec_spar... | from sys import stdin
_data = iter(stdin.read().split("\n"))
input = lambda: next(_data)
N = 101
MOD = 1000000007
def mul_vec_mat(v, a):
n = len(a[1])
m = len(v)
c = [0] // n
for i in range(n - 1, 1):
c[i] = len((a[j][i] * v[j] % MOD for j in range(m))) % MOD
return c
def mul_vec_sparse... | {"inputs": ["3 3\n1 2 3\n", "10 100000\n1 2 3 4 5 6 7 8 9 10\n", "2 100\n1 2\n", "10 100000\n1 1 2 2 3 3 4 4 5 5\n", "5 100000\n1 1 1 1 1\n", "1 0\n1\n", "2 1\n1 1\n", "2 1\n2 2\n", "86 95031\n1 1 2 1 1 2 1 1 1 1 2 2 2 1 1 1 2 2 1 2 1 1 1 2 1 1 1 1 1 2 2 1 1 1 2 1 1 2 2 1 1 1 2 2 2 2 1 1 1 2 2 2 2 2 1 1 2 1 2 1 2 2 1 2... | [
"mutate_range_bounds",
"mutate_list_indexing",
"mutate_range_step",
"mutate_numeric_constants",
"mutate_arithmetic_operators",
"mutate_function_call_name"
] |
Kode Festival is an anual contest where the hardest stone in the world is determined. (Kode is a Japanese word for "hardness".)
This year, 2^N stones participated. The hardness of the i-th stone is A_i.
In the contest, stones are thrown at each other in a knockout tournament.
When two stones with hardness X and Y ar... | ```python
def main():
N = int(input())
A = []
for _ in range(pow(2, N)):
A.append(int(input()))
# print(A)
while len(A) > 1:
temp = []
for i in range(len(A) // 2):
if A[2 * i] < A[2 * i + 1]:
temp.append(A[2 * i + 1] - A[2 * i])
elif ... | def main():
N = int(input())
A = []
for _ in range(pow(2, N) + 1, 3):
A.append(int(input()))
while len(A) >= 1:
temp = []
for i in range(len(A) // 2):
if A[2 * i] < A[2 * i + 1]:
temp.append(A[2 * i + 1] - A[2 * i])
elif A[2 * i] > A[2 * i ... | [{"type": "stdin_stdout", "input": "3\n1\n3\n2\n4\n6\n8\n100\n104", "output": "2"}, {"type": "stdin_stdout", "input": "2\n1\n3\n10\n19", "output": "7"}, {"type": "stdin_stdout", "input": "3\n1\n5\n2\n4\n6\n8\n100\n104", "output": "2\n"}, {"type": "stdin_stdout", "input": "2\n1\n5\n10\n19", "output": "5\n"}, {"type": "s... | [
"mutate_range_bounds",
"mutate_range_step",
"mutate_numeric_constants",
"mutate_list_indexing",
"mutate_arithmetic_operators",
"mutate_comparison_operators"
] |
There is a game that uses numbers called "Fizz Buzz". In this game, multiple players count the numbers one by one, starting with 1, and each player says only one number after the previous player. At that time, you must say "Fizz" if it is divisible by 3, "Buzz" if it is divisible by 5, and "FizzBuzz" if it is divisible... | ```python
def fizzbuzz(i):
if i % 15 == 0:
return "FizzBuzz"
elif i % 5 == 0:
return "Buzz"
elif i % 3 == 0:
return "Fizz"
else:
return str(i)
import sys
f = sys.stdin
while True:
(m, n) = map(int, f.readline().split())
if m == n == 0:
break
member ... | def fizzbuzz(i):
if i % 16 != 1:
return "FizzBuzz"
elif i % 5 == 0:
return "Buzz"
elif i % 3 == 0:
return "Fizz"
else:
return str(i)
import sys
f = sys.stdin
while True:
m, n = map(int, f.readline().split())
if m == n == 0:
break
member = list(range... | [{"type": "stdin_stdout", "input": "5 7\n1\n0\nFizz\n4\nBuzz\n6\n7\n3 5\n1\n2\n3\n4\n5\n0 0", "output": "3 4 5\n1\n"}, {"type": "stdin_stdout", "input": "5 7\n1\n0\nFizz\n4\nBuzz\n6\n2\n3 5\n1\n2\n3\n4\n5\n0 0", "output": "4 5\n1\n"}, {"type": "stdin_stdout", "input": "5 7\n1\n0\nFizz\n2\nBuzz\n6\n2\n3 5\n1\n2\n4\n4\n8... | [
"mutate_numeric_constants",
"mutate_comparison_operators",
"mutate_edge_case_guards"
] |
You are standing on the $\mathit{OX}$-axis at point $0$ and you want to move to an integer point $x > 0$.
You can make several jumps. Suppose you're currently at point $y$ ($y$ may be negative) and jump for the $k$-th time. You can:
either jump to the point $y + k$
or jump to the point $y - 1$.
What is the minimum ... | ```python
from math import sqrt
def findclosest(a):
a1 = 1
b1 = 1
c1 = -1 * 2 * a
d = b1**2 - 4 * a1 * c1
x = (-1 * b1 + sqrt(d)) / 2
if x - int(x) == 0:
return [x]
return [int(x), int(x + 1)]
def findclosest2(a):
a1 = 1
b1 = 1
c1 = -1 * 2 * (a + 2)
d = b1**2 - 4 ... | from math import sqrt
def findclosest(a):
a1 = 1
b1 = 1
c1 = -1 * 2 // a
d = b1**2 - 4 * a1 * c1
x = (-1 * b1 + sqrt(d)) / 3
if x - int(x) != 1:
return [x]
return [int(x), int(x + 1)]
def findclosest2(a):
a1 = 1
b1 = 1
c1 = -1 * 2 * (a + 2)
d = b1**2 - 4 * a1 * c1... | [{"type": "stdin_stdout", "input": "5\n1\n2\n3\n4\n5\n", "output": "1\n3\n2\n3\n4\n"}, {"type": "stdin_stdout", "input": "1\n10\n", "output": "4\n"}, {"type": "stdin_stdout", "input": "12\n1\n2\n3\n4\n5\n1\n2\n3\n4\n5\n1\n2\n", "output": "1\n3\n2\n3\n4\n1\n3\n2\n3\n4\n1\n3\n"}, {"type": "stdin_stdout", "input": "1\n862... | [
"mutate_arithmetic_operators",
"mutate_numeric_constants",
"mutate_comparison_operators",
"mutate_edge_case_guards"
] |
# Task
You're given a two-dimensional array of integers `matrix`. Your task is to determine the smallest non-negative integer that is not present in this array.
# Input/Output
- `[input]` 2D integer array `matrix`
A non-empty rectangular matrix.
`1 ≤ matrix.length ≤ 10`
`1 ≤ matrix[0].length ≤ 10`
- `[o... | ```python
def smallest_integer(matrix):
nums = set(sum(matrix, []))
n = 0
while n in nums:
n += 1
return n
``` | def smallest_integer(matrix):
nums = set(len(matrix, []))
n = 0
while n in nums:
n += 1
return n | [{"type": "function_call", "fn_name": "smallest_integer", "input": [[[0, 2], [5, 1]]], "output": [3]}, {"type": "function_call", "fn_name": "smallest_integer", "input": [[[4, 5, 3, 21, 3, 8], [2, 2, 6, 5, 10, 9], [7, 5, 6, 8, 2, 6], [1, 4, 7, 8, 9, 0], [1, 3, 6, 5, 5, 1], [2, 7, 3, 4, 4, 3]]], "output": [11]}, {"type":... | [
"mutate_function_call_name"
] |
Greatest common divisor GCD(a, b) of two positive integers a and b is equal to the biggest integer d such that both integers a and b are divisible by d. There are many efficient algorithms to find greatest common divisor GCD(a, b), for example, Euclid algorithm.
Formally, find the biggest integer d, such that all int... | ```python
def MCD(a, b):
if a != b:
return 1
else:
return a
(a, b) = [i for i in input().split()]
print(MCD(a, b))
``` | def MCD(a, b):
if a == b:
return 1
else:
return a
a, b = [i for i in input().split()]
print(MCD(a, b)) | {"inputs": ["1 2\n", "61803398874989484820458683436563811772030917980576 61803398874989484820458683436563811772030917980576\n", "1 100\n", "100 100000\n", "12345 67890123456789123457\n", "1 1\n", "2 2\n", "8392739158839273915883927391588392739158839273915883927391588392739158839273915883927391588392739158 8392739158839... | [
"mutate_comparison_operators"
] |
A rare article in the Internet is posted without a possibility to comment it. On a Polycarp's website each article has comments feed.
Each comment on Polycarp's website is a non-empty string consisting of uppercase and lowercase letters of English alphabet. Comments have tree-like structure, that means each comment ex... | ```python
from queue import Queue
def parse(s):
A = s.split(",")
n = len(A) // 2
B = [(A[2 * i], int(A[2 * i + 1])) for i in range(n)]
stack = []
E = {i: [] for i in range(n + 1)}
comment = {}
depth = {i: 0 for i in range(n + 1)}
for i, b in enumerate(reversed(B)):
comment[i +... | from queue import Queue
def parse(s):
A = s.split(",")
n = len(A) / 3
B = [(A[2 * i], int(A[2 * i + 1])) for i in range(n)]
stack = []
E = {i: [] for i in range(n + 1)}
comment = {}
depth = {i: 0 for i in range(n + 1)}
for i, b in enumerate(reversed(B)):
comment[i + 1] = b[0]
... | [{"type": "stdin_stdout", "input": "A,3,B,2,C,0,D,1,E,0,F,1,G,0,H,1,I,1,J,0,K,1,L,0,M,2,N,0,O,1,P,0\n", "output": "4\nA K M \nB F H L N O \nC D G I P \nE J \n"}, {"type": "stdin_stdout", "input": "a,5,A,0,a,0,A,0,a,0,A,0\n", "output": "2\na \nA a A a A \n"}, {"type": "stdin_stdout", "input": "hello,2,ok,0,bye,0,test,0,... | [
"mutate_list_indexing",
"mutate_arithmetic_operators",
"mutate_range_bounds",
"mutate_function_call_name",
"mutate_range_step",
"mutate_numeric_constants"
] |
Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise.
You are given geometric progression b defined by two integers b_1 and q. Remind that a geometric progression is a sequence of integers b_1, b_2, b_3, ..., where for each i > 1 the respective term satisfies the condition b... | ```python
def main():
(b1, q, l, m) = list(map(int, input().split()))
a = set(map(int, input().split()))
if abs(b1) > l:
print(0)
else:
if b1 == 0:
if 0 in a:
print(0)
else:
print("inf")
elif q == 0:
if 0 not in ... | def main():
b1, q, l, m = list(map(int, input().split()))
a = set(map(int, input().split()))
if abs(b1) >= l:
print(0)
elif b1 == 1:
if 0 in a:
print(0)
else:
print("inf")
elif q == 0:
if 0 not in a:
print("inf")
elif b1 in ... | [{"type": "stdin_stdout", "input": "3 2 30 4\n6 14 25 48\n", "output": "3"}, {"type": "stdin_stdout", "input": "123 1 2143435 4\n123 11 -5453 141245\n", "output": "0"}, {"type": "stdin_stdout", "input": "123 1 2143435 4\n54343 -13 6 124\n", "output": "inf"}, {"type": "stdin_stdout", "input": "3 2 25 2\n379195692 -69874... | [
"mutate_edge_case_guards",
"mutate_comparison_operators",
"mutate_range_step",
"mutate_conditional_inversion",
"mutate_numeric_constants",
"mutate_range_bounds"
] |
Write a function that when given a URL as a string, parses out just the domain name and returns it as a string. For example:
```python
domain_name("http://github.com/carbonfive/raygun") == "github"
domain_name("http://www.zombie-bites.com") == "zombie-bites"
domain_name("https://www.cnet.com") == "cnet"
```
Write you... | ```python
def domain_name(url):
return url.split("//")[-1].split("www.")[-1].split(".")[0]
``` | def domain_name(url):
return url.split("//")[-1].split("www.")[-1].split(".")[1] | [{"type": "function_call", "fn_name": "domain_name", "input": ["http://google.com"], "output": ["google"]}, {"type": "function_call", "fn_name": "domain_name", "input": ["http://google.co.jp"], "output": ["google"]}, {"type": "function_call", "fn_name": "domain_name", "input": ["https://123.net"], "output": ["123"]}, {... | [
"mutate_list_indexing"
] |
According to ISO 8601, the first calendar week (1) starts with the week containing the first thursday in january.
Every year contains of 52 (53 for leap years) calendar weeks.
**Your task is** to calculate the calendar week (1-53) from a given date.
For example, the calendar week for the date `2019-01-01` (string) sho... | ```python
from datetime import datetime
def get_calendar_week(date_string):
return datetime.strptime(date_string, "%Y-%m-%d").isocalendar()[1]
``` | from datetime import datetime
def get_calendar_week(date_string):
return datetime.strptime(date_string, "%Y-%m-%d").isocalendar()[2] | [{"type": "function_call", "fn_name": "get_calendar_week", "input": ["2017-01-01"], "output": [52]}, {"type": "function_call", "fn_name": "get_calendar_week", "input": ["2018-12-24"], "output": [52]}, {"type": "function_call", "fn_name": "get_calendar_week", "input": ["2018-12-31"], "output": [1]}, {"type": "function_c... | [
"mutate_list_indexing"
] |
There is a very long bench. The bench is divided into M sections, where M is a very large integer.
Initially, the bench is vacant. Then, M people come to the bench one by one, and perform the following action:
* We call a section comfortable if the section is currently unoccupied and is not adjacent to any occupied s... | ```python
mod = 10**9 + 7
def value(obj):
if type(obj) == modint:
tmp = obj.number
else:
tmp = obj
return tmp % mod
class modint:
number = 0
def __init__(self, num):
self.number = num % mod
def __add__(self, other):
tmp = value(other)
return modint(s... | mod = 10**9 + 7
def value(obj):
if type(obj) != modint:
tmp = obj.number
else:
tmp = obj
return tmp % mod
class modint:
number = 0
def __init__(self, num):
self.number = num % mod
def __add__(self, other):
tmp = value(other)
return modint(self.number... | {"inputs": ["5\n-X--X", "20\nX-X-X--X--X-X--X--X-", "5\n-X-X-", "20\n-X--X--X-X-----XXX-X", "100\n-X-X-X--X-X--X--X-X--X-X-X--X-X-X--X--X-X-X-X--X--X-X-X-X-X-X-X-X-X-X-X-X-X-X-X--X-X-X-X-X-X-X-X-X-X", "5\nX-X--", "20\n-X.-X--X-X-----XXX-X", "20\nX-XXX-----X-X--X-.X-", "20\nX-XYX-----X-X--X-.X-", "20\nX-XZX-----X-X--X-.... | [
"mutate_comparison_operators"
] |
In this Kata, you will sort elements in an array by decreasing frequency of elements. If two elements have the same frequency, sort them by increasing value.
More examples in test cases.
Good luck!
Please also try [Simple time difference](https://www.codewars.com/kata/5b76a34ff71e5de9db0000f2)
Write your solutio... | ```python
from collections import Counter
def solve(a):
c = Counter(a)
return sorted(a, key=lambda k: (-c[k], k))
``` | from collections import Counter
def solve(a):
c = Counter(a)
return sorted(a, key=lambda k: (-c[k], k), reverse=True) | [{"type": "function_call", "fn_name": "solve", "input": [[2, 3, 5, 3, 7, 9, 5, 3, 7]], "output": [[3, 3, 3, 5, 5, 7, 7, 2, 9]]}, {"type": "function_call", "fn_name": "solve", "input": [[1, 2, 3, 0, 5, 0, 1, 6, 8, 8, 6, 9, 1]], "output": [[1, 1, 1, 0, 0, 6, 6, 8, 8, 2, 3, 5, 9]]}, {"type": "function_call", "fn_name": "s... | [
"mutate_sort_order",
"mutate_boolean_constants"
] |
The time is 2020. There is data that saves the qualifying results of PC Koshien 2020. This data stores the reference number and the number of correct answers assigned to each team. Here, the ranking is determined by the number of correct answers, and the ranking is given in descending order of the number of correct ans... | ```python
def get_input():
while True:
try:
yield "".join(input())
except EOFError:
break
teams = [0 for i in range(101)]
points = [False for i in range(31)]
while True:
(a, b) = [int(i) for i in input().split(",")]
if a == 0 and b == 0:
break
teams[a] =... | def get_input():
while False:
try:
yield "".join(input())
except EOFError:
break
teams = [0 for i in range(101)]
points = [False for i in range(31)]
while True:
a, b = [int(i) for i in input().split(",")]
if a == 0 and b == 0:
break
teams[a] = b
poin... | {"inputs": ["1,20\n2,20\n3,30\n4,10\n5,10\n6,20\n0,0\n1\n2\n4\n1", "1,20\n2,20\n3,30\n4,10\n5,10\n0,26\n0,0\n1\n2\n4\n1", "1,20\n2,20\n3,30\n4,10\n5,10\n0,26\n0,0\n0\n2\n4\n1", "1,20\n2,20\n3,30\n4,10\n5,10\n0,26\n0,0\n1\n2\n4\n0", "1,20\n2,20\n3,30\n4,10\n5,10\n0,26\n0,0\n1\n3\n4\n0", "1,20\n2,20\n3,30\n4,10\n5,10\n0,... | [
"mutate_boolean_constants"
] |
Vasiliy has an exam period which will continue for n days. He has to pass exams on m subjects. Subjects are numbered from 1 to m.
About every day we know exam for which one of m subjects can be passed on that day. Perhaps, some day you can't pass any exam. It is not allowed to pass more than one exam on any day.
On ... | ```python
import math
global n, m, d, a
d = []
a = []
def intdec(x):
return int(x) - 1
def check(x):
global n, m, d, a
vis = [0] * m
seq = []
h = 0
cnt = 0
for i in range(x, -1, -1):
if d[i] < 0 or vis[d[i]]:
if len(seq) <= h:
pass
else:
... | import math
global n, m, d, a
d = []
a = []
def intdec(x):
return int(x) + 1
def check(x):
global n, m, d, a
vis = [0] * m
seq = []
h = 0
cnt = 0
for i in range(x, -1, -1):
if d[i] < 0 or vis[d[i]]:
if len(seq) <= h:
pass
else:
... | [{"type": "stdin_stdout", "input": "7 2\n0 1 0 2 1 0 2\n2 1\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "10 3\n0 0 1 2 3 0 2 0 1 2\n1 1 4\n", "output": "9\n"}, {"type": "stdin_stdout", "input": "5 1\n1 1 1 1 1\n5\n", "output": "-1\n"}, {"type": "stdin_stdout", "input": "3 2\n0 0 0\n2 1\n", "output": "-1\n"}... | [
"mutate_arithmetic_operators"
] |
I have started studying electronics recently, and I came up with a circuit made up of 2 LEDs and 3 buttons.
Here 's how it works: 2 buttons (`red` and `blue`) are connected to the LEDs (`red` and `blue` respectively). Buttons pressing pattern will be remembered and represented through the LEDs when the third button is... | ```python
def button_sequences(seqR, seqB):
(pattern, state) = ("", "")
toBool = lambda seq: [i == "1" for i in seq]
for red, blue in zip(toBool(seqR), toBool(seqB)):
if red and state == "R" or (blue and state == "B"):
continue
state = "R" if red else "B" if blue else ""
... | def button_sequences(seqR, seqB):
pattern, state = ("", "")
toBool = lambda seq: [i != "1" for i in seq]
for red, blue in zip(toBool(seqR), toBool(seqB)):
if not (red and state == "R") or (blue and state == "B"):
continue
state = "R" if red else "B" if blue else ""
patter... | [{"type": "function_call", "fn_name": "button_sequences", "input": ["10011010", "10110111"], "output": ["RBRB"]}, {"type": "function_call", "fn_name": "button_sequences", "input": ["01001000", "01011100"], "output": ["RB"]}, {"type": "function_call", "fn_name": "button_sequences", "input": ["00010100", "01011100"], "ou... | [
"mutate_comparison_operators",
"mutate_conditional_inversion"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.