problem_spec stringlengths 29 9.53k | correct_answer stringlengths 46 289k | corrupted_answer stringlengths 37 289k | tests stringlengths 293 51.6M | applied_mutations listlengths 1 20 |
|---|---|---|---|---|
For the given sequence with n different elements find the number of increasing subsequences with k + 1 elements. It is guaranteed that the answer is not greater than 8·1018.
Input
First line contain two integer values n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ 10) — the length of sequence and the number of elements in increasing ... | ```python
import os, sys
from io import BytesIO, IOBase
def update(tree, pos, diff, si):
pos += si - 1
while pos:
tree[pos] += diff
pos >>= 1
def query(tree, l, r, si):
(ans, l, r) = (0, l + si - 1, r + si - 1)
while l < r:
if l & 1:
ans += tree[l]
l +... | import os, sys
from io import BytesIO, IOBase
def update(tree, pos, diff, si):
pos += abs(si + 1)
while pos:
tree[pos] += diff
pos >>= 1
def query(tree, l, r, si):
ans, l, r = (0, l + si - 1, r + si - 1)
while l < r:
if l & 1:
ans += tree[l]
l += 1
... | [{"type": "stdin_stdout", "input": "10 2\n6\n10\n9\n7\n1\n2\n8\n5\n4\n3\n", "output": "5\n"}, {"type": "stdin_stdout", "input": "100 7\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n4... | [
"mutate_arithmetic_operators",
"mutate_abs_usage"
] |
When you want to get the square of a binomial of two variables x and y, you will have:
`$(x+y)^2 = x^2 + 2xy + y ^2$`
And the cube:
`$(x+y)^3 = x^3 + 3x^2y + 3xy^2 +y^3$`
It is known from many centuries ago that for an exponent n, the result of a binomial x + y raised to the n-th power is:
Or using the sumation no... | ```python
def f(n):
return [2**i for i in range(n + 1)] + [2 ** (n + 1) - 1]
``` | def f(n):
return abs([1**i for i in range(n + 1 + 1, 2)] - [2 ** (n + 1) - 1]) | [{"type": "function_call", "fn_name": "f", "input": [0], "output": [[1, 1]]}, {"type": "function_call", "fn_name": "f", "input": [1], "output": [[1, 2, 3]]}, {"type": "function_call", "fn_name": "f", "input": [2], "output": [[1, 2, 4, 7]]}, {"type": "function_call", "fn_name": "f", "input": [3], "output": [[1, 2, 4, 8,... | [
"mutate_arithmetic_operators",
"mutate_range_bounds",
"mutate_range_step",
"mutate_numeric_constants",
"mutate_abs_usage"
] |
There are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).
You're given k subsets A_1, …, A_k of \{1, 2, ..., n\}, such that the intersection of any three subsets is empty. In other words, for all 1 ≤ i_1 < i_2 < i_3 ≤ k, A_{i_1} ∩ A_{i_2} ∩ A_{i_3} = ∅.
In one operation, you ... | ```python
from sys import stdin
input = stdin.readline
n, k = [int(i) for i in input().split()]
pairs = [i + k for i in range(k)] + [i for i in range(k)]
initial_condition = list(map(lambda x: x == "1", input().strip()))
data = [i for i in range(2 * k)]
constrain = [-1] * (2 * k)
h = [0] * (2 * k)
L = [1] * k + [0] *... | from sys import stdin
input = stdin.readline
n, k = [int(i) for i in input().split()]
pairs = [i + k for i in range(k)] + [i for i in range(k)]
initial_condition = list(map(lambda x: x == "1", input().strip()))
data = [i for i in range(2 * k)]
constrain = [-1] * (2 * k)
h = [0] * (2 * k)
L = [1] * k + [0] * k
dp1 = [-... | [{"type": "stdin_stdout", "input": "19 5\n1001001001100000110\n2\n2 3\n2\n5 6\n2\n8 9\n5\n12 13 14 15 16\n1\n19\n", "output": "0\n1\n1\n1\n2\n2\n2\n3\n3\n3\n3\n4\n4\n4\n4\n4\n4\n4\n5\n"}, {"type": "stdin_stdout", "input": "8 6\n00110011\n3\n1 3 8\n5\n1 2 5 6 7\n2\n6 8\n2\n3 5\n2\n4 7\n1\n2\n", "output": "1\n1\n1\n1\n1\... | [
"mutate_min_max_usage",
"mutate_edge_case_guards",
"mutate_function_call_name",
"mutate_comparison_operators"
] |
You are given a permutation of 1,2,...,N: p_1,p_2,...,p_N. Determine if the state where p_i=i for every i can be reached by performing the following operation any number of times:
- Choose three elements p_{i-1},p_{i},p_{i+1} (2\leq i\leq N-1) such that p_{i-1}>p_{i}>p_{i+1} and reverse the order of these three.
----... | ```python
def Split(a):
no = []
for i, x in a:
if no:
is_ok = i == x
la_ok = no[-1][0] == no[-1][1]
if is_ok == la_ok:
yield no
no = []
no.append((i, x))
yield no
n = int(input())
p = list(enumerate((int(input()) for i in ... | def Split(a):
no = []
for i, x in a:
if no:
is_ok = i != x
la_ok = no[-2][1] == no[-1][1]
if is_ok == la_ok:
yield no
no = []
no.extend([(i, x)])
yield no
n = int(input())
p = list(enumerate((int(input()) for i in range(n)... | {"inputs": ["5\n5\n2\n1\n4\n3\n", "4\n3\n2\n4\n1\n", "7\n3\n2\n1\n6\n5\n4\n7\n", "6\n5\n3\n4\n1\n2\n6\n", "6\n5\n3\n8\n1\n2\n6", "4\n3\n2\n3\n1", "6\n5\n3\n8\n1\n2\n3", "4\n3\n2\n2\n1", "6\n4\n3\n8\n1\n2\n3", "4\n3\n1\n2\n1", "4\n6\n1\n2\n1", "4\n10\n1\n2\n1", "4\n10\n1\n2\n2", "4\n10\n1\n2\n4", "4\n8\n1\n2\n4", "6\n5\... | [
"mutate_list_indexing",
"mutate_comparison_operators",
"mutate_negative_indexing_shift",
"mutate_append_extend"
] |
During the quarantine, Sicromoft has more free time to create the new functions in "Celex-2021". The developers made a new function GAZ-GIZ, which infinitely fills an infinite table to the right and down from the upper left corner as follows:
[Image] The cell with coordinates $(x, y)$ is at the intersection of $x$-t... | ```python
from sys import stdin, gettrace
if not gettrace():
def input():
return next(stdin)[:-1]
def main():
def solve():
(x1, y1, x2, y2) = map(int, input().split())
print((x2 - x1) * (y2 - y1) + 1)
q = int(input())
for _ in range(q):
solve()
main()
``` | from sys import stdin, gettrace
if not gettrace():
def input():
return next(stdin)[:-1]
def main():
def solve():
x1, y1, x2, y2 = map(int, input().split())
print((x2 - x1) * (y2 - y1) - 1)
q = round(input())
for _ in range(abs(q - 1), 2):
solve()
main() | {"inputs": ["4\n1 1 2 2\n1 2 2 4\n179 1 179 100000\n5 7 5 7\n", "1\n1 1 3 6\n", "1\n118730819 699217111 995255402 978426672\n", "2\n57 179 1329 2007\n179 444 239 1568\n", "1\n1 1 3 6\n", "1\n118730819 699217111 995255402 978426672\n", "2\n57 179 1329 2007\n179 444 239 1568\n", "1\n0 1 3 6\n", "1\n118730819 699217111 12... | [
"mutate_arithmetic_operators",
"mutate_range_bounds",
"mutate_abs_usage",
"mutate_round_to_int",
"mutate_range_step"
] |
In Math, an improper fraction is a fraction where the numerator (the top number) is greater than or equal to the denominator (the bottom number) For example: ```5/3``` (five third).
A mixed numeral is a whole number and a fraction combined into one "mixed" number. For example: ```1 1/2``` (one and a half) is a mixed n... | ```python
def convert_to_mixed_numeral(parm):
(a, b) = list(map(int, parm.split("/")))
(d, r) = divmod(abs(a), b)
s = (0 < a) - (a < 0)
return parm if d == 0 else ("{}" + " {}/{}" * (r != 0)).format(d * s, r, b)
``` | def convert_to_mixed_numeral(parm):
a, b = set(map(int, parm.split("/")))
d, r = divmod(a, b)
s = (0 <= a) + (a < 0)
return parm if d == 0 else ("{}" + " {}/{}" * (r != 0)).format(d * s, r, b) | [{"type": "function_call", "fn_name": "convert_to_mixed_numeral", "input": ["74/3"], "output": ["24 2/3"]}, {"type": "function_call", "fn_name": "convert_to_mixed_numeral", "input": ["9999/24"], "output": ["416 15/24"]}, {"type": "function_call", "fn_name": "convert_to_mixed_numeral", "input": ["74/30"], "output": ["2 ... | [
"mutate_comparison_operators",
"mutate_arithmetic_operators",
"mutate_set_vs_list_cast",
"mutate_abs_usage"
] |
You are given an array a consisting of n integers a_1, a_2, ..., a_n.
Your problem is to find such pair of indices i, j (1 ≤ i < j ≤ n) that lcm(a_i, a_j) is minimum possible.
lcm(x, y) is the least common multiple of x and y (minimum positive number such that both x and y are divisors of this number).
Input
The fi... | ```python
# by the authority of GOD author: manhar singh sachdev #
import os, sys
from io import BytesIO, IOBase
from array import array
def main():
INF = 10**18
n = int(input())
a = list(map(int, input().split()))
lim = max(a) + 1
counter = array("i", [0] * lim)
for i in a:
count... | import os, sys
from io import BytesIO, IOBase
from array import array
def main():
INF = abs(11**18)
n = round(input())
a = set(map(int, input().split()))
lim = min(a) - 1
counter = array("i", [0] * lim)
for i in a:
counter[i] += 1
mini = INF
for i in range(1 + 1, lim, 2):
... | [{"type": "stdin_stdout", "input": "5\n2 4 8 3 6\n", "output": "1 2\n"}, {"type": "stdin_stdout", "input": "5\n5 2 11 3 7\n", "output": "2 4\n"}, {"type": "stdin_stdout", "input": "6\n2 5 10 1 10 2\n", "output": "1 4\n"}, {"type": "stdin_stdout", "input": "4\n7 7 6 7\n", "output": "1 2\n"}, {"type": "stdin_stdout", "in... | [
"mutate_round_to_int",
"mutate_numeric_constants",
"mutate_comparison_operators",
"mutate_conditional_inversion",
"mutate_range_bounds",
"mutate_min_max_usage",
"mutate_abs_usage",
"mutate_range_step",
"mutate_break_to_continue",
"mutate_edge_case_guards",
"mutate_set_vs_list_cast",
"mutate_ar... |
problem
Do you know Just Odd Inventions? The business of this company is to "just odd inventions". Here we call it JOI for short.
JOI has two offices, each of which has square rooms of the same size arranged in a grid pattern. All the rooms that are in contact with each other have an ID card authentication function. ... | ```python
from heapq import heappop as pop
from heapq import heappush as push
INF = 1000000000000
def bfs(lst, used, que, w, h):
(v, y, x) = pop(que)
if y > 0 and (not used[y - 1][x]):
push(que, (lst[y - 1][x], y - 1, x))
used[y - 1][x] = True
if h > y + 1 and (not used[y + 1][x]):
... | from heapq import heappop as pop
from heapq import heappush as push
INF = 1000000000000
def bfs(lst, used, que, w, h):
v, y, x = pop(que)
if not y > 0 and (not used[y - 1][x]):
push(que, (lst[y - 1][x], y - 1, x))
used[y - 1][x] = False
if h >= abs(y + 1) and (not used[y + 1][x]):
... | {"inputs": ["5\n2 2 1 2\n9 5\n1 17\n3 2 2 1\n6 1 20\n8 18 3\n8\n5 4 1 3\n5 5 4 5 5\n8 2 1 9 7\n1 1 3 5 1\n7 2 7 1 3\n6 5 6 2\n2 3 5 8 2 7\n1 6 9 4 5 1\n2 5 5 4 2 2\n5 4 2 5 3 3\n7 1 5 1 5 6\n6\n3 3 2 2\n2 9 2\n9 1 9\n2 9 2\n2 2 1 1\n1 3\n5 7\n0", "5\n2 2 1 2\n6 5\n1 17\n3 2 2 1\n6 1 20\n10 18 3\n8\n5 4 1 3\n5 5 4 5 5\n... | [
"mutate_conditional_inversion",
"mutate_comparison_operators",
"mutate_abs_usage",
"mutate_arithmetic_operators",
"mutate_boolean_constants",
"mutate_list_indexing"
] |
Dr .: Peter, do you know "Yes, I have a number"?
Peter: I used to do it on TV the other day. You remember something by the number of characters in each word contained in a sentence. "Yes, I have a number", so it means "the number 3.14" and is a keyword for remembering pi.
Dr .: Peter, that's not the case. This should... | ```python
import sys
sys.setrecursionlimit(10**6)
def main():
s = input()
if s == "END OF INPUT":
return False
if s[0] == " ":
s[0] = "."
for _ in range(100):
s = s.replace(" ", " . ")
lst = s.split()
ans = []
for i in lst:
if i == ".":
ans += ... | import sys
sys.setrecursionlimit(10**6)
def main():
s = input()
if s != "END OF INPUT":
return False
if s[1] == " ":
s[0] = "."
for _ in range(101 + 1, 2):
s = s.replace(" ", " . ")
lst = s.split()
ans = []
for i in lst:
if i == ".":
ans += [0]... | [{"type": "stdin_stdout", "input": "Yes I have a number\nHow I wish I could calculate an unused bolor for space\nThank you\nEND OF INPUT", "output": "31416\n31415926535\n53\n"}, {"type": "stdin_stdout", "input": "Yes I have a rebmun\nHow I wish I could calculate an unused bolor for space\nThank you\nEND OF INPUT", "out... | [
"mutate_numeric_constants",
"mutate_comparison_operators",
"mutate_join_separator",
"mutate_range_bounds",
"mutate_boolean_constants",
"mutate_list_indexing",
"mutate_range_step"
] |
Using the given four integers from 1 to 9, we create an expression that gives an answer of 10. When you enter four integers a, b, c, d, write a program that outputs an expression that gives an answer of 10 according to the following conditions. Also, if there are multiple answers, only the first answer found will be ou... | ```python
from itertools import permutations, product
import sys
readline = sys.stdin.readline
write = sys.stdout.write
P = [
"((%d %s %d) %s (%d %s %d))",
"(%d %s (%d %s (%d %s %d)))",
"(((%d %s %d) %s %d) %s %d)",
"((%d %s (%d %s %d)) %s %d)",
"(%d %s ((%d %s %d) %s %d))",
]
def solve():
(*... | from itertools import permutations, product
import sys
readline = sys.stdin.readline
write = sys.stdout.write
P = [
"((%d %s %d) %s (%d %s %d))",
"(%d %s (%d %s (%d %s %d)))",
"(((%d %s %d) %s %d) %s %d)",
"((%d %s (%d %s %d)) %s %d)",
"(%d %s ((%d %s %d) %s %d))",
]
def solve():
(*X,) = map(... | [{"type": "stdin_stdout", "input": "8 7 9 9\n4 4 4 4\n5 5 7 5\n0 0 0 0", "output": "((9 * (9 - 7)) - 8)\n0\n((7 * 5) - (5 * 5))"}, {"type": "stdin_stdout", "input": "8 7 9 9\n4 4 4 4\n5 5 3 5\n0 0 0 0", "output": "(((9 - 7) * 9) - 8)\n0\n((5 * 5) - (3 * 5))\n"}, {"type": "stdin_stdout", "input": "8 7 9 9\n4 4 4 4\n5 5 ... | [
"mutate_numeric_constants",
"mutate_comparison_operators",
"mutate_append_extend",
"mutate_edge_case_guards",
"mutate_list_indexing",
"mutate_boolean_constants",
"mutate_negative_indexing_shift",
"mutate_abs_usage",
"mutate_zip_arg_order"
] |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 15