description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h_1 and height of Abol is h_2. Each second, Mike waters Abol and Xaniar.
[Image]
So, if height of Xaniar is h_1 and height of Abol is h_2, after one second height of Xaniar will become $(x_... | def main():
m, tt = int(input()), [0] * 4
for i in (0, 2):
h, a = map(int, input().split())
x, y = map(int, input().split())
ha = h, a
for t in range(1, m * 2):
h = (h * x + y) % m
if h in ha:
if h == ha[0]:
if tt[i]:
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP LIST NUMBER NUMBER FOR VAR NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR ... |
Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h_1 and height of Abol is h_2. Each second, Mike waters Abol and Xaniar.
[Image]
So, if height of Xaniar is h_1 and height of Abol is h_2, after one second height of Xaniar will become $(x_... | import sys
__author__ = "kitkat"
def GetNext(h, x, y):
nonlocal m
return (x * h + y) % m
try:
while True:
m = int(input())
h1, a1 = list(map(int, input().split(" ")))
x1, y1 = list(map(int, input().split(" ")))
h2, a2 = list(map(int, input().split(" ")))
x2, y2 =... | IMPORT ASSIGN VAR STRING FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR WHILE NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR FUNC_... |
Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h_1 and height of Abol is h_2. Each second, Mike waters Abol and Xaniar.
[Image]
So, if height of Xaniar is h_1 and height of Abol is h_2, after one second height of Xaniar will become $(x_... | f = lambda: map(int, input().split())
m = int(input())
def g():
h, a = f()
x, y = f()
t = lambda: (h * x + y) % m
s, d = 0, 1
while h != a:
h = t()
s += 1
if s > m:
print(-1)
exit()
h = t()
while h != a:
h = t()
d += 1
... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR NUMBER NUMBER WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMB... |
Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h_1 and height of Abol is h_2. Each second, Mike waters Abol and Xaniar.
[Image]
So, if height of Xaniar is h_1 and height of Abol is h_2, after one second height of Xaniar will become $(x_... | mod = int(input())
h1, a1 = map(int, input().split())
x1, y1 = map(int, input().split())
h2, a2 = map(int, input().split())
x2, y2 = map(int, input().split())
q1 = 0
while h1 != a1:
h1 = (h1 * x1 + y1) % mod
q1 += 1
if q1 > 2 * mod:
print(-1)
return
q2 = 0
t2 = h2
while t2 != a2:
t2 = (t... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN... |
Marcin is a coach in his university. There are $n$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.
Let's focus on the students. They are indexed with integers from $1$ to $n$. Each of them can be described with two intege... | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = {}
for i in range(n):
if a[i] not in d:
d[a[i]] = []
d[a[i]].append(b[i])
res = 0
v = []
for i in d.keys():
if len(d[i]) > 1:
v.append(i)
res += sum(d[i])
for i in d.keys():
if len(d[i]) ... | 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 ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR LIST EXPR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LI... |
Marcin is a coach in his university. There are $n$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.
Let's focus on the students. They are indexed with integers from $1$ to $n$. Each of them can be described with two intege... | n = int(input())
ta = list(map(int, input().split()))
a = []
tb = list(map(int, input().split()))
cnt = {}
for i in range(n):
if ta[i] not in cnt:
cnt[ta[i]] = 1
else:
cnt[ta[i]] += 1
s1 = []
for i in range(n):
if cnt[ta[i]] > 1:
s1.append(ta[i])
def bin(num):
s = set()
for... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_... |
Marcin is a coach in his university. There are $n$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.
Let's focus on the students. They are indexed with integers from $1$ to $n$. Each of them can be described with two intege... | n = int(input())
a = [0] * n
b = [0] * n
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
for i in range(n):
a[i] = [a[i], b[i]]
a.sort(reverse=True, key=lambda x: x[0])
same = []
comp = a[0][0]
count = 1
score = a[0][1]
for i in range(1, n):
if comp == a[i][0] and i == n - 1:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR LIST VAR VAR VAR VAR EXP... |
Marcin is a coach in his university. There are $n$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.
Let's focus on the students. They are indexed with integers from $1$ to $n$. Each of them can be described with two intege... | n = int(input())
lst1 = list(map(int, input().split()))[:n]
lst2 = list(map(int, input().split()))[:n]
dict = {}
for a in lst1:
if a in dict:
dict[a] += 1
else:
dict[a] = 1
ans = 0
grp = []
for k in dict:
if dict[k] > 1:
grp.append(k)
for i in range(n):
for k in grp:
if l... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR IF VAR VAR NUMBER... |
Marcin is a coach in his university. There are $n$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.
Let's focus on the students. They are indexed with integers from $1$ to $n$. Each of them can be described with two intege... | def bitcode(lis):
bc = []
for n in lis:
if lis[n] > 1:
bc.append(n)
return bc
n = int(input())
lis = {}
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for bc in a:
try:
lis[bc] += 1
except:
lis[bc] = 1
bcs = bitcode(lis)
if len(bcs) == 0... | FUNC_DEF ASSIGN VAR LIST FOR VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT 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 FOR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR ... |
Marcin is a coach in his university. There are $n$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.
Let's focus on the students. They are indexed with integers from $1$ to $n$. Each of them can be described with two intege... | n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
d = {}
for i in range(len(a)):
if a[i] in d:
d[a[i]][0] += b[i]
d[a[i]][1] += 1
else:
d[a[i]] = [b[i], 1]
s = 0
currset = set()
countmax = 0
to = 0
for i in d:
if d[i][1] > 1:
s += d[... | 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 FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER VAR VAR VAR VAR VAR NUMBER NUMBER ASSIGN VAR VAR VAR LIST VAR VAR NUMBER ASSI... |
Marcin is a coach in his university. There are $n$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.
Let's focus on the students. They are indexed with integers from $1$ to $n$. Each of them can be described with two intege... | n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
lis = []
d = {}
for i in a:
if i in d:
d[i] += 1
else:
d[i] = 1
ans = 0
for i in d:
if d[i] > 1:
lis.append(i)
for i in range(len(lis)):
for j in range(n):
if lis[i] == a[j]:
... | 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 ASSIGN VAR LIST ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR NUMBER EXPR FU... |
Marcin is a coach in his university. There are $n$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.
Let's focus on the students. They are indexed with integers from $1$ to $n$. Each of them can be described with two intege... | n = int(input())
b = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
rev = {}
dic = {}
for i in range(n):
bb = b[i]
if bb in dic:
dic[bb].append(i)
else:
dic[bb] = [i]
neg1 = (1 << 60) - 1
ans = 0
mask = 0
dels = []
for bb in dic:
inds = dic[bb]
if len(inds) >... | 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 ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR LIST VAR ASSIGN VAR BIN_OP BIN_OP NUM... |
Marcin is a coach in his university. There are $n$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.
Let's focus on the students. They are indexed with integers from $1$ to $n$. Each of them can be described with two intege... | def bit(used, b):
count = 0
for num in used:
for i in range(b.bit_length() + 1):
if 1 << i & num == 0 and 1 << i & b:
count += 1
break
if count == len(used):
return True
else:
return False
def f(a, b):
arr = list(zip(a, b))
d ... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP NUMBER VAR VAR NUMBER BIN_OP BIN_OP NUMBER VAR VAR VAR NUMBER IF VAR FUNC_CALL VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR ... |
Marcin is a coach in his university. There are $n$ students who want to attend a training camp. Marcin is a smart coach, so he wants to send only the students that can work calmly with each other.
Let's focus on the students. They are indexed with integers from $1$ to $n$. Each of them can be described with two intege... | import sys
input = sys.stdin.readline
def gcd(a, b):
if a == 0:
return b
return gcd(b % a, a)
def lcm(a, b):
return a * b / gcd(a, b)
def main():
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = {}
f = {}
for i in range(n):
... | IMPORT ASSIGN VAR VAR FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_C... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | data = [int(i) for i in input()]
n = len(data)
minval = [0] * n
minval[-1] = 2 * data[-1] - 1
for i in range(n - 2, -1, -1):
if data[i] == 1:
minval[i] = min(1, minval[i + 1] + 1)
else:
minval[i] = min(-1, minval[i + 1] - 1)
ans = [i for i in data]
for i in range(n - 1, -1, -1):
if minval[i]... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER BIN_OP BIN_OP NUMBER VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VA... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | a = input() + "1"
n = len(a) - 1
s = [0] * (n + 1)
for q in range(n - 1, -1, -1):
s[q] = s[q + 1]
if a[q] == "1":
s[q] += 1
d = [0] * (n + 1)
for q in range(n - 1, -1, -1):
d[q] = max(s[q], d[q + 1])
if a[q] == "0":
d[q] = max(d[q], d[q + 1] + 1)
t = []
for q in range(n):
if a[q] == ... | ASSIGN VAR BIN_OP FUNC_CALL VAR STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR VAR BIN_OP VAR NUMBER IF VAR VAR STRING VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL ... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | import sys
INF = 10**10
def main():
st = list(input())
stk = []
for index, i in enumerate(st):
if i == "0" and len(stk) > 0 and stk[-1][0] == "1":
stk.pop()
else:
stk.append([i, index])
for li in stk:
st[li[1]] = "0"
print("".join(st))
out = []
ge... | IMPORT ASSIGN VAR BIN_OP NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR IF VAR STRING FUNC_CALL VAR VAR NUMBER VAR NUMBER NUMBER STRING EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR LIST VAR VAR FOR VAR VAR ASSIGN VAR VAR NUMBER STRING EXPR FUNC_CALL VAR FUNC_CALL ST... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = list(map(int, input()))
ans = [0] * len(s)
back = []
for i, c in enumerate(s):
if c == 0:
if back:
ans[back.pop()] = 1
else:
back.append(i)
print(*ans, sep="") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR ASSIGN VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR STRING |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
n = len(s)
if n == 1:
print(0)
elif n == 2:
if s == "10":
print("10")
else:
print("00")
else:
s_lis = 0
s_max = 0
s_zero = 0
t_zero = 0
stack_01 = []
t = []
for i in range(n):
t.append("0")
t_zero += 1
if s[i] == "0":
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER IF VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL V... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | import sys
s = list(input())
l = len(s)
sun = 0
for i in range(l - 1, -1, -1):
if s[i] == "0":
sun += 1
elif s[i] == "1" and sun:
sun -= 1
else:
s[i] = "0"
print("".join(s)) | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR STRING VAR NUMBER IF VAR VAR STRING VAR VAR NUMBER ASSIGN VAR VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
ans = list(s)
n = len(s)
dp = [0] * n
i = 0
j = 1
while j < n:
if s[i] == "1" and s[j] == "0":
dp[i] = 1
dp[j] = 1
if i > 0:
while dp[i] == 1 and i > 0:
i -= 1
j += 1
else:
j += 1
i = j - 1
for i in range(n):
if dp[i] ==... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR STRING VAR VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR NUMBER WHILE VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMB... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | v, t = 0, ""
for c in input()[::-1]:
if c < "1" or v:
t += c
v += 1 - (c < "1") * 2
else:
t += "0"
print(t[::-1]) | ASSIGN VAR VAR NUMBER STRING FOR VAR FUNC_CALL VAR NUMBER IF VAR STRING VAR VAR VAR VAR BIN_OP NUMBER BIN_OP VAR STRING NUMBER VAR STRING EXPR FUNC_CALL VAR VAR NUMBER |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()[::-1]
ans = ""
c = 0
for i in s:
if i == "0":
ans += "0"
c += 1
elif c > 0:
ans += "1"
c -= 1
else:
ans += "0"
print(ans[::-1]) | ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR STRING VAR NUMBER IF VAR NUMBER VAR STRING VAR NUMBER VAR STRING EXPR FUNC_CALL VAR VAR NUMBER |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | import sys
sys.setrecursionlimit(10**5 + 1)
inf = int(10**20)
max_val = inf
min_val = -inf
RW = lambda: sys.stdin.readline().strip()
RI = lambda: int(RW())
RMI = lambda: [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda: [x for x in sys.stdin.readline().strip().split()]
given = input()[::-1]
zeros = ... | IMPORT EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL FUN... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
n = len(s)
tot = 0
S = list(s)
for i in range(n - 1, -1, -1):
if s[i] == "0":
tot += 1
elif tot:
tot -= 1
else:
S[i] = "0"
print("".join(S)) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR STRING VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = list(map(int, input()))
stack = []
for i in range(len(s)):
if s[i] == 1:
stack.append(i)
elif len(stack) != 0:
stack.pop()
for i in stack:
s[i] = 0
s = list(map(str, s))
print("".join(s)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VA... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
ans = ["0" for i in range(len(s))]
st = []
for i in range(len(s)):
if s[i] == "0":
if len(st):
ans[st.pop()] = "1"
else:
st.append(i)
print("".join(ans)) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
pre = [(0) for i in range(111111)]
suf = [(0) for i in range(111111)]
lens = len(s)
index = 0
for i in s:
index += 1
t = 0
if i == "0":
t = 1
else:
t = -1
pre[index] = min(pre[index - 1] + t, t)
index = lens + 1
for i in reversed(s):
index -= 1
t = 0
if i == "... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIG... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | import sys
input = sys.stdin.readline
def solve():
i = 0
s = list(input().strip())
st = []
for c in s:
if c == "1":
st.append(i)
elif len(st) > 0:
st.pop()
i += 1
for i in st:
s[i] = "0"
print("".join(s))
solve() | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER FOR VAR VAR ASSIGN VAR VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
t = [0] * len(s)
stack = []
for i in range(len(s)):
if s[i] == "1":
stack.append(i)
elif len(stack) > 0:
pos = stack.pop()
t[pos] = 1
print("".join(map(str, t))) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
res = ["0"] * len(s)
min_dif = 0
length = len(s)
for i in range(length):
if s[length - i - 1] == "0":
min_dif = min([-1, min_dif - 1])
else:
if min_dif < 0:
res[length - i - 1] = "1"
min_dif = min([1, min_dif + 1])
print("".join(res)) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR LIST NUMBER BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER STRING ASSIGN VAR FUNC... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | def main():
s = input()
n = len(s)
st = []
flags = [(False) for i in range(n)]
for i in range(n):
if s[i] == "1":
st.append(i)
elif len(st) != 0:
st.pop()
for i in range(len(st)):
flags[st[i]] = True
for i in range(n):
if flags[i] == Tr... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = list(map(int, input()))
ps = [0]
for i in s:
if i == 0:
ps.append(ps[-1] + 1)
else:
ps.append(ps[-1] - 1)
b = 0
maba = 0
sufmax = [-(10**9)]
for i in range(len(ps) - 1, 0, -1):
sufmax.append(max(sufmax[-1], ps[i]))
sufmax = sufmax[::-1]
ans = []
cnt = 0
if s[0] == 1:
cnt += 1
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
t = ""
blockable_ones = 0
is_blockable = False
last_num = "1"
for i in range(1, len(s) + 1):
num = s[-i]
if num == "0":
t += num
blockable_ones += 1
is_blockable = True
elif blockable_ones > 0 and is_blockable:
blockable_ones -= 1
t += num
else:
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR IF VAR STRING VAR VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR VAR NUMBER VAR VAR VAR STRING ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR NUMBER |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
s = [*s]
c = m = 0
for i in range(len(s) - 1, -1, -1):
c += -1 if s[i] == "0" else 1
if c > m:
s[i] = "0"
m = c
print("".join(s)) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER VAR VAR VAR STRING NUMBER NUMBER IF VAR VAR ASSIGN VAR VAR STRING ASSIGN VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
n = len(s)
b = [0] * n
x = 1
l = []
for i in range(n):
l.append(i)
while x == 1:
x = 0
for i in range(len(s) - 1):
if s[i] == "1" and s[i + 1] == "0":
x = 1
b[int(l[i])] = 1
l[i] = l[i + 1] = 1000000
s = s.replace("10", "")
l = list(set(l))
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR WHILE VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR STRING VAR BIN_OP VAR NUMBER STRING ASSIGN VAR NU... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
ans = []
for i in range(0, len(s)):
ans.append(s[i])
c0 = 0
c1 = 0
for i in range(len(ans) - 1, -1, -1):
if ans[i] == "0":
c0 += 1
elif ans[i] == "1" and c1 >= c0:
ans[i] = "0"
else:
c1 += 1
ans = "".join(ans)
print(ans) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR VAR STRING VAR NUMBER IF VAR VAR STRING VAR VAR ASSIGN VAR VAR STRING VAR NUMBER ASSIGN VAR FU... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = list(map(int, input()))
ans = []
cnt = 0
if s[0] == 1:
cnt += 1
else:
ans.append("0")
for i in range(1, len(s)):
if s[i] == 0 and s[i - 1] == 0:
ans.append("0")
elif s[i] == 1:
cnt += 1
else:
maba = 0
b = 0
for x in range(i, len(s)):
if s[x] ==... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER IF VAR NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING IF VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSI... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = str(input().strip())
t = list(s[::-1])
cnt = 0
for i, v in enumerate(t):
if v == "0":
cnt += 1
elif cnt:
cnt -= 1
else:
t[i] = "0"
print("".join(t[::-1])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR STRING VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR NUMBER |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
n = len(s)
b = [0] * n
l = []
m = []
j = 0
for i in s:
if len(l) == 0:
l.append(i)
m.append(j)
elif l[-1] == "1" and i == "0":
l.pop()
b[m.pop()] = 1
else:
l.append(i)
m.append(j)
j += 1
print(*b, sep="") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER STRING VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER EXPR FUNC_CAL... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | pp = input()
if len(pp) == 1:
print("0")
return
z = 1 if pp[0] == "0" else 0
zc = [z]
l = 1
lndl = [l]
for p in pp[1:]:
l = max(z + 1, l + (1 if p == "1" else 0))
z += 1 if p == "0" else 0
lndl.append(l)
zc.append(z)
lnda = lndl[-1]
o = 1 if pp[-1] == "1" else 0
oc = [o]
l = 1
lndr = [l]
for p i... | ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR VAR NUMBER STRING NUMBER NUMBER ASSIGN VAR LIST VAR ASSIGN VAR NUMBER ASSIGN VAR LIST VAR FOR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR VAR STRING NUMBER NUMBER VAR VAR STRING NUMBER NUMBER EXPR F... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | a = list(map(int, input()))
w = [0] * len(a)
q = []
for i in range(len(a)):
if a[i] == 1:
q.append(i)
elif len(q) > 0:
qw = q.pop()
w[qw] = 1
print(*w, sep="") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR VAR STRING |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | S = input()
N = len(S)
p = q = 0
prv = S[0]
c = 0
C = []
if S[0] == "1":
C.append(0)
for ch in S:
if ch != prv:
C.append(c)
c = 1
prv = ch
else:
c += 1
C.append(c)
ans = []
r = 0
L = len(C)
for i in range(L - 1, -1, -1):
c = C[i]
if i % 2:
r += c
if i ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST IF VAR NUMBER STRING EXPR FUNC_CALL VAR NUMBER FOR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR N... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | S = list(map(int, input().strip()))
N = len(S)
stack = []
for i in range(N):
s = S[i]
if s == 0 and stack and stack[-1][0] == 1:
stack.pop()
else:
stack.append((s, i))
T = S[:]
for i in tuple(map(list, zip(*stack)))[1]:
T[i] = 0
print("".join(map(str, T))) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR NUMBER VAR VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR N... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | st = input().rstrip()
a = []
for item in st:
a.append(int(item))
a.reverse()
zero_count = 0
for i, item in enumerate(a):
if item == 0:
zero_count += 1
elif zero_count > 0:
zero_count -= 1
else:
a[i] = 0
a.reverse()
print("".join([str(item) for item in a])) | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
t = list(s)
stack = []
for i in range(len(s)):
if t[i] == "1":
stack.append(i)
elif len(stack):
stack.pop()
for i in range(len(stack)):
t[stack[i]] = "0"
print("".join(t)) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
res = ["0"] * len(s)
stk = []
for i in range(len(s)):
if s[i] == "0":
if len(stk) > 0:
res[stk[-1]] = "1"
stk.pop()
else:
stk.append(i)
print("".join(res)) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER STRING EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | from sys import stdin
s = stdin.readline().strip()
dp = [(0) for i in range(len(s) + 2)]
ons = [(0) for i in range(len(s) + 2)]
zs = [(0) for i in range(len(s) + 2)]
for i in range(len(s) - 1, -1, -1):
if s[i] == "1":
ons[i] += 1
if i != len(s) - 1:
ons[i] += ons[i + 1]
z = 0
for i in range(len... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR VAR ST... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = str(input())
n = len(s)
ns = ["0" for i in range(n)]
st = []
for i in range(n):
if s[i] == "0":
if len(st):
ns[st.pop()] = "1"
else:
st.append(i)
print("".join(ns)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | import sys
input = sys.stdin.readline
s = list(input().rstrip())
n = len(s)
c = m = 0
for i in range(n)[::-1]:
c += -1 if s[i] == "0" else 1
if c > m:
s[i] = "0"
c = m
print("".join(s)) | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER VAR VAR VAR STRING NUMBER NUMBER IF VAR VAR ASSIGN VAR VAR STRING ASSIGN VAR VAR EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = [int(x) for x in list(input())]
n = len(s)
b = [0] * n
counter = 0
for i in range(n - 1, -1, -1):
if s[i] == 0:
counter += 1
elif counter > 0:
counter -= 1
else:
s[i] = 0
arr = ""
for item in s:
arr += str(item)
print(arr) | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR STRING FOR VAR VAR VAR FUNC_CALL VAR ... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | import sys
def main():
import sys
input = sys.stdin.readline
s = [int(i) for i in input()[:-1]][::-1]
n = len(s)
dp = [([0] * n) for _ in range(n)]
for j in range(n):
tmp = [0, 0]
for i in range(j, n):
if s[i] == 0:
tmp[0] = max(tmp) + 1
... | IMPORT FUNC_DEF IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR IF VAR VAR NUMBER ASSIGN VAR NUMBER BIN_OP FUNC_CA... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()[::-1]
count = 0
n = len(s)
s1 = ""
for i in range(n):
if s[i] == "0":
count += 1
s1 += "0"
elif count > 0:
count -= 1
s1 += "1"
else:
s1 += "0"
s1 = s1[::-1]
print(s1) | ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER VAR STRING IF VAR NUMBER VAR NUMBER VAR STRING VAR STRING ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR VAR |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
s = list(s)
l = len(s) - 1
z = 0
for i in range(l, -1, -1):
if s[i] == "0":
z += 1
elif z:
z -= 1
else:
s[i] = "0"
s = "".join(s)
print(s) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF VAR VAR STRING VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR STRING ASSIGN VAR FUNC_CALL STRING VAR EXPR FUNC_CALL VAR VAR |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s = input()
a, b, c = [], [], []
count = 0
for i in range(len(s) - 1, -1, -1):
a.append(s[i])
for i in range(len(a)):
if a[i] == "0":
count += 1
b.append("0")
elif a[i] == "1" and count > 0:
count -= 1
b.append("1")
elif a[i] == "1" and count == 0:
b.append("0")
f... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR LIST LIST LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR VAR STRING VAR NUMBER VAR NUMBER EXPR FUNC_CAL... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | line = input()
res = []
zer = 0
one = 0
for i in range(len(line)):
ind = len(line) - 1 - i
if line[ind] == "0":
res.append("0")
zer += 1
else:
if zer <= one:
res.append("0")
zer += 1
else:
res.append("1")
one += 1
for i in range(len... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER VAR IF VAR VAR STRING EXPR FUNC_CALL VAR STRING VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING VAR NUMBER EXPR FUNC_CALL VAR STRING VAR NUMBER FOR VAR F... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | s, cnt = list(input()), 0
for i in range(len(s) - 1, -1, -1):
if s[i] == "0":
cnt += 1
elif cnt:
cnt -= 1
else:
s[i] = "0"
print("".join(s)) | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR VAR STRING VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING VAR |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | a = input()
a = list(a)
l = []
for i in range(0, len(a)):
l.append([a[i], i])
i = 1
while i < len(l):
if l[i][0] == "0" and l[i - 1][0] == "1":
l.pop(i)
l.pop(i - 1)
i -= 2
if i == -1:
i = 0
i += 1
for i in range(0, len(l)):
a[l[i][1]] = 0
print(*a, sep="") | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER STRING VAR BIN_OP VAR NUMBER NUMBER STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ... |
The only difference between easy and hard versions is the length of the string. You can hack this problem only if you solve both problems.
Kirk has a binary string $s$ (a string which consists of zeroes and ones) of length $n$ and he is asking you to find a binary string $t$ of the same length which satisfies the foll... | inn = lambda: int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
DBG = True and False
def ddprint(x):
if DBG:
print(x)
s = input().strip()
n = len(s)
ones = []
stk = []
for i in range(n):
if len(stk) > 0 and stk[-1][0] == "1" and s[i] == "0":
o... | 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 FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER NUMBER FUNC_DEF IF VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST F... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input())
arr = []
while t > 0:
t -= 1
n = int(input())
a = 0
maxi = 0
arr.clear()
inpArr = input().split(" ")
for i in range(len(inpArr)):
arr.append(int(inpArr[i]))
maxi = max(maxi, arr[i])
a += arr[i]
if n == 1:
print("T")
elif n == 2:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input())
for _ in range(t):
n = input()
a = [int(i) for i in input().split()]
maxi = max(a)
s = sum(a)
if s < 2 * maxi or s % 2 == 1:
print("T")
else:
print("HL") | 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
t = sum(a)
flag = 0
for i in range(n):
if 2 * a[i] > t:
flag = 1
break
if t % 2 == 1:
flag = 1
if flag == 1:
print("T")
else:
print("HL") | 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 IF BIN_OP NUMBER VAR VAR VAR ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER A... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input())
for i in range(t):
n = int(input())
data = list(map(int, input().split()))
data = sorted(data, reverse=True)
sd = sum(data[1:])
if data[0] > sd:
print("T")
elif data[0] == sd:
print("HL")
else:
temp = sd - data[0]
if temp % 2 == 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 NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER VAR EXPR FUNC_CALL ... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | a = int(input())
b = []
c = []
for i in range(a):
b.append(int(input()))
c.append(list(map(int, input().split())))
for i in range(a):
if b[i] == 1:
print("T")
elif b[i] == 2:
if c[i][0] == c[i][1]:
print("HL")
else:
print("T")
elif max(c[i]) > sum(c[i]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR VAR NUMBER IF VAR VAR NU... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
a.sort()
sumi = sum(a[: n - 1])
s = a[-1]
if s > sumi:
print("T")
continue
sumi += s
if sumi % 2:
print("T")
continue
print("HL") | 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 EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | import sys
input = lambda: sys.stdin.readline().rstrip()
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
if 2 * max(a) > sum(a) or sum(a) % 2 == 1:
print("T")
else:
print("HL") | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL 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 IF BIN_OP NUMBER FUNC_CALL VAR VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL ... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
most = max(a)
s = sum(a)
if most > s - most:
print("T")
elif most == s - most:
print("HL")
elif s % 2 == 0:
print("HL")
else:
print("T") | 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 ASSIGN VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR STRING IF VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR STRING IF BIN_OP ... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input())
for _ in range(t):
n = int(input())
arr = list(map(int, input().split()))
s = sum(arr)
if n == 1 and s > 0 or sum(arr) < 2 * max(arr):
print("T")
elif s % 2 == 0:
print("HL")
else:
print("T") | 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 IF VAR NUMBER VAR NUMBER FUNC_CALL VAR VAR BIN_OP NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBE... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | import sys
input = sys.stdin.buffer.readline
def solve():
n = int(input())
alst = list(map(int, input().split()))
if n == 1:
print("T")
return
total = sum(alst)
max_a = max(alst)
if max_a * 2 > total:
print("T")
elif total % 2 == 0:
print("HL")
else:
... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER NUMBER... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input().split()[0])
for case in range(t):
n = int(input().split()[0])
a = list(map(int, input().split()))
if n == 1:
print("T")
else:
a.sort()
if sum(a) - a[n - 1] < a[n - 1]:
print("T")
elif sum(a) % 2 == 0:
print("HL")
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF BIN_OP FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR BI... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | for ad in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
l.sort()
l.reverse()
if n == 1:
print("T")
continue
elif n == 2:
if l[0] > l[1]:
print("T")
else:
print("HL")
continue
t = 0
i = 0
j = 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ST... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | import sys
T = int(sys.stdin.readline().strip())
for t in range(0, T):
n = int(sys.stdin.readline().strip())
a = list(map(int, sys.stdin.readline().strip().split()))
if max(a) > sum(a) / 2:
print("T")
elif sum(a) % 2 == 1:
print("T")
else:
print("HL") | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP FUNC_CALL VAR VA... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input())
for _ in range(t):
n = int(input())
a = [int(i) for i in input().split()]
if n == 1:
print("T")
continue
elif n == 2:
if a[0] == a[1]:
print("HL")
else:
print("T")
continue
total = sum(a)
if total % 2 or max(a) * 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 VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | cases = int(input())
for t in range(cases):
n = int(input())
a = list(map(int, input().split()))
if n == 1:
if a[0] == 0:
print("HL")
else:
print("T")
else:
a = sorted(a)
if a[-1] > sum(a[:-1]):
print("T")
else:
s = ... | 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 IF VAR NUMBER IF VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER FUNC_CALL VAR VAR N... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input())
for _ in range(t):
n = int(input())
a = [int(x) for x in input().split()]
s = sum(a)
flag = False
for x in a:
if x > s // 2:
flag = True
break
if flag:
print("T")
continue
print("HL" if s % 2 == 0 else "T") | 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 VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_O... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
a.sort()
s = sum(a)
if a[n - 1] * 2 > s or s % 2 == 1:
print("T")
elif s % 2 == 0:
print("HL") | 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 EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER N... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input())
for _ in range(t):
p = int(input())
arr = list(map(int, input().split()))
if len(arr) == 1:
print("T")
else:
last = 999
ind = 997
c = 0
while ind != 998:
ind = 998
best = 0
for i in range(len(arr)):
... | 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 IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR NUMBER ASSIGN... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input())
while t:
t -= 1
n = int(input())
l = list(map(int, input().split()))
m = max(l)
s = sum(l)
if s % 2 or 2 * m > s:
print("T")
else:
print("HL") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER 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 FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | import sys
input = sys.stdin.buffer.readline
T = int(input())
for testcase in range(T):
n = int(input())
a = list(map(int, input().split()))
a.sort()
if n == 1:
print("T")
else:
s = sum(a) - a[-1]
if a[-1] > s:
print("T")
else:
s += a[-1]
... | IMPORT 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 EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER IF VAR NUMBER VAR EXP... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
def gift():
for _ in range(t):
n = int(input())
arry = list(map(int, input().split()))
if n == 1:
yield "T"
elif n == 2:
if arry[0] != arry[1]:
yield "T"
... | IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_DEF 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 IF VAR NUMBER EXPR STRING IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR STRING EXPR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input())
while t > 0:
n = int(input())
l = list(map(int, input().split()))
ls = [0] * n
tu = 0
p = 0
while True:
m = 0
ind = -1
for i in range(n):
if l[i] > m and ls[i] == 0:
m = l[i]
ind = i
if ind == -1:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VA... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | for w in range(eval(input())):
n = eval(input())
l = [int(i) for i in input().split()]
s = sum(l)
if max(l) * 2 > s or s % 2 == 1:
print("T")
else:
print("HL") | 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | for s in [*open(0)][2::2]:
s = sum((a := [*map(int, s.split())]))
print("HTL"[s < 2 * max(map(int, a)) or s % 2 :: 2]) | FOR VAR LIST FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR LIST FUNC_CALL VAR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR STRING VAR BIN_OP NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER NUMBER |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | def check_done(a):
count = 0
for i in a:
if i != 0:
count += 1
if count == 2:
return False
return True
t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
turn = "T"
T_pick = -1
H_pick =... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR NUMBER IF VAR NUMBER RETURN NUMBER RETURN NUMBER 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 STR... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
n = int(input())
A = list(map(int, input().split()))
if n == 1:
print("T")
elif n == 2:
if A[0] == A[1]:
print("HL")
else:
print("T")
else:
SUM = sum(A)
MAX ... | IMPORT 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 IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STR... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | import sys
input = sys.stdin.readline
def solve(n, a):
if n == 1:
print("T")
return
s = sum(a)
if max(a) > s - max(a):
print("T")
return
s -= n
if s % 2 == 0:
cur = "T"
else:
cur = "HL"
if n % 2 == 0:
print("T" if cur == "HL" else "H... | IMPORT ASSIGN VAR VAR FUNC_DEF IF VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR BIN_OP VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING RETURN VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR STRING ASSIGN VAR STRING IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR STRING ... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input())
for you in range(t):
n = int(input())
l = input().split()
li = [int(i) for i in l]
z = sum(li)
if z % 2:
print("T")
continue
poss = 0
for i in li:
if 2 * i > z:
poss = 1
break
if poss:
print("T")
else:
p... | 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 FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP NUMBER VAR VAR ASSIGN VAR NU... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | test = int(input())
for t in range(0, test):
n = int(input())
a = [int(i) for i in input().split(" ")]
m1 = max(a)
c = 0
a.remove(m1)
while sum(a):
m2 = max(a)
a.append(m1 - 1)
a.remove(m2)
m1 = m2
c += 1
if c % 2:
print("HL")
else:
... | 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 VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR WHILE FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input())
while t:
t -= 1
n = int(input())
lst = list(map(int, input().split()))
max_ele = max(lst)
sum1 = sum(lst)
diff = sum1 - max_ele
if max_ele > sum1:
print("T")
elif diff >= max_ele and diff % 2 == max_ele % 2:
print("HL")
else:
print("T") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER 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 FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING IF VAR VAR BIN_OP VAR NUMBER BIN_... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | def checkWin(a, summ):
if summ % 2 == 1:
return "T"
for i in range(n):
if a[i] > summ - a[i]:
return "T"
return "HL"
def simulate(a):
popped = True
turn = 0
while True:
a.sort()
if len(a) == 0 or len(a) == 1 and not popped:
if turn == 0:
... | FUNC_DEF IF BIN_OP VAR NUMBER NUMBER RETURN STRING FOR VAR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR VAR VAR RETURN STRING RETURN STRING FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER EXPR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR IF VAR NUMBER RETURN STRING RETURN STRING VAR NUMBE... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input())
for q in range(t):
n = int(input())
A = [int(i) for i in input().split()]
vis = -1
last = 1
t = True
while t:
m = 0
mi = -1
sm = 0
smi = -1
for i in range(n):
if A[i] > m:
sm = m
smi = mi
... | 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 VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR V... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | T = int(input())
for _ in range(T):
n, ar = int(input()), list(map(int, input().split()))
ar.sort()
sm, psm, last = sum(ar), sum(ar) - ar[-1], ar[-1]
if last > psm or sm % 2:
print("T")
else:
print("HL") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRIN... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | from sys import stdin
input = stdin.readline
def put():
return map(int, input().split())
def fail():
print(-1)
exit()
t = int(input())
for _ in range(t):
n = int(input())
if n == 1:
_ = input()
print("T")
else:
l = list(put())
x = 0
m = max(l)
... | ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | def main():
t = int(input())
for i in range(t):
n = int(input())
a = tuple(map(int, input().split()))
winner = who_wins(("T", "HL"), a)
print(winner)
def who_wins(players, field):
players = tuple(players)
field = sorted(field)
max_value = field.pop()
other_value... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING STRING VAR EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN ... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
max_a = max(a)
nokori_a = sum(a) - max_a
if nokori_a < max_a:
print("T")
continue
if sum(a) % 2 == 0:
print("HL")
else:
print("T") | IMPORT 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 VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING IF BIN_OP FUNC_CALL V... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | def solve():
n = int(input())
a = list(map(int, input().split()))
mx = max(a)
s = sum(a)
if s - mx < mx or s & 1:
print("T")
else:
print("HL")
for _ in range(int(input())):
solve() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR ... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | t = int(input())
for juego in range(t):
n = int(input())
a = [int(x) for x in input().split()]
maxx = 0
summ = 0
for i in range(n):
if a[i] > maxx:
maxx = a[i]
summ += a[i]
if maxx > summ - maxx:
print("T")
elif summ % 2:
print("T")
else:
... | 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 VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR IF VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR STRING IF ... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
flag = True
if n == 1:
print("T")
elif arr[0] > sum(arr[1:]):
print("T")
elif (sum(arr[1:]) - arr[0]) % 2 == 1:
print("T")
else:
print("HL") | 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 EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING IF BIN_OP BIN_O... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | import sys
input = sys.stdin.readline
for _ in range(int(input())):
n = int(input())
arr = [int(el) for el in input().split()]
if n == 1:
print("T")
elif max(arr) > sum(arr) - max(arr):
print("T")
elif sum(arr) % 2 == 0:
print("HL")
else:
print("T") | IMPORT ASSIGN 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 VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING IF BIN_OP FUNC_CALL VA... |
T is playing a game with his friend, HL.
There are $n$ piles of stones, the $i$-th pile initially has $a_i$ stones.
T and HL will take alternating turns, with T going first. In each turn, a player chooses a non-empty pile and then removes a single stone from it. However, one cannot choose a pile that has been chosen... | def rainy(S, L):
if sum(L) < 2 * max(L) or sum(L) % 2:
return "T"
return "HL"
C = int(input())
for i in range(C):
S = int(input())
L = list(map(int, input().split()))
print(rainy(S, L)) | FUNC_DEF IF FUNC_CALL VAR VAR BIN_OP NUMBER FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER RETURN STRING RETURN STRING 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 EXPR FUNC_CALL VAR FUNC_CAL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.