description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his k cows have decided to stay at the luxurious Grand Moo-dapest Hotel. The hotel consists of n rooms located in a row, some of which are occupied.
... | n, k = list(map(int, input().split()))
s = input()
prefixes = [0]
for i in range(n):
prefixes.append(prefixes[i] + (int(s[i]) + 1) % 2)
a = n
for i in range(n):
if s[i] == "0":
left = 0
right = n
while right - left > 1:
middle = (right + left) // 2
if prefixes[min... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR NUMBER ASSIGN VAR VAR... |
In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his k cows have decided to stay at the luxurious Grand Moo-dapest Hotel. The hotel consists of n rooms located in a row, some of which are occupied.
... | n, k = map(int, input().split())
t = [i for i, v in enumerate(input()) if v == "0"]
s, m = n, 0
f = lambda m: max(r - t[m], t[m] - l)
for l, r in zip(t, t[k:]):
while f(m) > f(m + 1):
m += 1
s = min(s, f(m))
print(s) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR STRING ASSIGN VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR FOR VAR VAR FUNC_CALL VAR VAR VAR VAR WHILE FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN ... |
In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his k cows have decided to stay at the luxurious Grand Moo-dapest Hotel. The hotel consists of n rooms located in a row, some of which are occupied.
... | n, k = [int(_) for _ in input().split()]
a = input()
def next_free(x):
x += 1
while x < n and a[x] == "1":
x += 1
return x
l = next_free(-1)
r = -1
k += 1
for _ in range(k):
r = next_free(r)
i = l
dis = max(i - l, r - i)
next_i = next_free(i)
while True:
cur_dis = max(i - l, r - i)
n... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF VAR NUMBER WHILE VAR VAR VAR VAR STRING VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP ... |
In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his k cows have decided to stay at the luxurious Grand Moo-dapest Hotel. The hotel consists of n rooms located in a row, some of which are occupied.
... | n, k = map(int, input().split())
t = [i for i, v in enumerate(input()) if v == "0"]
s, i = n, 0
a, b = t[:2]
for l, r in zip(t, t[k:]):
while max(r - a, a - l) > max(r - b, b - l):
i += 1
a, b = t[i : i + 2]
s = min(s, max(r - a, a - l))
print(s) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR STRING ASSIGN VAR VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR VAR WHILE FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR VAR FUNC_CALL VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR NUMBER ASSIGN... |
In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his k cows have decided to stay at the luxurious Grand Moo-dapest Hotel. The hotel consists of n rooms located in a row, some of which are occupied.
... | n, k = [int(_) for _ in input().split()]
a = input()
k += 1
f = [0] * (n + 1)
f[1] = int(a[0] == "0")
for i in range(2, n + 1):
f[i] = f[i - 1] + int(a[i - 1] == "0")
def check(dis):
for i in range(n):
if a[i] == "0":
left = max(i - dis, 0)
right = min(i + dis, n - 1)
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR BIN_OP VAR NUMBE... |
In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his k cows have decided to stay at the luxurious Grand Moo-dapest Hotel. The hotel consists of n rooms located in a row, some of which are occupied.
... | import sys
r = sys.stdin.readline
n, k = map(int, r().split())
rooms = list(r().strip())
def nextRoom(i):
i += 1
while i < n and rooms[i] == "1":
i += 1
return i
l = nextRoom(-1)
r, m = l, l
ans = sys.maxsize
for i in range(k):
r = nextRoom(r)
while r < n:
while max(m - l, r - m) > max(... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF VAR NUMBER WHILE VAR VAR VAR VAR STRING VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ... |
In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his k cows have decided to stay at the luxurious Grand Moo-dapest Hotel. The hotel consists of n rooms located in a row, some of which are occupied.
... | import sys
def can_book(mid, n, k, accum_arr):
for i in range(1, n + 1):
if accum_arr[i] == accum_arr[i - 1]:
continue
max_idx = min(i + mid, n)
min_idx = max(i - mid - 1, 0)
if accum_arr[max_idx] - accum_arr[min_idx] >= k + 1:
return True
return False
... | IMPORT FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER IF BIN_OP VAR VAR VAR VAR BIN_OP VAR NUMBER RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR LIST NUMBER FOR VAR FUNC_CA... |
In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his k cows have decided to stay at the luxurious Grand Moo-dapest Hotel. The hotel consists of n rooms located in a row, some of which are occupied.
... | n, k = list(map(int, input().split()))
a = [int(i) for i in input()]
i, j, l = 0, -1, 0
z = n
b = []
c = -1
for i in range(n):
if a[i] == 0:
c = i
b.append(c)
c = -1
for i in range(n - 1, -1, -1):
if a[i] == 0:
c = i
if c != -1 and (b[i] == -1 or c - i < i - b[i]):
b[i] = c
while... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_... |
In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his k cows have decided to stay at the luxurious Grand Moo-dapest Hotel. The hotel consists of n rooms located in a row, some of which are occupied.
... | [n, k] = [int(x) for x in input().split()]
room_free = [bool(1 - int(x)) for x in input()]
closest_before = []
closest_after = []
before = -1
for i in range(n):
if room_free[i]:
before = i
closest_before.append(before)
after = 11**8
for i in range(n - 1, -1, -1):
if room_free[i]:
after = i
... | ASSIGN LIST VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR ... |
In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his k cows have decided to stay at the luxurious Grand Moo-dapest Hotel. The hotel consists of n rooms located in a row, some of which are occupied.
... | ans = 1000000000
n, k = [int(i) for i in input().split()]
s = input()
l = len(s)
d = [k // 2, (k + 1) // 2]
nearl = [0] * n
nearr = [0] * n
last = 1000000000
for i in range(n):
if s[i] == "0":
last = i
nearl[i] = last
for i in range(n - 1, -1, -1):
if s[i] == "0":
last = i
nearr[i] = las... | ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VA... |
In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his k cows have decided to stay at the luxurious Grand Moo-dapest Hotel. The hotel consists of n rooms located in a row, some of which are occupied.
... | n, k = map(int, input().split())
rooms = input()
count = [0] * (n + 1)
for i in range(n):
count[i] = count[i - 1]
if rooms[i] == "0":
count[i] += 1
ans = float("inf")
for i in range(n):
l = 0
r = n
while l + 1 < r:
m = (r + l) // 2
if rooms[i] == "0" and count[min(i + m, n - ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR BIN_OP VAR NUMBER IF VAR VAR STRING VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHI... |
In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his k cows have decided to stay at the luxurious Grand Moo-dapest Hotel. The hotel consists of n rooms located in a row, some of which are occupied.
... | import sys
input = sys.stdin.readline
def judge(i, x):
return acc[min(n, i + x + 1)] - acc[max(0, i - x)] >= k + 1
def binary_search(i):
l, r = 0, n
while l <= r:
mid = (l + r) // 2
if judge(i, mid):
r = mid - 1
else:
l = mid + 1
return l
n, k = map... | IMPORT ASSIGN VAR VAR FUNC_DEF RETURN BIN_OP VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR FUNC_CALL VAR NUMBER BIN_OP VAR VAR BIN_OP VAR NUMBER FUNC_DEF ASSIGN VAR VAR NUMBER VAR WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR N... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | from sys import stdin
input = stdin.readline
for _ in range(int(input())):
a, b, c = map(int, input().strip().split(" "))
if a == b == c:
print("YES")
continue
f = 0
for i in range(31):
if a == b and b == c:
f = 1
break
bit = 1 << i
cnt = ... | ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING IF VAR VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP BIN_O... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | for h in range(int(input())):
x, y, z = map(int, input().split())
i, k = 0, 1
while i < 31:
ze = []
o = []
if x & k == k:
o.append(x)
else:
ze.append(x)
if y & k == k:
o.append(y)
else:
ze.append(y)
if z ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER WHILE VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | def solve(a, b, c):
flag = True
for i in range(0, 31):
if a == b and b == c:
break
x = 1 << i
cnt = (x & a != 0) + (x & b != 0) + (x & c != 0)
if cnt == 0 or cnt == 3:
flag = False
break
elif cnt == 1:
if x & a:
... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF VAR VAR VAR VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER IF BIN_OP VAR VAR VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR I... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | n = int(input())
for _ in range(n):
A, B, C = map(int, input().split())
for i in range(33):
if A == B == C:
print("YES")
break
elif A == B < C or A == C < B or B == C < A:
print("NO")
break
bit = 2**i
A_bit = A & bit
B_bit =... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR EXPR FUNC_CALL VAR STRING IF VAR VAR VAR VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR VAR ASSI... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | for _ in range(int(input())):
a, b, c = list(map(int, input().split()))
flag = False
for i in range(40):
if a == b and c == b:
flag = True
else:
p, q, r = a >> i & 1, b >> i & 1, c >> i & 1
if p + q + r == 2:
if not p:
a... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR VAR BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER IF BI... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | import sys
input = sys.stdin.readline
M = int(1000000000.0) + 7
def solve():
l = list(map(int, input().split()))
while l[1] != 0:
ev = 0
for num in l:
ev += num % 2 == 0
if ev == 0 or ev == 3:
break
if ev == 2:
for i in range(3):
... | IMPORT ASSIGN VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR WHILE VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR BIN_OP VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER IF VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR NUMBER ... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | for t in range(int(input())):
n = list(map(int, input().strip().split()))
p = 1
is_possible = True
while is_possible and not n[0] == n[1] == n[2]:
cnt = 0
if n[0] & p:
cnt += 1
i = 0
else:
j = 0
if n[1] & p:
cnt += 1
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER VAR... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | for _ in range(int(input())):
a, b, c = map(int, input().split())
mask = 1
for i in range(64):
if a & mask != b & mask == c & mask:
a += mask
elif b & mask != a & mask == c & mask:
b += mask
elif c & mask != b & mask == a & mask:
c += mask
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR VAR IF BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR VAR IF BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR VA... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | def fun(ar, i, nar, lar):
newar = ""
if nar == 1:
if i < lar:
c = 1
for x in range(i, lar):
if ar[x] == 0:
newar += "1"
c = 0
for j in range(x + 1, lar):
newar += str(ar[j])
... | FUNC_DEF ASSIGN VAR STRING IF VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR IF VAR VAR NUMBER VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR FUNC_CALL VAR VAR VAR VAR STRING IF VAR NUMBER VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR V... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | t = int(input())
for i in range(t):
a, b, c = [int(x) for x in input().split()]
x = a
y = b
z = c
i = 0
while x and z or y and x or y and z:
if a == b and b == c:
break
if a & 1 << i != 0 and b & 1 << i != 0 and c & 1 << i == 0:
c += 1 << i
z +... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR VAR VAR IF VAR VAR VAR VAR IF BIN_OP VAR BIN_OP NUMBER VAR NUMBER BIN_OP VAR BIN_OP NUMBER VAR NUMBER BIN... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | t = int(input())
def solve():
a = list(map(int, input().split()))
k = 1
if a[0] == a[1] and a[1] == a[2]:
print("YES")
return
for _ in range(31):
ones = 0
if a[0] == a[1] and a[1] == a[2]:
print("YES")
return
for i in range(3):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING RETURN FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CAL... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | for _ in range(int(input())):
l = list(map(int, input().split()))
i = 0
while (l[0] >> i, l[1] >> i, l[2] >> i).count(0) < 2:
if len(set(l)) == 1:
print("YES")
break
d = l[0] >> i & 1, l[1] >> i & 1, l[2] >> i & 1
if d.count(1) == 1:
l[d.index(1)] ... | 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 NUMBER WHILE FUNC_CALL BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER NUMBER IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | for _ in range(int(input())):
a, b, c = map(int, input().split())
ans = 0
for i in range(0, 129):
pw2 = 2**i - 1
num = pw2 + a + b + c
if num % 3 == 0:
num = num // 3
if num >= max({a, b, c}):
aa, bb, cc = num - a, num - b, num - c
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR ... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | for _ in range(int(input())):
a, b, c = map(int, input().split())
c1 = 0
f = 0
while c1 < 32:
if a == b and b == c:
print("YES")
f = 1
break
val = 1 << c1
f1 = a & val
f2 = b & val
f3 = c & val
if f1 == f2 and f2 == f3:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER IF VAR VAR VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR B... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | T = int(input())
for case in range(T):
a, b, c = map(int, input().split(" "))
while True:
a, b, c = sorted([a, b, c])
if a % 2 == b % 2 == c % 2 or a + b + c == 1:
break
rem = (a + b + c) % 2
if a % 2 == rem:
a += 1
elif b % 2 == rem:
b... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING WHILE NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR LIST VAR VAR VAR IF BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VA... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | t = int(input())
while t:
a, b, c = map(int, input().split())
poss = False
for i in range(40):
if a == b and b == c:
poss = True
break
ct = (a >> i & 1) + (b >> i & 1) + (c >> i & 1)
if ct == 2:
if a >> i & 1 == 0:
a += 1 << i
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER IF VAR NUMBER ... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | for _ in range(int(input())):
last = None
li = list(map(int, input().split()))
while True:
if li == last:
print("NO")
break
last = li[:]
if li[0] == li[1] == li[2]:
print("YES")
break
c0 = 0
c1 = 0
for i in li:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NONE ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR WHILE NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VA... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | n = int(input())
def comp(x, y, z):
l = [x, y, z]
l.sort()
x = l[2]
y = l[1]
z = l[0]
if x == y == z:
return "YES"
if y == z or x % 2 == y % 2 == z % 2:
return "NO"
if x % 2 + y % 2 + z % 2 == 1:
if x % 2 == 1:
x = x + 1
if y % 2 == 1:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR LIST VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR VAR VAR RETURN STRING IF VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER RETURN STRING IF BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBE... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | def solve(_in):
if _in[0] == _in[1] and _in[0] == _in[2]:
return "YES"
_in.sort()
if _in[0] == 0:
if _in[1] == 0:
return "NO"
Sum = sum(_in)
remainders = [(x % 2) for x in _in]
if Sum % 3 in [0, 2] and sum(remainders) in [1, 2]:
if sum(remainders) == 1:
... | FUNC_DEF IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER RETURN STRING EXPR FUNC_CALL VAR IF VAR NUMBER NUMBER IF VAR NUMBER NUMBER RETURN STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER LIST NUMBER NUMBER FUNC_CALL VAR VAR LIST NUMBER NUMBER IF FUNC_CALL VAR VAR NUMBER ASSI... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | def sol():
a, b, c = map(int, input().split())
for i in range(31):
if a == b and b == c:
return "YES"
bit = 1 << i
cnt = (a & bit != 0) + (b & bit != 0) + (c & bit != 0)
if cnt == 0 or cnt == 3:
return "NO"
elif cnt == 2:
if a & bit == ... | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR VAR RETURN STRING ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN STRING IF VAR NUMBER IF BIN_OP VAR V... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | def win(a, b, c):
if a == b == c:
return True
elif (a, b, c) in [(0, 0, 1), (0, 1, 0), (1, 0, 0)]:
return False
elif a % 2 == b % 2 == c % 2:
return False
elif a % 2 == b % 2:
return win(a // 2, b // 2, (c + 1) // 2)
elif a % 2 == c % 2:
return win(a // 2, (b ... | FUNC_DEF IF VAR VAR VAR RETURN NUMBER IF VAR VAR VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER RETURN NUMBER IF BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER RETURN NUMBER IF BIN_OP VAR NUMBER BIN_OP VAR NUMBER RETURN FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER BIN_OP BIN_OP VAR ... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | for _ in range(int(input())):
a, b, c = map(int, input().split())
x = min(min(a, b), c)
a -= x
b -= x
c -= x
temp = True
while temp:
if a == 0 and b == 0 and c == 0:
break
if (
a == 0
and b == 0
or b == 0
and c == 0
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR IF VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER B... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | for _ in range(int(input())):
a, b, c = map(int, input().split())
ans = True
ar = True
while True:
if a == b and b == c:
break
cnt = 0
zer = 0
if a == 0:
cnt += 1
zer += 1
if b == 0:
cnt += 1
zer += 1
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER IF VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMB... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | def mi():
return map(int, input().split())
def li():
return list(mi())
def si():
return str(input())
def ni():
return int(input())
for T in range(int(input())):
a, b, c = mi()
for i in range(32):
x, y, z = a & 1 << i, b & 1 << i, c & 1 << i
if x != y and x != z:
... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | t = int(input())
def getbits(n):
ans = []
while n > 0:
ans.append(n % 2)
n = n // 2
while t > 0:
t = t - 1
a, b, c = list(map(int, input().split()))
ans = "YES"
while a > 0 or b > 0 or c > 0:
if a == b == c:
break
if a < 2 and b < 2 and c < 2:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR LIST WHILE VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING WHILE VAR NUMBER VAR NUMBER VAR NU... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | def ff(arr):
ans = 0
for i in range(len(arr)):
ans += arr[i] * 2**i
return ans
def convert(n):
arr = []
while n > 0:
r = n % 2
arr.append(r)
n >>= 1
return arr
def f(arr, n):
while len(arr) < n:
arr.append(0)
def ad(ar, br, cr, x):
c = 1
... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR BIN_OP NUMBER VAR RETURN VAR FUNC_DEF ASSIGN VAR LIST WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER RETURN VAR FUNC_DEF WHILE FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | def bits(a, bit):
if a & bit > 0:
return 1
else:
return 0
for _ in range(int(input())):
a, b, c = map(int, input().split())
flag = True
for i in range(31):
if a == b == c:
break
bit = 1 << i
cnt = bits(a, bit) + bits(b, bit) + bits(c, bit)
... | FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL... |
You are given 3 numbers A, B and C.
You want to make all these 3 numbers equal. To do this, you can perform any finite number of operations:
In the i^{th} operation, you must add 2^{(i-1)} to any one of these 3 numbers.
Find whether you can make these 3 numbers equal in finite number of moves.
------ Input Format ... | def set_bit(x, i):
if 1 << i & x:
return 1
return 0
for _ in range(int(input())):
nums = list(map(int, input().split()))
flag = 1
for i in range(31):
if len(set(nums)) == 1:
print("YES")
flag = 0
break
bit_sum = sum(set_bit(n, i) for n in... | FUNC_DEF IF BIN_OP BIN_OP NUMBER VAR VAR RETURN NUMBER RETURN NUMBER 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 NUMBER FOR VAR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER A... |
Let us call two integers $x$ and $y$ adjacent if $\frac{lcm(x, y)}{gcd(x, y)}$ is a perfect square. For example, $3$ and $12$ are adjacent, but $6$ and $9$ are not.
Here $gcd(x, y)$ denotes the greatest common divisor (GCD) of integers $x$ and $y$, and $lcm(x, y)$ denotes the least common multiple (LCM) of integers $x... | from sys import stdin
T = int(stdin.readline())
dct = {i: i for i in range(1000001)}
for i in range(2, 1001):
for j in range(1, 10**6 // i**2 + 1):
dct[i**2 * j] = j
for _ in range(T):
n = int(stdin.readline())
arr = list(map(int, stdin.readline().split()))
q = int(stdin.readline())
seen = ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP BIN_OP NUMBER NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASS... |
Let us call two integers $x$ and $y$ adjacent if $\frac{lcm(x, y)}{gcd(x, y)}$ is a perfect square. For example, $3$ and $12$ are adjacent, but $6$ and $9$ are not.
Here $gcd(x, y)$ denotes the greatest common divisor (GCD) of integers $x$ and $y$, and $lcm(x, y)$ denotes the least common multiple (LCM) of integers $x... | from sys import stdin
dct = {i: i for i in range(1000001)}
for i in range(2, 1001):
for j in range(1, 10**6 // i**2 + 1):
dct[i**2 * j] = j
t = int(stdin.readline())
for _ in range(t):
n = int(stdin.readline())
elements = map(int, stdin.readline().split())
q = int(stdin.readline())
dct2 = {... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP BIN_OP NUMBER NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASS... |
Let us call two integers $x$ and $y$ adjacent if $\frac{lcm(x, y)}{gcd(x, y)}$ is a perfect square. For example, $3$ and $12$ are adjacent, but $6$ and $9$ are not.
Here $gcd(x, y)$ denotes the greatest common divisor (GCD) of integers $x$ and $y$, and $lcm(x, y)$ denotes the least common multiple (LCM) of integers $x... | from sys import stdin
input = stdin.readline
def calculate():
a = [i for i in range(10**6 + 1)]
for square_root in range(1000, 1, -1):
square = square_root**2
x = square
while x <= 10**6:
if a[x] % square == 0:
a[x] //= square
x += square
re... | ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR WHILE VAR BIN_OP NUMBER NUMBER IF BIN_OP VAR VAR VAR NUMBER VAR VAR VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_... |
Let us call two integers $x$ and $y$ adjacent if $\frac{lcm(x, y)}{gcd(x, y)}$ is a perfect square. For example, $3$ and $12$ are adjacent, but $6$ and $9$ are not.
Here $gcd(x, y)$ denotes the greatest common divisor (GCD) of integers $x$ and $y$, and $lcm(x, y)$ denotes the least common multiple (LCM) of integers $x... | import sys
input = sys.stdin.readline
for f in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
v = {}
for x in a:
f = []
i = 3
c = 0
while x % 2 == 0:
x //= 2
c += 1
if c % 2 == 1:
... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR NUMBER... |
Let us call two integers $x$ and $y$ adjacent if $\frac{lcm(x, y)}{gcd(x, y)}$ is a perfect square. For example, $3$ and $12$ are adjacent, but $6$ and $9$ are not.
Here $gcd(x, y)$ denotes the greatest common divisor (GCD) of integers $x$ and $y$, and $lcm(x, y)$ denotes the least common multiple (LCM) of integers $x... | import sys
input = lambda: sys.stdin.readline().rstrip()
def gcd(a, b):
while b:
a, b = b, a % b
return a
def isPrimeMR(n):
d = n - 1
d = d // (d & -d)
L = (
[2, 7, 61]
if n < 1 << 32
else (
[2, 3, 5, 7, 11, 13, 17]
if n < 1 << 48
... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF WHILE VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR VAR BIN_OP NUMBER NUMBER LIST NUMBER NUMBER NUMBER VAR BIN_OP NUMBER NUMBER LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBE... |
Polycarpus has a sequence, consisting of n non-negative integers: a_1, a_2, ..., a_{n}.
Let's define function f(l, r) (l, r are integer, 1 ≤ l ≤ r ≤ n) for sequence a as an operation of bitwise OR of all the sequence elements with indexes from l to r. Formally: f(l, r) = a_{l} | a_{l} + 1 | ... | a_{r}.
Polycarpus ... | n = int(input())
a = list(map(int, input().split()))
s1, s2 = set(), set()
for each in a:
st = set()
st.add(each)
for i in s1:
st.add(each | i)
s1 = st
s2.update(s1)
print(len(s2)) | 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 FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CAL... |
Polycarpus has a sequence, consisting of n non-negative integers: a_1, a_2, ..., a_{n}.
Let's define function f(l, r) (l, r are integer, 1 ≤ l ≤ r ≤ n) for sequence a as an operation of bitwise OR of all the sequence elements with indexes from l to r. Formally: f(l, r) = a_{l} | a_{l} + 1 | ... | a_{r}.
Polycarpus ... | input()
a, b = set(), set()
for i in map(int, input().split()):
a = {(i | j) for j in a}
a.add(i)
b.update(a)
print(len(b)) | EXPR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR |
Polycarpus has a sequence, consisting of n non-negative integers: a_1, a_2, ..., a_{n}.
Let's define function f(l, r) (l, r are integer, 1 ≤ l ≤ r ≤ n) for sequence a as an operation of bitwise OR of all the sequence elements with indexes from l to r. Formally: f(l, r) = a_{l} | a_{l} + 1 | ... | a_{r}.
Polycarpus ... | def subarrayBitwiseOR(A):
res = set()
pre = {0}
for x in A:
pre = {(x | y) for y in pre} | {x}
res |= pre
return len(res)
n = int(input())
arr = list(map(int, input().split()))
print(subarrayBitwiseOR(arr)) | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR VAR RETURN 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_CALL VAR VAR |
Polycarpus has a sequence, consisting of n non-negative integers: a_1, a_2, ..., a_{n}.
Let's define function f(l, r) (l, r are integer, 1 ≤ l ≤ r ≤ n) for sequence a as an operation of bitwise OR of all the sequence elements with indexes from l to r. Formally: f(l, r) = a_{l} | a_{l} + 1 | ... | a_{r}.
Polycarpus ... | n = input()
r = set()
s = set()
l = list(map(int, input().split(" ")))
for i in l:
s = {(i | a) for a in s}
s.add(i)
r |= s
print(len(r)) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR |
Polycarpus has a sequence, consisting of n non-negative integers: a_1, a_2, ..., a_{n}.
Let's define function f(l, r) (l, r are integer, 1 ≤ l ≤ r ≤ n) for sequence a as an operation of bitwise OR of all the sequence elements with indexes from l to r. Formally: f(l, r) = a_{l} | a_{l} + 1 | ... | a_{r}.
Polycarpus ... | n, p, q = input(), set(), set()
for i in map(int, input().split()):
q = set(i | j for j in q)
q.add(i)
p.update(q)
print(len(p)) | ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR |
Polycarpus has a sequence, consisting of n non-negative integers: a_1, a_2, ..., a_{n}.
Let's define function f(l, r) (l, r are integer, 1 ≤ l ≤ r ≤ n) for sequence a as an operation of bitwise OR of all the sequence elements with indexes from l to r. Formally: f(l, r) = a_{l} | a_{l} + 1 | ... | a_{r}.
Polycarpus ... | def brand(arr):
ans = set()
temp = set()
for i in arr:
temp = {(i | j) for j in temp}
temp.add(i)
ans.update(temp)
return len(ans)
a = input()
lst = list(map(int, input().strip().split()))
print(brand(lst)) | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR RETURN FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR |
Polycarpus has a sequence, consisting of n non-negative integers: a_1, a_2, ..., a_{n}.
Let's define function f(l, r) (l, r are integer, 1 ≤ l ≤ r ≤ n) for sequence a as an operation of bitwise OR of all the sequence elements with indexes from l to r. Formally: f(l, r) = a_{l} | a_{l} + 1 | ... | a_{r}.
Polycarpus ... | import sys
In = sys.stdin
n = int(In.readline().strip())
arr = [int(x) for x in In.readline().split()]
res, m = set(), set()
for i in range(n):
s = set()
s.add(arr[i])
s.update([(x | arr[i]) for x in m])
m = s
res.update(s)
print(len(res)) | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR ASSIGN VAR VAR EXPR FUNC_... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | def solve(A, B):
count = [0, 0]
o, moves = 0, 0
for i in range(len(A)):
if A[i]:
o += 1
if o == len(A) or o == 0:
return "Unlucky Chef"
for i in range(len(A)):
op = not A[i]
if A[i] == B[i]:
continue
if count[op]:
count[op] ... | FUNC_DEF ASSIGN VAR LIST NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR NUMBER IF VAR FUNC_CALL VAR VAR VAR NUMBER RETURN STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR VAR VAR IF VAR VAR VAR VAR NUMBER VAR NUMBER VAR VAR VAR NUMBER RETURN... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
while t:
countone = 0
countzero = 0
flag1 = 0
flag2 = 0
str1 = input()
str2 = input()
length = len(str1)
for i in range(length):
if str1[i] == "1":
flag1 = 1
elif str1[i] == "0":
flag2 = 1
if flag1 == 1 and flag2 == 1:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR NUMBER IF VAR VAR STRING ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMB... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | for i in range(int(input())):
a = input()
b = input()
a1 = a[0]
temp = 0
c = list(a)
if c.count(a1) == len(a):
print("Unlucky Chef")
else:
cnt1 = 0
cnt2 = 0
for j in range(len(a)):
if a[j] == "0" and b[j] == "1":
cnt1 += 1
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | n = int(input())
for i in range(n):
a = 0
b = 0
f1 = 0
f2 = 0
str1 = input()
str2 = input()
for j in range(0, len(str1)):
if str1[j] == "1":
f1 = 1
else:
f2 = 1
if str1[j] != str2[j]:
if str1[j] == "1":
a = a + 1
... | 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 NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR VAR VAR IF VAR VAR ST... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | N = int(input())
gifts = []
for index in range(0, 2 * N):
gifts.append(input())
def numbers_in_binary(A_string, B_string):
zero_to_one = 0
one_to_zero = 0
zeroesA = 0
onesA = 0
zeroesB = 0
onesB = 0
for x in range(0, len(A_string)):
if A_string[x] == "0":
zeroesA +=... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING VAR... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
while t != 0:
t -= 1
s1 = input()
s2 = input()
i = 0
i0 = 0
i1 = 0
while i < len(s1):
if s1[i] != s2[i]:
if s1[i] == "0":
i0 += 1
else:
i1 += 1
i += 1
k0 = s1.count("0")
k1 = s1.count("1")
an... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR IF VAR VAR STRING VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CAL... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | def same(a):
x = a[0]
for i in range(1, len(a)):
if x != a[i]:
return False
return True
t = int(input())
while t:
a = input()
b = input()
count = 0
a1 = ""
if same(a) == True:
print("Unlucky Chef")
t -= 1
continue
for i in range(len(a)):
... | FUNC_DEF ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR STRING IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING VAR NUMBER... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
while t > 0:
a = input()
b = input()
if len(set(list(a))) != 1:
dist = []
for i, j in zip(a, b):
if i != j:
dist.append(i)
print("Lucky Chef")
d = dist.count("1")
e = dist.count("0")
print(max(d, e))
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | def check(a):
x = a[0]
for n in a:
if n != x:
return False
return True
t = int(input().strip())
while t:
a = input().strip()
b = input().strip()
if check(a):
print("Unlucky Chef")
else:
print("Lucky Chef")
xor = 0
a1 = 0
b1 = 0
... | FUNC_DEF ASSIGN VAR VAR NUMBER FOR VAR VAR IF VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
while t:
A = input()
B = input()
mp1 = 0
p1 = 0
mp0 = 0
p0 = 0
for i in range(len(B)):
if A[i] == B[i] and B[i] == "1":
p1 += 1
elif A[i] == B[i] and B[i] == "0":
p0 += 1
elif A[i] != B[i] and B[i] == "1":
mp0 += 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR STRING VAR NUMBER IF VAR VAR VAR VAR VAR VAR STRING VAR NUMBER IF VAR VAR VAR VAR ... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
for _t in range(t):
A = input()
B = input()
l, c01, c10 = len(A), 0, 0
if A == "0" * l or A == "1" * l:
print("Unlucky Chef")
continue
else:
for i in range(l):
a, b = A[i], B[i]
if a == "0" and b == "1":
c01 += 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF VAR BIN_OP STRING VAR VAR BIN_OP STRING VAR EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR IF VAR STRING VAR STRING... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | for w in range(int(input())):
i = input()
f = input()
i0 = 0
i1 = 0
zeroto1 = 0
up = 0
down = 0
move = 0
diff = 0
for p in range(len(i)):
if i[p] == "0":
i0 = 1
if i[p] == "1":
i1 = 1
if i[p] == "0" and f[p] == "1":
up +... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR NUMBER IF VAR VAR STRING ... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
for i in range(0, t):
a = input()
b = input()
l = len(a)
o = 0
z = 0
po = 0
pz = 0
for j in range(0, l):
if a[j] == "1":
po += 1
else:
pz += 1
for j in range(0, l):
if a[j] == "0" and b[j] == "1":
z += 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 ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR STRING VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NU... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | T = int(input())
ZERO_TO_ONE = -1
ONE_TO_ZERO = 1
LUCKY_CHEF = "Lucky Chef"
UNLUCKY_CHEF = "Unlucky Chef"
def compare(A, B):
for a, b in zip(A, B):
if a == "0" and b == "1":
yield ZERO_TO_ONE
if a == "1" and b == "0":
yield ONE_TO_ZERO
for i in range(0, T):
A = input(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FUNC_DEF FOR VAR VAR FUNC_CALL VAR VAR VAR IF VAR STRING VAR STRING EXPR VAR IF VAR STRING VAR STRING EXPR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | for _ in range(0, int(input())):
a, b = input(), input()
zero = one = 0
if a.count("1") == len(a) or a.count("0") == len(a):
print("Unlucky Chef")
else:
print("Lucky Chef")
i = 0
while i < len(a):
if a[i] != b[i]:
if a[i] == "1":
... | FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER IF FUNC_CALL VAR STRING FUNC_CALL VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | T = int(input())
for i in range(T):
A = input()
B = input()
if "0" not in A or "1" not in A:
print("Unlucky Chef")
else:
to1 = 0
to0 = 0
for i in range(len(A)):
if not A[i] == B[i]:
if A[i] == "0":
to1 += 1
e... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF STRING VAR STRING VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR IF VAR VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CAL... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | import sys
T = int(sys.stdin.readline())
for _ in range(0, T):
A = list(sys.stdin.readline().rstrip())
B = list(sys.stdin.readline().rstrip())
if A[0] == "0":
firstCharComplement = "1"
else:
firstCharComplement = "0"
if not firstCharComplement in A:
print("Unlucky Chef")
... | IMPORT ASSIGN VAR FUNC_CALL VAR 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 FUNC_CALL VAR IF VAR NUMBER STRING ASSIGN VAR STRING ASSIGN VAR STRING IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIG... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | for t in range(int(input())):
a = [int(j) for j in input()]
b = [int(j) for j in input()]
x = y = c = 0
if 0 in a and 1 in a:
for i in range(len(a)):
if a[i] != b[i]:
if a[i] == 1:
x += 1
else:
y += 1
whi... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER IF NUMBER VAR NUMBER VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR IF VAR VAR NUMBER VAR NUMBER VAR NUMBER WHILE VAR NUMBER VAR NUMBE... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | test = int(input().strip())
for each in range(test):
A = input().strip()
B = input().strip()
e0 = "0" in A
e1 = "1" in A
if not (e0 and e1):
print("Unlucky Chef")
continue
n0 = 0
n1 = 0
for i in range(len(A)):
if not A[i] == B[i]:
if A[i] == "0":
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING VAR ASSIGN VAR STRING VAR IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
while t > 0:
a = input()
b = input()
l = len(a)
count1 = 0
count0 = 0
ans = 0
c = 0
d = 0
for i in range(l):
if a[i] == "1":
c = c + 1
if b[i] == "0":
count1 = count1 + 1
else:
d = d + 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR STRING ASSI... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | T = int(input())
for _ in range(T):
A = input()
B = input()
A_zero, A_one, miss0, miss1 = 0, 0, 0, 0
for a, b in zip(A, B):
if a == "0":
A_zero += 1
if b == "1":
miss1 += 1
else:
A_one += 1
if b == "0":
miss0... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR NUMBER NUMBER NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER VAR NUMBER IF VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR V... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
for i in range(t):
a = str(input())
b = str(input())
if a == b:
print("Lucky Chef")
print(0)
continue
z = a.count("0")
o = a.count("1")
if z == len(a) or o == len(a):
print("Unlucky Chef")
else:
ones = 0
zeros = 0
for 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 IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR EXP... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | def fun():
f = input()
t = input()
zero, one = 0, 0
noz, noo = 0, 0
for i in range(len(f)):
if f[i] is "0":
noz += 1
else:
noo += 1
if f[i] is not t[i]:
if f[i] is "0":
zero += 1
else:
one += 1
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER VAR NUMBER IF VAR VAR VAR VAR IF VAR VAR STRING VAR NUMBER VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING RETURN EXPR FUNC_CALL VAR S... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | tests = int(input())
for i in range(tests):
A = input()
B = input()
if "0" not in A and "0" in B or "1" not in A and "1" in B:
print("Unlucky Chef")
else:
ans = 0
zeroes_required = 0
ones_required = 0
length = len(A)
for j in range(length):
if ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF STRING VAR STRING VAR STRING VAR STRING VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR IF V... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
for _ in range(t):
a = input()
b = input()
t = 0
za, zb = 0, 0
oa, ob = 0, 0
n = len(a)
ans = 0
for i in range(n):
if a[i] != b[i]:
t += 1
if a[i] == "0":
za += 1
else:
oa += 1
if b[i] == "0":
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER IF VAR VAR STRING VAR NUMB... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | for i in range(int(input())):
a = input()
b = input()
if "0" not in a and "0" in b or "1" not in a and "1" in b:
print("Unlucky Chef")
else:
count = 0
onee = 0
for j in range(len(a)):
if a[j] != b[j]:
if a[j] == "0":
count +... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF STRING VAR STRING VAR STRING VAR STRING VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR IF VAR VAR STRING VAR NUMBER VAR NUMBER EXPR FUNC_CA... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | T = int(input())
for tc in range(T):
A = [int(x) for x in list(input())]
B = [int(x) for x in list(input())]
if len(B) != len(A):
print("Unlucky Chef")
continue
ln = len(B)
if 0 not in A or 1 not in A:
print("Unlucky Chef")
continue
count = 0
same = 0
for ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR IF NUMBER VAR NUMBER VAR EXPR FUNC_CALL... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | for _ in range(int(input())):
a = input()
b = input()
c, d = 0, 0
for i in range(len(a)):
if a[i] == "0":
c += 1
else:
d += 1
if c == 0 or d == 0:
print("Unlucky Chef")
continue
c, d = 0, 0
for i in range(len(a)):
if a[i] != b[i... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
for T in range(t):
c0to1 = 0
c1to0 = 0
a = input()
b = input()
for i in range(len(a)):
if a[i] == "1" and b[i] == "0":
c1to0 = c1to0 + 1
elif a[i] == "0" and b[i] == "1":
c0to1 += 1
c = list(a)
if "1" in c and "0" not in c or "0" in c ... | 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 ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR STRING VAR VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VA... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | for _ in range(int(input())):
result = None
a, b = input(), input()
if len(a) == len(b):
c = [(x == "1") for x, y in zip(a, b) if x != y]
zeros, ones = len(c) - sum(c), sum(c)
if ones > zeros and any(x == "0" for x in a):
result = ones
elif zeros > ones and any(x ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NONE ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR STRING VAR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR FUNC_CALL VAR VAR STRING ... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | def yes(n):
print("Lucky Chef")
print(n)
def no():
print("Unlucky Chef")
for _ in range(int(input())):
a, b = input(), input()
zes = True if "0" in a else False
ones = True if "1" in a else False
if len(a) == 1:
no()
continue
ctr = 0
os = 0
zs = 0
for ai, ... | FUNC_DEF EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR FUNC_DEF EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING VAR NUMBER NUMBER ASSIGN VAR STRING VAR NUMBER NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NUMB... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
while t > 0:
t -= 1
a = list(input())
b = list(input())
a0 = 0
a1 = 0
b0 = 0
b1 = 0
mismatch = [0, 0]
for i in range(len(a)):
if a[i] == "1":
a1 += 1
else:
a0 += 1
if b[i] == "1":
b1 += 1
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER VAR ... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | def ops(a, b):
n = len(a)
azeroes = a.count("0")
aones = n - azeroes
bzeroes = b.count("0")
bones = n - bzeroes
if azeroes == 0 or aones == 0:
return 0
c0 = 0
c1 = 0
for i in range(n):
if a[i] == b[i]:
continue
if a[i] == "0":
c0 += 1
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR IF VAR VAR STRING VAR NUMBER VAR NUMBER RETURN... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | def main():
T = int(input())
result = []
for x in range(0, T):
A = input()
B = input()
c = 0
Count1 = 0
Count0 = 0
CountA1 = 0
CountA0 = 0
for x in range(0, len(A)):
if A[x] == "0":
CountA0 = CountA0 + 1
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP ... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | import sys
t = int(input())
while t > 0:
a = input()
b = input()
j = 0
diff_0 = 0
diff_1 = 0
diff = 0
while j < len(a) - 1:
if a[j] != a[j + 1]:
diff = 1
j += 1
break
j += 1
i = 0
while i < len(a):
if a[i] != b[i]:
... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER WH... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | for t in range(int(input())):
a = input()
b = input()
if a == b:
print("Lucky Chef")
print(0)
elif max(a.count("0"), a.count("1")) == len(a):
print("Unlucky Chef")
else:
zeros = 0
ones = 0
for i, j in zip(a, b):
if i == j:
c... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_C... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | def solve(a, b):
if "0" not in a:
return 0
if "1" not in a:
return 0
zc = oc = 0
otz = 0
zto = 0
for i in range(len(a)):
if a[i] == "0":
zc += 1
if a[i] != b[i]:
zto += 1
elif a[i] == "1":
oc += 1
if ... | FUNC_DEF IF STRING VAR RETURN NUMBER IF STRING VAR RETURN NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER IF VAR VAR VAR VAR VAR NUMBER IF VAR VAR STRING VAR NUMBER IF VAR VAR VAR VAR VAR NUMBER RETURN FUNC_CALL VAR VAR VAR ASSIGN VAR... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | for _ in range(int(input())):
s1 = input()
s2 = input()
su1 = 0
su2 = 0
for i in range(len(s1)):
su1 += ord(s1[i]) - ord("0")
su2 += ord(s2[i]) - ord("0")
if su1 == 0 and su2 > 0 or su1 == len(s1) and su2 < len(s1):
print("Unlucky Chef")
continue
else:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING IF VAR NUMBER VAR NUMBER VAR FUNC_CA... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | def main():
testCases = int(input())
results = []
for i in range(testCases):
a = input()
b = input()
a0 = 0
a1 = 0
a0_1 = 0
a1_0 = 0
for j in range(len(a)):
aj = a[j]
bj = b[j]
if aj == bj:
if aj == "... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR IF VAR VAR IF VAR STRING VAR N... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
for i in range(t):
a = list(input())
b = list(input())
l = len(a)
ctr0 = 0
ctr1 = 0
for i in range(0, l):
if a[i] != b[i]:
if a[i] == "0":
ctr0 += 1
else:
ctr1 += 1
ctr = max(ctr0, ctr1)
if "1" in a and "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 ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR VAR IF VAR VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
for i in range(t):
a = input()
b = input()
if a == b:
print("Lucky Chef")
print(0)
elif a.count("1") == len(a) or a.count("0") == len(b):
print("Unlucky Chef")
else:
count1 = 0
count2 = 0
for j in range(0, len(a)):
if a[j] ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR STRING FUNC_CALL VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | for _ in range(int(input())):
result = None
a, b = ([(c == "1") for c in input()] for _ in range(2))
if len(a) == len(b):
c = list(map(lambda x: x[0], filter(lambda x: x[0] != x[1], zip(a, b))))
ones = sum(c)
zeros = len(c) - ones
if ones > zeros:
if not all(a):
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NONE ASSIGN VAR VAR VAR STRING VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR NUMBER FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VA... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | T = int(input())
for t in range(T):
s1 = list(map(int, list(input())))
s2 = list(map(int, list(input())))
s3 = map(lambda x, y: x ^ y, s1, s2)
n1 = sum(s1)
n2 = sum(s2)
n3 = sum(s3)
l1 = len(s1)
if n1 == 0 or n1 == l1:
print("Unlucky Chef")
else:
print("Lucky Chef")
... | 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN ... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | for t in range(int(input())):
a = list(input())
b = list(input())
zero_present = any(map(lambda x: x == "0", a))
one_present = any(map(lambda x: x == "1", a))
one_count = sum(map(lambda x, y: 1 if x == "0" and y == "1" else 0, b, a))
zero_count = sum(map(lambda x, y: 1 if x == "1" and y == "0" e... | 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 STRING VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR STRING VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR STRING VAR STRING NUMBER NUMBER VAR VAR A... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | T = int(input())
aList = []
bList = []
for i in range(T):
aList.append(input())
bList.append(input())
for i in range(T):
a = aList[i]
b = bList[i]
temp = ""
for j in range(len(a)):
if a[j] != b[j]:
temp = temp + a[j]
oneCount = temp.count("1")
zeroCount = len(temp) - ... | 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 EXPR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ASSIGN VAR BIN_O... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | T = int(input())
for t in range(T):
A = input()
B = input()
n = len(A)
a = 0
b = 0
d = 0
if A == "1" * n or A == "0" * n:
print("Unlucky Chef")
else:
for i in range(n):
if A[i] != B[i]:
d += 1
if A[i] == "1":
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR BIN_OP STRING VAR VAR BIN_OP STRING VAR EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR ... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
while t:
t -= 1
a = input()
b = input()
x = True
y = False
ans1 = 0
ans2 = 0
for i in range(len(a)):
x = x and int(a[i])
y = y or int(a[i])
if a[i] == "1" and b[i] == "0":
ans1 += 1
if a[i] == "0" and b[i] == "1":
a... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR STRING VAR VA... |
Today is Chef's birthday. His mom decided to surprise him with a truly fantastic gift: his favourite binary string B. But, unfortunately, all the stocks of binary string B have been sold out, and only a binary string A (A ≠ B) is available in the market.
She purchases the string A and tries to convert it to string B by... | t = int(input())
while t > 0:
a = list(input())
b = list(input())
r = 0
q = 0
x = a.count("1")
y = a.count("0")
z = b.count("0")
for i in range(len(a)):
if a[i] == "1" and b[i] == "0":
r += 1
if a[i] == "0" and b[i] == "1":
q += 1
if x == len(a... | 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 ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.