description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | def simulate(n, m, first, last, mask):
pos = "left"
time = 0
for floor in range(n - 1):
action = mask & 1
mask >>= 1
if pos == "left":
if action == 0:
time += 2 * last[floor]
else:
time += m + 1
pos = "right"
... | FUNC_DEF ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR STRING IF VAR NUMBER VAR BIN_OP NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR STRING IF VAR NUMBER VAR BIN_OP NUMBER BIN_OP BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR STR... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | from sys import stdin
def last_in(s):
for index, c in enumerate(reversed(s)):
if c == "1":
return len(s) - 1 - index
return 0
def first_in(s):
for index, c in enumerate(s):
if c == "1":
return index
return len(s) - 1
n, m = map(int, stdin.readline().rstrip()... | FUNC_DEF FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR STRING RETURN BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER VAR RETURN NUMBER FUNC_DEF FOR VAR VAR FUNC_CALL VAR VAR IF VAR STRING RETURN VAR RETURN BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | def counti(i, curr, stairs, s, s2):
if i == n:
return 0
elif on[i] != -1:
a = m + 2 - L[i] + stairs + (m + 2 - curr)
b = R[i] - 1 + stairs + curr - 1
stairs = 1
s = a
x = counti(i + 1, L[i], 1, s, s2)
s += x
s2 = b
y = counti(i + 1, R[i], 1... | FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER VAR VAR VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR NUMBER VAR VAR VAR VAR A... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | n, m = map(int, input().split())
temp = []
for i in range(n):
s = input()
s = s[1:-1]
temp.append(s)
temp = temp[::-1]
i = len(temp) - 1
while len(temp):
s = temp[i]
if s.count("1") == 0:
temp.pop()
i -= 1
else:
break
n = len(temp)
if n == 0:
print(0)
exit()
if n ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF FUNC_CALL VAR STRING NUMBER EXPR ... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | n, m = map(int, input().split())
hotel = [list(map(int, list(input()))) for _ in range(n)]
left = [0] * n
right = [0] * n
c = 0
for i in hotel:
if all(map(lambda x: x == 0, i)):
c += 1
else:
break
for i in range(c, n):
for j in range(m + 2):
if hotel[i][j] == 1:
right[i] ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR VAR NUMBER FOR VAR FUNC_CA... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | n, m = map(int, input().split())
p = [input() for y in range(n)][::-1]
l = r = d = 0
i = j = 0
for y, t in enumerate(p):
if "1" in t:
l, r = min(l - i, r - j) + 2 * m + 2, min(l + i, r + j)
i, j = t.find("1"), t.rfind("1")
l, r, d = l - i, r + j, y
print(min(l, r) + d) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF STRING VAR ASSIGN VAR VAR BIN_OP BIN_OP FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP NUMBER VAR NUMBER FUNC_CALL VAR BIN_O... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | n, m = map(int, input().split())
s = [input() for _ in range(n)]
s = s[::-1]
mark = -1
for i in range(n):
if "1" in s[i]:
mark = i
if mark == -1:
print(0)
exit()
s = s[: mark + 1]
n = len(s)
l = []
r = []
for i in range(n):
for j in range(m + 2):
if s[i][j] == "1":
l.append(j... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF STRING VAR VAR ASSIGN VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR ... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | n, m = map(int, input().split())
l = []
for i in range(n):
l.append(input())
ans = 0
dp = [[0, 0] for i in range(n)]
dp[n - 1][0] = 0
dp[n - 1][1] = m + 1
for i in range(n - 1, 0, -1):
x = l[i][::-1]
if "1" in l[i]:
a = x.index("1")
b = l[i].index("1")
else:
a = m + 1
b =... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | n, m = map(int, input().split())
p = 1
l = [[1, 0]]
l1 = []
r = 0
M = [input() for i in range(n)]
for i in range(n):
if M[i].count("1") == 0:
r = r + 1
else:
break
for i in range(n - 1, r, -1):
for j in range(len(l)):
k = l[j][1]
if l[j][0] == 1:
l1.append([2, k +... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST LIST NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR STRING NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | n, m = map(int, input().split())
L = [list(input()) for i in range(n)]
light_floors = [(n - i - 1) for i in range(n) if "1" in L[i]]
if len(light_floors) == 0:
print(0)
exit()
limit = max(light_floors)
def rec(i, lst):
if i == limit:
if "1" in L[-1]:
cnt = m + 2 - list(reversed(L[-1]))... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER VAR FUNC_CALL VAR VAR STRING VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_DEF IF VAR VAR IF ... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | def booly(s):
return bool(int(s))
n, m = list(map(int, input().split()))
nothing = "0" * (m + 2)
a = []
for i in range(n):
a.append(input())
for i in range(n):
if a[i] != nothing:
break
a = a[i:]
a.reverse()
n = len(a)
leftA = [i.find("1") for i in a]
rightA = [i.rfind("1") for i in a]
for i in ra... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP STRING BIN_OP VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR ASSI... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | def variant(cur):
global minv
if len(cur) < len(rooms):
variant(cur + [0])
variant(cur + [1])
else:
curpos = 0
time = 0
for i in range(len(rooms) - 1):
if curpos != cur[i]:
time += m + 1
curpos = cur[i]
else:
... | FUNC_DEF IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR LIST NUMBER EXPR FUNC_CALL VAR BIN_OP VAR LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR VAR BIN_OP NUMBER VAR VAR VAR IF VAR NUMBE... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | def R():
return map(int, input().strip().split())
n, m = R()
graph = [list(input()) for i in range(n)]
graph = graph[::-1]
dp = []
cost = 0
for i in range(1, n):
L = m + 1
R = 0
for j in range(m + 2):
if graph[i][j] == "1":
L = j
break
for j in range(m + 1, -1, -1):... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | n, m = map(int, input().split())
num = float("inf")
left = 0
right = 1
L, R = [], []
for i in range(n):
s = input()
if "1" not in s:
L.append(-1)
R.append(-1)
else:
L.append(s.index("1"))
R.append(s.rindex("1"))
k = 0
while k < n and R[k] == -1:
k += 1
for i in range(1 <<... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR LIST LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF STRING VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR STRING EXPR FUNC_CAL... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | Inf = int(1000000000.0 + 7)
[n, m] = list(map(int, input().split()))
bld = list()
for i in range(n):
bld.append(input())
bld.reverse()
lef = [(m + 1) for i in range(n)]
rig = [(0) for i in range(n)]
last = -1
for i in range(n):
for j in range(m + 2):
if bld[i][j] == "1":
lef[i] = min(lef[i],... | ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN LIST VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSI... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | def sol():
n, m = map(int, input().split(" "))
mapp = []
for a in range(n):
s = list(input())
s = [(c == "1") for c in s]
mapp.insert(0, s[1:-1])
res = None
empty_floor = n
while True:
litup = False
for x in mapp[empty_floor - 1]:
if x:
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR STRING VAR VAR EXPR FUNC_CALL VAR NUMBER VAR NUMBER NUMBER ASSIGN VAR NONE ASSIGN VAR VAR WHILE NUMBER ASSIGN VAR NUMBER FOR VAR VAR BIN_OP VAR NUMBER ... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | n, m = map(int, input().strip().split())
a = []
L = []
R = []
t = {}
for i in range(n):
b = input()
a.append(b)
L.append(9000000)
R.append(0)
t[i] = 0
a.reverse()
for i in range(n):
for j in range(m + 2):
if a[i][j] == "1":
L[i] = min(L[i], j)
R[i] = max(R[i], j)
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR ... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | n, m = map(int, input().split())
a = [list(map(int, input())) for i in range(n)]
a.reverse()
dp = [[0, 0] for i in range(n + 2)]
dp[0][1] = 10000
last_none = -1
last = -1
for i in range(1, n + 1):
f, l = -1, -1
for j in range(1, m + 1):
if a[i - 1][j] == 1:
if f == -1:
f = j
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BI... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | n, m = map(int, input().split())
h = []
l = []
r = []
last = -1
for i in range(n):
s = input()
h.append(s)
i = 0
for s in reversed(h):
lp, rp = m + 1, 0
for j in range(len(s)):
let = s[j]
if let == "1" and lp == m + 1:
lp = j
if let == "1":
rp = j
l.ap... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | n, m = list(map(int, input().split()))
inf = 10**10
dp = [[inf, inf] for i in range(n)]
a = []
last = -1
for i in range(n):
tmp = input()
tmp1 = []
for j in range(len(tmp)):
if tmp[j] == "1":
tmp1.append(1)
if last == -1:
last = n - i - 1
else:
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR LIST VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CA... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | INF = float("inf")
def solve(grid, n, m):
dp = [[INF for _ in range(2)] for _ in range(n)]
dp[0][0] = -1
dp[0][1] = INF
for i in range(1, n):
occur = [j for j in range(m + 2) if grid[i - 1][j] == "1"]
if not occur:
dp[i][0] = min(dp[i][0], dp[i - 1][0] + 1)
dp[i... | ASSIGN VAR FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR STRING IF VAR ASSIGN VAR VAR NUMBER FUNC_CALL ... |
Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goes and turns all the lights off.
The building consists of n floors with stairs at the left and the right sides... | import sys
input = sys.stdin.readline
n, m = map(int, input().split())
a = []
for i in range(n):
p = list(input().rstrip())
for j in range(m + 2):
p[j] = int(p[j])
a.append(p)
for i in range(n // 2):
a[i], a[n - i - 1] = a[n - i - 1], a[i]
dp = [[0, 0] for i in range(n)]
count = [[-9, -9] for i... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
s = set()
for x in range(n):
s.add(int("".join(map(str, input().split())), 2))
found = False
for i in s:
for j in s:
if i & j == 0 and not found:
print("YES")
found = True
break
if not found:
print("NO") | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FOR VAR VAR IF BIN_OP VAR VAR NUMBER VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBE... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | def test(masks, wanted):
for w in wanted:
if w not in masks:
return False
return True
def any_test(masks, tests):
for t in tests:
if test(masks, t):
return True
return False
def inflate(perm):
count = max(perm)
masks = [[(0) for i in range(len(perm))] ... | FUNC_DEF FOR VAR VAR IF VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF FOR VAR VAR IF FUNC_CALL VAR VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR BIN... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = input().split()
n = int(n)
k = int(k)
inputList = []
twoPkList = []
kList = []
result = "NO"
for j in range(k + 1):
kList.append(0)
for i in range(2**k - 2):
twoPkList.append(list(kList))
for i in range(n):
onesList = []
inputList = input().split()
summation = 0
for j in range(k):
... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
freq = {mask: (0) for mask in range(1 << k)}
for i in range(n):
freq[int("".join([x for x in input().split()]), 2)] += 1
def solve(freq, k):
if freq[0] >= 1:
return True
for mask1 in range(1 << k):
for mask2 in range(1 << k):
if mask1 & mask2 ==... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL STRING VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER NUMBER FUNC_DEF IF VAR NUMBER NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR BIN_OP NUMBER VAR FOR VAR FUNC_C... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
arr = [list(map(int, input().split())) for _ in range(n)]
vis = [0] * (1 << k)
for i in arr:
x = 0
for j in i:
x = 2 * x + j
if x == 0:
print("YES")
exit()
for j in range(len(vis)):
if j & x == 0 and vis[j]:
print("YES")
... | 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 VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER VAR FOR VAR VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | import sys
def ReadInput():
return sys.stdin.read().splitlines()
def GetIA(s, delim=" "):
return [int(x) for x in s.split(delim)]
def GetKey(flags):
key = 0
for a in flags:
key <<= 1
key += a
return key
def main():
input = ReadInput()
seen = dict()
for s in input[... | IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF STRING RETURN FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
arr = [(0) for i in range(2**k)]
for _ in range(n):
s = input()
s = s.replace(" ", "")
kk = int(s, 2)
arr[kk] = 1
f = False
for i in range(2**k):
if arr[i] == 0:
continue
if i == 0:
f = True
for j in range(i + 1, 2**k):
if arr[j] == 0:... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP NUMBER VAR IF ... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
l = [0] * 100
for i in range(n):
l[int("".join(input().split()), 2)] = 1
for i in range(16):
for j in range(16):
if l[i] and l[j] and i & j == 0:
print("YES")
exit(0)
print("NO") | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR VAR BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR ST... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | import sys
N, K = list(map(int, input().split()))
states = set([(0, 0)])
for _ in range(N):
can_solve = list(map(int, input().split()))
next_states = set()
for selected, bm in states:
cnts = [(bm >> i & 1) for i in range(K)][::-1]
next_cnts = [(cnts[i] + can_solve[i]) for i in range(K)]
... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER VAR FUNC_CALL VAR VAR NU... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
sp = [0] * 2**k
for i in range(n):
ci = list(map(int, input().split()))
c = 0
for j in range(k - 1, -1, -1):
c += (1 - ci[j]) * 2**j
sp[c] += 1
ed = [False] * k
for i in range(2**k - 1, -1, -1):
ci = []
t = i
for j in range(k - 1, -1, -1):
ci.... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER VAR BIN_OP BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | from sys import exit
n, k = [int(i) for i in input().split()]
s = set([int("".join(input().split()), base=2) for j in range(n)])
for t in s:
for m in range(1 << k):
if m in s:
for i in range(k):
if t >> i & 1 and m >> i & 1:
break
else:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP NUMBER VAR IF VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER ... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | from itertools import chain, combinations
n, k = list(map(int, input().split()))
a = [int(input().replace(" ", ""), 2) for i in range(n)]
def powerset(iterable):
xs = list(iterable)
return chain.from_iterable(combinations(xs, n) for n in range(len(xs) + 1))
for s in powerset([x for x in range(1 << k) if x ... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING STRING NUMBER VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR RETURN FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR ... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | vis = [0] * ((1 << 4) + 5)
line = input().split()
n = int(line[0])
k = int(line[1])
for i in range(n):
line = input().split()
st = 0
for j in range(k):
x = int(line[j])
st += (1 << j) * x
vis[st] = 1
flag = False
for i in range(16):
for j in range(16):
if vis[i] == 0 or vis[j... | ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR BIN_OP... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
probs = list([0] * n for _ in range(k))
pbtype = [0] * 2**k
e = [False] * 2**k
ei = [False] * k
for i in range(n):
x = list(map(int, input().split()))
sum = 0
for j in range(k):
if x[j] == 0:
sum += 2**j
ei[j] = True
pbtype[sum] += 1
e... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VA... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | ii = lambda: int(input())
kk = lambda: map(int, input().split())
ll = lambda: list(kk())
n, k = kk()
ls = [False] * 16
for _ in range(n):
x = 0
for v in kk():
x = x * 2 + v
ls[x] = True
if ls[0]:
print("yes")
exit()
for i in range(1, 16):
if ls[i]:
for j in range(i + 1, 16):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR VAR NU... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = list(map(int, input().strip().split()))
array = [0] * 2**k
for _ in range(n):
t = int("".join(input().strip().split()), 2)
array[t] += 1
comp = [[] for i in range(2**k)]
for i in range(2**k):
for j in range(2**k):
if i & j == 0:
comp[i].append(j)
flag = False
if array[0] > 0:
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL FUNC_CALL FUNC_CALL VAR NUMBER VAR VAR NUMBER ASSIGN VAR LIST VAR FUNC_CALL VAR BIN_OP NUMBER VAR FOR VAR FUNC_CA... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
vis = [0] * 17
for _ in range(n):
a = list(map(int, input().split()))
vis[sum(a[i] * (1 << i) for i in range(k))] = 1
flag = 0
for i in range(16):
for j in range(16):
if i & j == 0 and vis[i] and vis[j]:
flag = 1
print("YES" if flag else "NO") | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP NUMBER VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | import sys
input = sys.stdin.readline
n, k = list(map(int, input().split()))
ps = set()
for _ in range(n):
ps.add(tuple(map(int, input().split())))
if tuple([0] * k) in ps:
print("YES")
exit()
for first in ps:
for i in range(2**k):
binary = list(map(int, bin(i)[2:]))
binary = tuple([0] ... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR BIN_OP LIST NUMBER VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FOR VAR VAR ... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
a = set()
yes = False
for i in range(n):
a.add(input())
for w1 in a:
for w2 in a:
x = list(map(int, w1.split()))
y = list(map(int, w2.split()))
count = 0
for i in range(k):
if x[i] + y[i] != 2:
count += 1
if cou... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR FOR VAR 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 ASSIGN VAR NUMBER FOR V... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | from itertools import accumulate, combinations, permutations
from sys import stdout
R = lambda: map(int, input().split())
n, k = R()
s = set(tuple(R()) for x in range(n))
res = False
for l in range(1, len(s) + 1):
for x in combinations(s, l):
res = res or all(2 * sum(t) <= l for t in zip(*x))
print("YES" i... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR BIN_OP NUMBER FUNC_CALL V... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | def bel(mask, bit):
return mask & 1 << bit != 0
read = lambda: map(int, input().split())
n, k = read()
f = [0] * 100
for i in range(n):
cur = int("".join(input().split()), 2)
cur ^= (1 << k) - 1
f[cur] = 1
ans = "NO"
if k == 1:
if f[1]:
ans = "YES"
if k == 2:
f1 = f2 = 0
for i in r... | FUNC_DEF RETURN BIN_OP VAR BIN_OP NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL FUNC_CALL VAR NUMBER VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR VAR... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | Read = lambda: map(int, input().split())
n, m = Read()
s = set()
for i in range(n):
s.add(int("".join(map(str, input().split())), 2))
for i in s:
for j in s:
if i & j == 0:
print("Yes")
exit()
print("No") | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER FOR VAR VAR FOR VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CAL... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | inp = map(int, input().split())
n, k = inp
a = [list(map(int, input().split())) for _ in range(n)]
found = [False] * (1 << k)
done = False
for i in a:
val = 0
for j in i:
val *= 2
val += j
if val == 0:
done = True
for j in range(len(found)):
if j & val == 0 and found[j]:
... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER ... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
cnt = [0] * (1 << k)
for _ in range(n):
arr = list(map(int, input().split()))
acc = 0
for i in range(k):
acc |= arr[i] * (1 << i)
cnt[acc] += 1
gud = cnt[0] > 0
for i in range(1 << k):
for j in range(i + 1, 1 << k):
if i & j > 0:
continue
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR BIN_OP NUMBER VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMB... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | def flip(x):
return any(bin(i)[2:] in s for i in range(2 << k) if not i & x)
n, k = map(int, input().split())
s = set()
for _ in range(n):
x = input().replace(" ", "")
if flip(int(x, 2)) or x == "0" * k:
exit(print("YES"))
s.add(x.lstrip("0"))
print("NO") | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR VAR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING STRING IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR BIN_OP ... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | inp = input().split(" ")
n = int(inp[0])
k = int(inp[1])
s = set()
for i in range(n):
a = input().split(" ")
x = 0
for j in range(k):
x = 2 * x + int(a[j])
s.add(x)
for i in range(16):
if i in s:
for j in range(16):
if j in s:
if i & j == 0:
... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR FUNC_CALL VAR VAR VAR EXPR FUNC_C... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = [int(i) for i in input().split()]
store = set()
for i in range(n):
temp = [int(_) for _ in input().split()]
temp = tuple(temp)
store.add(temp)
store = list(store)
def fun3(arr, total, a, b, c, index):
if 2 * a <= total and 2 * b <= total and 2 * c <= total and total != 0:
return 1
i... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_DEF IF BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR VAR BIN_OP NUMBER ... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | import sys
from sys import stdin, stdout
def R():
return map(int, stdin.readline().strip().split())
def I():
return stdin.readline().strip().split()
n, m = map(int, stdin.readline().strip().split())
arr = []
for i in range(n):
arr.append(int("".join(I()), 2))
arr = list(set(arr))
if 0 in arr:
prin... | IMPORT FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR NUMBER ASSIGN VAR FUNC... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = list(map(int, input().split()))
sq_k = 2**k
rec = [0] * sq_k
for _ in range(n):
ind = int("".join(input().split()), 2)
rec[ind] += 1
ans = "YES"
if rec[0] > 0:
print(ans)
exit()
for i in range(sq_k):
for j in range(sq_k):
if rec[i] > 0 and rec[j] > 0:
if i & j == 0:
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL FUNC_CALL VAR NUMBER VAR VAR NUMBER ASSIGN VAR STRING IF VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = [int(i) for i in input().split()]
K = 1 << k
p = [0] * K
for i in range(n):
pi = [int(j) for j in input().split()]
pc = sum(pi[j] << j for j in range(k))
p[pc] += 1
s = [0] * k
def go(i0, used):
if i0 >= K:
return False
if p[i0]:
s0 = s[:]
ok = True
used += 1... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VA... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = list(map(int, input().split()))
cnt = {}
for i in range(2**k):
cnt[bin(i)[2:].zfill(k)] = 0
for i in range(n):
l = input().split()
s = ""
for x in l:
s += x
cnt[s] += 1
def f1():
if cnt["0"] > 0:
print("YES")
else:
print("NO")
def f2():
if cnt["00"] > 0... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING FOR VAR VAR VAR VAR VAR VAR NUMBER FUNC_DEF IF VAR STRING... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
temp = {}
for i in range(n):
c = int("".join(input().split()), 2)
temp[c] = 1
f = 0
for i in range((1 << k) + 1):
for j in range((1 << k) + 1):
if temp.get(i, 0) and temp.get(j, 0) and not i & j:
f = 1
if f:
print("YES")
else:
print("NO") | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR NUMBER ... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | v = [(0) for i in range(20)]
n, m = map(int, input().split())
for i in range(n):
x = list(map(int, input().split()))
sum = 0
for j in range(m):
sum += x[j] * (1 << j)
v[sum] = 1
flag = 0
for i in range(16):
for j in range(16):
if i & j == 0 and v[i] and v[j]:
flag = 1
if ... | ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR BIN_OP NUMBER VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VA... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = [int(z) for z in input().split()]
ans = [0] * 16
for i in range(n):
problem = [int(z) for z in input().split()]
s = 0
for j in range(k):
s = s * 2 + problem[j]
ans[s] += 1
for i in range(16):
for j in range(16):
if ans[i] > 0 and ans[j] > 0 and i & j == 0:
print("Y... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, m = map(int, input().split())
c = [0] * 16
for _ in range(n):
c[int("".join(input().split()), 2)] += 1
yes = c[0]
for i in range(1 << m):
if c[i]:
for j in range(i + 1, 1 << m):
if 0 == i & j and c[j]:
yes = 1
print("YES" if yes else "NO") | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP NUMBER VAR IF VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP NUMBER ... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
kij = [list(map(int, input().split())) for i in range(n)]
kji = [[max(sum(kij[j]) / k, kij[j][i]) for j in range(n)] for i in range(k)]
km = [min(kji[i]) for i in range(k)]
if max(km) == 1 or sum(km) > k / 2:
print("NO")
elif k == 2 or k == 3 or min(km) <= 0.25:
print("YES")
els... | 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 VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR IF FU... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | from sys import stdin, stdout
n, k = map(int, stdin.readline().split())
used = {}
sze = 2**k
for i in range(n):
values = list(map(int, stdin.readline().split()))
if "".join(list(map(str, values))) in used:
used["".join(list(map(str, values)))] += 1
else:
used["".join(list(map(str, values)))... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER A... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | problems, teams = [int(x) for x in input().split()]
teams1 = [(0) for x in range(teams)]
known = set()
for i in range(problems):
questions = "".join(input().split())
known.add(int(questions, 2))
known = sorted(known)
z = len(known)
for i in range(z):
for j in range(i, z):
if known[i] & known[j] == 0... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL STRING FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_C... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = [int(x) for x in input().split()]
bit_array = set()
for i in range(n):
temp = input()
temp2 = ""
for c in temp:
if c != " ":
temp2 += c
bit_array.add(temp2)
ls = list(bit_array)
ans = "no"
for x in ls:
for y in ls:
temp = ""
for i in range(k):
t... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR VAR IF VAR STRING VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR VAR FOR VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL V... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | def fun(l):
s = 0
for i in range(len(l)):
s += l[i] << i
return s
la = [(0) for i in range(16)]
n, k = [int(i) for i in input().split()]
for i in range(n):
la[fun([int(j) for j in input().split()])] += 1
f = 0
for i in range(16):
if la[i] > 0:
for j in range(i + 1, 16):
... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR VAR RETURN VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | m = []
n, k = [int(x) for x in input().split()]
for i in range(n):
m.append(list(map(int, input().split())))
mp = [0] * 100
for i in range(n):
s = ""
for j in range(k):
s += str(m[i][j])
mp[int(s, 2)] += 1
if mp[0]:
print("YES")
exit()
if mp[1]:
if mp[2] or mp[4] or mp[6] or mp[8] or... | ASSIGN VAR LIST ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR F... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | def main():
m, k = map(int, input().split())
all = set()
zeros = ""
for _ in range(k):
zeros += "0"
for _ in range(m):
line = input().replace(" ", "")
if line == zeros:
print("YES")
return
all.add(line)
for s1 in all:
for s2 in all:... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING STRING IF VAR VAR EXPR FUNC_CALL VAR STRING RETURN EXPR FUNC_CALL VAR VAR FOR VAR VAR FOR VAR VAR IF VAR V... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = [int(i) for i in input().split()]
if k == 1:
alert = 0
for time in range(n):
term = str(input())
if term == "0":
alert = 1
break
print("NO") if alert == 0 else print("YES")
elif k == 2:
s1, s2 = 0, 0
for time in range(n):
term = str(input())
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR STRING ASSIGN VAR NUMBER EXPR VAR NUMBER FUNC_CALL VAR STRING FUNC_CALL VAR STRING IF VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASS... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
s = []
A = []
for i in range(16):
A.append(False)
for i in range(n):
s.append(input())
s[i] = s[i].replace(" ", "")
s[i] = s[i] + "0" * (4 - k)
s[i] = int(s[i], 2)
A[s[i]] = True
fl = False
if A[0]:
fl = True
if A[1]:
for i in range(2, 16, 2):
if ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR STRING STRING ASSIGN VAR VAR BIN_OP VAR VAR BIN_OP STRING BIN_OP NUMBER VAR ASSIGN V... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
exist = [False] * 16
zero = [False] * 4
for i in range(n):
part = list(map(int, input().split()))
P = [0] * (4 - k)
for elem in part:
P.append(elem)
num = 0
for j in range(4):
if P[j] == 0:
zero[j] = True
for j in range(4):
if ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NU... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | def main():
arr = input().split()
count = int(arr[0])
teams = int(arr[1])
arr = [(False) for x in range(2**teams)]
arr[0] = True
bo = False
for x in range(count):
string = input().split()
store = 0
for y in range(teams):
if string[y] == "0":
... | FUNC_DEF ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
a = []
for i in range(n):
l = list(map(int, input().split()))
a.append(l)
a = list(set(tuple(i) for i in a))
for i in range(len(a)):
flag = False
for j in range(len(a)):
cnt = 0
for x in range(k):
if a[i][x] == 1 and a[j][x] != 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR ... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k = map(int, input().split())
z = [0] * 2**k
for i in range(n):
x = list(map(int, input().split()))
s = ""
for i in x:
s += str(i)
num = int(s, 2)
z[num] += 1
if z[0]:
print("YES")
exit()
for i in range(2**k):
for j in range(2**k):
if i & j == 0:
if z[i] an... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING FOR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR VAR NUMBER IF VAR NUMBER EXPR ... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | n, k1 = tuple(map(int, input().split()))
l = []
ans = 0
for i in range(n):
l.append(list(map(int, input().split())))
d1 = [[[0], [0]], [[0], [1]]]
d2 = [
[[0, 0], [0, 1]],
[[0, 0], [1, 0]],
[[0, 0], [0, 0]],
[[0, 0], [1, 1]],
[[0, 1], [1, 0]],
]
d3 = []
d4 = []
for i in range(1):
for j in ra... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST LIST LIST NUMBER LIST NUMBER LIST LIST NUMBER LIST NUMBER ASSIGN VAR LIST LIST LIST NUMBER NUMBER ... |
Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subset of it as a problemset.
k experienced teams are participating in the contest. Some of these teams already know some of the problems... | def clc(m, k):
opts = [""]
for i in range(k):
if m[i] == 1:
opts = [(o + "0") for o in opts]
else:
opts = [(o + "0") for o in opts] + [(o + "1") for o in opts]
return opts
n, k = map(int, input().split())
s = set()
for _ in range(n):
m = list(map(int, input().sp... | FUNC_DEF ASSIGN VAR LIST STRING FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR BIN_OP VAR STRING VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR STRING VAR VAR BIN_OP VAR STRING VAR VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CA... |
Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0.
There are also n cards, each card has 2 attributes: length li and cost ci. If she pays ci dollars then she can apply i-th card. After app... | def gcd(x, y):
while x % y > 0:
x, y = y, x % y
return y
n = int(input())
a, b, c = (
[int(x) for x in input().split()],
[int(x) for x in input().split()],
[{} for i in range(n)],
)
def f(i, g):
if g == 1:
return 0
if i == n:
return 100000000000
if g in c[i]:
... | FUNC_DEF WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR DICT VAR FUNC_CALL VAR VAR FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR VAR RETURN NUMBER... |
Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0.
There are also n cards, each card has 2 attributes: length li and cost ci. If she pays ci dollars then she can apply i-th card. After app... | def main():
input()
acc = {(0): 0}
for p, c in zip(list(map(int, input().split())), list(map(int, input().split()))):
adds = []
for b, u in acc.items():
a = p
while b:
a, b = b, a % b
adds.append((a, u + c))
for a, u in adds:
... | FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR DICT NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR WHILE VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR ... |
Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0.
There are also n cards, each card has 2 attributes: length li and cost ci. If she pays ci dollars then she can apply i-th card. After app... | def gcd(x, y):
if y == 0:
return x
return gcd(y, x % y)
n = int(input())
a = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
d = sorted(c)
for i in range(n):
for j in range(i, n):
if d[i] == c[j]:
c[i], c[j] = c[j], c[i]
a[i], a[j] = a[j], a[... | FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN 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 FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR IF VAR V... |
Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0.
There are also n cards, each card has 2 attributes: length li and cost ci. If she pays ci dollars then she can apply i-th card. After app... | n = int(input())
l = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
gcds = {(0): 0}
for i in range(n):
adds = {}
for g in gcds.keys():
x = gcd(g, l[i])
y = gcds.get(x)
u = g... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN VAR DICT NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR... |
Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0.
There are also n cards, each card has 2 attributes: length li and cost ci. If she pays ci dollars then she can apply i-th card. After app... | import sys
n = int(input())
l = list(map(int, input().split()))
c = list(map(int, input().split()))
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
a = {(0): 0}
for i in range(n):
b = a.copy()
for p in a.items():
d = gcd(p[0], l[i])
cost = p[1] + c[i]
if d no... | IMPORT 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN VAR DICT NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR... |
Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0.
There are also n cards, each card has 2 attributes: length li and cost ci. If she pays ci dollars then she can apply i-th card. After app... | def gcd(x, y):
if y == 0:
return x
return gcd(y, x % y)
n = int(input())
a = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
f = {}
for i in range(n):
h = {}
for x in f:
h[x] = f[x]
for x in f:
tmp = h[x] + c[i]
g = gcd(x, a[i])
h[g] ... | FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN 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 DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR VAR VAR ... |
While doing some spring cleaning, Daniel found an old calculator that he loves so much. However, it seems like it is broken. When he tries to compute $1 + 3$ using the calculator, he gets $2$ instead of $4$. But when he tries computing $1 + 4$, he gets the correct answer, $5$. Puzzled by this mystery, he opened up his ... | def solve(L, R):
res = 0
for i in range(32):
for j in range(32):
l = L >> i << i
r = R >> j << j
if l >> i & 1 == 0 or r >> j & 1 == 0:
continue
l -= 1 << i
r -= 1 << j
if l & r:
continue
... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER BIN_OP BIN_OP VAR VAR NUMBER NUMBER VAR BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR IF BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VA... |
While doing some spring cleaning, Daniel found an old calculator that he loves so much. However, it seems like it is broken. When he tries to compute $1 + 3$ using the calculator, he gets $2$ instead of $4$. But when he tries computing $1 + 4$, he gets the correct answer, $5$. Puzzled by this mystery, he opened up his ... | def g(a, b):
cur = 1
res = 0
ze = 0
while cur <= b:
if b & cur:
b ^= cur
if a & b == 0:
res += 1 << ze
if a & cur == 0:
ze = ze + 1
cur <<= 1
return res
def f(a, b):
res = 0
if a == b:
return 0
if a == ... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR VAR VAR IF BIN_OP VAR VAR NUMBER VAR BIN_OP NUMBER VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR NUMBER IF VAR VAR RETURN NUMBER IF VAR NUMBER RETURN BIN_OP BIN_OP BIN_OP ... |
While doing some spring cleaning, Daniel found an old calculator that he loves so much. However, it seems like it is broken. When he tries to compute $1 + 3$ using the calculator, he gets $2$ instead of $4$. But when he tries computing $1 + 4$, he gets the correct answer, $5$. Puzzled by this mystery, he opened up his ... | def get_bin(a):
nums = []
for i in range(32):
if 1 << i & a:
nums.append(1)
else:
nums.append(0)
while len(nums) > 0 and nums[-1] == 0:
nums.pop()
return nums
dp = {}
def get_num(a, b):
nonlocal dp
if (a, b) in dp:
return dp[a, b]
i... | FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR RETURN VAR ASSIGN VAR DICT FUNC_DEF IF VAR VAR VAR RETURN VAR VAR VAR IF VAR NUMBER VAR NUMBER RETURN NUMBER IF VA... |
Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas).
... | def F(a, b, c, d, e, f, k):
for _ in range(k - 2):
a, b, c, d, e, f = d, e, f, a, b + e + (c and d), f
return e
k, x, n, m = map(int, input().split())
for a in [True, False]:
for c in [True, False]:
for b in range((n - a - c) // 2 + 1):
for d in [True, False]:
f... | FUNC_DEF FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR RETURN VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR LIST NUMBER NUMBER FOR VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR VA... |
Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas).
... | import sys
def make_string(k, k2string, s1, s2):
if k in k2string:
return k2string[k]
if k == 1:
k2string[k] = s1
elif k == 2:
k2string[k] = s2
else:
k2string[k] = make_string(k - 2, k2string, s1, s2) + make_string(
k - 1, k2string, s1, s2
)
retu... | IMPORT FUNC_DEF IF VAR VAR RETURN VAR VAR IF VAR NUMBER ASSIGN VAR VAR VAR IF VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR RETURN VAR VAR FUNC_DEF IF VAR VAR RETURN VAR VAR IF VAR NUMBER ASSIGN VAR VAR LIST NUMBER NUMBER NUMB... |
Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas).
... | def main():
k, x, n, m = map(int, input().split())
def f(s, e, n, cnt):
ret = [""] * n
ret[0] = s
ret[-1] = e
sa = 0 if s == "A" else 1
for i in range(cnt):
ret[sa] = "A"
ret[sa + 1] = "C"
sa += 2
for j in range(sa, n - 1):
... | FUNC_DEF ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR NUMBER VAR ASSIGN VAR NUMBER VAR ASSIGN VAR VAR STRING NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER STRING VAR NUMBER FOR VAR FUNC_CALL VAR VAR BI... |
Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas).
... | def f(k):
if k == 1:
return 1, 0, 0, 0, 0
if k == 2:
return 0, 1, 0, 0, 0
if k == 3:
return 1, 1, 1, 0, 0
a, b = 1, 1
for i in range(k - 3):
a, b = b, a + b
c = a
d = e = 0
for i in range(k - 3):
d, e = e, d + e + int(i % 2 == 0)
return a, b, c... | FUNC_DEF IF VAR NUMBER RETURN NUMBER NUMBER NUMBER NUMBER NUMBER IF VAR NUMBER RETURN NUMBER NUMBER NUMBER NUMBER NUMBER IF VAR NUMBER RETURN NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR NUMBER FOR... |
Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas).
... | k, x, n, m = map(int, input().split())
def calc(k, a, b, op1, ed1, op2, ed2):
if k == 2:
return b
return calc(k - 1, b, a + b + (ed1 & op2), op2, ed2, op1, ed2)
def make(len, a, op, ed):
res, i = "", 0
if op:
res += "C"
i += 1
if ed:
len -= 1
while a:
... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR FUNC_DEF ASSIGN VAR VAR STRING NUMBER IF VAR VAR STRING VAR NUMBER IF VAR VAR NUMBER WHILE VAR VAR STRING VAR NUMBER VAR NUMB... |
Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas).
... | import itertools
import sys
k, x, n, m = map(int, input().split())
def valid(inicio, fim, tamanho, num_ac):
if num_ac == 0:
if tamanho == 1:
return "" if inicio != fim else inicio
elif tamanho == 2:
return inicio + fim if inicio + fim != "AC" else ""
else:
... | IMPORT IMPORT ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR NUMBER IF VAR NUMBER RETURN VAR VAR STRING VAR IF VAR NUMBER RETURN BIN_OP VAR VAR STRING BIN_OP VAR VAR STRING RETURN BIN_OP BIN_OP VAR BIN_OP STRING BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP STRING VAR IF VAR VAR NUMBER VAR A... |
Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0.
There are also n cards, each card has 2 attributes: length l_{i} and cost c_{i}. If she pays c_{i} dollars then she can apply i-th card. ... | def main():
input()
acc = {(0): 0}
for p, c in zip(list(map(int, input().split())), list(map(int, input().split()))):
adds = []
for b, u in acc.items():
a = p
while b:
a, b = b, a % b
adds.append((a, u + c))
for a, u in adds:
... | FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR DICT NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR WHILE VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR ... |
You are given a sequence of $n$ integers $a_1, \, a_2, \, \dots, \, a_n$.
Does there exist a sequence of $n$ integers $b_1, \, b_2, \, \dots, \, b_n$ such that the following property holds?
For each $1 \le i \le n$, there exist two (not necessarily distinct) indices $j$ and $k$ ($1 \le j, \, k \le n$) such that $a_i ... | def f(l, i, s):
if s == 0:
return 1
if i >= len(l):
return 0
if s == -1:
return f(l, i + 1, l[i]) or f(l, i + 1, -1) or f(l, i + 1, -l[i])
else:
return f(l, i + 1, s + l[i]) or f(l, i + 1, s) or f(l, i + 1, s - l[i])
for _ in range(int(input())):
n = int(input())
... | FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR FUNC_CALL VAR VAR RETURN NUMBER IF VAR NUMBER RETURN FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR N... |
You are given a sequence of $n$ integers $a_1, \, a_2, \, \dots, \, a_n$.
Does there exist a sequence of $n$ integers $b_1, \, b_2, \, \dots, \, b_n$ such that the following property holds?
For each $1 \le i \le n$, there exist two (not necessarily distinct) indices $j$ and $k$ ($1 \le j, \, k \le n$) such that $a_i ... | for _ in range(int(input())):
N = int(input())
A = list(map(int, input().split()))
found = False
for mask in range(1, 3**N):
sm = 0
for i in range(N):
rem = mask % 3
mask //= 3
if rem == 2:
rem = -1
sm += rem * A[i]
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 FOR VAR FUNC_CALL VAR NUMBER BIN_OP NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR NUMBER A... |
You are given a sequence of $n$ integers $a_1, \, a_2, \, \dots, \, a_n$.
Does there exist a sequence of $n$ integers $b_1, \, b_2, \, \dots, \, b_n$ such that the following property holds?
For each $1 \le i \le n$, there exist two (not necessarily distinct) indices $j$ and $k$ ($1 \le j, \, k \le n$) such that $a_i ... | ans = []
for _ in range(int(input())):
n = int(input())
u = list(map(int, input().split()))
if 0 in u:
ans.append("YES")
continue
for i in range(n):
if u[i] < 0:
u[i] = -u[i]
u.sort()
for i in range(1, n):
if u[i] == u[i - 1]:
ans.append("Y... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF NUMBER VAR EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR VAR VAR VAR EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR ... |
You are given a sequence of $n$ integers $a_1, \, a_2, \, \dots, \, a_n$.
Does there exist a sequence of $n$ integers $b_1, \, b_2, \, \dots, \, b_n$ such that the following property holds?
For each $1 \le i \le n$, there exist two (not necessarily distinct) indices $j$ and $k$ ($1 \le j, \, k \le n$) such that $a_i ... | from itertools import *
for s in [*open(0)][2::2]:
a = (*map(int, s.split()),)
n = len(a)
print(
"YNEOS"[
len({sum(x * y for x, y in zip(a, p)) for p in product((0, 1), repeat=n)})
>> n :: 2
]
) | FOR VAR LIST FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING BIN_OP FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR NUMBER NUMBER VAR VAR NUMBER |
You are given a sequence of $n$ integers $a_1, \, a_2, \, \dots, \, a_n$.
Does there exist a sequence of $n$ integers $b_1, \, b_2, \, \dots, \, b_n$ such that the following property holds?
For each $1 \le i \le n$, there exist two (not necessarily distinct) indices $j$ and $k$ ($1 \le j, \, k \le n$) such that $a_i ... | def r(a, suma, cerca):
if suma == cerca:
return True
if not a:
return False
last = a.pop()
possible = r(a, suma + last, cerca) or r(a, suma - last, cerca) or r(a, suma, cerca)
a.append(last)
return possible
for _ in range(int(input())):
n = int(input())
a = list(map(int... | FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN... |
You are given a sequence of $n$ integers $a_1, \, a_2, \, \dots, \, a_n$.
Does there exist a sequence of $n$ integers $b_1, \, b_2, \, \dots, \, b_n$ such that the following property holds?
For each $1 \le i \le n$, there exist two (not necessarily distinct) indices $j$ and $k$ ($1 \le j, \, k \le n$) such that $a_i ... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
x = 2**n - 1
d = []
an = "NO"
for i in range(x + 1):
c = sum([a[j] for j in range(n) if i & 1 << j])
if c in d:
an = "YES"
break
else:
d.append(c)
pr... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 BIN_OP NUMBER VAR NUMBER ASSIGN VAR LIST ASSIGN VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL ... |
You are given a sequence of $n$ integers $a_1, \, a_2, \, \dots, \, a_n$.
Does there exist a sequence of $n$ integers $b_1, \, b_2, \, \dots, \, b_n$ such that the following property holds?
For each $1 \le i \le n$, there exist two (not necessarily distinct) indices $j$ and $k$ ($1 \le j, \, k \le n$) such that $a_i ... | def main():
t = int(input())
for i in range(t):
c = int(input())
s = set()
k = 999999
for j in map(int, input().split()):
s.add(abs(j))
k = min(abs(j), k)
if len(s) < c or k == 0:
print("YES")
continue
m = list(s)
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR IF FUNC_CALL VAR VAR VAR VAR N... |
You are given a sequence of $n$ integers $a_1, \, a_2, \, \dots, \, a_n$.
Does there exist a sequence of $n$ integers $b_1, \, b_2, \, \dots, \, b_n$ such that the following property holds?
For each $1 \le i \le n$, there exist two (not necessarily distinct) indices $j$ and $k$ ($1 \le j, \, k \le n$) such that $a_i ... | t = int(input())
for o in range(t):
n = int(input())
l = list(map(int, input().strip().split()))
zeros = 0
can = False
for i in l:
if i == 0:
zeros += 1
if zeros > 1:
print("YES")
continue
mx = 1
bit = 2**n
sums = {}
powers = []
k = 1
f... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN V... |
You are given a sequence of $n$ integers $a_1, \, a_2, \, \dots, \, a_n$.
Does there exist a sequence of $n$ integers $b_1, \, b_2, \, \dots, \, b_n$ such that the following property holds?
For each $1 \le i \le n$, there exist two (not necessarily distinct) indices $j$ and $k$ ($1 \le j, \, k \le n$) such that $a_i ... | for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
def f(i, s, c):
if i == n:
if s == 0 and c != n:
return True
return False
if f(i + 1, s, c + 1) or f(i + 1, s + l[i], c) or f(i + 1, s - l[i], c):
return Tr... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR VAR IF VAR NUMBER VAR VAR RETURN NUMBER RETURN NUMBER IF FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER BIN_O... |
You are given a sequence of $n$ integers $a_1, \, a_2, \, \dots, \, a_n$.
Does there exist a sequence of $n$ integers $b_1, \, b_2, \, \dots, \, b_n$ such that the following property holds?
For each $1 \le i \le n$, there exist two (not necessarily distinct) indices $j$ and $k$ ($1 \le j, \, k \le n$) such that $a_i ... | import sys
t = int(sys.stdin.readline())
def f(k, su, w):
if w and su == 0:
return True
if k < n:
if f(k + 1, su + nums[k], True):
return True
if f(k + 1, su - nums[k], True):
return True
if w:
if f(k + 1, su, True):
return T... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF VAR VAR NUMBER RETURN NUMBER IF VAR VAR IF FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR NUMBER RETURN NUMBER IF FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR NUMBER RETURN NUMBER IF VAR IF FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER RETURN NUMBER IF FU... |
You are given a sequence of $n$ integers $a_1, \, a_2, \, \dots, \, a_n$.
Does there exist a sequence of $n$ integers $b_1, \, b_2, \, \dots, \, b_n$ such that the following property holds?
For each $1 \le i \le n$, there exist two (not necessarily distinct) indices $j$ and $k$ ($1 \le j, \, k \le n$) such that $a_i ... | T = int(input())
for _ in range(T):
N = int(input())
A = [abs(int(a)) for a in input().split()]
L = []
for i in range(1 << N):
s = 0
for j in range(N):
if i >> j & 1:
s += A[j]
L.append(s)
print("YES" if len(set(L)) < 1 << N else "NO") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR E... |
You are given a sequence of $n$ integers $a_1, \, a_2, \, \dots, \, a_n$.
Does there exist a sequence of $n$ integers $b_1, \, b_2, \, \dots, \, b_n$ such that the following property holds?
For each $1 \le i \le n$, there exist two (not necessarily distinct) indices $j$ and $k$ ($1 \le j, \, k \le n$) such that $a_i ... | import sys
input = sys.stdin.readline
def rec(i, w, s, a, n):
if i == n:
for i in range(n):
if w[i] == 0 and a[i] == s:
return True
return False
w[i] = 1
if rec(i + 1, w, s + a[i], a, n):
return True
w[i] = 0
if rec(i + 1, w, s, a, n):
r... | IMPORT ASSIGN VAR VAR FUNC_DEF IF VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP VAR VAR VAR VAR VAR RETURN NUMBER ASSIGN VAR VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR VAR RETURN NUMBER ASSIG... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.