description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = list(map(int, input().split(" ")))
fuel_level = b
point = 0
direction = 1
journays = 0
impossible = 0
refuel_counter = 0
if k == 1 and (b < a - f or b < f):
print(-1)
elif k == 2 and (b < f or b < 2 * (a - f)):
print(-1)
elif k > 2 and (b < 2 * f or b < 2 * (a - f)):
print(-1)
else:
while j... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR VAR VAR BIN_OP NUMBER BIN_OP VAR VAR EXPR FU... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = map(int, input().split())
d = b
n = 0
s = 0
x = a - f
d -= f
if x * 2 > b or f * 2 > b:
if k < 3:
if k == 1:
if a <= b:
print(0)
elif f <= b and x <= b:
print(1)
else:
print(-1)
if k == 2:
if... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR VAR IF BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR IF VAR NUMBER IF VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CAL... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | def can_make_route():
can_return_to_station = (
bus["gasoline"]
- (abs(bus["position"] - bus["direction"]) + abs(bus["direction"] - station))
>= 0
)
is_last_route = (
bus["qty_routs"] + 1 == cnt_routes
and bus["gasoline"] - abs(bus["position"] - bus["direction"]) >= 0... | FUNC_DEF ASSIGN VAR BIN_OP VAR STRING BIN_OP FUNC_CALL VAR BIN_OP VAR STRING VAR STRING FUNC_CALL VAR BIN_OP VAR STRING VAR NUMBER ASSIGN VAR BIN_OP VAR STRING NUMBER VAR BIN_OP VAR STRING FUNC_CALL VAR BIN_OP VAR STRING VAR STRING NUMBER RETURN VAR VAR FUNC_DEF ASSIGN VAR STRING BIN_OP VAR STRING FUNC_CALL VAR BIN_OP ... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = map(int, input().split(" "))
if (
k > 2
and (b < 2 * f or b < 2 * (a - f))
or k == 1
and (b < f or b < a - f)
or k == 2
and (b < f or b < 2 * (a - f))
):
print(-1)
else:
state = 2
cir = 0
rb = b - f
c = 0
while cir < k:
if state == 1:
if c... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER VAR BIN_OP NUMBER VAR VAR BIN_OP NUMBER BIN_OP VAR VAR VAR NUMBER VAR VAR VAR BIN_OP VAR VAR VAR NUMBER VAR VAR VAR BIN_OP NUMBER BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR A... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a = 0
b = 0
f = 0
k = 0
def get_user_input():
global a
global b
global f
global k
interval_info = input("").split()
a = int(interval_info[0])
b = int(interval_info[1])
f = int(interval_info[2])
k = int(interval_info[3])
def calc():
global b
m = 0
count = 0
B = b
... | ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN V... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | inp = input().split(" ")
a = int(inp[0])
b = int(inp[1])
f = int(inp[2])
k = int(inp[3])
b_temp = b
i = 0
doz = 0
if k > 2 and b < 2 * f or k > 1 and b < 2 * (a - f):
print(-1)
else:
while i < k:
if k == 1 and max(f, a - f) > b:
print(-1)
break
else:
b = b - f... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR VAR NUMBER VAR BIN_OP NUMBER BIN_OP VAR VAR EXP... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = map(int, input().split())
tf = a - f
gas = b - f
if gas < 0:
print(-1)
exit()
ans = 0
for i in range(k):
if i % 2 == 0:
if i == k - 1:
if gas < tf:
gas = b
ans += 1
elif gas < tf * 2:
gas = b
ans += 1
if... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER IF VAR BIN_OP VAR NUMBER IF VAR VAR ASSIGN VAR VAR VAR NUMBER IF VAR BIN... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | def solve():
a, b, f, k = [int(st) for st in input().split(" ")]
fuel = b
location = 0
direction = "right"
fueled = 0
journeypassed = 0
while journeypassed < k:
if location == 0:
if fuel < f:
return -1
fuel -= f
location = f
... | FUNC_DEF ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR NUMBER IF VAR VAR RETURN NUMBER VAR VAR ASSIGN VAR VAR ASSIGN VAR STRING IF VAR VAR IF VAR BIN_OP VAR VAR RETURN NUMBER VAR BIN... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | b, max_fuel, f, k = map(int, input().split())
now_fuel = max_fuel
ans = 0
part_1 = f
part_2 = b - f
now_fuel -= part_1
if now_fuel < 0:
print("-1")
exit()
while k != 0:
if k > 1:
if now_fuel < part_2 * 2:
ans += 1
now_fuel = max_fuel
now_fuel -= part_2 * 2
k -... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR WHILE VAR NUMBER IF VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = (int(x) for x in input().split())
z = 0
curr_petrol = b
curr_races_made = 0
ans = 0
z___f = f - z
f___a = a - f
if k == 1:
if z___f > b or f___a > b:
print(-1)
return
elif k == 2:
if 2 * f___a > b:
print(-1)
return
elif 2 * z___f > b or 2 * f___a > b:
print(-1)
... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER IF VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER RETURN IF VAR NUMBER IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = list(map(int, input().split()))
g = b
ans = 0
p1, p2 = 0, f
for i in range(2 * k):
if p1 == 0 and p2 == f:
if b >= p2 - p1:
b = b - (p2 - p1)
else:
ans = -1
break
p1 = f
p2 = a
elif p1 == f and p2 == a:
y = 1 if i == 2 * k ... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP NUMBER VAR IF VAR NUMBER VAR VAR IF VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR IF VAR VAR VA... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | def find_refuels(a, b, f, k):
if b < f or b < a - f:
return -1
if b < 2 * (a - f) and k > 1:
return -1
if b < 2 * f and k > 2:
return -1
curr_fuel = b - f
refuel_count = 0
remaining_trips = k
while remaining_trips:
remaining_trips -= 1
if (
... | FUNC_DEF IF VAR VAR VAR BIN_OP VAR VAR RETURN NUMBER IF VAR BIN_OP NUMBER BIN_OP VAR VAR VAR NUMBER RETURN NUMBER IF VAR BIN_OP NUMBER VAR VAR NUMBER RETURN NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR NUMBER IF VAR BIN_OP NUMBER BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR NUMBER AS... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | def main():
A, B, F, K = map(int, input().split())
gas = B
refuel = 0
i = 1
while i <= K:
if i % 2:
gas -= F
if gas >= 0:
if K - i > 0 and gas < (A - F) * 2 or K - i == 0 and gas < A - F:
gas = B
refuel += 1
... | FUNC_DEF ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR NUMBER VAR VAR IF VAR NUMBER IF BIN_OP VAR VAR NUMBER VAR BIN_OP BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER VAR BIN_OP VAR VAR ASSIGN VAR VAR VAR NUMBER VAR BIN_OP VA... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = input().split()
a, b, f, k = int(a), int(b), int(f), int(k)
if k > 2 and b < max(2 * f, 2 * (a - f)):
print(-1)
exit()
if k == 1 and b < max(f, a - f):
print(-1)
exit()
if k == 2 and (b < 2 * (a - f) or b < f):
print(-1)
exit()
v = b
count = 0
while k > 0:
v = v - f
if v < 0... | ASSIGN VAR VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR FUNC_CALL VAR BIN_OP NUMBER VAR BIN_OP NUMBER BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF VAR NUMBER VAR FUNC_CALL VAR VAR BIN_OP VAR VAR EXP... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = map(int, input().split(" "))
l, r = f, a - f
if b < l or b < r:
print(-1)
elif k > 1 and b < 2 * r:
print(-1)
elif k > 2 and b < 2 * l:
print(-1)
else:
remain = b
cnt = 0
i = 0
while i < k:
remain -= l
if i < k - 1 and remain < 2 * r:
remain = b
... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR BIN_OP VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR N... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = map(int, input().split())
c, v = b, 0
def t(d):
global c, v
if c < d:
c, v = b, v + 1
if c < d:
print(-1)
exit()
c -= d
t(f)
for i in range(k - 1):
t(2 * f if i % 2 else 2 * (a - f))
t(a - f if k % 2 else f)
print(v) | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER FUNC_DEF IF VAR VAR ASSIGN VAR VAR VAR BIN_OP VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP N... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = map(int, input().split())
tank = b
dist = [f, a - f]
direction = 0
total = 0
res = 0
journeys = 0
while journeys < k:
if total + tank >= k * a:
break
if tank < dist[direction]:
res = -1
break
tank -= dist[direction]
total += dist[direction]
if tank < 2 * dist[(di... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR LIST VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR BIN_OP VAR VAR IF VAR VAR VAR ASSIGN VAR NUMBER VAR VAR VAR VAR VAR VAR IF VAR BIN_OP NUMBER VAR BIN_... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = map(int, input().split())
s = a - f
tch = f
counter = 0
c = 0
full = b
flag = True
while flag:
for i in range(k):
b -= tch
if b < 0:
c = -1
if b < 2 * s and i != k - 1:
counter += 1
b = full
elif i == k - 1:
if b < s:
... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR FOR VAR FUNC_CALL VAR VAR VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER IF VAR BIN_OP NUMBER VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR ... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = map(int, input().split())
bv = 0
j = 0
fu = 0
x = 0
ch = True
bv += b
def a_fs():
if b >= f:
return True
return False
def a_ej(x, j, b):
if j % 2 == 0 and a - x <= b or j % 2 == 1 and x <= b:
return True
return False
def a_nfs(x, j, b):
if j % 2 == 0 and b >= 2 * (... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR VAR FUNC_DEF IF VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR VAR VAR BIN_OP VAR NUMBER NUMBER VAR VAR RETURN NUMBER RETURN... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = map(int, input().split())
now = b
da = [0, f, a]
an = 0
for r in range(k):
if r == k - 1:
if r % 2 == 0:
if now < f:
print(-1)
exit(0)
now -= f
if now < a - f:
now = b
an += 1
if now ... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR LIST NUMBER VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR VAR IF VAR BIN_OP VAR VAR ASSIGN VAR VAR VAR ... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = list(map(int, input().split()))
t = b
ans = 0
def go(dist):
global ans, t
if dist > b:
print(-1)
exit()
if t < dist:
t = b
ans += 1
t -= dist
go(f)
fw = True
for _ in range(k - 1):
go(2 * (a - f if fw else f))
fw = not fw
go(a - f if fw else f)
pr... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FUNC_DEF IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VA... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | def list_input():
return list(map(int, input().split()))
def map_input():
return map(int, input().split())
def map_string():
return input().split()
a, b, f, k = map_input()
tot = a * k
s = 2 * a - f
cur = 0
cnt = b
go = 0
ans = 0
while cur < tot:
go = 1 - go
if go == 1:
if cnt < s and ... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUM... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | def get_raw_input():
raw = input()
raw = raw.split(" ")
return raw
def is_tour_possible(total, capo, pos, jrns):
x = total - pos
if (2 * x > capo or 2 * pos > capo) and jrns > 2:
return False
if jrns == 1 and (x > capo or pos > capo):
return False
if jrns == 2 and (2 * x > ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING RETURN VAR FUNC_DEF ASSIGN VAR BIN_OP VAR VAR IF BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR VAR VAR NUMBER RETURN NUMBER IF VAR NUMBER VAR VAR VAR VAR RETURN NUMBER IF VAR NUMBER BIN_OP NUMBER VAR VAR VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF IF VAR VAR ... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | value = input().split()
finish, tank, azs, count = int(value[0]), int(value[1]), int(value[2]), int(value[3])
before_azs = (finish - azs) * 2 if count > 1 else finish - azs, finish * 2 - (
finish - azs
) * 2
tank_now = tank - azs
if tank_now < 0:
print(-1)
exit()
lent = finish * count - azs
values, binar = ... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER BIN_OP VAR VAR BIN_OP BIN_OP VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EX... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = map(int, input().split())
tmp = b
flag = 0
c = 0
for i in range(k):
if i % 2 == 0:
if f > b:
flag = 1
break
else:
b = b - f
if i != k - 1:
if 2 * (a - f) > b:
c += 1
b = tmp
... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER IF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR BIN_OP VAR NUMBER IF BIN_OP NUMBER BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR VAR ASSIGN V... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = [int(i) for i in input().split()]
if b < f:
print(-1)
return
journeys = 0
previous = 0
refuels1 = 0
tank = b - f
while journeys != k:
if previous == 0:
if tank >= a - f + a * (k - journeys - 1):
print(refuels1)
return
if b >= a - f + a * (k - journeys - 1... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER RETURN ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR WHILE VAR VAR IF VAR NUMBER IF VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR RETURN ... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = list(map(int, input().split()))
now = b
path = 0
ans = 0
for i in range(k):
if path == 0:
if i == k - 1 and now >= a:
break
now -= f
if now < 0:
print(-1)
return
if 2 * (a - f) <= now:
now -= a - f
else:
... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR VAR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER RETURN IF BIN_OP NUMBER BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR VAR NUM... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = map(lambda x: int(x), input().split())
if b < f:
print(-1)
exit()
cnt = 0
t = b - f
g = f = a - f
for i in range(k):
if t < 0:
break
if k - i - 1:
g += f
if t < g:
cnt += 1
t = b
t -= g
g = f = a - f
print(-1 if t < 0 else cnt) | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER VAR VAR IF VAR VAR VAR NUMBER ASSIGN VA... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | a, b, f, k = map(int, input().split())
start = True
tank = b
refuels = 0
possible = True
while k > 0 and possible:
if k == 1:
if tank >= a:
k -= 1
continue
if start:
if tank >= f and b >= a - f:
refuels += 1
else:
possib... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER VAR IF VAR NUMBER IF VAR VAR VAR NUMBER IF VAR IF VAR VAR VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER IF V... |
A bus moves along the coordinate line Ox from the point x = 0 to the point x = a. After starting from the point x = 0, it reaches the point x = a, immediately turns back and then moves to the point x = 0. After returning to the point x = 0 it immediately goes back to the point x = a and so on. Thus, the bus moves from ... | from sys import exit
a, b, f, k = map(int, input().split())
item, res = b, 0
if item < f:
print(-1)
exit()
item -= f
x, y = f * 2, (a - f) * 2
for i in range(1, k):
if i % 2 == 1:
if item < y:
res += 1
item = b - y
else:
item -= y
if item < 0:
... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR NUMBER NUMBER IF VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VA... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(a, c):
while a and c:
if a > c:
a, c = c, a
c %= a
return a + c
for i in range(int(input())):
r, b, k = map(int, input().split())
if r > b:
r, b = b, r
g = gcd(r, b)
r, b = r // g, b // g
print("REBEL" if (k - 1) * r + 1 < b else "OBEY") | FUNC_DEF WHILE VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR RETURN BIN_OP VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR EXPR FUNC_... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
n = int(input())
for _ in range(n):
a, b, k = map(int, input().split())
d = gcd(a, b)
a = a // d
b = b // d
mx = max(a, b)
mn = min(a, b)
if mn * (k - 1) >= mx - 1:
print("OBEY")
else:
... | FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR AS... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
t = int(input())
for case_num in range(t):
r, b, k = map(int, input().split(" "))
if r > b:
tmp = r
r = b
b = tmp
g = gcd(r, b)
b = b // g
r = r // g
n = (b - 2) // r + 1 if b % r != 0 else b // r - 1
print("R... | FUNC_DEF RETURN VAR NUMBER VAR FUNC_CALL VAR VAR BIN_OP VAR VAR 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 IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN V... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | n = int(input())
def gcd(x, y):
while x != 0 and y != 0:
x, y = max(x, y), min(x, y)
x %= y
return max(x, y)
for i in range(n):
r, b, k = list(map(int, input().split()))
g = gcd(r, b)
r, b = max(r, b) // g, min(r, b) // g
if (
r % b == 0
and r // b - 1 < k
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF WHILE VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR RETURN FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | t = int(input())
for i in range(t):
r, b, k = list(map(int, input().split()))
if r > b:
temp = r
r = b
b = temp
a = b // r
c = b % r
if c == 0:
a -= 1
if c > 0 and r % c > 0:
a += 1
if a >= k:
print("REBEL")
else:
print("OBEY") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER VAR NUMBER IF VAR NUMBER BIN_OP VAR VAR NUMBER VAR NUMBER ... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | t = int(input())
def gcd(x, y):
while y % x != 0:
r = y % x
x, y = r, x
return x
for i in range(t):
r, b, k = list(map(int, input().split()))
l = max(r, b)
s = min(r, b)
d = gcd(s, l)
x = l // d - 1
if (x + s // d - 1) // (s // d) >= k:
print("REBEL")
else... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_C... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | t = int(input())
def gwc(r, b):
while r % b:
r, b = b, r % b
return b
for j in range(t):
r, b, k = [int(i) for i in input().split()]
if r < b:
r, b = b, r
c = gwc(r, b)
r, b = r // c, b // c
if r % b == 0 and r // b <= k:
print("OBEY")
elif r > b * (k - 1) + 1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF WHILE BIN_OP VAR VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR IF ... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
t = int(input())
for i in range(t):
b, r, k = map(int, input().split())
if (max(b, r) - gcd(b, r) + min(b, r) - 1) // min(b, r) < k:
print("OBEY")
else:
print("REBEL") | FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR 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 IF BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER FUNC_CALL VAR VA... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(a, b):
if a < b:
a, b = b, a
while a % b != 0:
a, b = b, a % b
return b
w = int(input())
for i in range(0, w):
r, b, k = map(int, input().split())
s = gcd(r, b)
if s == b:
if r / b <= k:
print("OBEY")
else:
print("REBEL")
elif... | FUNC_DEF IF VAR VAR ASSIGN VAR VAR VAR VAR WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR VAR IF BIN_OP VAR VAR VAR EXPR ... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(a: int, b: int) -> int:
if b == 0:
return a
return gcd(b, a % b)
t = int(input())
for _ in range(t):
a, b, k = map(int, input().split())
if a > b:
a, b = b, a
gcd_ab = gcd(a, b)
tmp = a % gcd_ab + gcd_ab
if -(-(b - tmp) // a) < k:
print("OBEY")
else:
... | FUNC_DEF VAR VAR IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR VAR 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 IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR IF B... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def getGCD(a, b):
if a == 0 or b == 0:
return max(a, b)
if a > b:
return getGCD(a % b, b)
return getGCD(b % a, a)
n = int(input())
for i in range(n):
r, b, k = map(int, input().split())
bCopy = b
b = max(b, r)
r = min(r, bCopy)
if (b - getGCD(r, b) - 1) // r + 1 >= k:
... | FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN FUNC_CALL VAR VAR VAR IF VAR VAR RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR ... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def hcf(a, b):
if a % b == 0:
return b
return hcf(b, a % b)
def lcm(a, b):
return a * b // hcf(a, b)
t = int(input())
for i in range(t):
a, b, k = map(int, input().split())
p = lcm(a, b)
q = hcf(a, b)
if k >= p:
print("OBEY")
elif a == b:
print("OBEY")
els... | FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(x, y):
while y:
x, y = y, x % y
return x
x = eval(input())
for i in range(x):
y = input().split(" ")
g = gcd(int(y[0]), int(y[1]))
a = min(int(y[0]), int(y[1])) / g
b = max(int(y[0]), int(y[1])) / g
c = int(y[2])
if (b - 1) // a + 1 > c:
print("REBEL")
elif ... | FUNC_DEF WHILE VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | T = int(input())
def gcd(a, b):
if a > b:
a, b = b, a
if b % a == 0:
return a
return gcd(a, b % a)
for case in range(T):
r, b, k = list(map(int, input().split()))
if r > b:
r, b = b, r
if k * r < b:
print("REBEL")
elif (k - 1) * r >= b:
print("OBEY... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF VAR VAR ASSIGN VAR VAR VAR VAR IF BIN_OP VAR VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR IF BIN_OP VAR VAR VAR EXPR ... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def func_name(input1, input2):
while input2:
input1, input2 = input2, input1 % input2
return input1
counter = 0
T = int(input())
for i in range(T):
temp = input().split()
input1 = int(temp[counter])
input2 = int(temp[counter + 1])
input3 = int(temp[counter + 2])
if input1 > input2:... | FUNC_DEF WHILE VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR RETURN VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF VAR VAR ... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | import sys
class IoTool:
DEBUG = 0
def _reader_dbg():
with open("./input.txt", "r") as f:
lines = f.readlines()
for l in lines:
yield l.strip()
def _reader_oj():
return iter(sys.stdin.read().split("\n"))
reader = _reader_dbg() if DEBUG else _reader_oj... | IMPORT CLASS_DEF ASSIGN VAR NUMBER FUNC_DEF FUNC_CALL VAR STRING STRING VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR EXPR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_DEF RETURN VAR NUMBER VAR FUNC... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | import sys
input = lambda: sys.stdin.readline().rstrip()
def gcd(x, y):
while y != 0:
r = x % y
x = y
y = r
return x
T = int(input())
for _ in range(T):
r, b, k = map(int, input().split())
if r < b:
r, b = b, r
g = gcd(r, b)
r = r / g
b = b / g
if b *... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR RETURN VAR 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 IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | n = int(input())
def gcd(a, b):
if b > a:
ob = b
b = a
a = ob
if b == 0:
return a
return gcd(a % b, b)
for i in range(0, n):
ln = [int(j) for j in input().split(" ")]
b = ln[0]
r = ln[1]
k = ln[2]
if b > r:
ob = b
b = r
r = ob
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
for i in " " * int(input()):
r, b, k = map(int, input().split())
g = gcd(r, b)
r /= g
b /= g
if r > b:
r, b = b, r
if r == 1:
if b > k:
print("REBEL")
else:
print("OBEY")
... | FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR FOR VAR BIN_OP STRING FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR IF VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING E... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(x, y):
while y:
x, y = y, x % y
return x
t = int(input())
for nt in range(t):
r, b, k = map(int, input().split())
r, b = max(r, b), min(r, b)
if r == b:
print("OBEY")
elif (r - 1) // b >= k:
print("REBEL")
else:
hcf = gcd(r, b)
if (r - 1 + (b... | FUNC_DEF WHILE VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING IF BIN_OP BIN_OP VAR NUMBER VAR VA... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | t = int(input())
def ext_gcd(p, q):
if q == 0:
return p, 1, 0
g, y, x = ext_gcd(q, p % q)
y -= p // q * x
return g, x, y
for _ in range(t):
r, b, k = map(int, input().split())
ponta = ext_gcd(r, b)[0]
if ponta <= b - 1 - (k - 1) * r or ponta <= r - 1 - (k - 1) * b:
print(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF VAR NUMBER RETURN VAR NUMBER NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR RETURN VAR VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER IF VA... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | import sys
input = sys.stdin.readline
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
t = int(input())
for testcase in range(t):
r, b, k = map(int, input().split())
if r == b:
print("OBEY")
continue
if r < b:
r, b = b, r
g = gcd(r, b)
... | IMPORT ASSIGN VAR VAR FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR 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 IF VAR VAR EXPR FUNC_CALL VAR STRING IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VA... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(a, b):
while b != 0:
temp = a % b
a = b
b = temp
return abs(a)
for _ in range(int(input())):
r, b, k = map(int, input().split())
r, b = min(r, b), max(r, b)
g = gcd(r, b)
r //= g
b //= g
x = (b - 2) // r + 1
if x >= k:
print("REBEL")
else... | FUNC_DEF WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR RETURN FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VA... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(a, b):
while b:
a, b = b, a % b
return abs(a)
N = int(input())
for _ in range(N):
a, b, k = list(map(int, input().split()))
g = gcd(a, b)
mi = min(a, b)
ma = max(a, b)
A = ma // g - 1
B = mi // g
if B * (k - 1) < A:
print("REBEL")
else:
print("OB... | FUNC_DEF WHILE VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR RETURN FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASS... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(a, b):
if a < b:
a, b = b, a
while b:
a, b = b, a % b
return a
def f():
r, b, k = [int(s) for s in input().split()]
if r > b:
r, b = b, r
g = gcd(r, b)
r //= g
b //= g
rangeLen = r * (k - 1) + 1
if rangeLen <= b - 1:
print("REBEL")
el... | FUNC_DEF IF VAR VAR ASSIGN VAR VAR VAR VAR WHILE VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF VAR BIN_... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | t = int(input())
def gcd(a, b):
while not (a == 0 or b == 0):
if a < b:
a, b = b, a
a %= b
return a + b
for i in range(t):
r, b, k = map(int, input().split())
g = gcd(r, b)
if r > b:
r, b = b, r
r //= g
b //= g
val = (k - 1) * r + 1
if val < b:... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF WHILE VAR NUMBER VAR NUMBER IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR RETURN BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(x, y):
if x == 0:
return y
elif y == 0:
return x
elif x > y:
return gcd(x % y, y)
else:
return gcd(x, y % x)
t = int(input())
for i in range(t):
r, b, k = map(int, input().split())
if r == b:
print("obey")
else:
r, b = r / gcd(r, b), ... | FUNC_DEF IF VAR NUMBER RETURN VAR IF VAR NUMBER RETURN VAR IF VAR VAR RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR 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 IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN ... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | n = int(input())
def m(x, y):
a = max(x, y)
b = min(x, y)
while a != b:
c = a % b
a = b
b = c
if c == 0:
break
return a
for i in range(n):
r, b, k = [int(x) for x in input().split(" ")]
a = m(r, b)
x = max(r, b)
y = min(r, b)
if 2 * x %... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FU... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(a, b):
while a % b != 0:
r_ = a % b
a = b
b = r_
return b
for _ in range(int(input())):
r, b, k = map(int, input().split())
if r > b:
r, b = b, r
max_same = b // r
g = gcd(r, b)
r = r // g
b = b // g
if b % r == 0:
max_same -= 1
i... | FUNC_DEF WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR B... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def main():
a, b, k = map(int, input().split())
if a == b:
print("OBEY")
return
l, m = min(a, b), max(a, b)
d = gcd(a, b)
diff = m - d
c = int(diff / l) + 1
if diff % l == 0:
c = c - 1
if c ... | FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | import sys
def gcd(a, b):
if a == 0:
return b
return gcd(b % a, a)
def solve():
import sys
T = int(input())
while T > 0:
rbk = sys.stdin.readline().split()
r = int(rbk[0])
b = int(rbk[1])
k = int(rbk[2])
if r == b:
print("OBEY")
... | IMPORT FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR FUNC_DEF IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR EXPR FUNC_CAL... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | import sys
input = iter(sys.stdin.read().splitlines()).__next__
def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
def solveAH(r, b, k):
if r == b:
return True
g = gcd(r, b)
r //= g
b //= g
if r > b:
r, b = b, r
return (b - 1 + r - 1) // r < k
def solveBF(r, b, k):
... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN VAR NUMBER VAR FUNC_CALL VAR VAR BIN_OP VAR VAR FUNC_DEF IF VAR VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR RETURN BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR VAR FUNC_DEF IF VAR VA... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | t = int(input())
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
for _ in range(t):
r, b, k = map(int, input().split())
if r > b:
r, b = b, r
g = gcd(b, r)
b /= g
r /= g
x = (b - 1 + r - 1) // r
if x <= k - 1:
print("OBEY")
else:
print(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_O... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | import sys
def gcd(x, y):
while y != 0:
x, y = y, x % y
return x
def main():
t = int(input())
allans = []
for _ in range(t):
r, b, k = readIntArr()
if r > b:
temp = r
r = b
b = temp
g = gcd(r, b)
binn = 10**9
max... | IMPORT FUNC_DEF WHILE VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP NUMBER NUMBE... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep="\n")
def gcd(u, v):
while v:
u, v = v, u... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF WHILE VAR ASSIGN VAR VAR VAR BIN_O... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | t = int(input())
for _ in range(t):
r, b, k = map(int, input().split(" "))
if r > b:
r, b = b, r
if b % r == 0:
if b // r - 1 >= k:
print("REBEL")
else:
print("OBEY")
continue
ok = True
diff = r - ((b // r + 1) * r - b)
x = r - r // diff * ... | 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 IF VAR VAR ASSIGN VAR VAR VAR VAR IF BIN_OP VAR VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR ... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def gcd(a, b):
while b:
a, b = b, a % b
return a
T = int(input())
for _ in range(T):
r, b, k = map(int, input().split())
r, b = min(r, b), max(r, b)
if gcd(r, b) + r * (k - 1) < b:
print("REBEL")
else:
print("OBEY") | FUNC_DEF WHILE VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR EXPR F... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def nod(a, b):
a, b = min(a, b), max(a, b)
while a > 0:
a, b = b % a, a
return b
n = int(input())
for i in range(n):
r, b, k = [int(i) for i in input().split()]
r, b = max(r, b), min(r, b)
if (k - 1) * b + nod(b, r) >= r:
print("OBEY")
else:
print("REBEL") | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR WHILE VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR VAR RETURN VAR 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 FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR I... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | for t in range(int(input())):
r, b, k = map(int, input().split())
if b > r:
b, r = r, b
if r == b:
print("OBEY")
elif r % b == 0:
if r // b <= k:
print("OBEY")
else:
print("REBEL")
elif r % (r % b) == 0 and b % (r % b) == 0:
if r // b <... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING IF BIN_OP VAR VAR NUMBER IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING IF BIN_OP VAR BIN_OP VAR VAR NUMBER BIN... |
You are a rebel leader and you are planning to start a revolution in your country. But the evil Government found out about your plans and set your punishment in the form of correctional labor.
You must paint a fence which consists of $10^{100}$ planks in two colors in the following way (suppose planks are numbered fro... | def euc(a, b):
while b != 0:
a, b = b, a % b
return a
for _ in range(int(input())):
r, b, k = map(int, input().split())
if r == b:
print("OBEY")
continue
r, b = min(r, b), max(r, b)
if b % r == 0:
if b // r - 1 < k:
print("OBEY")
else:
... | FUNC_DEF WHILE VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR VAR NUMBER IF BIN_OP BIN_OP ... |
Little Petya very much likes playing with little Masha. Recently he has received a game called "Zero-One" as a gift from his mother. Petya immediately offered Masha to play the game with him.
Before the very beginning of the game several cards are lain out on a table in one line from the left to the right. Each card c... | s = input()
a, b, c = (s.count(x) for x in "01?")
if a + c > b:
print("00")
if a + c + 2 > b >= a - c:
if s[-1] != "?":
if s[-1] == "0":
print("10")
else:
print("01")
else:
if a + c > b:
print("01")
if b + c > a + 1:
print("10")... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR STRING IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR STRING IF BIN_OP BIN_OP VAR VAR NUMBER VAR BIN_OP VAR VAR IF VAR NUMBER STRING IF VAR NUMBER STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR STRING IF BIN... |
Little Petya very much likes playing with little Masha. Recently he has received a game called "Zero-One" as a gift from his mother. Petya immediately offered Masha to play the game with him.
Before the very beginning of the game several cards are lain out on a table in one line from the left to the right. Each card c... | s = input()
n = len(s)
zeros, ones, other = 0, 0, 0
for x in s:
zeros += x == "0"
ones += x == "1"
other += x == "?"
A = ["00", "01", "10", "11"]
pos = [0] * 4
pos[0] = zeros + other > n // 2
pos[3] = zeros < n // 2
if zeros <= n // 2 and zeros + other >= n // 2:
canuse = other - n // 2 + zeros
pos[... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR VAR VAR VAR STRING VAR VAR STRING VAR VAR STRING ASSIGN VAR LIST STRING STRING STRING STRING ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER BIN_OP VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR BIN_OP VAR NUMB... |
Little Petya very much likes playing with little Masha. Recently he has received a game called "Zero-One" as a gift from his mother. Petya immediately offered Masha to play the game with him.
Before the very beginning of the game several cards are lain out on a table in one line from the left to the right. Each card c... | res = input()
possible = []
zero = res.count("0")
one = res.count("1")
question = res.count("?")
if (len(res) - 2) // 2 + 2 <= zero + question:
possible.append("00")
if res[-1] == "?":
if (
one + 1 <= (len(res) + 1) // 2 <= one + question
and zero <= len(res) // 2 <= zero + question - 1
):
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER BIN_OP VAR VAR EXPR FUNC_CALL VAR STRING IF VAR NUMBER STRING IF BIN_OP VAR NUMBER BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBE... |
Little Petya very much likes playing with little Masha. Recently he has received a game called "Zero-One" as a gift from his mother. Petya immediately offered Masha to play the game with him.
Before the very beginning of the game several cards are lain out on a table in one line from the left to the right. Each card c... | def evaluate(a):
c1 = a.count("1")
c0 = a.count("0")
n = len(a)
A = (n - 1) // 2
B = (n - 2) // 2
if c1 <= A:
return "00"
if c0 <= B:
return "11"
p1 = a.rfind("1")
p0 = a.rfind("0")
if p0 < p1:
return "01"
else:
return "10"
a = input()
x = []... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER IF VAR VAR RETURN STRING IF VAR VAR RETURN STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF VAR VAR RETURN ... |
Little Petya very much likes playing with little Masha. Recently he has received a game called "Zero-One" as a gift from his mother. Petya immediately offered Masha to play the game with him.
Before the very beginning of the game several cards are lain out on a table in one line from the left to the right. Each card c... | import sys
def rint():
return map(int, sys.stdin.readline().split())
s = list(input())
q = s.count("?")
o = s.count("1")
z = s.count("0")
ans = []
if z + q >= o + 1:
ans.append("00")
tmp = o + q - z - (z + o + q) % 2
if tmp % 2 == 0:
x = tmp // 2
if x >= 0 and x <= q:
if s[-1] == "1" or s[-1... | IMPORT FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR LIST IF BIN_OP VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR VA... |
Little Petya very much likes playing with little Masha. Recently he has received a game called "Zero-One" as a gift from his mother. Petya immediately offered Masha to play the game with him.
Before the very beginning of the game several cards are lain out on a table in one line from the left to the right. Each card c... | a, b, c = 0, 0, 0
last = ""
for i in input():
if i == "1":
a += 1
elif i == "0":
b += 1
else:
c += 1
last = i
if b + c > a:
print("00")
if last != "0":
a1, b1, c1 = a, b, c
if last == "?":
c1 -= 1
a1 += 1
x = (-a1 + b1 + c1 + (a1 + b1 + c1) % 2) //... | ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR STRING IF VAR STRING ASSIGN VAR VAR VAR VAR VAR VAR IF VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN... |
Fangy the little walrus, as all the modern walruses, loves to communicate via text messaging. One day he faced the following problem: When he sends large texts, they are split into parts each containing n characters (which is the size of one text message). Thus, whole sentences and words get split!
Fangy did not like ... | n, text, SMSes, SMS_len = int(input()), input(), 0, 0
for ch in ".?!":
text = text.replace(ch, "_")
for L in map(len, (" " + text).split("_")[:-1]):
if L > n:
print("Impossible")
break
SMS_len += L + 1 if SMS_len else L
if SMS_len > n:
SMSes, SMS_len = SMSes + 1, L
else:
prin... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR STRING FOR VAR FUNC_CALL VAR VAR FUNC_CALL BIN_OP STRING VAR STRING NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING VAR VAR BIN_OP VAR NUMBER VAR IF VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER VAR EXPR FU... |
Fangy the little walrus, as all the modern walruses, loves to communicate via text messaging. One day he faced the following problem: When he sends large texts, they are split into parts each containing n characters (which is the size of one text message). Thus, whole sentences and words get split!
Fangy did not like ... | import sys
n = int(input())
s = str(input())
m = len(s)
cnt = 0
gd = False
ans = 0
lst = 0
end = [".", "?", "!"]
rem = 0
for i in range(m):
cnt += 1
if s[i] in end:
gd = True
lst = cnt
if cnt == n:
if not gd:
print("Impossible")
exit(0)
else:
... | IMPORT 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 ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST STRING STRING STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VA... |
Fangy the little walrus, as all the modern walruses, loves to communicate via text messaging. One day he faced the following problem: When he sends large texts, they are split into parts each containing n characters (which is the size of one text message). Thus, whole sentences and words get split!
Fangy did not like ... | n = int(input())
q, w, r = [], [], []
for x in input().split("."):
q += x.split("!")
for x in q:
w += x.split("?")
for x in w:
if x:
r += [x.strip() + "."]
i = 0
while i < len(r):
if len(r[i]) > n:
print("Impossible")
exit()
while i + 1 < len(r) and len(r[i]) + len(r[i + 1]) ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR LIST LIST LIST FOR VAR FUNC_CALL FUNC_CALL VAR STRING VAR FUNC_CALL VAR STRING FOR VAR VAR VAR FUNC_CALL VAR STRING FOR VAR VAR IF VAR VAR LIST BIN_OP FUNC_CALL VAR STRING ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL ... |
Fangy the little walrus, as all the modern walruses, loves to communicate via text messaging. One day he faced the following problem: When he sends large texts, they are split into parts each containing n characters (which is the size of one text message). Thus, whole sentences and words get split!
Fangy did not like ... | n = int(input())
s = input()
S = []
e = ""
for i in range(len(s)):
if s[i] in ".?!":
e += s[i]
S.append(e)
e = ""
else:
e += s[i]
acc = 0
ans = 0
for item in S:
x = len(item)
if acc == 0:
i = 0
while item[i] == " ":
x -= 1
i += 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN V... |
Fangy the little walrus, as all the modern walruses, loves to communicate via text messaging. One day he faced the following problem: When he sends large texts, they are split into parts each containing n characters (which is the size of one text message). Thus, whole sentences and words get split!
Fangy did not like ... | n = int(input()) + 1
p, s, j = 0, 1, -2
for i, c in enumerate(input()):
if c in ".?!":
d = i - j
if d > n:
s = 0
break
if p + d > n:
s += 1
p = 0
p += d
j = i
print(s if s else "Impossible") | ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR STRING ASSIGN VAR BIN_OP VAR VAR IF VAR VAR ASSIGN VAR NUMBER IF BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR VAR STRING |
Fangy the little walrus, as all the modern walruses, loves to communicate via text messaging. One day he faced the following problem: When he sends large texts, they are split into parts each containing n characters (which is the size of one text message). Thus, whole sentences and words get split!
Fangy did not like ... | n = int(input())
a = input()
b = []
c = ""
a1 = len(a)
i = 0
while i < len(a):
c += a[i]
if a[i] in [".", "?", "!"]:
b.append(len(c))
c = ""
i += 1
i += 1
d = 0
e = 0
f = 0
for i in b:
if e + i + f > n:
if e == 0 or i > n:
print("Impossible")
break... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR LIST STRING STRING STRING EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASS... |
Fangy the little walrus, as all the modern walruses, loves to communicate via text messaging. One day he faced the following problem: When he sends large texts, they are split into parts each containing n characters (which is the size of one text message). Thus, whole sentences and words get split!
Fangy did not like ... | n = int(input())
text = input()
text = text.replace("?", ".").replace("!", ".").split(".")
ans = True
qnt = 0
acu = n + 1
for i in range(len(text)):
if len(text[i]) == 0:
continue
if len(text[i]) > n:
ans = False
break
acu += len(text[i]) + 1
if acu > n:
acu = len(text[i]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING STRING STRING STRING STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR ASSIGN VAR... |
Fangy the little walrus, as all the modern walruses, loves to communicate via text messaging. One day he faced the following problem: When he sends large texts, they are split into parts each containing n characters (which is the size of one text message). Thus, whole sentences and words get split!
Fangy did not like ... | n = int(input())
raw = input().split(" ")
sentences = []
punctuation = {"?", ".", "!"}
curr = ""
for idx in raw:
curr += idx
if idx[len(idx) - 1] in punctuation:
sentences.append(curr)
curr = ""
else:
curr += " "
bad = False
for idx in sentences:
if len(idx) > n:
bad = Tr... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR STRING STRING STRING ASSIGN VAR STRING FOR VAR VAR VAR VAR IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR STRING ASSIGN VAR NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR VAR ASS... |
Fangy the little walrus, as all the modern walruses, loves to communicate via text messaging. One day he faced the following problem: When he sends large texts, they are split into parts each containing n characters (which is the size of one text message). Thus, whole sentences and words get split!
Fangy did not like ... | class CodeforcesTask70BSolution:
def __init__(self):
self.result = ""
self.n = 0
self.message = ""
def read_input(self):
self.n = int(input())
self.message = input()
def process_task(self):
sentences = []
s = ""
for x in range(len(self.messa... | CLASS_DEF FUNC_DEF ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR STRING FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR LIST ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR LIST STRING STRING STRING VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR STRING I... |
Fangy the little walrus, as all the modern walruses, loves to communicate via text messaging. One day he faced the following problem: When he sends large texts, they are split into parts each containing n characters (which is the size of one text message). Thus, whole sentences and words get split!
Fangy did not like ... | u = input
e = 1
while e:
n = int(u())
s = u().replace("?", ".").replace("!", ".")
f = 1
p = len(s) - 1
i = 0
if "." != s[p]:
f = 0
else:
l = s[:p].split(".")
q, t, i = 0, 1, 0
while i < len(l):
r = len(l[i]) + 1
if len(str(l[i]).lstrip(... | ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING STRING STRING STRING ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER IF STRING VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING ASSIGN VAR VAR... |
Fangy the little walrus, as all the modern walruses, loves to communicate via text messaging. One day he faced the following problem: When he sends large texts, they are split into parts each containing n characters (which is the size of one text message). Thus, whole sentences and words get split!
Fangy did not like ... | n = int(input())
s = input()
sens = [[]]
for i in s:
sens[-1].append(i)
if i in [".", "!", "?"]:
sens.append([])
for i in range(len(sens)):
if sens[i]:
sens[i] = "".join(sens[i])
sens[i] = sens[i].strip()
if len(sens[i]) > n:
print("Impossible")
exit(0... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST LIST FOR VAR VAR EXPR FUNC_CALL VAR NUMBER VAR IF VAR LIST STRING STRING STRING EXPR FUNC_CALL VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR FUNC_CALL STRING VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR IF FUNC_CALL... |
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the club, Polycarpus put down character "+" in his notes. Similarly, ... | s = input()
low = 0
high = 0
sum = 0
for i in s:
if i == "+":
sum += 1
else:
sum -= 1
if sum < low:
low = sum
if sum > high:
high = sum
print(high - low) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER VAR NUMBER IF VAR VAR ASSIGN VAR VAR IF VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR |
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the club, Polycarpus put down character "+" in his notes. Similarly, ... | suspects = input()
minSus = 0
maxSus = 0
counter = 0
for x in suspects:
if x == "+":
counter += 1
minSus = min(minSus, counter)
maxSus = max(maxSus, counter)
else:
counter -= 1
minSus = min(minSus, counter)
maxSus = max(maxSus, counter)
print(maxSus - minSus) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR |
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the club, Polycarpus put down character "+" in his notes. Similarly, ... | s = input()
d, f, r = 0, 0, 0
for c in s:
if c == "-":
f += 1
if d >= 1:
d -= 1
else:
r += 1
elif c == "+":
d += 1
if f >= 1:
f -= 1
else:
r += 1
print(r) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER IF VAR STRING VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR |
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the club, Polycarpus put down character "+" in his notes. Similarly, ... | a = [(1 if x == "+" else -1) for x in input()]
b = list(map(lambda i: sum(a[0:i]), range(len(a) + 1)))
print(max(b) - min(b)) | ASSIGN VAR VAR STRING NUMBER NUMBER VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR |
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the club, Polycarpus put down character "+" in his notes. Similarly, ... | inp = input()
inclb = 0
outclb = 0
seen = 0
i = 0
for i in range(0, len(inp)):
if inp[i] == "-":
outclb += 1
if inclb > 0:
inclb -= 1
else:
seen += 1
else:
inclb += 1
if outclb > 0:
outclb -= 1
else:
seen += 1
print(... | ASSIGN VAR FUNC_CALL VAR 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 NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR |
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the club, Polycarpus put down character "+" in his notes. Similarly, ... | input_var = input()
counter1 = 0
counter2 = 0
for temp in input_var:
if temp == "+":
counter1 += 1
if counter2 > 0:
counter2 -= 1
else:
counter2 += 1
if counter1 > 0:
counter1 -= 1
print(counter1 + counter2) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR |
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the club, Polycarpus put down character "+" in his notes. Similarly, ... | s = input()
a, b = 0, 0
for i in range(len(s)):
if s[i] == "-":
a = a - 1
if a < b:
b = a
else:
a = a + 1
a = -b
ans = a
for i in range(len(s)):
if s[i] == "-":
a = a - 1
else:
a = a + 1
if a > ans:
ans = a
print(ans) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN ... |
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the club, Polycarpus put down character "+" in his notes. Similarly, ... | s = input()
mx = 0
mn = 0
cur = 0
for i in s:
if i == "+":
cur += 1
else:
cur -= 1
mx = max(mx, cur)
mn = min(mn, cur)
print(abs(mx - mn)) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR |
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the club, Polycarpus put down character "+" in his notes. Similarly, ... | t = input()
inPerson = 0
outPerson = 0
for i in range(0, len(t)):
if t[i] == "+":
inPerson += 1
if outPerson:
outPerson -= 1
elif t[i] == "-":
outPerson += 1
if inPerson:
inPerson -= 1
print(inPerson + outPerson) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER IF VAR VAR NUMBER IF VAR VAR STRING VAR NUMBER IF VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR |
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the club, Polycarpus put down character "+" in his notes. Similarly, ... | n = input()
inside_count = 0
outside_count = 0
for element in n:
if element == "+":
inside_count += 1
outside_count -= 1
if outside_count < 0 or inside_count > 100:
outside_count = 0
else:
inside_count -= 1
outside_count += 1
if inside_count < 0 or out... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR |
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the club, Polycarpus put down character "+" in his notes. Similarly, ... | p = [0] + [(1 if i == "+" else -1) for i in input()]
for i in range(1, len(p)):
p[i] += p[i - 1]
print(max(p) - min(p)) | ASSIGN VAR BIN_OP LIST NUMBER VAR STRING NUMBER NUMBER VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR |
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the club, Polycarpus put down character "+" in his notes. Similarly, ... | def main():
s = input()
cnt = 0
ans = 0
for x in s:
if x == "+":
cnt += 1
ans = max(ans, cnt)
elif cnt == 0:
ans += 1
else:
cnt -= 1
print(ans)
def __starting_point():
main()
__starting_point() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR FUNC_DEF EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR |
Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen.
On the burglary night Polycarpus kept a careful record of all club visitors. Each time a visitor entered the club, Polycarpus put down character "+" in his notes. Similarly, ... | s = input()
p = 0
m = 0
for i in s:
if i == "+":
p += 1
m = max(m - 1, 0)
elif i == "-":
m += 1
p = max(p - 1, 0)
print(p + m) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.