description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | def getClosest(h, c, st, en, t):
if abs(val(h, c, st, t) / (2 * st - 1)) <= abs(val(h, c, en, t) / (2 * en - 1)):
return st
else:
return en
def val(h, c, x, t):
return x * h + (x - 1) * c - (2 * x - 1) * t
def findClosest(h, c, st, en, t):
if val(h, c, st, t) <= 0:
return st
... | FUNC_DEF IF FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER RETURN VAR RETURN VAR FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR NUMBER VAR BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER VAR FUN... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | t = int(input())
def main():
hot, cold, temp = map(int, input().split())
if temp <= (hot + cold) // 2:
return 2
k = (hot - temp) // (2 * temp - hot - cold)
l = abs(k * (hot + cold) + hot - temp * (2 * k + 1)) * (2 * k + 3)
u = abs((k + 1) * (hot + cold) + hot - temp * (2 * k + 3)) * (2 * k... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER RETURN NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR VAR VAR BIN_OP VAR B... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | T = int(input())
C = []
for i in range(0, T):
h, c, t = [int(x) for x in input().split(" ")]
if h + c == 2 * t:
C.append(2)
elif 2 * t < h + c:
if abs((h + c) / 2 - t) < abs(h - t):
C.append(2)
else:
C.append(1)
else:
m = (h - t) // (2 * t - h - c)... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF BIN_OP VAR VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP NUMBER VAR BIN_OP VAR VAR IF FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR FUNC_... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | def temp(h, c, n):
return h * (n + 1) + c * n, 2 * n + 1
for _ in range(int(input())):
h, c, t = map(int, input().split())
if t * 2 <= h + c:
print(2)
continue
n = (h - t) // (2 * t - h - c)
n1 = n + 1
a, b = temp(h, c, n)
a1, b1 = temp(h, c, n1)
d, dn = abs(a - b * t),... | FUNC_DEF RETURN BIN_OP BIN_OP VAR BIN_OP VAR NUMBER BIN_OP VAR VAR BIN_OP BIN_OP NUMBER VAR 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 IF BIN_OP VAR NUMBER BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP B... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | def cups(x, h, c, t):
error = (x + 1) * h + x * c - t * (2 * x + 1)
return abs(error)
def f(h, c, t):
if h + c >= 2 * t:
return 2
x = (h - t) // (2 * t - h - c)
e1 = cups(x, h, c, t)
e2 = cups(x + 1, h, c, t)
if e1 * (2 * x + 3) <= e2 * (2 * x + 1):
return 2 * x + 1
els... | FUNC_DEF ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER VAR BIN_OP VAR VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER RETURN FUNC_CALL VAR VAR FUNC_DEF IF BIN_OP VAR VAR BIN_OP NUMBER VAR RETURN NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR A... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | printn = lambda x: print(x, end="")
inn = lambda: int(input())
inl = lambda: list(map(int, input().split()))
inm = lambda: map(int, input().split())
ins = lambda: input().strip()
DBG = True
BIG = 10**18
R = 10**9 + 7
def ddprint(x):
if DBG:
print(x)
def foo(h, c, n):
return (n * h + (n - 1) * c) / (... | ASSIGN VAR FUNC_CALL VAR VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER N... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | for _ in range(int(input())):
h, c, t = map(int, input().split())
h -= c
t -= c
if h == t:
print(1)
elif h / 2 >= t:
print(2)
else:
def p(a):
return h * (1 + a)
def q(a):
return 1 + 2 * a
a = 0
b = 10**10
while a ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER FUNC_DEF RETURN BIN_OP VAR BIN_OP NUMBER VAR FUNC_DEF RETURN BIN_OP NUMBER BIN_OP NUMBER VAR ASSIGN VAR N... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | T = int(input())
for t in range(T):
h, c, t = map(int, input().split())
h *= 2
c *= 2
t *= 2
m = (h + c) // 2
if t <= m:
print(2)
else:
hc, tc = h - m, t - m
tms = hc // tc
apr = [2434841, 1]
for i in range(tms - 5, tms + 5):
if i % 2 and a... | 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 VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LI... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | for i in range(int(input())):
h, c, t = map(int, input().split())
result = float("inf")
avg = (h + c) / 2
D = {}
if t == h:
result = 1
elif t in (c, avg):
result = 2
else:
D[abs(t - c)] = 2
D[abs(t - h)] = 1
if t - avg > 0:
X = (h - avg) / ... | 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 STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR DICT IF VAR VAR ASSIGN VAR NUMBER IF VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR NUMBER ASSIGN VAR F... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | q = int(input())
for i in range(q):
h, c, t = list(map(int, input().split()))
if 2 * t <= h + c:
print(2)
else:
k = (h - t) / (2 * t - h - c)
m = int(k)
n = m + 1
x = abs((m + 1) * h + m * c - (2 * m + 1) * t) / (2 * m + 1)
y = abs((n + 1) * h + n * c - (2 * n... | 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 BIN_OP NUMBER VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_O... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | import sys
input = sys.stdin.readline
flush = sys.stdout.flush
for _ in range(int(input())):
h, c, t = list(map(int, input().split()))
m = h + c >> 1
if t <= m:
print(2)
continue
a = (h - t) // (2 * t - h - c)
b = a + 1
print(
2 * a + 1
if 2 * t * (2 * a + 1) * (... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR 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 BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN V... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | for _ in range(int(input())):
h, c, t = map(int, input().split())
if 2 * t <= h + c:
print(2)
continue
x = (h - t) // (2 * t - h - c)
k = 2 * x + 1
val1 = abs(k // 2 * c + (k + 1) // 2 * h - t * k)
val2 = abs((k + 2) // 2 * c + (k + 3) // 2 * h - t * (k + 2))
print(k if val1 ... | 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 BIN_OP NUMBER VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | T = int(input())
s = []
for i in range(T):
s.append(input())
for i in range(T):
h, c, t = map(int, s[i].split())
if t == h:
n = 1
elif t <= (h + c) / 2:
n = 2
else:
k = (c - t) / (h + c - 2 * t)
n = int(2 * k - 1)
if n % 2 == 0:
n = n + 1
k... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR NUMBER IF VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BI... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
h, c, t = list(map(int, input().split()))
if h + c >= 2 * t:
print(2)
else:
diff2 = 2 * t - (h + c)
hDiff2 = 2 * h - (h + c)
kDown = (hDiff2 // diff2 - 1) // 2
kUp = kDown + 1
diffDown ... | IMPORT ASSIGN 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 IF BIN_OP VAR VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR BIN_OP VA... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | t = int(input())
for test in range(t):
inp = input().split()
h = int(inp[0])
c = int(inp[1])
t = int(inp[2])
if t + t <= c + h:
print(2)
continue
if t >= h:
print(1)
continue
k = (h - t) // (t + t - c - h)
if (h - t) % (t + t - c - h) == 0:
print(k... | 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 NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_O... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | T = int(input().strip())
eps = 1e-20
def diff(n):
return abs(((n + 1) * h + n * c) / (2 * n + 1) - t)
def better(k, n):
return (2 * k + 1) * abs((n + 1) * (h - t) + n * (c - t)) >= (2 * n + 1) * abs(
(k + 1) * (h - t) + k * (c - t)
)
def strictlybetter(k, n):
return (2 * k + 1) * abs((n + ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER VAR BIN_OP VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR VAR BIN_OP... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | for i in range(int(input())):
h, c, t = map(int, input().split())
if h + c >= 2 * t:
print(2)
elif h == t:
print(1)
else:
x = int((t - c) / (2 * t - h - c))
tb1 = abs((2 * x - 1) * t - ((h + c) * x - c)) * (2 * x + 1)
tb2 = abs(t * (2 * x + 1) - ((h + c) * x + h))... | 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 BIN_OP VAR VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR BIN_OP FUNC_... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | import sys
input = sys.stdin.readline
def print(val):
sys.stdout.write(str(val) + "\n")
def val(x, h, c):
return (h - c) / (2 * (x * 2 - 1))
def prog():
for _ in range(int(input())):
L = 1
R = 10**12
h, c, t = map(int, input().split())
if t <= (h + c) / 2:
... | IMPORT ASSIGN VAR VAR FUNC_DEF EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR BIN_OP NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CAL... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | import sys
[t] = [int(i) for i in sys.stdin.readline().split()]
for _ in range(t):
[h, c, t] = [int(i) for i in sys.stdin.readline().split()]
h -= c
t -= c
if 2 * t <= h:
print(2)
else:
k1 = t // (2 * t - h)
k2 = k1 + 1
t1 = h * k1 * (2 * k2 - 1)
diff1 = abs(... | IMPORT ASSIGN LIST VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR VAR VAR IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN V... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | def check(h, c, k, l, t):
if l == -1:
return abs(((k + 1) * h + k * c) / (2 * k + 1) - t)
T = abs((k + 1) * h + k * c - t * (2 * k + 1)) * (2 * l + 1) - abs(
(l + 1) * h + l * c - t * (2 * l + 1)
) * (2 * k + 1)
return T
def solve(h, c, t):
m1 = abs((h + c) // 2 - t)
if t <= (h... | FUNC_DEF IF VAR NUMBER RETURN FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER VAR BIN_OP VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER VAR BIN_OP VAR VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP BIN_OP NUMBER VAR NUMBER BIN... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | import sys
input = lambda: sys.stdin.readline().rstrip()
T = int(input())
for _ in range(T):
h, c, t = map(int, input().split())
a = h - t
b = t - c
if a <= 0:
print(1)
elif a >= b:
print(2)
else:
mi = a, 1
mii = 1
if abs((a + b) * mi[1]) < mi[0] * 2:
... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL 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 BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER A... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | T = int(input())
for _ in range(T):
h, c, t = list(map(int, input().split()))
if h + c >= t * 2:
print(2)
else:
l, r = 0, 10**9
while r - l > 1:
m = (l + r) // 2
if h * (m + 1) + c * m >= t * (2 * m + 1):
l = m
else:
... | 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 BIN_OP VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER BIN_OP NUMBER NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | T = int(input())
for iteration in range(T):
[h, c, t] = list(map(int, input().split()))
if t <= (h + c) / 2:
print(2)
else:
k = 1 / 2 * (h - c) / (2 * t - h - c)
k = k + 1 / (4 * (int(k) + 1))
if k - int(k) <= 10**-8:
k = int(k) - 1
else:
k = i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN LIST VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER NUMBER BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR B... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | _ = int(input())
h = 0
c = 0
t = 0
def fn(cnt):
return t * (2 * cnt - 1) - cnt * h - (cnt - 1) * c
for __ in range(_):
h, c, t = [int(a) for a in input().split()]
if h + c >= t * 2:
print(2)
continue
l = 1
r = 1
while fn(r) < 0:
r *= 2
l = r // 2
while l < r:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP VAR VAR BIN_OP BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR VAR B... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | for i in range(int(input())):
a, b, c = map(int, input().split())
d = a - c
e = c - b
f = e - d
if d >= e:
print(2)
elif d == 0:
print(1)
elif 2 <= e / d:
if c * 3 - (2 * a + b) >= (a - c) * 3:
print(1)
else:
print(3)
else:
... | 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 BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF NUMBER BIN_OP VAR VAR IF BIN_OP BIN_OP VAR NUMBER B... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | def N():
return int(input())
def NM():
return map(int, input().split())
def L():
return list(NM())
def LN(n):
return [N() for i in range(n)]
def LL(n):
return [L() for i in range(n)]
T = N()
def f():
h, c, t = NM()
h -= c
t -= c
if h == t:
print(1)
return
... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR 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 VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | def main(h, c, t):
lowtmp = (h + c) / 2
if t == h:
return 1
if t <= lowtmp:
return 2
def tempSum(n):
return n * h + (n - 1) * c
l = 1
r = 10**7
while l < r:
mid = (l + r) // 2
if tempSum(mid) <= t * (2 * mid - 1):
r = mid
else:
... | FUNC_DEF ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR RETURN NUMBER IF VAR VAR RETURN NUMBER FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR BIN_OP VAR BIN_OP BIN_OP NUMB... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | import sys
def input():
return sys.stdin.readline().rstrip()
testcases = int(input())
answers = []
def loss(two_n_plus_one, hot, cold, desired):
n = two_n_plus_one // 2
return abs((desired * (2 * n + 1) - ((n + 1) * hot + n * cold)) / (2 * n + 1))
for _ in range(testcases):
hot, cold, desired_te... | IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER RETURN FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP BIN_OP BIN_OP VAR NUMBER VAR BIN_OP VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER FOR VAR FUNC_CALL V... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | def count(h, c, t):
if h + c >= 2 * t:
ans = 2
else:
k = int((h - t) / (2 * t - h - c))
if 4 * k * (k + 1) * (h + c) + (6 * k + 5) * h + c * (2 * k + 1) <= 2 * t * (
2 * k + 1
) * (2 * k + 3):
ans = 2 * k + 1
else:
ans = 2 * k + 3
r... | FUNC_DEF IF BIN_OP VAR VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR IF BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP NUMBER VAR BIN_OP VAR NUMBER BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER BI... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | T = int(input())
for t_itr in range(T):
H, C, T = list(map(int, input().rstrip().split()))
if T >= H:
print(1)
elif 2 * T <= H + C:
print(2)
else:
n = (C - T) // (H + C - 2 * T)
n1 = n + 1
d1 = H * n + C * (n - 1) - T * (2 * n - 1)
d2 = H * n1 + C * (n1 - ... | 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 FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP NUMBER VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR BIN_OP NUMBER VA... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | def i_by_t(h, c, t):
return ((h - c) / (t - (h + c) / 2) + 2) / 2
for _ in range(int(input())):
h, c, t = map(int, input().split())
mean = (h + c) / 2
def temp(i):
half = i // 2
return (h * (i - i // 2) + c * half) / i
T = temp(1)
if t >= T:
print(1)
continue
... | FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER 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 BIN_OP BIN_OP VAR VAR NUMBER FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER RETURN BIN_OP BIN_OP BIN_... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | def check(h, c, x, t):
return abs((x * (h + c - 2 * t) + t - c) / (2 * x - 1))
def answer(h, c, t):
avg = (h + c) // 2
if t <= avg:
return 2
x = (t - c) // (2 * t - h - c)
if check(h, c, x, t) <= check(h, c, x + 1, t):
return 2 * x - 1
else:
return 2 * x + 1
t = int(i... | FUNC_DEF RETURN FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR VAR BIN_OP NUMBER VAR VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER FUNC_DEF ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR RETURN NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR IF FUNC_CALL VAR VAR VAR VAR VA... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | t = int(input())
for _ in range(t):
h, c, t = map(int, input().split())
if t >= h:
print(1)
continue
if (h + c) % 2 == 0 and t == (h + c) // 2:
print(2)
continue
if t < (h + c) / 2:
print(2)
continue
n = (t - c) // (2 * t - h - c)
if (t - c) % (2 *... | 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 NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMB... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | inp = lambda cast=int: [cast(x) for x in input().split()]
printf = lambda s="", *args, **kwargs: print(str(s).format(*args), flush=True, **kwargs)
(t,) = inp()
for _ in range(t):
h, c, t = inp()
if 2 * t <= h + c:
print(2)
else:
x = (t - c) // (2 * t - h - c)
y = x + 1
res1 =... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR VAR VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR IF BIN_OP NUMBER VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_O... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | for case in range(int(input())):
a = input().split(" ")
h = int(a[0])
c = int(a[1])
t = int(a[2])
avg = (h + c) / 2
if t < avg:
ans = 2
elif t == avg:
ans = 2
elif t == h:
ans = 1
elif h > t > avg:
diff = t - avg
v = (h - avg) // diff
i... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR ... |
There are two infinite sources of water: hot water of temperature $h$; cold water of temperature $c$ ($c < h$).
You perform the following procedure of alternating moves: take one cup of the hot water and pour it into an infinitely deep barrel; take one cup of the cold water and pour it into an infinitely deep bar... | for T in range(int(input())):
h, c, x = list(map(int, input().split()))
if h == x:
print(1)
else:
av = (h + c) / 2
if av >= x:
print(2)
else:
n = (h - x) // (2 * x - h - c)
p = n + 1
temp = ((h + c) * n + h) * (2 * p + 1)
... | 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 IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN V... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | n = int(input())
name = []
for i in range(n):
x = input()
name.append(x + (101 - len(x)) * "{")
G = [[] for i in range(26)]
G2 = [[] for i in range(26)]
def f(s):
return ord(s) - ord("a")
flag = True
for i in range(1, n):
for j in range(100):
if name[i][j] != name[i - 1][j]:
if "... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR STRING ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER FUNC_DEF RETURN BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR S... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | def go_through(given_char):
global order
global freq
global orders
if given_char in orders:
while orders[given_char]:
next_letter = orders[given_char].pop()
freq[next_letter] = freq[next_letter] - 1
go_through(next_letter)
if given_char not in order:
... | FUNC_DEF IF VAR VAR WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR N... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | n = int(input())
ss = [input() for i in range(n)]
graph = set()
def rec(fr=0, to=len(ss) - 1, dep=0):
if fr == to:
return
pos = fr
while pos <= to:
i = pos
while (
1 + i <= to
and len(ss[i]) > dep
and len(ss[1 + i]) > dep
and ss[i][de... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER IF VAR VAR RETURN ASSIGN VAR VAR WHILE VAR VAR ASSIGN VAR VAR WHILE BIN_OP NUMBER VAR VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR VA... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | __author__ = "Utena"
n = int(input())
e = []
def cmp(a, b):
for i in range(min(len(a), len(b))):
if a[i] != b[i]:
e.append((a[i], b[i]))
return 0
if len(a) > len(b):
print("Impossible")
exit(0)
def indegree0(v, e):
if v == []:
return None
tmp =... | ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR RETURN NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER FUNC_DE... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | n = int(input())
s = [input() for i in range(n)]
m = [([0] * 26) for i in range(26)]
f = lambda x: ord(x) - ord("a")
for i in range(n - 1):
for ch1, ch2 in zip(s[i], s[i + 1]):
if ch1 != ch2:
m[f(ch1)][f(ch2)] = 1
break
else:
if len(s[i]) > len(s[i + 1]):
prin... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER IF VAR VAR ASSIGN V... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | imp = False
nodes = {}
for i in "abcdefghijklmnopqrstuvwxyz":
nodes[i] = set()
n = int(input())
prev = None
for i in range(n):
name = input()
if prev:
for x, y in zip(name, prev):
if x != y:
nodes[x].add(y)
break
else:
if prev > name:
... | ASSIGN VAR NUMBER ASSIGN VAR DICT FOR VAR STRING ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NONE FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF VAR FOR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR VAR IF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR LI... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | vis = [0] * 26
ans = []
graph = [[] for _ in range(26)]
A = ord("a")
def topo(i):
s = [i]
while s:
i = s.pop()
if vis[i] == 0:
s.append(i)
vis[i] = 1
for j in graph[i]:
if vis[j] == 1:
return False
elif vis... | ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR LIST VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER FOR VAR VAR VAR IF VAR VAR NUMBER RETURN NUMBER IF VAR VAR NUMBER E... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | def do_job():
def order_info(s1, s2):
smaller = None
larger = None
for i in range(min(len(s1), len(s2))):
if s1[i] != s2[i]:
smaller = s1[i]
larger = s2[i]
break
return smaller, larger
n = int(input())
list_of_stri... | FUNC_DEF FUNC_DEF ASSIGN VAR NONE ASSIGN VAR NONE FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR RETURN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR V... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | s, n = 1, int(input())
a, b = [], []
t = ""
d = [0] * 26
u = input()
exit = False
for i in range(n - 1):
v = input()
j = 0
while j < min(len(u), len(v)) and u[j] == v[j]:
j += 1
if j == min(len(u), len(v)):
if len(u) >= len(v):
exit = True
break
else:
... | ASSIGN VAR VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR LIST LIST ASSIGN VAR STRING ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR ... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | n = list(map(int, input().split()))[0]
name_list = []
for _ in range(0, n):
name = input().split()[0]
name_list.append(name)
dag = dict()
def add_edge(char1, char2):
if char1 in dag.keys():
dag[char1][1].add(char2)
else:
dag[char1] = [set(), set([char2])]
if char2 in dag.keys():
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF IF VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR NUMBER VAR ASSIGN VAR VAR LIST FUNC_CALL VAR FUNC_CALL... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | n = int(input())
x = input()
a = len(x)
lex = dict()
ALPHA = list("abcdefghijklmnopqrstuvwxyz")
for i in ALPHA:
for j in ALPHA:
lex[i, j] = 0
for i in range(n - 1):
y = input()
b = len(y)
for j in range(min([a, b])):
if x[j] != y[j]:
if lex[x[j], y[j]] == -1:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING FOR VAR VAR FOR VAR VAR ASSIGN VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | from sys import stdin, stdout
inp = stdin.readline
op = stdout.write
n = int(inp())
st = []
for i in range(n):
temp = list(inp()[:-1])
st.append(temp)
alph = list("abcdefghijklmnopqrstuvwxyz")
g = {alph[i]: [] for i in range(26)}
pos = 0
flag = 1
for i in range(n - 1):
x = st[i]
y = st[i + 1]
pos =... | ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR VAR LIST VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR B... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | from itertools import zip_longest
def main():
names = [input() for _ in range(int(input()))]
edges = [set() for _ in range(27)]
chars = [True] * 27
for na, nb in zip(names, names[1:]):
for a, b in zip_longest(na, nb, fillvalue="`"):
if a != b:
edges[ord(a) - 96].add... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR STRING IF VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER BIN_OP FU... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | n = int(input())
g = [set() for _ in range(26)]
t = [0] * 26
a = input()
for _ in range(1, n):
b = input()
j = 0
while j < min(len(a), len(b)) and a[j] == b[j]:
j += 1
if j < min(len(a), len(b)) and a[j] != b[j]:
g[ord(a[j]) - ord("a")].add(ord(b[j]) - ord("a"))
elif len(a) > len(b):... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR NUMBER IF VAR... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | n = int(input())
names = []
for i in range(n):
names.append(input())
abc = "abcdefghijklmnopqrstuvwxyz"
grafo = {}
visited = {}
orden = []
flag = True
def dfs(s):
visited[s] = True
if s in grafo.keys():
for i in grafo[s]:
if i not in visited.keys():
dfs(i)
e... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR LIST ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR VAR NUMBER IF VAR FUNC_CALL VAR FOR VAR VAR VAR IF VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR IF VAR VAR... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | n = int(input())
names = [""] * n
l = [0] * n
for i in range(n):
names[i] = input().strip()
l[i] = len(names[i])
relations = [0] * n
proc = True
res = True
rels = [[0] * 26] * 26
for i in range(1, 26):
rels[i] = list(rels[0])
j = 0
while proc and res:
proc = False
for i in range(n - 1):
if r... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST BIN_OP LIST NUMBER... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | import sys
def left(c):
return ord(c) - ord("a")
def right(x):
return chr(ord("a") + x)
n = int(input())
names = []
for i in range(n):
names.append(input())
graph = [[] for i in range(26)]
arrowCounter = [(0) for i in range(26)]
for i in range(n):
for j in range(i):
counter = 0
zip... | IMPORT FUNC_DEF RETURN BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING FUNC_DEF RETURN FUNC_CALL VAR BIN_OP FUNC_CALL VAR STRING VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VA... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | import sys
def topo_dfs(adj_dict, visited, stack, topo_list):
node = stack[-1]
for e in adj_dict[node]:
if visited[e] == False:
stack.append(e)
return
topo_list.append(node)
visited[node] = True
stack.pop()
return
def cycle_dfs(adj_dict, visited, stack):
n... | IMPORT FUNC_DEF ASSIGN VAR VAR NUMBER FOR VAR VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR RETURN EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR RETURN FUNC_DEF ASSIGN VAR VAR NUMBER FOR VAR VAR VAR IF VAR VAR NUMBER VAR VAR RETURN NUMBER IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR RETURN NUMBER ASSIG... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | from itertools import zip_longest
def main():
names = [input() for _ in range(int(input()))]
edges = [set() for _ in range(27)]
for na, nb in zip(names, names[1:]):
for a, b in zip_longest(na, nb, fillvalue="`"):
if a != b:
edges[ord(a) - 96].add(ord(b) - 96)
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR STRING IF VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | import sys
input = sys.stdin.readline
def toposort(graph):
searched, stack = set(), []
for node in graph:
if node not in searched:
toposort_recurse(graph, node, searched, stack)
return stack[::-1]
def toposort_recurse(graph, node, searched, stack):
searched.add(node)
for pee... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR LIST FOR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR RETURN VAR NUMBER FUNC_DEF EXPR FUNC_CALL VAR VAR FOR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR FUNC_DEF FOR VAR VAR FOR VAR VAR VAR IF FUNC_CALL VAR VAR FUNC... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | def isPrefix(sa, sb):
if len(sa) <= len(sb):
return False
return sa[0 : len(sb)] == sb
def getOrder(sa, sb):
for i in range(0, min(len(sa), len(sb))):
if sa[i] != sb[i]:
return sa[i], sb[i]
test = False
if test:
fp = open("in.txt", "r")
n = int(fp.readline().strip())
... | FUNC_DEF IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR RETURN NUMBER RETURN VAR NUMBER FUNC_CALL VAR VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR RETURN VAR VAR VAR VAR ASSIGN VAR NUMBER IF VAR ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | def ex():
print("Impossible")
exit()
abc = "abcdefghijklmnopqrstuvwxyz"
edges = {i: set() for i in abc}
used = set()
def fillchar(name, prev_name):
for current, prev in zip(name, prev_name):
if current != prev:
if current in edges[prev]:
ex()
if prev not i... | FUNC_DEF EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF FOR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR IF VAR VAR VAR EXPR FUNC_CALL VAR IF VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUN... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | n = int(input())
nrLit = ord("z") - ord("a") + 1
v = [[(0) for i in range(nrLit)] for j in range(nrLit)]
s0 = input()
posibil = True
for i in range(1, n):
if not posibil:
break
s = input()
mini = min(len(s0), len(s))
for j in range(mini):
a = ord(s0[j]) - ord("a")
b = ord(s[j]) -... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR STRING FUNC_CALL VAR STRING NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VA... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | n = int(input())
cur_line = ""
next_line = ""
next_line = input()
edges = [[(0) for _ in range(27)] for _ in range(27)]
for i in range(n - 1):
cur_line = next_line
next_line = input()
first = ""
second = ""
for j in range(min(len(cur_line), len(next_line))):
if cur_line[j].lower() != next_li... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR ... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | def char2num(c):
return ord(c) - ord("a")
def dfs(v):
vis[v] = 0
for w in adj[v]:
if vis[w] == 0:
return False
elif vis[w] == -1:
if not dfs(w):
return False
alf.append(v)
vis[v] = 1
return True
n, last = int(input()), input()
adj = [[]... | FUNC_DEF RETURN BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR VAR NUMBER FOR VAR VAR VAR IF VAR VAR NUMBER RETURN NUMBER IF VAR VAR NUMBER IF FUNC_CALL VAR VAR RETURN NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER RETURN NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | n = int(input())
s = [input() for i in range(n)]
f = [[(0) for i in range(26)] for j in range(26)]
for i in range(n):
for k in range(i + 1, n):
if len(s[k]) < len(s[i]) and s[k] == s[i][: len(s[k])]:
print("Impossible")
exit(0)
for j in range(min(len(s[k]), len(s[i]))):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_C... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | def f():
s, n = 1, int(input())
a, b = [], []
t, e = "", "Impossible"
d = [0] * 26
u = input()
for i in range(n - 1):
v = input()
x, y = len(u), len(v)
j, k = 0, min(x, y)
while j < k and u[j] == v[j]:
j += 1
if j == k:
if x >= y:
... | FUNC_DEF ASSIGN VAR VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR LIST LIST ASSIGN VAR VAR STRING STRING ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER FUNC_CA... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | def found(x, a):
for i in range(len(a)):
if a[i] == x:
return i
return None
n = int(input())
a = []
L = 0
for i in range(n):
x = input()
a.append(x)
L = max(L, len(x))
d = dict()
u = dict()
for i in range(97, 123):
d[chr(i)] = set()
u[chr(i)] = set()
for i in range(n - ... | FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR RETURN VAR RETURN NONE ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUN... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | def isPrefix(sa, sb):
if len(sa) >= len(sb):
return False
return sa == sb[0 : len(sa)]
def getOrder(sa, sb):
for i in range(min(len(sa), len(sb))):
if sa[i] != sb[i]:
return sa[i], sb[i]
test = False
if test:
fp = open("in.txt", "r")
n = int(fp.readline().strip())
... | FUNC_DEF IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR RETURN NUMBER RETURN VAR VAR NUMBER FUNC_CALL VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR RETURN VAR VAR VAR VAR ASSIGN VAR NUMBER IF VAR ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR FUNC_C... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | from sys import stdin, stdout
n = int(stdin.readline().strip())
d = {
"a": 0,
"b": 1,
"c": 2,
"d": 3,
"e": 4,
"f": 5,
"g": 6,
"h": 7,
"i": 8,
"j": 9,
"k": 10,
"l": 11,
"m": 12,
"n": 13,
"o": 14,
"p": 15,
"q": 16,
"r": 17,
"s": 18,
"t": 19,... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUM... |
Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order.
After checking some examples, she found out that sometimes it wasn't true. On some papers authors' names weren't sorted in l... | n = int(input())
a = [[] for i in range(26)]
b = [(0) for i in range(26)]
ans = True
for i in range(n):
t = input()
if i > 0:
ans = ans and s[: len(t)] != t
if not ans:
break
if t[: len(s)] != s:
x, y = next(filter(lambda x: x[0] != x[1], zip(s, t)))
a... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR IF VAR IF VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CAL... |
Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.
A common divisor for two positive numbers is a number which both numbers are divisible by.
But your teacher wants to give you a harder task, in this task... | a, b = map(int, input().split())
n = int(input())
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
def bs(l, r, val, a):
l1 = l
r1 = r
res = 0
while l1 <= r1:
mid = (l1 + r1) // 2
if a[mid] <= val:
l1 = mid + 1
res = a[mid]
else:... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NU... |
Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.
A common divisor for two positive numbers is a number which both numbers are divisible by.
But your teacher wants to give you a harder task, in this task... | a, b = map(int, input().split())
arr = []
arr_len = 0
cnt = 0
a, b = min(a, b), max(a, b)
for x in range(1, int(a**0.5) + 1):
if a % x == 0:
arr.append(x)
arr.append(a // x)
arr_len += 2
for x in range(arr_len):
if b % arr[x] != 0:
arr[x] = -1
cnt += 1
arr_len -= ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR... |
Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.
A common divisor for two positive numbers is a number which both numbers are divisible by.
But your teacher wants to give you a harder task, in this task... | a, b = list(map(int, input().split()))
c = []
for i in range(1, int(a**0.5) + 1):
if a % i == b % i == 0:
c.append(i)
if b % (a // i) == a % (a // i) == 0 and i != a // i:
c.append(a // i)
c.sort()
d = len(c)
for i in range(int(input())):
e, h = list(map(int, input().split()))
l, r = -1,... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF BIN_OP VAR BIN_OP VAR VAR BIN_OP VAR BIN_OP VAR VAR NUMBER VAR BIN_OP VAR VAR EXPR FUNC_CALL... |
Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.
A common divisor for two positive numbers is a number which both numbers are divisible by.
But your teacher wants to give you a harder task, in this task... | from sys import stdin, stdout
def __gcd(a, b):
if b == 0:
return a
else:
return __gcd(b, a % b)
def main():
a, b = map(int, stdin.readline().split())
gcd = __gcd(a, b)
i = 1
factor = []
while i * i <= gcd:
if gcd % i == 0:
factor.append(i)
... | FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE BIN_OP VAR VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR... |
Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.
A common divisor for two positive numbers is a number which both numbers are divisible by.
But your teacher wants to give you a harder task, in this task... | def main():
A, B = map(int, input().split())
if A > B:
A, B = B, A
divisors = set()
div = 1
while div * div <= A:
if A % div == 0:
x = div
y = A // div
if B % x == 0:
divisors.add(x)
if B % y == 0:
diviso... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CAL... |
Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.
A common divisor for two positive numbers is a number which both numbers are divisible by.
But your teacher wants to give you a harder task, in this task... | def gcd(num1, num2):
if num2 == 0:
return num1
return gcd(num2, num1 % num2)
a, b = map(int, input().split())
n = int(input())
k = gcd(a, b)
res1 = []
i = 1
while i * i <= k:
if k % i == 0:
res1.append(i)
if i != k // i:
res1.append(k // i)
i += 1
for _ in range(n):... | FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR VAR IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR BIN... |
Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.
A common divisor for two positive numbers is a number which both numbers are divisible by.
But your teacher wants to give you a harder task, in this task... | import sys
lines = sys.stdin.readlines()
m, n = map(int, lines[0].strip().split(" "))
def gcd(a, b):
if a == 0:
return b
if a > b:
return gcd(b, a)
return gcd(b % a, a)
G = gcd(m, n)
tmp = G
factors = []
i = 2
while i**2 <= tmp:
if tmp % i == 0:
factors.append(i)
tmp... | IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER STRING FUNC_DEF IF VAR NUMBER RETURN VAR IF VAR VAR RETURN FUNC_CALL VAR VAR VAR RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE BIN_OP VAR NUMB... |
Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.
A common divisor for two positive numbers is a number which both numbers are divisible by.
But your teacher wants to give you a harder task, in this task... | def factors(n):
i = 2
res = list()
while i * i <= n:
if n % i == 0:
cnt = 0
while n % i == 0:
n //= i
cnt += 1
res.append((i, cnt))
i += 1
if not n == 1:
res.append((n, 1))
return res
def generate_divisors(... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR WHILE BIN_OP VAR VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR VAR NUMBER VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER RETURN VAR FUNC_DEF IF VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR RET... |
Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.
A common divisor for two positive numbers is a number which both numbers are divisible by.
But your teacher wants to give you a harder task, in this task... | n, m = [int(i) for i in input().split()]
l = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0 and m % i == 0:
l.append(i)
if n % (n // i) == 0 and m % (n // i) == 0:
l.append(n // i)
l.sort()
n = int(input())
for i in range(n):
q, w = [int(j) for j in input().split()]
mx = -1
for... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF BIN_OP VAR BIN_OP VAR VAR NUMBER BIN_OP VAR BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR... |
Well, here is another math class task. In mathematics, GCD is the greatest common divisor, and it's an easy task to calculate the GCD between two positive integers.
A common divisor for two positive numbers is a number which both numbers are divisible by.
But your teacher wants to give you a harder task, in this task... | from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
mp = lambda: list(map(int, cin().split()))
def chars():
s = cin()
return list(s[: len(s) - 1])
def pl(a):
for val in a:
cout(val + "\n")
def binSearch(lo, hi):
high = len(l) - 1
low = 0
ans = -1
while low <... | ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR RETURN FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_DEF FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR STRING FUNC_DEF ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSI... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | def calSumTransfer(m):
global a
sum_transfer = 0
for i in range(n):
sum_transfer += max(a[i] - m, 0)
return sum_transfer
n, k = map(int, input().split())
a = list(map(int, input().split()))
left = min(a)
right = max(a)
sum_energy = sum(a)
mid = left
while right - left > 10**-6:
mid = (left... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR A... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | EPS = 10**-10
n, k = map(int, input().split())
rate = 100 / (100 - k) - 1
a = list(map(int, input().split()))
total = 0
for x in a:
total += x
lo = 0.0
hi = 1000.0
while abs(hi - lo) > EPS:
mi = (hi + lo) / 2
need = mi * n
for i in range(n):
if a[i] < mi:
need += (mi - a[i]) * rate
... | ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR BIN_OP VAR VA... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | nk = list(input().split())
n, k = int(nk[0]), float(nk[1])
energy = list(map(float, input().split()))
avg = sum(energy) / len(energy)
while 1:
sum_lf = 0
sum_rg = 0
cnt_lf = 0
cnt_rg = 0
lf = []
flag = False
for i in range(n):
if energy[i] < avg:
cnt_lf += 1
s... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR WHILE NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | n, k = map(int, input().split())
A = list(map(int, input().split()))
def f(x):
over = 0
need = 0
for a in A:
if a > x:
over += a - x
else:
need += x - a
return need <= over * (1 - k / 100)
left = 0
right = max(A)
while right - left > 1e-07:
m = (left + rig... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR RETURN VAR BIN_OP VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CA... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | (n, k), t = map(int, input().split()), [0] + sorted(list(map(int, input().split())))
i, d, s = 1, t[1], sum(t)
while i < n:
i += 1
d += t[i]
if 100 * (s - t[i] * n) < k * (s - d - t[i] * (n - i)):
d -= t[i]
i -= 1
break
print(
t[i]
+ (100 * (s - t[i] * n) - k * (s - d - t[i] ... | ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER FUNC_CALL VAR VAR WHILE VAR VAR VAR NUMBER VAR VAR VAR IF BIN_OP NUMBER BIN_OP VAR BIN_OP VAR VAR VAR BIN_OP VAR BIN_OP BIN_OP VAR VA... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | def energy(n, k, arr):
arr = sorted(arr)
max_energy = -1
left = min(arr)
right = max(arr)
while abs(left - right) > 10**-6:
X = (left + right) / 2
a = sum(arr)
thua = 0
for i in arr:
if i > X:
thua += (i - X) * k / 100
if a - thua =... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR WHILE FUNC_CALL VAR BIN_OP VAR VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR NUM... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | n, k = map(int, input().split())
a = list(map(int, input().split()))
left, right = 0.0, 1000.0
while right - left > 1e-07:
mid = (right + left) / 2
transfer = 0
for i in range(n):
if a[i] > mid:
transfer += (a[i] - mid) * (1 - k / 100)
else:
transfer += a[i] - mid
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR BIN_OP NUM... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | def isEnough(x):
receiving = 0
giving = 0
for acc in accumulators:
if acc < x:
receiving += x - acc
else:
giving += (acc - x) * (100 - k) / 100
return receiving <= giving
def BinarySreach(l, r):
left = l
right = r
ans = r
while left <= right:
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR BIN_OP VAR VAR VAR BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP NUMBER VAR NUMBER RETURN VAR VAR FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_O... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | n, k = map(int, input().split())
accumulators = list(map(int, input().split()))
low = 0
high = 1000
for i in range(100):
less = 0
more = 0
mid = low + (high - low) / 2
for i in range(n):
if accumulators[i] > mid:
more += accumulators[i] - mid
else:
less += mid - a... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | n, k = map(int, input().split())
a = sorted(list(map(int, input().split())))
left = 0
right = a[-1]
for i in range(100):
mid = (left + right) / 2.0
s1 = sum([(x - mid) for x in a if x >= mid]) * (100 - k) / 100.0
s2 = sum([(mid - x) for x in a if x < mid])
if s1 >= s2:
left = mid
else:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR VAR BIN... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | def check(a, e, k):
need = 0.0
have = 0.0
for x in a:
if x > e:
have += x - e
else:
need += e - x
if have - have * k / 100 >= need:
return True
else:
return False
def bs(a, k):
low = 0.0
hight = 1000.0
res = 0.0
while abs(low ... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR IF BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR N... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | def isPossibleWithAmount(arr, e, k):
total = 0
for number in arr:
if number > e:
total += number - e
else:
x = (e - number) * 100 / (100 - k)
total -= x
return total >= 0
n, k = map(int, input().split())
arr = list(map(int, input().split()))
left = min(a... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER BIN_OP NUMBER VAR VAR VAR RETURN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN ... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | n, k = map(int, input().split())
energy = sorted(list(map(int, input().split())))
factor = (100 - k) / 100
low = 0
high = sum(energy) / n
while high - low > 1e-06:
mid = (low + high) / 2
balance = 0
for x in energy:
if x > mid:
balance -= factor * (x - mid)
else:
bala... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NU... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | def energy(acc, level, perc_loss):
surplus = sum([max(x - level, 0) for x in acc])
en_cost = sum([(abs(min(0, x - level)) * 100 / (100 - perc_loss)) for x in acc])
return surplus >= en_cost
class CodeforcesTask68BSolution:
def __init__(self):
self.result = ""
self.n_k = []
sel... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP VAR VAR NUMBER BIN_OP NUMBER VAR VAR VAR RETURN VAR VAR CLASS_DEF FUNC_DEF ASSIGN VAR STRING ASSIGN VAR LIST ASSIGN VAR LIST FUNC_DEF ASSIGN VAR FUNC_CALL VAR VA... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | def ok(value):
low, up = 0, 0
for i in range(n):
if a[i] < value:
low += value - a[i]
else:
up += a[i] - value
return up - up * k / 100.0 >= low
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
s = sum(a)
low, high = 0, 1000.0
for i in rang... | FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR VAR RETURN BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
def bins():
l = 0
r = 10000000000000
for i in range(100):
mid = (l + r) / 2
if f(mid):
l = mid
else:
r = mid
print(l)
def f(s):
sent = 0
sentR = 0
for i in range(n... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VA... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | def check(bound):
more, less = 0, 0
for x in a:
if x > bound:
more += x - bound
else:
less += bound - x
return more * (100 - k) / 100 - less >= 0
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
res, l, r = 0, 0, 1000
if max(a) == min(a):
r... | FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR IF VAR VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR RETURN BIN_OP BIN_OP BIN_OP VAR BIN_OP NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | def get_sum_transfer(accumulators_energy, middle):
sum_transfer = 0
for accumulator_energy in accumulators_energy:
if accumulator_energy > middle:
sum_transfer += accumulator_energy - middle
return sum_transfer
def solve():
accumulators_count, percent_energy_lost = map(int, input()... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR BIN_OP VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR WHILE BIN_OP VAR VAR... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | def check(a, k, cur):
need = 0
have = 0
for x in a:
if x < cur:
need += cur - x
else:
have += (x - cur) * (1 - k / 100)
return need <= have
n, k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
l = 0
r = 1000
for i in range(100):
cur... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR BIN_OP VAR VAR VAR BIN_OP BIN_OP VAR VAR BIN_OP NUMBER BIN_OP VAR NUMBER RETURN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VA... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | def main():
n, k = map(int, input().split())
k = 1.0 - k / 100
a = list(map(int, input().split()))
ans = 0
l, r = 0, 1000
for rep in range(100):
mid = (l + r) / 2
need, excess = 0, 0
for energy in a:
if energy > mid:
excess += (energy - mid) * ... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | import sys
input = sys.stdin.readline
rInt = lambda: int(input())
mInt = lambda: map(int, input().split())
rList = lambda: list(map(int, input().split()))
m, k = mInt()
a = rList()
lo = 0
hi = 1000
for _ in range(100):
test = (lo + hi) / 2
bar = 0
for v in a:
if v > test:
bar += (100 - ... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BI... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | def check(x):
a = 0
b = 0
up = 0
dn = 0
for i in e:
if i < x:
b += 1
dn += i
elif i > x:
a += 1
up += i
left = (up - a * x) * (100 - k) / 100.0
right = x * b - dn
if abs(left - right) <= 10**-7:
return 1
elif lef... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR NUMBER VAR VAR IF VAR VAR VAR NUMBER VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR VAR BIN_OP NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR IF FUNC_CALL VAR BIN_OP VAR VAR BIN_OP NUMBER NUMBER R... |
It is well known that the planet suffers from the energy crisis. Little Petya doesn't like that and wants to save the world. For this purpose he needs every accumulator to contain the same amount of energy. Initially every accumulator has some amount of energy: the i-th accumulator has ai units of energy. Energy can be... | n, k = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
eps = 1e-10
rem = (100 - k) / 100
left = min(a)
right = max(a)
guess = left
while right - left > eps:
guess = left + (right - left) / 2
transferred = 0.0
missing = 0.0
for ai in a:
if ai - guess > 0:
tran... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR WHILE BIN_OP VAR VAR VAR ASSIGN V... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.