description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | for _ in range(int(input())):
s = " " + input()
n = len(s) - 1
ans = 0
prefix = [0] * (n + 1)
for i in range(1, n + 1):
prefix[i] += prefix[i - 1]
if s[i] == "1":
prefix[i] += 1
last = n
for i in range(n, 0, -1):
if s[i] == "1":
ans += last - i... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP STRING FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER IF VAR VAR STRING VAR VAR NUMBER ASSIGN VAR V... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | T = int(input())
for i in range(T):
data = [x.strip() for x in input()]
cnt = 0
los = len(data) - 1
f = -1
zf = -1
pc = [0] * (los + 1)
cost = 0
for i2 in range(los, -1, -1):
if data[i2] == "0" and zf == -1:
zf += 1
if data[i2] == "1" and f == -1 and i != los ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF VAR VA... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | def calculate(n, N):
red = []
b = N.index(1)
s = 1
for i in range(b, n):
if N[i] == 0:
s += 1
if N[i] == 1 or i == n - 1:
if s == 1:
s = 0
red.append(s)
s = 1
for i in range(len(red) - 2, 0, -1):
red[i] = red[i] ... | FUNC_DEF ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR IF VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER ASSIG... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | def rowsold():
T = int(input())
for _ in range(T):
count1 = 0
sec = 0
flag = 0
l = [int(d) for d in str(input())]
for i in range(len(l)):
if l[i] == 1:
count1 += 1
flag = 1
elif l[i - 1] == 1 and l[i] == 0:
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER IF VAR BIN_OP VAR NUMBER NUMBER VAR VAR NUMB... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | t = int(input())
while t:
t -= 1
s = input()[::-1]
zeroes = 0
zero_batches = 0
result = 0
last = -1
for i in s:
if "0" == i:
zeroes += 1
if "1" == i:
if "0" == last:
zero_batches += 1
result += zeroes
result += z... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF STRING VAR VAR NUMBER IF STRING VAR IF STRING VAR VAR NUMBER VAR VAR VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | for _ in range(int(input())):
s = list(input())
score = 0
ones = 0
consz = 0
for i in range(len(s)):
if i < len(s) - 1:
if s[i] == "0" and s[i + 1] == "1":
score += ones * (consz + 2)
consz = 0
elif s[i] == "1":
ones += ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | T = int(input())
for t1 in range(T):
s = input()
n = len(s)
sec = 0
block = 0
streak = 0
for q1 in range(n):
if s[q1] == "1":
streakover = True
if block > 0 and streak > 0 and streakover:
sec += block * (streak + 1)
streak = 0
if s[q1] ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER VAR VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER IF VA... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | t = int(input())
while t > 0:
t -= 1
s = input()
ls = len(s)
c = 0
tot = 0
i = 0
l = []
while i < ls:
k = 0
if s[i] == "0":
while i + 1 < ls and s[i + 1] == "0":
i += 1
k += 1
l.append(k + 1)
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR VAR ASSIGN VAR NUMBER IF VAR VAR STRING WHILE BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER STRING VAR NUMBER VAR NUMBER ... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | T = int(input())
while T > 0:
a = input()
s1 = 0
c1 = 0
h1 = 0
l = len(a)
for i in range(0, l):
if a[i] == "0":
h1 = h1 + 1
else:
break
k = h1
while k < l:
s = 0
while a[k] != "0":
c1 = c1 + 1
k = k + 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR STRING ASSIGN V... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | t = int(input())
for t0 in range(t):
str1 = str(input())
list1 = []
for i in str1:
list1.append(int(i))
lis2 = []
lis3 = []
list2 = []
c = 0
for j in list1:
if j == 1:
list2.append(c)
c += 1
sum1 = 0
for j in range(1, len(list2)):
if li... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | t = int(input())
for i in range(t):
s = input()
s = s + "1"
c = 0
one = 0
j = 0
while True:
if s[j] == "1":
one += 1
ind = s.index("1", j + 1)
if ind - j == 1:
j += 1
if j == len(s) - 1:
break
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER IF VAR VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING BIN_OP VAR NUMBER IF BIN_OP VAR VAR NUMBER VAR NUMBER IF VAR BIN_OP FUNC_... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | h = int(input())
for k in range(0, h):
s = input()
l = len(s)
counter0 = 0
counter1 = 0
value = 0
for i in range(0, l):
if i == l - 1 and s[l - 1] == "0":
counter0 += 1
value += counter0 * counter1 + counter1
elif s[i] == "0":
counter0 += 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER STRING VAR NUMBER VAR BIN_OP BIN_OP VAR VAR VAR IF VAR VAR S... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | for _ in range(int(input())):
s = input() + " "
output, zeroes, ones = 0, 0, 0
for i in range(len(s)):
if (s[i] == "1" or s[i] == " ") and zeroes >= 1:
output += ones * (zeroes + 1)
zeroes = 0
ones += 1
elif s[i] == "1":
ones += 1
elif ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR STRING ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR STRING VAR NUMBER VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER IF VAR VAR STRING VAR NUMBER IF VAR VAR STRIN... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | for _ in range(int(input())):
row = [i for i in input()]
L, ans, pos = len(row), 0, -1
cnt = [0] * L
if row[L - 1] == "0":
cnt[L - 1] = 1
for i in range(L - 2, -1, -1):
cnt[i] = cnt[i + 1]
if row[i] == "0" and row[i + 1] == "1":
cnt[i] += 1
for i in range(L - ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR VAR BIN_OP VAR ... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | T = int(input())
for t in range(T):
string = input()
ones = 0
dists = []
first = True
dist = 1
for c in reversed(string):
if c == "1":
dists.append(dist)
dist = 1
ones += 1
else:
dist += 1
sums = 0
for i, dist in enumerate(d... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR NU... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | n = int(input())
for ii in range(n):
s = list(input())
if set(s) == set(["1"]):
print("0")
else:
while s[-1] == "1":
s.pop()
a = []
for i in range(0, len(s)):
if s[i] == "1":
a.append(i + 1)
c = 0
ans = 0
if len(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR FUNC_CALL VAR LIST STRING EXPR FUNC_CALL VAR STRING WHILE VAR NUMBER STRING EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR ... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | for I in range(int(input())):
s = str(input())
soldier_number = 0
ans = 0
i = 0
while i < len(s):
if s[i] == "1":
soldier_number += 1
i += 1
else:
zero_number = 0
while i < len(s) and s[i] == "0":
zero_number += 1
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR STRING VAR NUMBER VAR NUMBER VAR BIN_OP VAR BIN_OP VAR ... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | T = int(input())
n = 1
while n <= T:
st = str(input())
d = {}
ones = 1
for i in range(len(st)):
if st[i] == "1":
d[i] = ones
ones += 1
i = 0
time = 0
pos = len(st)
for pos in sorted(d):
if i == 0:
ppos = pos
i = 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR V... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | for x in range(int(input())):
a = [int(i) for i in input()]
a.append(1)
su = 0
b = []
for i in a:
if i == 1:
su += 1
b.append(su)
hh = 0
cu = 0
for i in range(len(b)):
if a[i] == 0:
cu += 1
elif cu != 0:
hh += (cu + 1) *... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NUMBE... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | for xaxa in range(int(input())):
o = 0
m = 0
s = input()
n = len(s)
for i in range(n):
c = s[i]
if c == "1":
o += 1
else:
m += o
if i < n - 1 and s[i + 1] == "1":
m += o
if s[-1] == "0":
m += o
print(m) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR STRING VAR NUMBER VAR VAR IF VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER STRING VAR VAR IF VAR NUMBER STRING VAR VAR EXPR FUNC_C... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | def rowsold():
T = int(input())
for _ in range(T):
count1 = 0
sec = 0
l = [int(d) for d in str(input())]
try:
while l[-1] == 1:
del l[-1]
while l[0] == 0:
del l[0]
except IndexError:
pass
for i in... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER NUMBER VAR NUMBER WHILE VAR NUMBER NUMBER VAR NUMBER VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NUMBER IF VAR... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | from itertools import groupby
for i in range(int(input())):
ls = []
N = input()
k = 0
for i, j in groupby(N):
ls.append(list(j))
sum = 0
temp = 0
for i in range(len(ls)):
if ls[i][0] == "1":
temp += len(ls[i])
if i != len(ls) - 1:
sum ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR EXPR 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 STRING VAR FUNC_CALL VAR VAR VAR IF VAR BIN_OP FUN... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | t = int(input())
for y in range(t):
s = list(map(int, list(input())))
b = a = ans = 0
z = 0
ek = -1
for x in range(len(s)):
if s[x] == 1 and a != 0:
ans = ans + b * (a + 1)
ek = 1
a = 0
z = 1
if s[x] == 1 and ek == 1:
b += 1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR BIN_OP VAR NUMBER AS... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | for _ in range(int(input())):
s = input()
n = len(s)
i = 0
ans = 0
n1 = 0
while i < n:
if s[i] == "1":
i += 1
n1 += 1
while i < n and s[i] == "1":
i += 1
n1 += 1
n0 = 0
while i < n and s[i] == "0"... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR STRING VAR NUMBER VAR NUMBER WHILE VAR VAR VAR VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR STRING VAR NUMBER... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | for _ in range(int(input())):
string = list(input())
time = 0
n = string.count("1")
k = len(string)
for _ in range(n):
for i in range(k):
if string[i] == "1":
if i == k - 1:
break
j = i + 1
while string[j] != "1"... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR STRING ASSIGN ... |
Limak is a little polar bear.
He is playing a video game and he needs your help.
There is a row with N cells, each either empty or occupied by a soldier, denoted by '0' and '1' respectively.
The goal of the game is to move all soldiers to the right (they should occupy some number of rightmost cells).
The only possible ... | for _ in range(int(input())):
l = list(map(int, input().strip()))
for i in range(len(l) - 1, -1, -1):
if l[i] == 1:
l.pop()
else:
break
if l.count(1):
time, prev, z, c = 0, 0, 0, 0
for i in range(len(l) - 1, -1, -1):
if l[i] == 0:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR VAR NUMBER EXPR FUNC_CALL VAR IF FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR B... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | n, m = map(int, input().split())
chs = []
for i in range(n):
chs.append(list(input()))
test = []
for i in range(n):
if i % 2 == 0:
test.append(list("01" * (m // 2 + 1)))
else:
test.append(list("10" * (m // 2 + 1)))
inv = [([0] * (m + 1)) for i in range(n + 1)]
for i in range(n):
for j in... | 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 FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_C... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | def preProcess(mat, aux):
for i in range(M):
aux[0][i] = mat[0][i]
for i in range(1, N):
for j in range(M):
aux[i][j] = mat[i][j] + aux[i - 1][j]
for i in range(N):
for j in range(1, M):
aux[i][j] += aux[i][j - 1]
def sumQuery(aux, li, lj, ri, rj):
res =... | FUNC_DEF FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR VAR VAR BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR VAR VAR BIN_OP VAR NUMBER FUNC_DEF ASSIGN VAR VAR VAR ... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | n, m = [int(i) for i in input().split()]
sqsets = list(range(2, min(n, m) + 1))
ci = []
for i in range(n):
ci.append(list(input()))
cc = [[(0) for i in range(m + 1)] for j in range(n + 1)]
def cache_creation_part(x, y):
cc[y][x] = cc[y][x - 1] + cc[y - 1][x] - cc[y - 1][x - 1]
if (y + x) % 2 == 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBE... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | def toggle_elem(elem):
if elem == "0":
return "1"
else:
return "0"
def printGrid(grid, n, m):
for i in range(n):
for j in range(m):
print(grid[i][j], end=" ")
print()
_input = input().split()
N = int(_input[0])
M = int(_input[1])
dp_data = [([0] * M) for i in ... | FUNC_DEF IF VAR STRING RETURN STRING RETURN STRING FUNC_DEF FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_C... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | def hz_arr(arr, N, M):
ans = []
for g in range(N):
pref = [0]
for h in range(M):
if g % 2 == 0:
if h % 2 == 0 and int(arr[g][h]) == 1:
pref.append(pref[h] + 1)
elif h % 2 == 1 and int(arr[g][h]) == 0:
pref.append... | FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER FUNC_CALL VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER FUNC_CALL VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | n, m = list(map(int, input().split()))
grid = [list(map(int, list(input()))) for i in range(n)]
obs0 = [[(0) for j in range(m)] for i in range(n)]
obs1 = [[(0) for j in range(m)] for i in range(n)]
max_side = min(m, n)
side_c = [(40000) for i in range(max_side + 1)]
side_c[0] = 0
side_c[1] = 0
for i in range(n):
fo... | 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 VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | n, m = map(int, input().split())
dp = [[(0) for x in range(m + 1)] for y in range(n + 1)]
l1 = [[(0) for x in range(m)] for y in range(n)]
l2 = [[(0) for x in range(m)] for y in range(n)]
for ii in range(n):
for jj in range(m):
if (ii + jj) % 2 == 0:
l2[ii][jj] = 1
else:
l2[i... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR V... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | def sum_up(row1, col1, row2, col2):
return (
sums[row2 + 1][col2 + 1]
- sums[row2 + 1][col1]
- sums[row1][col2 + 1]
+ sums[row1][col1]
)
n, m = map(int, input().strip().split())
c = []
arr1 = [[(0) for i in range(205)] for j in range(205)]
arr2 = [[(0) for i in range(205)] for ... | FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_C... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | n, m = map(int, input().split(" "))
CZM = 0
COM = 0
IVM0 = [([0] * m) for i in range(n)]
IVM1 = [([0] * m) for i in range(n)]
PSA0 = [([0] * m) for i in range(n)]
PSA1 = [([0] * m) for i in range(n)]
def findsum(PSA, i, j, k):
x, y = i - k, j - k
if x < 0 and y < 0:
return PSA[i][j]
if x < 0 and y... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR ... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | a, b = map(int, input().split())
arr2d = []
for i in range(a):
arr2d.append(list(map(int, input())))
gi = int(1000000000.0)
acc = [([0] * (b + 1)) for i in range(a + 1)]
szm = [gi] * (min(a, b) + 1)
def citr(shift=0):
for i in range(a):
for j in range(b):
acc[i + 1][j + 1] = 0
... | 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 FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST VAR BIN_OP FUNC_C... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | n, m = map(int, input().split())
C = []
for i in range(n):
R_ = list(map(int, list(input().strip())))
C.append(R_)
vo = [[(0) for _ in range(m)] for _ in range(n)]
ve = [[(0) for _ in range(m)] for _ in range(n)]
vo[0][0] = C[0][0]
ve[0][0] = (C[0][0] + 1) % 2
for i in range(1, m):
if C[0][i] == i % 2:
... | 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 VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL V... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | n, m = map(int, input().split())
b = [[int(x) for x in list(input())] for x in range(n)]
c = int(input())
size = min(n, m)
res = [(size**2) for x in range(size + 1)]
def invert(i, j, r, ele):
count = 0
for index, x in enumerate(range(i, i + r)):
temp = ele
if index % 2:
temp = 0 if... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR FUNC... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | n, m = map(int, input().split())
R = n
C = m
a = [None] * n
z = [0] * n
o = [1] * n
for i in range(m):
if i % 2 != 0:
z[i] = 1
o[i] = 0
zi = [None] * n
oi = [None] * n
for i in range(n):
a[i] = input()
a[i] = list(a[i])
for j in range(m):
a[i][j] = int(a[i][j])
if i % 2 == 0:... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST NONE VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NONE VAR ASS... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | n, m = map(int, input().split())
L = []
for i in range(n):
s = input()
L.append(s)
cost = []
h2 = [0] * (m + 1)
cost.append(h2)
for i in range(n):
h = [0]
for j in range(m):
if L[i][j] == "0" and (i + j) % 2 != 0:
h.append(1)
elif L[i][j] == "1" and (i + j) % 2 == 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 EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR ... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | def get_aux_matrix(C, n, m):
mat = [[(0) for j in range(0, m)] for i in range(0, N)]
for i in range(0, m):
mat[0][i] = C[0][i]
for i in range(1, n):
for j in range(0, m):
mat[i][j] = C[i][j] + mat[i - 1][j]
for i in range(0, n):
for j in range(1, m):
mat[i... | FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER VAR VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR VAR VAR BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR FO... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | n, m = map(int, input().split())
chess = []
for _ in range(n):
chess.append([int(x) for x in list(input())])
chessO = []
chessL = []
fixO = []
fixL = []
for _ in range(n):
p = [0] * m
fixL.append(p)
q = [0] * m
fixO.append(q)
tm = [0] * m
chessO.append(tm)
to = [0] * m
chessL.append(... | 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 VAR 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 BIN_OP LIST NUMBER VAR EXPR FUNC_CALL VAR VAR ASSIG... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | n, m = input().split(" ")
n = int(n)
m = int(m)
lst = [None] * n
for i in range(0, n):
lst[i] = input()
c1 = [[(0) for x in range(m + 2)] for y in range(n + 2)]
c2 = [[(0) for x in range(m + 2)] for y in range(n + 2)]
c3 = [[(0) for x in range(m + 2)] for y in range(n + 2)]
c4 = [[(0) for x in range(m + 2)] for y i... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NONE VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL ... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | def pre():
for i in range(n):
for j in range(m):
if a[i][j] == "1":
b[i][j].append((1, 0))
else:
b[i][j].append((0, 1))
hr = 1
vr = 1
co = 0
if b[i][j][0][1]:
co = 1
for k in r... | FUNC_DEF FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING EXPR FUNC_CALL VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR... |
Chef loves to play chess, so he bought a new chessboard with width M$M$ and height N$N$ recently.
Chef considers a chessboard correct if its width (number of columns) is equal to its height (number of rows) and each cell has no side-adjacent cell of the same color (this is the so-called "chess order" which you can see ... | import sys
dp = [[(0) for i in range(201)] for i in range(201)]
Q = [sys.maxsize for i in range(201)]
Q1 = [sys.maxsize for i in range(201)]
def compareWith(A, B, n, m, f):
for i in range(1, n + 1):
for j in range(1, m + 1):
a = 0
if A[i - 1][j - 1] != B[i - 1][j - 1]:
... | IMPORT ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER IF VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER V... |
Read problems statements [Hindi] ,[Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well.
There are $N$ circles in a plane. Circle $i$ and circle $j$ form a *good pair* if it is possible to choose a point $P_{1}$ on the perimeter of circle $i$ and a point $P_{2}$ on the perimeter of circle $j$ such that t... | N, Q = list(map(int, input().split()))
g = []
karray = [(0) for z in range(10**6 + 1)]
for i in range(N):
X, Y, R = list(map(int, input().split()))
g.append((X, Y, R))
for i in range(0, len(g) - 1):
for j in range(i + 1, len(g)):
x1, y1, r1 = g[i]
x2, y2, r2 = g[j]
c = ((x2 - x1) * (... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER B... |
A famous student of AESC MSU, as you know, comes from Kostomuksha. Kostomuksha has a popular game called Doka.
The essence of Doka is as follows:
You are given an array A and an integer X. You want to calculate how many subarrays of this array have a geometric mean of X.
Formally, calculate the number of pairs of i... | for _ in range(int(input())):
list1 = list(map(int, input().split()))
N, x = list1[0], list1[1]
A = list(map(int, input().split()))
flag = True
for i in range(1, N):
if A[i] != A[i - 1]:
flag = False
break
if flag:
print(N * (N + 1) // 2)
continue
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMB... |
A famous student of AESC MSU, as you know, comes from Kostomuksha. Kostomuksha has a popular game called Doka.
The essence of Doka is as follows:
You are given an array A and an integer X. You want to calculate how many subarrays of this array have a geometric mean of X.
Formally, calculate the number of pairs of i... | from sys import stdin
input = stdin.readline
PRIME = 1000000007
def solve(N, X, A):
count = 0
visited = set()
for i in range(N):
if i not in visited:
product = 1
power = 1
n = 1
for j in range(i, N):
product = product * A[j] % PRIME
... | ASSIGN VAR VAR ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR IF VAR VAR VAR VAR VAR NUMBER EXPR F... |
You are given an array A of length N.
You can perform the following operation on the array, as long as it has more than one element:
Choose any two adjacent elements, remove them from the array and insert their sum at that position.
Formally, if the current length of the array is |A|, you can choose an index 1 β€ i < ... | from itertools import accumulate
def check_valid(acc, ind, i):
res = ind
ind += 1
mult = 2
sm = acc[-1]
try:
while ind < len(acc) and abs(i * mult) <= abs(sm):
ind2 = acc.index(i * mult, ind)
res += ind2 - ind
mult += 1
ind = ind2 + 1
... | FUNC_DEF ASSIGN VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER WHILE VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR VAR RETURN VAR VAR RETURN NUMBER FOR V... |
You are given an array A of length N.
You can perform the following operation on the array, as long as it has more than one element:
Choose any two adjacent elements, remove them from the array and insert their sum at that position.
Formally, if the current length of the array is |A|, you can choose an index 1 β€ i < ... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
b = []
s = 0
for i in range(n):
s += a[i]
b.append(s)
if s == 0:
c = 0
for i in range(n):
if b[i] != 0:
c += 1
print(c)
else:
for i 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 LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR ... |
You are given an array A of length N.
You can perform the following operation on the array, as long as it has more than one element:
Choose any two adjacent elements, remove them from the array and insert their sum at that position.
Formally, if the current length of the array is |A|, you can choose an index 1 β€ i < ... | from itertools import accumulate
from sys import stdin
inp = stdin.readline
T = int(inp())
for tx in range(T):
N = int(inp())
S = list(map(int, inp().split()))
acS = list(accumulate(S))
tot = acS[-1]
if tot == 0:
print(N - acS.count(0))
continue
atot = abs(tot)
partn = min(N... | ASSIGN VAR VAR 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 VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR NUMBER ASSI... |
You are given an array A of length N.
You can perform the following operation on the array, as long as it has more than one element:
Choose any two adjacent elements, remove them from the array and insert their sum at that position.
Formally, if the current length of the array is |A|, you can choose an index 1 β€ i < ... | NEG = -(10**9) - 7
def factors(n):
neg = False
if n < 0:
neg = True
n = abs(n)
ret = set()
if n == 0:
ret.add(0)
return ret
for i in range(1, n, 1):
if i * i > n:
break
if n % i == 0:
ret.add(i)
ret.add(int(n / i))... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ... |
You are given an array A of length N.
You can perform the following operation on the array, as long as it has more than one element:
Choose any two adjacent elements, remove them from the array and insert their sum at that position.
Formally, if the current length of the array is |A|, you can choose an index 1 β€ i < ... | def partitions2(array, n, K):
if e % K != 0:
return False
temp = 0
count = n - K
c = False
imp = True
cursum = 0
for i in range(n):
if count < 0:
imp = False
break
if cursum + array[i] == e / K and temp <= K:
temp += 1
c... | FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR VAR VAR BI... |
You are given an array A of length N.
You can perform the following operation on the array, as long as it has more than one element:
Choose any two adjacent elements, remove them from the array and insert their sum at that position.
Formally, if the current length of the array is |A|, you can choose an index 1 β€ i < ... | T = int(input())
for _ in range(T):
n = int(input())
A = list(map(int, input().split()))
SUM = sum(A)
op = -1
for i in range(n, 0, -1):
if SUM % i == 0:
if SUM != 0:
target = SUM // i
SS = SUM
j = 0
sd = 0
... | 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 VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR V... |
You are given an array A of length N.
You can perform the following operation on the array, as long as it has more than one element:
Choose any two adjacent elements, remove them from the array and insert their sum at that position.
Formally, if the current length of the array is |A|, you can choose an index 1 β€ i < ... | import itertools
import sys
MAXN = 30000
SQRTMAXN = 175
ISPRIME = [1] * (MAXN + 1)
PRIMES = [2]
def sieve():
for i in range(MAXN // 2):
ISPRIME[2 * i] = 0
ISPRIME[1] = 0
ISPRIME[2] = 1
for i in range(3, SQRTMAXN):
if ISPRIME[i]:
for j in range(i * i, MAXN + 1, 2 * i):
... | IMPORT IMPORT ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR LIST NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR FOR VAR FUNC_CALL VA... |
You are given an array A of length N.
You can perform the following operation on the array, as long as it has more than one element:
Choose any two adjacent elements, remove them from the array and insert their sum at that position.
Formally, if the current length of the array is |A|, you can choose an index 1 β€ i < ... | from itertools import accumulate
from sys import stdin
inp = stdin.readline
T = int(inp())
for tx in range(T):
N = int(inp())
accA = list(accumulate(map(int, inp().split())))
tot = accA[-1]
if tot == 0:
print(N - accA.count(0))
continue
atot = abs(tot)
partn = min(N, atot)
f... | ASSIGN VAR VAR 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSI... |
You are given an array A of length N.
You can perform the following operation on the array, as long as it has more than one element:
Choose any two adjacent elements, remove them from the array and insert their sum at that position.
Formally, if the current length of the array is |A|, you can choose an index 1 β€ i < ... | def cal(x, ps):
n = len(ps)
mul = 0
i = 0
while i < n and mul // x < ps[-1] // x:
if mul + x == ps[i]:
mul += x
i += 1
cnt = ps[-1] // x if mul == ps[-1] else 1
return n - cnt
for t in range(int(input().strip())):
n = int(input().strip())
a = tuple(map(int, ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR VAR BIN_OP VAR NUMBER VAR IF BIN_OP VAR VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER RETURN BIN_OP VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FU... |
You are given an array A of length N.
You can perform the following operation on the array, as long as it has more than one element:
Choose any two adjacent elements, remove them from the array and insert their sum at that position.
Formally, if the current length of the array is |A|, you can choose an index 1 β€ i < ... | t = int(input())
for y in range(t):
n = int(input())
arr = list(map(int, input().split()))
adj = []
main_count = float("-inf")
main_number = float("inf")
big_fail = float("-inf")
adj.append(arr[0])
i = 0
for x in arr[1:]:
i = i + 1
adj.append(adj[i - 1] + arr[i])
... | 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 VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR NUMBER ASSIGN ... |
You are given an array A of length N.
You can perform the following operation on the array, as long as it has more than one element:
Choose any two adjacent elements, remove them from the array and insert their sum at that position.
Formally, if the current length of the array is |A|, you can choose an index 1 β€ i < ... | def func(n, arr):
total = sum(arr)
if total == 0:
a = [arr[0]]
for i in range(1, n):
a.append(a[i - 1] + arr[i])
i = a.index(total)
moves = i
curr = i
for j in range(i + 1, n):
if a[j] == total:
moves += j - curr - 1
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR VAR VAR BIN_OP BIN_OP VAR VAR NUMBER A... |
You are given an array A of length N.
You can perform the following operation on the array, as long as it has more than one element:
Choose any two adjacent elements, remove them from the array and insert their sum at that position.
Formally, if the current length of the array is |A|, you can choose an index 1 β€ i < ... | def poss(res, elem, len):
cnt = 0
for i in res:
if i == elem * (cnt + 1):
cnt += 1
return cnt >= len
for _ in range(int(input())):
n = int(input())
ar = list(map(int, input().split()))
res = [sum(ar[: i + 1]) for i in range(len(ar))]
s = res[-1]
ans = 0
if s == ... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF VAR BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR VAR 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 FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR FUNC_CALL VA... |
You are given an array A of length N.
You can perform the following operation on the array, as long as it has more than one element:
Choose any two adjacent elements, remove them from the array and insert their sum at that position.
Formally, if the current length of the array is |A|, you can choose an index 1 β€ i < ... | import sys
input = sys.stdin.readline
def check(part_sum, k, A):
curr_sum = None
for i, a in enumerate(A):
curr_sum = (0 if curr_sum is None else curr_sum) + a
if k > 1 and curr_sum == part_sum:
curr_sum = None
k -= 1
return k == 1 and curr_sum == part_sum
for _ ... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR NONE FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NONE NUMBER VAR VAR IF VAR NUMBER VAR VAR ASSIGN VAR NONE VAR NUMBER RETURN VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_C... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | for _ in range(int(input())):
n = int(input())
s = input()
x, y = map(int, input().split(" "))
curr = 0
for i in range(n):
if s[i] == "S":
curr = curr + min(x, 3 * y)
if s[i] == "E":
curr = curr + min(2 * x, 2 * y)
if s[i] == "N":
curr = cu... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR IF VAR VAR STRING ASSI... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | def calc(ini, fin, x, y):
if ini == fin:
return 0
if ini == "W" and fin == "E" or ini == "E" and fin == "W":
return min(2 * x, 2 * y)
if ini == "N" and fin == "E" or ini == "S" and fin == "W":
return min(x, 3 * y)
return min(3 * x, y)
for _ in range(int(input())):
n = int(i... | FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR STRING VAR STRING VAR STRING VAR STRING RETURN FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP NUMBER VAR IF VAR STRING VAR STRING VAR STRING VAR STRING RETURN FUNC_CALL VAR VAR BIN_OP NUMBER VAR RETURN FUNC_CALL VAR BIN_OP NUMBER VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | from sys import stdin
input = stdin.readline
def answer():
prefix, suffix = [0] * (n + 1), [0] * (n + 2)
for i in range(n):
if s[i] == "S":
energy = min(y, 3 * x)
elif s[i] == "N":
energy = min(x, 3 * y)
elif s[i] == "W":
energy = min(2 * x, 2 * y)
... | ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR IF VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR IF VAR VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP N... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | for i in range(int(input())):
ui = int(input())
s = str(input())
x, y = map(int, input().split())
ans = []
dire = {"N": 0, "S": 0, "E": 0, "W": 0}
for j in s:
dire[j] += 1
t = min(x, y)
if x > 3 * y:
a = 3 * y
else:
a = x
if y > 3 * x:
b = 3 * x
... | 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 ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | for _ in range(int(input())):
n = int(input())
s = input()
x, y = map(int, input().split())
arr = [0]
sum = 0
for i in range(n):
if s[i] == "N":
sum += min(x, 3 * y)
arr.append(sum)
elif s[i] == "W":
sum += min(2 * x, 2 * y)
arr.app... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR VAR I... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | t = int(input())
for i in range(t):
N = int(input())
s = str(input())
x, y = map(int, input().split())
a = min(x, 3 * y)
b = min(y, 3 * x)
c = min(x, y)
east = list()
west = list()
min_ene = 0
for i in range(len(s)):
if s[i] == "N":
east.append(a)
... | 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 ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR V... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | def distance(ch, x, y):
if ch == "E":
east = 0
west = min(2 * x, 2 * y)
elif ch == "W":
east = min(2 * x, 2 * y)
west = 0
elif ch == "N":
east = min(x, 3 * y)
west = min(y, 3 * x)
else:
east = min(y, 3 * x)
west = min(x, 3 * y)
return e... | FUNC_DEF IF VAR STRING ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP NUMBER VAR IF VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER IF VAR STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_C... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | T = int(input())
for i in range(T):
clockwise = {"W": (0, 2), "N": (3, 1), "E": (2, 0), "S": (1, 3)}
anti_clockwise = {"W": (0, 2), "N": (1, 3), "E": (2, 0), "S": (3, 1)}
N = int(input())
directions = input()
X, Y = map(int, input().split())
base_energy = 0
for direction in directions:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR DICT STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR DICT STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | for _ in range(int(input())):
n = int(input())
a = input()
x, y = map(int, input().split())
east = [0]
west = [0] * n + [0]
for i in range(n):
if a[i] == "E":
east.append(east[-1] + 0)
elif a[i] == "W":
east.append(east[-1] + 2 * min(x, y))
elif a[... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR BIN_OP BIN_OP LIST NUMBER VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR BIN_OP VAR... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | for _ in range(int(input())):
N = int(input())
S = input()
X, Y = map(int, input().split())
to_west, to_east = [], []
directions = ["N", "E", "S", "W"]
for i in range(N):
titan = directions.index(S[i])
clockwise_west = (3 - titan) * X
counter_clockwise_west = (titan + 1) ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR LIST LIST ASSIGN VAR LIST STRING STRING STRING STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | from sys import stdin, stdout
nmbr = lambda: int(input())
lst = lambda: list(map(int, input().split()))
for _ in range(nmbr()):
n = nmbr()
s = input()
clock, anti = lst()
east = {"E": 0}
east["W"] = 2 * min(clock, anti)
east["N"] = min(clock, 3 * anti)
east["S"] = min(3 * clock, anti)
w... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR DICT STRING NUMBER ASSIGN VAR STRING BIN_OP NUMBER FUNC_CALL VAR VAR VAR ASSIGN VAR STRI... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | k = int(input())
for x in range(0, k):
n = input()
string = str(input())
a1 = input().split()
clock = int(a1[0])
anticlock = int(a1[1])
toeast = []
towest = []
for i in string:
if i == "E":
toeast.append(0)
elif i == "S":
toeast.append(min(anticloc... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR ... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | for _ in range(int(input())):
n = int(input())
s = input()
x, y = map(int, input().split())
left = [0] * n
right = [0] * n
for i in range(n):
if s[i] == "N":
left[i] = min(x * 3, y)
right[i] = min(x, y * 3)
elif s[i] == "S":
left[i] = min(x, y ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR VAR FUNC_CALL VAR BIN_OP V... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | t = int(input())
for _ in range(t):
n = int(input())
S = list(input())
X, Y = map(int, input().split())
arr = []
for i in range(n):
a = [0, 0]
if S[i] == "S":
a[0] = min(3 * X, Y)
a[1] = min(X, 3 * Y)
elif S[i] == "N":
a[0] = min(X, 3 * Y)
... | 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 ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER NUMBER IF VAR VAR STRING ASSIGN VAR NUMBER FUNC_CALL VA... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | T = int(input())
for t in range(T):
n = int(input())
s = input()
x, y = [int(i) for i in input().split()]
prefse = [(0) for i in range(n + 2)]
prefsw = [(0) for i in range(n + 2)]
prefsn = [(0) for i in range(n + 2)]
prefss = [(0) for i in range(n + 2)]
sufse = [(0) for i in range(n + 2)... | 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 VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR ... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | import sys
input = sys.stdin.readline
def inp():
return int(input())
def st():
return input().rstrip("\n")
def lis():
return list(map(int, input().split()))
def ma():
return map(int, input().split())
t = inp()
while t:
t -= 1
n = inp()
s = st()
x, y = ma()
pre = [0]
su... | IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | def solve(N, S, X, Y):
east_align, west_align = [0] * N, [0] * N
cost = {
"EE": 0,
"WW": 0,
"NE": min(X, 3 * Y),
"NW": min(Y, 3 * X),
"SE": min(Y, 3 * X),
"SW": min(X, 3 * Y),
"WE": 2 * min(X, Y),
"EW": 2 * min(X, Y),
}
for i in range(N):
... | FUNC_DEF ASSIGN VAR VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR ASSIGN VAR DICT STRING STRING STRING STRING STRING STRING STRING STRING NUMBER NUMBER FUNC_CALL VAR VAR BIN_OP NUMBER VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR BIN_OP NUMBER FUNC_C... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | def func(i, X, Y):
if i == "N":
return min(X * 3, Y)
elif i == "E":
return min(X * 2, Y * 2)
elif i == "W":
return 0
else:
return min(X * 1, Y * 3)
def func2(i, X, Y):
if i == "N":
return min(X * 1, Y * 3)
elif i == "E":
return 0
elif i == "W... | FUNC_DEF IF VAR STRING RETURN FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR STRING RETURN FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF VAR STRING RETURN NUMBER RETURN FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER FUNC_DEF IF VAR STRING RETURN FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF VAR STRING RETU... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | def min_energy(p):
if p == "N":
return min(x, 3 * y), min(3 * x, y)
elif p == "E":
return 0, min(2 * x, 2 * y)
elif p == "S":
return min(3 * x, y), min(x, 3 * y)
else:
return min(2 * x, 2 * y), 0
t = int(input())
for _ in range(t):
n = int(input())
q = list(inpu... | FUNC_DEF IF VAR STRING RETURN FUNC_CALL VAR VAR BIN_OP NUMBER VAR FUNC_CALL VAR BIN_OP NUMBER VAR VAR IF VAR STRING RETURN NUMBER FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP NUMBER VAR IF VAR STRING RETURN FUNC_CALL VAR BIN_OP NUMBER VAR VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR RETURN FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP N... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | import sys
for tc in range(int(input())):
n = int(input())
ls = list(input())
lk = list(map(int, input().split()))
x = lk[0]
y = lk[1]
nums = []
pre = []
dis = {"E": 0, "W": 1, "N": 2, "S": 3}
lp = []
lp.append("#")
te = tw = tn = ts = 0
for g in ls:
lp.append(g)... | IMPORT 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 ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR DICT STRING STRING STRING STRIN... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | for _ in range(int(input())):
N = int(input())
S = input()
R, L = list(map(int, input().split()))
energy = []
east_vals = {"N": min(R, 3 * L), "S": min(L, 3 * R), "E": 0, "W": min(2 * L, 2 * R)}
west_vals = {"N": min(L, 3 * R), "S": min(R, 3 * L), "W": 0, "E": min(2 * L, 2 * R)}
sm1 = 0
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT STRING STRING STRING STRING FUNC_CALL VAR VAR BIN_OP NUMBER VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR NUM... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | def cost(a, b):
if a == "W":
if b == "W":
return 0
elif b == "N":
return 1
elif b == "E":
return 2
elif b == "S":
return 3
if a == "E":
if b == "E":
return 0
elif b == "N":
return 3
el... | FUNC_DEF IF VAR STRING IF VAR STRING RETURN NUMBER IF VAR STRING RETURN NUMBER IF VAR STRING RETURN NUMBER IF VAR STRING RETURN NUMBER IF VAR STRING IF VAR STRING RETURN NUMBER IF VAR STRING RETURN NUMBER IF VAR STRING RETURN NUMBER IF VAR STRING RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | def theRumbling(N, D, X, Y):
E = []
W = []
for i in range(N):
if D[i] == "S":
W.append(min(X, 3 * Y))
E.append(min(Y, 3 * X))
elif D[i] == "N":
W.append(min(Y, 3 * X))
E.append(min(X, 3 * Y))
elif D[i] == "W":
W.append(0)
... | FUNC_DEF ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR IF VAR VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP NUMBER V... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | T = int(input())
for i in range(T):
N = int(input())
a = input()
[X, Y] = [int(k) for k in input().split()]
r = []
q = 0
for j in range(N):
if a[j] == "S":
p = min(3 * X, Y)
if a[j] == "W":
p = min(2 * X, 2 * Y)
if a[j] == "N":
p = min(... | 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 LIST VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER VAR VAR ... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | for i in range(int(input())):
n = int(input())
s = input()
x, y = map(int, input().split())
def turne(s, x, y):
if s == "E":
return 0
if s == "N":
return min(x, 3 * y)
if s == "S":
return min(y, 3 * x)
else:
return min(2 * ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR STRING RETURN NUMBER IF VAR STRING RETURN FUNC_CALL VAR VAR BIN_OP NUMBER VAR IF VAR STRING RETURN FUNC_CALL VAR VAR BIN_OP NUMBER VA... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | for _ in range(int(input())):
n = int(input())
s = input()
x, y = map(int, input().split())
total = 0
a = [0]
for i in range(n):
if s[i] == "N":
total += min(x, 3 * y)
a.append(total)
elif s[i] == "S":
total += min(3 * x, y)
a.appen... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR VAR I... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | T = int(input(""))
for _ in range(T):
N = int(input(""))
line = input("")
X, Y = map(int, input("").rstrip().split(" "))
costs = {}
DIRECTIONS = {"N": 0, "E": 1, "S": 2, "W": 3}
for direction_val in DIRECTIONS.values():
for dest_direction in ("E", "W"):
dest_direction_val = D... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING STRING ASSIGN VAR DICT ASSIGN VAR DICT STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER F... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | def check(n, string, a, b):
arr = [0]
add = 0
for i in range(n):
if string[i] is "N":
add += min(a, 3 * b)
arr.append(add)
elif string[i] is "W":
add += min(2 * a, 2 * b)
arr.append(add)
elif string[i] is "S":
add += min(3 *... | FUNC_DEF ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR VAR IF VAR VAR STRING VAR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR VAR IF VAR VAR STRING VAR FUNC_CALL VAR BIN_OP NUMBER VAR VAR EXPR FUNC_... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | for i in range(int(input())):
n = int(input())
direction = input()[:n]
x, y = map(int, input().split())
energy = 0
for item in direction:
if item == "E":
energy += min(x * 2, y * 2)
elif item == "W":
energy += 0
elif item == "N":
energy += ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR FUNC... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | for _ in range(int(input())):
n = int(input())
a = input()
x, y = list(map(int, input().split(" ")))
r, l = [0], [0]
for i in a:
if i == "N":
r.append(min(x, y * 3))
l.append(min(y, x * 3))
if i == "S":
r.append(min(y, x * 3))
l.append(... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR LIST NUMBER LIST NUMBER FOR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER EXPR FUN... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | for _ in range(int(input())):
n = int(input())
s = input()
y, x = map(int, input().split())
left, reverse, right = min(x, 3 * y), min(2 * x, 2 * y), min(3 * x, y)
dic = {"N": 0, "S": 0, "E": 0, "W": 0}
for v in s:
dic[v] += 1
cost = dic["N"] * left + dic["E"] * reverse + dic["S"] * r... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP NUMBER VAR FUNC_CALL VAR BIN_OP NUMBER VAR VAR ASSIGN V... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | for t in range(int(input())):
l = int(input())
p = input()
x, y = map(int, input().split())
n = [0] * l
s = [0] * l
e = [0] * l
w = [0] * l
a = 0
b = 0
c = 0
d = 0
for i in range(l):
if p[i] == "N":
a += 1
elif p[i] == "S":
b += 1
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NU... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | from itertools import combinations
for _ in range(int(input())):
n = int(input())
soldger = list(input())
clock, anitClock = list(map(int, input().split()))
east = []
west = []
for i in soldger:
if i == "N":
west.append(min(anitClock, 3 * clock))
east.append(min(... | 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 ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR EXPR FUN... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | for _ in range(int(input())):
n = int(input())
s = input()
x, y = map(int, input().split())
li = []
E = [min(x, 3 * y), 0, min(3 * x, y), min(2 * x, 2 * y)]
W = [min(3 * x, y), min(2 * x, 2 * y), min(x, 3 * y), 0]
data = {"N": 0, "E": 1, "S": 2, "W": 3}
for i in s:
li.append([E[d... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FUNC_CALL VAR VAR BIN_OP NUMBER VAR NUMBER FUNC_CALL VAR BIN_OP NUMBER VAR VAR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | def find_east(x, clock, anti):
if x == "E":
return 0
elif x == "S":
if anti < clock * 3:
return anti
else:
return clock * 3
elif x == "N":
if anti * 3 < clock:
return anti * 3
else:
return clock
elif anti < clock:
... | FUNC_DEF IF VAR STRING RETURN NUMBER IF VAR STRING IF VAR BIN_OP VAR NUMBER RETURN VAR RETURN BIN_OP VAR NUMBER IF VAR STRING IF BIN_OP VAR NUMBER VAR RETURN BIN_OP VAR NUMBER RETURN VAR IF VAR VAR RETURN BIN_OP VAR NUMBER RETURN BIN_OP VAR NUMBER FUNC_DEF IF VAR STRING RETURN NUMBER IF VAR STRING IF BIN_OP VAR NUMBER ... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | def calcmin(n, e, w, s):
ans = 0
ans += min(n * x, n * y * 3)
ans += min(w * 2 * x, w * y * 2)
ans += min(s * x * 3, s * y)
return ans
def calcmin1(n, e, w, s):
ans = 0
ans += min(n * x * 3, n * y)
ans += min(e * 2 * x, e * y * 2)
ans += min(s * x, s * y * 3)
return ans
t = i... | FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER VAR BIN_OP BIN_OP VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER BIN_OP VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER BIN_OP V... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | T = int(input())
for t in range(T):
n = int(input())
directions = input()
cost_turn_cw, cost_turn_ccw = [int(x) for x in input().split()]
cost_to_face_left = []
cost_to_face_right = []
for direction in directions:
if direction == "E":
cost_to_face_right += [0]
cos... | 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 VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR IF VAR STRING VAR LIST NUMBER VAR LIST BIN_OP NUMBER FUNC_CALL VAR VAR VAR IF VAR STRI... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | def enToFaceEast(d, X, Y):
if d == "E":
return 0
elif d == "N":
return min(X * 1, Y * 3)
elif d == "W":
return min(X * 2, Y * 2)
else:
return min(X * 3, Y * 1)
def enToFaceWest(d, X, Y):
if d == "E":
return min(X * 2, Y * 2)
elif d == "N":
return... | FUNC_DEF IF VAR STRING RETURN NUMBER IF VAR STRING RETURN FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF VAR STRING RETURN FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER RETURN FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER FUNC_DEF IF VAR STRING RETURN FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF V... |
The Rumbling is a hypothetical cataclysmic event involving Karl Fritz's Wall Titans marching across the Earth, destroying all life upon it. Eren Yeager who possesses the Founding Titan has decided to begin The Rumbling to show the true power of the Eldians to the rest of the world.
There are N Titans standing in a lin... | test = int(input())
for i in range(0, test):
n = int(input())
s = input()
x, y = map(int, input().split())
west = []
east = []
for i in s:
if i == "E":
west.append(2 * min(x, y))
east.append(0)
elif i == "N":
west.append(min(y, 3 * x))
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR BIN_OP NUMBER FUNC_CALL VAR VAR VAR EXPR FUNC_CALL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.