description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | n = int(input())
a = []
b = []
c = []
d = []
for i in range(n):
opt, num = [int(x) for x in input().split()]
if opt == 0:
a.append(num)
if opt == 10:
b.append(num)
if opt == 1:
c.append(num)
if opt == 11:
d.append(num)
ans = sum(d)
b.sort(reverse=True)
c.sort(reverse=... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR ... |
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | n = int(input())
no = []
a = []
b = []
bo = []
for _ in range(n):
t, s = map(int, input().split())
if t == 11:
bo.append(s)
elif t == 10:
a.append(s)
elif t == 1:
b.append(s)
else:
no.append(s)
ans = 0
for i in bo:
ans += i
a.sort(reverse=True)
b.sort(reverse=True... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ... |
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | n = int(input())
both = []
a, b = [], []
no = []
lb = 0
la = 0
for _ in range(n):
x, y = [x for x in input().split()]
if x == "11":
both.append(int(y))
elif x == "01":
b.append(int(y))
lb += 1
elif x == "10":
a.append(int(y))
la += 1
else:
no.append(in... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR VAR LIST LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER IF... |
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | import sys
a = []
b = []
c = []
d = []
def main():
n = int(sys.stdin.readline().strip("\n"))
for i in range(n):
opt, num = [int(line) for line in sys.stdin.readline().strip("\n").split()[:2]]
if opt == 0:
a.append(num)
if opt == 10:
b.append(num)
if opt... | IMPORT ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR... |
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | n = int(input())
x_s = []
y_s = []
w_s = []
z_s = []
for _ in range(n):
s, a = input().split(" ")
a = int(a)
if s == "00":
z_s.append(a)
if s == "01":
x_s.append(a)
if s == "10":
y_s.append(a)
if s == "11":
w_s.append(a)
w_s = list(reversed(sorted(w_s)))
x_s = lis... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR IF VAR STRING EXPR FUNC_CALL VAR VAR IF VAR STRING EXPR FUNC_CALL VAR VAR IF VAR STRING EXPR FUNC_CALL VAR VAR IF VA... |
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | def fun(c):
return c[0]
def f(a, b, alice, bob, un, n, check):
inf = 0
if n - a <= a:
inf = 0
for i in range(n):
inf += int(inp[i][1])
else:
tempb = 0
j = 0
for i in range(a):
inf += alice[i][0]
d[alice[i][1]] = 1
... | FUNC_DEF RETURN VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER IF BIN_OP VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER NUMBER IF VAR VAR VAR NUMBER VAR STRING VAR NUMBER VAR NUMBE... |
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | N = int(input())
A = [[] for _ in range(4)]
a, b, c, d = A
for ni in range(N):
v, f = input().split()
A[int(v, 2)].append(int(f))
for i in range(len(A)):
A[i].sort(reverse=True)
ans = sum(A[3] or [0])
single = min(len(A[1]), len(A[2]))
ans += sum(A[1][:single] or [0])
ans += sum(A[2][:single] or [0])
x = le... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_... |
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | n = int(input())
a, b, c = [], [], []
ans = 0
num11 = 0
for i in range(n):
t, val = map(int, input().split())
if t == 11:
ans += val
num11 += 1
continue
if t & 1:
a.append(val)
if t & 2:
b.append(val)
if not t:
c.append(val)
a.sort(reverse=True)
b.sort... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR LIST LIST LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR ... |
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | n = int(input())
s = [[], [], [], []]
for i in range(n):
x = input().strip().split()
if x[0] == "11":
s[3].append(int(x[1]))
elif x[0] == "10":
s[2].append(int(x[1]))
elif x[0] == "01":
s[1].append(int(x[1]))
else:
s[0].append(int(x[1]))
ans = 0
for i in range(len(s[3... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST LIST LIST LIST LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING EXPR FUNC... |
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | arr = [[], [], []]
ans = 0
temp = 0
for _ in range(int(input())):
s, c = input().split()
if s == "11":
ans += int(c)
temp += 1
elif s == "00":
arr[0].append(int(c))
elif s == "01":
arr[1].append(int(c))
else:
arr[2].append(int(c))
temp1 = min(len(arr[1]), len(... | ASSIGN VAR LIST LIST LIST LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR STRING VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR STRING EXPR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR STRING EXPR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR E... |
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | n = int(input())
a10 = []
a01 = []
a00 = []
cnt11 = 0
cnt10 = 0
cnt01 = 0
cnt00 = 0
res = 0
for i in range(n):
t1, t2 = input().split(" ")
if t1 == "11":
cnt11 += 1
res += int(t2)
elif t1 == "10":
cnt10 += 1
a10.append(int(t2))
elif t1 == "01":
cnt01 += 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR STRING VAR NUMBER VAR FUNC_CALL VAR VAR IF VAR STRING VAR NUMBER... |
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | n = int(input())
a = [[] for i in range(4)]
for i in range(n):
s, influence = [i for i in input().split()]
a[int(s, 2)].append(int(influence))
for i in range(4):
a[i].sort(reverse=True)
def check():
x = len(a[1])
y = len(a[2])
xy = len(a[3])
z = len(a[0])
if xy + y == 0 or xy + x == 0:... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER A... |
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | n = int(input())
lis10 = []
lis01 = []
lis00 = []
inf = c11 = c10 = c01 = c = c00 = 0
for i in range(n):
a, b = list(map(str, input().split()))
if a == "11":
inf += int(b)
c11 += 1
elif a == "10":
c10 += 1
lis10.append(int(b))
elif a == "01":
c01 += 1
lis0... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR VAR VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR STRING VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR STRING VAR NUMBER EXPR FUNC_CALL VAR FUNC_CA... |
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | def __starting_point():
n = int(input())
supporters = {}
supporters[0] = []
supporters[1] = []
supporters[10] = []
supporters[11] = []
for i in range(n):
[x, y] = [int(x) for x in input().split()]
supporters[x].append(y)
for x in supporters:
supporters[x].sort(rev... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER LIST ASSIGN VAR NUMBER LIST ASSIGN VAR NUMBER LIST ASSIGN VAR NUMBER LIST FOR VAR FUNC_CALL VAR VAR ASSIGN LIST VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR NUMBER ASS... |
Elections in Berland are coming. There are only two candidates β Alice and Bob.
The main Berland TV channel plans to show political debates. There are $n$ people who want to take part in the debate as a spectator. Each person is described by their influence and political views. There are four kinds of political views:... | n = int(input())
both = []
a = []
b = []
neither = []
for i in range(n):
c, d = map(int, input().split())
if c == 11:
both.append(d)
elif c == 10:
a.append(d)
elif c == 1:
b.append(d)
else:
neither.append(d)
inf = sum(both)
lee = len(both)
a.sort(reverse=True)
b.sort(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ... |
A tuple of positive integers {x_1, x_2, ..., x_{k}} is called simple if for all pairs of positive integers (i, j) (1 β€ i < j β€ k), x_{i} + x_{j} is a prime.
You are given an array a with n positive integers a_1, a_2, ..., a_{n} (not necessary distinct). You want to find a simple subset of the array a with the... | def main():
n = int(input())
l = list(map(int, input().split()))
seive = [False, True] * max(l)
a = len(seive)
for i in range(3, int(a**0.5) + 1, 2):
if seive[i]:
for j in range(i * i, a, i):
seive[j] = False
i = l.count(1)
if i:
res = [1] * i
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR FOR VAR FUNC_CALL VAR BIN_OP... |
A tuple of positive integers {x_1, x_2, ..., x_{k}} is called simple if for all pairs of positive integers (i, j) (1 β€ i < j β€ k), x_{i} + x_{j} is a prime.
You are given an array a with n positive integers a_1, a_2, ..., a_{n} (not necessary distinct). You want to find a simple subset of the array a with the... | from time import time
n = int(input())
a = list(map(int, input().split()))
start = time()
cache = {}
def is_prime(n):
if n not in cache:
cache[n] = _is_prime(n)
return cache[n]
def _is_prime(n):
if n == 2 or n == 3:
return True
if n < 2 or n % 2 == 0:
return False
if n <... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT FUNC_DEF IF VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR RETURN VAR VAR FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN NUMBER IF VAR NUMBER BIN_OP VAR NUMBER NUMBER RETURN NUMBER IF V... |
A tuple of positive integers {x_1, x_2, ..., x_{k}} is called simple if for all pairs of positive integers (i, j) (1 β€ i < j β€ k), x_{i} + x_{j} is a prime.
You are given an array a with n positive integers a_1, a_2, ..., a_{n} (not necessary distinct). You want to find a simple subset of the array a with the... | n = int(input())
t = list(map(int, input().split()))
k = t.count(1)
s = " ".join("1" * k)
p = [0] + [1, 0] * 1000000
for i in range(3, 1415, 2):
if p[i]:
p[i * i :: 2 * i] = [0] * ((2000000 - i * i) // 2 // i + 1)
if k > 1:
for q in t:
if q > 1 and p[1 + q]:
exit(print(k + 1, q, s))
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL STRING BIN_OP STRING VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP LIST NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF VAR VAR ASSIGN VAR BIN_OP V... |
A tuple of positive integers {x_1, x_2, ..., x_{k}} is called simple if for all pairs of positive integers (i, j) (1 β€ i < j β€ k), x_{i} + x_{j} is a prime.
You are given an array a with n positive integers a_1, a_2, ..., a_{n} (not necessary distinct). You want to find a simple subset of the array a with the... | def isPrime(n):
if n <= 1:
return False
if n <= 3:
return True
if n % 2 == 0 or n % 3 == 0:
return False
i = 5
while i * i <= n:
if n % i == 0 or n % (i + 2) == 0:
return False
i = i + 6
return True
n = int(input())
arr = list(map(int, input(... | FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER RETURN NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR IF BIN_OP VAR VAR NUMBER BIN_OP VAR BIN_OP VAR NUMBER NUMBER RETURN NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FU... |
A tuple of positive integers {x_1, x_2, ..., x_{k}} is called simple if for all pairs of positive integers (i, j) (1 β€ i < j β€ k), x_{i} + x_{j} is a prime.
You are given an array a with n positive integers a_1, a_2, ..., a_{n} (not necessary distinct). You want to find a simple subset of the array a with the... | def main():
input()
l0, l1, ones = [], [], 0
for a in map(int, input().split()):
if a == 1:
ones += 1
else:
(l1 if a & 1 else l0).append(a)
seive = [False, True] * (((max(l0) if l0 else 0) + (max(l1) if l1 else 0)) // 2 + 1)
a = len(seive)
for i in range(3... | FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR LIST LIST NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL BIN_OP VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER BIN_OP BIN_OP BIN_OP VAR FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR VAR NUMBER NUMBER NUMBER ASSIGN... |
A tuple of positive integers {x_1, x_2, ..., x_{k}} is called simple if for all pairs of positive integers (i, j) (1 β€ i < j β€ k), x_{i} + x_{j} is a prime.
You are given an array a with n positive integers a_1, a_2, ..., a_{n} (not necessary distinct). You want to find a simple subset of the array a with the... | n = int(input())
L = list(map(int, input().split()))
P = [(-1) for _ in range(2000001)]
def premier(n):
if P[n] >= 0:
return P[n]
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
P[n] = False
return False
P[n] = True
return True
e = L.count(1)
if n == 1:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FUNC_DEF IF VAR VAR NUMBER RETURN VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR VAR NUMBER RETURN ... |
A tuple of positive integers {x_1, x_2, ..., x_{k}} is called simple if for all pairs of positive integers (i, j) (1 β€ i < j β€ k), x_{i} + x_{j} is a prime.
You are given an array a with n positive integers a_1, a_2, ..., a_{n} (not necessary distinct). You want to find a simple subset of the array a with the... | def primes_upto(limit):
is_prime = [False] * 2 + [True] * (limit - 1)
for n in range(int(limit**0.5 + 1.5)):
if is_prime[n]:
for i in range(n * n, limit + 1, n):
is_prime[i] = False
return [i for i, prime in enumerate(is_prime) if prime]
check = set(primes_upto(2 * 10**... | FUNC_DEF ASSIGN VAR BIN_OP BIN_OP LIST NUMBER NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER IF VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR NUMBER RETURN VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | for _ in range(int(input())):
n, x, y = map(int, input().split())
a = input()
b = input()
changes = []
for i in range(n):
if a[i] != b[i]:
changes.append(i)
k = len(changes)
if k % 2 == 1:
print(-1)
continue
start = 0
end = k - 1
if not k:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | t = int(input())
for _ in range(t):
n, x, y = map(int, input().split())
a = input()
b = input()
poss = 0
for j in range(n):
if a[j] != b[j]:
poss += 1
if poss % 2 != 0:
print(-1)
continue
if poss == 0:
print(0)
elif poss > 2:
print(y * ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EX... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | tasks = int(input())
for t in range(tasks):
n, x, y = list(map(int, input().split()))
a = input()
b = input()
diff = [i for i in range(n) if a[i] != b[i]]
if len(diff) % 2 != 0:
print(-1)
elif len(diff) != 2:
print(y * len(diff) // 2)
elif diff[0] + 1 != diff[1]:
prin... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER IF FUNC_C... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | t = int(input())
for _ in range(t):
n, x, y = map(int, input().split())
a = list(input())
b = list(input())
mis = set()
for i in range(n):
a[i] = int(a[i])
b[i] = int(b[i])
if a[i] != b[i]:
mis.add(i)
if x >= y * 2:
better_y = True
else:
be... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | testcases = int(input())
while testcases > 0:
n, x, y = [int(x) for x in input().split()]
array = []
string1 = input()
string2 = input()
for i in range(len(string1)):
if string1[i] != string2[i]:
array.append(i)
if len(array) % 2 != 0:
print("-1")
else:
co... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | def f():
n, x, y = map(int, input().split())
a = input()
b = input()
C = 0
CG = 0
for i in range(n - 1):
if a[i] != b[i] and a[i + 1] != b[i + 1]:
C += 1
i += 1
for i in range(n):
if a[i] != b[i]:
CG += 1
if CG % 2:
print(-1)
... | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VA... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | import sys
input = sys.stdin.readline
for _ in range(int(input())):
n, x, y = map(int, input().split())
a = input().strip()
b = input().strip()
ao = a.count("1")
bo = b.count("1")
if bo & 1 != ao & 1:
print(-1)
continue
c = []
for i in range(n):
if a[i] != b[i]:
... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | for mak in range(int(input())):
n, a, b = map(int, input().split())
Flag = 0
s = input()
p = input()
m = []
for i in range(n):
if s[i] != p[i]:
m.append(i)
if len(m) % 2 == 0:
has = len(m)
if has == 0:
print(0)
Flag += 2
eli... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | for _ in range(int(input())):
n, x, y = map(int, input().split())
a = input()
b = input()
yo = []
for i in range(n):
if a[i] != b[i]:
yo.append(i)
if len(yo) % 2:
print(-1)
elif len(yo) == 2:
if yo[1] == yo[0] + 1:
print(min(x, 2 * y))
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL V... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | def solve():
n, x, y = [int(i) for i in input().split()]
a, b = input(), input()
q = 0
w = []
for i in range(n):
if a[i] != b[i]:
q += 1
w.append(i)
if q % 2 != 0:
return -1
if q == 0:
return 0
if q != 2 or w[0] + 1 != w[1]:
return ... | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR NUMBER BIN_OP... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | def solve():
[n, x, y] = [int(x) for x in input().split()]
a = input()
b = input()
arr = []
count = 0
count_idx = []
for idx in range(n):
if a[idx] == b[idx]:
arr.append(0)
else:
arr.append(1)
count += 1
count_idx.append(idx)
... | FUNC_DEF ASSIGN LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUM... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | import sys
input = sys.stdin.readline
def solve():
n, x, y = map(int, input().split())
A = input().strip()
B = input().strip()
diff = []
for i in range(n):
if A[i] != B[i]:
diff.append(i)
m = len(diff)
if m % 2:
return -1
elif m == 2:
return y if di... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER RETURN NUMBER IF VAR NUM... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | for _ in range(int(input())):
n, x, y = list(map(int, input().split()))
a = list(input())
b = list(input())
n_d = 0
r = 0
d = []
for i in range(n):
if a[i] != b[i]:
d.append(i)
n_d += 1
if n_d % 2 == 0:
if n_d == 2 and d[1] - d[0] == 1:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR V... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | t = int(input().strip())
def solve(n, x, y, a, b):
re = 0
cab = a.count("1") + b.count("1")
place = []
k = 0
if cab % 2 == 1:
return -1
cab = 0
for i in range(n):
if a[i] != b[i]:
if a[i] == "1":
cab += 1
if b[i] == "1":
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER RETURN NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR IF VAR VAR STRING VAR NUMBER IF VAR VAR STRIN... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | t = int(input())
for i in range(t):
n, x, y = map(int, input().split(" "))
a = [int(i) for i in input()]
b = [int(i) for i in input()]
sum = 0
flag = 0
found = 0
for i in range(n):
if a[i] - b[i] != 0:
sum += 1
if flag == 1:
found = 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | t = int(input())
for i in range(t):
l0 = input().split()
n, x, y = int(l0[0]), int(l0[1]), int(l0[2])
a = input()
b = input()
con = 0
l = []
for j in range(n):
if a[j] != b[j]:
l.append(j)
con += 1
if con == 0:
print(0)
elif con % 2 == 1:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR V... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | t = int(input())
for i in range(t):
n, x, y = map(int, input().split())
a = input()
b = input()
k = list()
r = 0
for j in range(n):
if a[j] != b[j]:
k.append(j)
if len(k) % 2 != 0:
print(-1)
else:
for f in range(0, len(k), 2):
if x < y or l... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBE... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | t = int(input())
while t > 0:
ip = [int(x) for x in input().split()]
n = ip[0]
x = ip[1]
y = ip[2]
s1 = input()
s2 = input()
count = 0
for i in range(n):
if s1[i] != s2[i]:
count += 1
if count % 2 == 1:
print(-1)
elif count == 0:
print(0)
e... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER IF BIN_OP VAR NUM... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | for i in range(int(input())):
n, x, y = map(int, input().split())
a = input()
b = input()
ch1 = a.count("1")
ch2 = b.count("1")
if abs(ch1 - ch2) % 2 == 0:
j = 0
sum = 0
while j < n:
if a[j] != b[j]:
sum += 1
j += 1
if sum >... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF BIN_OP FUNC_CALL VAR BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE ... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | def main():
for _ in range(int(input())):
n, x, y = map(int, input().split())
a, b = input(), input()
ls = []
for i in range(n):
if a[i] != b[i]:
ls.append(i)
if len(ls) % 2 == 1:
print(-1)
continue
if len(ls) == 2:
... | FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER IF FU... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | for _ in range(int(input())):
n, x, y = map(int, input().split())
x, y = max(x, y), min(x, y)
a = input()
b = input()
s = []
ans = 0
for i in range(n):
if a[i] != b[i]:
ans += 1
s.append(i)
if ans & 1 == 1:
print(-1)
elif ans == 2 and s[1] - s[... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER EXPR FUNC_... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | for _ in range(int(input())):
n, x, y = map(int, input().split())
a = input()
b = input()
p = 0
q = 0
for i in range(n):
if a[i] == "1" and b[i] == "0":
p += 1
elif a[i] == "0" and b[i] == "1":
q += 1
if (p + q) % 2:
print(-1)
else:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR STRING VAR NUMBER IF VAR VAR STRING VAR VAR STRING VAR NUMBER IF BIN_OP... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | t = int(input())
for _ in range(t):
n, x, y = map(int, input().split())
A = list(input())
B = list(input())
d = 0
for i in range(n):
if A[i] != B[i]:
d += 1
if d == 0:
print(0)
continue
if d % 2 != 0:
print(-1)
else:
if d == n == 2:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | t = eval(input())
for i in range(t):
n, x, y = map(int, input().split())
a = input()
b = input()
ind = []
for i in range(n):
if a[i] != b[i]:
ind.append(i)
if len(ind) % 2 == 1:
print(-1)
else:
l = len(ind)
if l != 2 or ind[0] + 1 != ind[1]:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | for _ in range(int(input())):
n, x, y = map(int, input().split())
a = int(input(), 2)
b = a ^ int(input(), 2)
c = bin(b)[2:].count("1")
if c % 2:
print(-1)
elif c == 2 and b & b << 1:
print(min(2 * y, x))
else:
print(y * c // 2) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER STRING IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | def solve():
n, x, y = [int(x) for x in input().split()]
a = input()
b = input()
ind = []
for i in range(n):
if a[i] != b[i]:
ind.append(i)
if len(ind) % 2:
return -1
if len(ind) == 2:
if ind[0] + 1 == ind[1]:
if n == 2 or n == 3:
... | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER RETURN NUMBER IF FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR NUM... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | def miis():
return map(int, input().split())
for _ in range(int(input())):
n, x, y = miis()
a = list(map(int, list(input())))
b = list(map(int, list(input())))
sma = sum(a)
smb = sum(b)
if (n - sum(a)) % 2 != (n - sum(b)) % 2:
print(-1)
continue
ans = 0
f = []
f... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN V... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | testcases = int(input())
for i in range(testcases):
input_1 = input().split()
[n, x, y] = list(map(int, input_1))
input_2 = input()
a_list = list(map(int, [*input_2]))
input_3 = input()
b_list = list(map(int, [*input_3]))
n_diff = 0
cons = False
diff_last = 0
for j in range(n):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN LIST VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR LIST VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR LIST VAR ASSIGN... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | t = int(input())
for _ in range(t):
nxy = [int(i) for i in input().split()]
n, x, y = nxy[0], nxy[1], nxy[2]
a = [int(i) for i in input()]
b = [int(i) for i in input()]
if a == b:
print(0)
continue
k, c = 0, 0
for i in range(n):
if a[i] != b[i]:
k += 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR ... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | def get_numbers_list(string_list):
string_split_list = string_list.split()
number_list = []
for element in string_split_list:
number_list.append(int(element))
return number_list
def main():
t = int(input())
for i in range(t):
n, x, y = map(int, input().split())
a = int(... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CA... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | for i in range(int(input())):
n, x, y = input().split(" ")
n, x, y = int(n), int(x), int(y)
a = input()
b = input()
arr = []
p = 0
for i in range(n):
if a[i] != b[i]:
arr.append(i)
p += 1
if p % 2:
print(-1)
continue
if p == 2 and n >= ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | t = int(input())
for i in range(t):
n, x, y = map(int, input().split(" "))
a = input()
b = input()
c = list(map(lambda x: x[0] != x[1], zip(a, b)))
if sum(c) % 2 == 1:
print(-1)
elif sum(c) == 0:
print(0)
elif n == 2:
print(x)
elif n == 3:
if c[1]:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER FUNC_CALL VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CA... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | t = int(input())
for test in range(t):
n, x, y = map(int, input().split())
a = list(map(int, input()))
b = list(map(int, input()))
if a[0] != b[0]:
if a[1] != b[1]:
cnt = 2
ld = 1
else:
cnt = 1
ld = 0
elif a[1] != b[1]:
cnt = 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR N... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | def func():
n, x, y = map(int, input().split())
a = input()
b = input()
diff = []
for i in range(n):
if a[i] != b[i]:
diff.append(i)
if x > 2 * y:
x = 2 * y
if len(diff) % 2 == 1:
print(-1)
return
elif len(diff) == 0:
print(0)
r... | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR IF VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP NUMBER VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR N... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | for _ in range(int(input())):
n, x, y = map(int, input().split())
l1 = [int(z) for z in list(input())]
l2 = [int(z) for z in list(input())]
changes = 0
changes_ind = []
out = 0
for v in range(n):
if l1[v] != l2[v]:
changes += 1
changes_ind.append(v)
if cha... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VA... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | for _ in range(int(input())):
n, x, y = map(int, input().split())
a = input()
b = input()
c = ""
k = min(x, 2 * y)
for i in range(n):
if a[i] == b[i]:
c += "0"
else:
c += "1"
if c.count("1") % 2:
print(-1)
elif c.count("1") == 0:
pr... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR STRING VAR STRING IF BIN_OP FUNC_CALL VAR STR... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | def cal():
if len(p) == 0:
return 0
if len(p) == 2:
if p[1] == p[0] + 1:
return min(x, 2 * y)
else:
return min(y, x * (p[1] - p[0]))
return len(p) // 2 * y
for jj in range(int(input())):
n, x, y = [int(i) for i in input().split()]
a = input()
b =... | FUNC_DEF IF FUNC_CALL VAR VAR NUMBER RETURN NUMBER IF FUNC_CALL VAR VAR NUMBER IF VAR NUMBER BIN_OP VAR NUMBER NUMBER RETURN FUNC_CALL VAR VAR BIN_OP NUMBER VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER RETURN BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CAL... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | t = int(input())
for _ in range(t):
n, x, y = map(int, input().split())
a = input()
b = input()
c = [0] * n
count = 0
last_occurence = -1
for i in range(n):
if a[i] != b[i]:
c[i] = 1
count += 1
last_occurence = i
if count % 2 != 0:
prin... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ASSIGN VAR VAR NUMBER VAR NUM... |
This is the easy version of the problem. In this version, $n \le 3000$, $x \ge y$ holds. You can make hacks only if both versions of the problem are solved.
You are given two binary strings $a$ and $b$, both of length $n$. You can do the following operation any number of times (possibly zero).
Select two indices $l$ ... | R = lambda: map(int, input().split())
(t,) = R()
for k in range(t):
n, x, y = R()
a = input()
b = input()
indices = []
for i in range(len(a)):
if a[i] != b[i]:
indices.append(i)
length = len(indices)
if length == 0:
print(0)
elif length % 2 != 0:
print... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | import sys
def input():
return sys.stdin.readline().rstrip()
t = int(input())
for i in range(t):
some_val_equal_x = False
some_val_not_equal_x = False
[n, x] = list(map(int, input().split()))
arr = list(map(int, input().split()))
totalDiff = 0
for val in arr:
totalDiff += val - x... | IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN LIST VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | for t in range(int(input())):
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
b = True
c = False
ans = 2
if sum(a) / n == x:
ans = 1
for i in a:
if i != x:
b = False
if i == x:
c = True
if c:
ans = 1
i... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR A... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | for _ in range(int(input())):
n, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
if x in a and max(a) == min(a):
print(0)
elif x in a or sum(a) / n == x:
print(1)
else:
print(2) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR BIN_OP FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | t = int(input())
for you in range(t):
l = input().split()
n = int(l[0])
x = int(l[1])
l = input().split()
li = [int(i) for i in l]
poss = 1
for i in li:
if i != x:
poss = 0
break
if poss:
print(0)
continue
poss = 0
for i in li:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR NUMBER IF VAR EXPR FUNC_... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | for _ in range(int(input())):
n, x = map(int, input().split())
l = [int(i) for i in input().split()][:n]
s = list(set(l))
if len(s) == 1 and s[0] == x:
print(0)
else:
cnt = sum(l)
if cnt == n * x or l.count(x) > 0:
print(1)
else:
print(2) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR BIN_... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | for _ in range(int(input())):
n, x = map(int, input().split())
lis = list(map(int, input().split()))
lo = 0
up = 0
for i in lis:
if i < x:
lo += x - i
elif i > x:
up += i - x
if lo == 0 and up == 0:
print(0)
elif lo == up and lo > 0 or x in lis... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR BIN_OP VAR VAR IF VAR VAR VAR BIN_OP VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CAL... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | def main():
t = int(input())
for _ in range(t):
n, x = map(int, input().split())
a = list(map(int, input().split()))
case_0 = True
for i in a:
if i != x:
case_0 = False
break
if case_0:
print(0)
continue
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | import sys
input = sys.stdin.buffer.readline
def solution():
n, x = map(int, input().split())
l = list(map(int, input().split()))
if l.count(x) == n:
print(0)
elif l.count(x) > 0:
print(1)
else:
s = 0
for i in range(n):
s += x - l[i]
if s == 0:
... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR BIN_OP VAR V... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | def main():
n, x = map(int, input().split())
lst = list(map(int, input().split()))
all_x = True
one = False
sm = 0
for i in lst:
if i != x:
all_x = False
if i == x:
one = True
sm += i - x
if all_x:
print(0)
elif sm != 0 and not one:... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER VAR BIN_OP VAR VAR IF VAR EXPR FUNC_CALL VAR NUMBER IF VAR NUMB... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | t = int(input())
while t > 0:
t -= 1
n, k = input().split()
n, k = int(n), int(k)
lt = [int(o) for o in input().split()]
c = 0
for i in lt:
if i == k:
c += 1
if c == n:
print(0)
elif sum(lt) / n == k or c > 0:
print(1)
else:
print(2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP FUNC_CA... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
n, x = map(int, input().split())
v = [(x - int(i)) for i in input().split()]
v.sort()
if set(v) == {0}:
print(0)
elif sum(v) == 0 or 0 in v:
print(1)
else:
print(2) | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR NUMBER NUMBER VAR EXPR FUNC_C... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | import sys
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return map(int, sys.stdin.readline().rstrip().split())
def LI():
return list(map(int, sys.stdin.readline().rstrip().split()))
t = I()
for _ in range(t):
n, x = MI()
A = LI()
b = sum(A[i] == x for i in range(n))
i... | IMPORT FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSI... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | ansl = []
for _ in range(int(input())):
n, x = map(int, input().split())
al = list(map(int, input().split()))
al.sort()
if al[0] == x and al[-1] == x:
ansl.append(0)
continue
if x * n == sum(al):
ansl.append(1)
elif x in al:
ansl.append(1)
else:
ansl.a... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR NUMBER VAR VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL V... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | T = int(input())
for _ in range(0, T):
n, kk = map(int, input().split())
s = [int(x) for x in input().split()]
arr = list(set(s))
if len(arr) == 1 and s[0] == kk:
print(0)
else:
temp = 0
for i in range(0, len(s)):
if s[i] == kk:
temp = 1
to... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR ... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | from sys import stdin, stdout
for _ in range(int(stdin.readline())):
n, inf = list(map(int, stdin.readline().split()))
a = list(map(int, stdin.readline().split()))
diff = [(inf - v) for v in a]
flag = sm = 0
for v in diff:
if v != 0:
flag = 1
sm += v
if flag == 0:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER VAR VAR IF VAR NUMBER EXPR FUNC_... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | import sys
input = sys.stdin.readline
for _ in range(int(input())):
n, x = map(int, input().split())
arr = list(map(int, input().split()))
_sum = 0
if arr.count(x) == len(arr):
print(0)
continue
for i in arr:
_sum += x - i
if _sum == 0 or arr.count(x) > 0:
print(... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR VAR VAR BIN_OP VAR VAR IF VAR NUM... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | for _ in range(int(input())):
n, x = map(int, input().split())
l = list(map(int, input().split()))
f1, f2 = 0, 0
for i in range(n):
if l[i] == x:
f1 = 1
else:
f2 = 1
if f1 == 1 and f2 == 0:
print(0)
elif f1 == 1 and f2 == 1:
print(1)
el... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL ... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | rl = lambda: list(map(int, input().split()))
rn = lambda: int(input())
rns = lambda: map(int, input().split())
for _ in range(rn()):
n, k = rns()
l = rl()
if l.count(k) == n:
print(0)
elif l.count(k) > 0 or sum([(k - i) for i in l]) == 0:
print(1)
else:
print(2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | import sys
def input():
return sys.stdin.readline()[:-1]
def getInt():
return int(input())
def getIntIter():
return map(int, input().split())
def getIntList():
return list(getIntIter())
def flush():
sys.stdout.flush()
for _ in range(getInt()):
n, x = getIntIter()
nums = getIntLis... | IMPORT FUNC_DEF RETURN FUNC_CALL VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR BIN_O... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | def killJoy(x, n, ratings):
initialInfection = 0
for rating in ratings:
if rating == x:
initialInfection += 1
if initialInfection == n:
return 0
if initialInfection >= 1:
return 1
summ = sum(ratings)
if summ == x * n:
return 1
return 2
t = int(in... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR NUMBER IF VAR VAR RETURN NUMBER IF VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIG... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | for _ in range(int(input())):
rate_change = 0
n, x = map(int, input().split())
acc = list(map(int, input().split()))
acc1 = []
for i in acc:
if i != x:
acc1.append(i)
if not acc1:
print(0)
continue
if len(acc1) < n:
print(1)
continue
fo... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR IF VAR EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR VAR EXPR FUN... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | [
(
lambda N, R, n: (
lambda a, b, c: print(0 if a == b == 0 else 1 if a == b or c else 2)
)(
sum(R - i for i in n if i < R),
sum(i - R for i in n if i > R),
sum(1 for i in n if i == R),
)
)(*map(int, input().split()), list(map(int, input()... | EXPR FUNC_CALL FUNC_CALL FUNC_CALL VAR VAR VAR NUMBER NUMBER VAR VAR VAR NUMBER NUMBER FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | t = int(input())
for _ in range(t):
n, k = map(int, input().split())
A = list(map(int, input().split()))
if sum(A) == n * k:
for a in A:
if a != k:
print(1)
break
else:
print(0)
elif k in A:
print(1)
else:
print(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR BIN_OP VAR VAR FOR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | for i in range(int(input())):
n, x = map(int, input().split())
a = list(map(int, input().split()))
c = 0
sumo = 0
for j in range(n):
if a[j] == x:
c = c + 1
sumo = sumo + a[j] - x
if c == n:
print("0")
elif c >= 1 and c < n:
print("1")
elif sum... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | t = int(input())
def solve():
n, x = map(int, input().split())
A = list(map(int, input().split()))
assert len(A) == n
diff = [(x - xx) for xx in A]
if sum(diff) == 0:
for x in diff:
if x != 0:
return 1
return 0
for x in diff:
if x == 0:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR IF FUNC_CALL VAR VAR NUMBER FOR VAR VAR IF VAR NUMBER RETURN NUMBER RETURN NUMBER FOR VAR VA... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | def main():
n, vir = map(int, input().split(" "))
grade = [i for i in map(int, input().split(" "))]
if grade.count(vir) == n:
return 0
elif vir in grade and sum(grade) != vir * n:
return 1
elif sum(grade) == vir * n:
return 1
else:
return 2
n = int(input())
res ... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR VAR RETURN NUMBER IF VAR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR RETURN NUMBER IF FUNC_CALL VAR VAR BIN_OP VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CA... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | def solve(n, x, ar):
flag = False
for i in range(n):
if ar[i] == x:
continue
else:
flag = True
break
if flag == False:
print(0)
else:
found = False
sumi = 0
for i in range(n):
if ar[i] == x:
f... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR NUMBER VAR BIN_OP VAR VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | t = int(input())
for case in range(t):
n, x = [int(s) for s in input().split(" ")]
a = [int(s) for s in input().split(" ")]
if set(a) == set([x]):
ans = 0
elif sum([(b - x) for b in a]) == 0 or x in a:
ans = 1
else:
ans = 2
print(ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR FUNC_CALL VAR LIST VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR VAR VAR VAR NUMBER VAR VAR ASSIGN... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | for _ in range(int(input())):
n, x = map(int, input().split())
l = list(map(int, input().split()))
print((0, 2 - (x in l or sum(l) == x * n))[l != [x] * n]) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER BIN_OP NUMBER VAR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR BIN_OP LIST VAR VAR |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | t = int(input())
for _ in range(t):
n, x = map(int, input().split())
a = [int(x) for x in input().split()]
c = 0
d = a.count(x)
for i in a:
c += x - i
if d == n:
print("0")
elif c == 0 or a.count(x) > 0:
print("1")
else:
print("2") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR VAR BIN_OP VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER FUNC_CALL VA... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | t = int(input())
for i in range(t):
l, r = map(int, input().split())
a = list(map(int, input().split()))
a = [(r - a[j]) for j in range(l)]
p = sum(a)
if p == 0 and len(set(a)) == 1:
print(0)
elif p == 0 or 0 in a:
print(1)
else:
print(2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR NUMB... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | import sys
inp = sys.stdin.buffer.readline
inar = lambda: list(map(int, inp().split()))
inin = lambda: int(inp())
inst = lambda: inp().decode().rstrip("\n\r")
_T_ = inin()
for _t_ in range(_T_):
n, x = inar()
a = inar()
if set(a) == {x}:
print(0)
elif sum(a) / n == x:
print(1)
elif ... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | t = int(input())
for _ in range(t):
n, x = (int(w) for w in input().split(" "))
A = [int(a) for a in input().split(" ")]
if n * x == sum(A):
if all(a == x for a in A):
print(0)
else:
print(1)
elif any(a == x for a in A):
print(1)
else:
print(2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF BIN_OP VAR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | import sys
input = sys.stdin.readline
(T,) = map(int, input().split())
for _ in range(T):
N, M = map(int, input().split())
X = list(map(int, input().split()))
if len(set(X)) == 1 and M == X[0]:
print(0)
continue
t = 0
for x in X:
t += M - x
if t == 0:
print(1)
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR N... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | def go():
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
diff = [(a[i] - x) for i in range(len(a))]
flag = True
f2 = False
for i in range(len(diff)):
if diff[i] != 0:
flag = False
if diff[i] == 0:
f2 = True
if flag:
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR NU... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | for _ in range(int(input())):
n, x = map(int, input().split())
a = list(map(int, input().split()))
sa = sum(a)
ma, mi = max(a), min(a)
yes = x in a
if ma == mi == x:
print(0)
elif yes:
print(1)
elif sa == x * n:
print(1)
else:
print(2) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | t = int(input())
for i in range(t):
n, x = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
diff = []
s = 0
for j in range(n):
if x - arr[j] == 0:
s += 1
diff.append(x - arr[j])
a = sum(diff)
if a == 0:
z = arr[0]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER VAR NUMBE... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | t = int(input())
q = []
for i in range(t):
l = list(input().split())
n = int(l[0])
x = int(l[1])
m = list(map(int, list(input().split())))
if m.count(x) == n:
q.append(0)
elif sum(m) == x * n or m.count(x) > 0:
q.append(1)
else:
q.append(2)
for i in q:
print(i) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CA... |
A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).
Killjoy's account is already infected and has a rating equal to $x$. Its rating is constant. There are $n$ accounts except hers, nu... | t = int(input())
i = 0
while i < t:
n, k = [int(j) for j in input().split()]
mas = [int(j) for j in input().split()]
flag = [(0) for j in range(len(mas))]
count = 0
for j in range(len(mas)):
if mas[j] == k:
count += 1
flag[j] = 1
if count == len(mas):
prin... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.