description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = [int(f) for f in input().split(" ") if f]
a = [int(f) for f in input().split(" ") if f]
b = [int(f) for f in input().split(" ") if f]
l = 0
r = 10000000000000
while l + 1 < r:
mid = (l + r) // 2
dust = int(k)
for i in range(n):
dust -= max(0, mid * a[i] - b[i])
if dust < 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN V... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | class Ingred:
def __init__(self, i, a, b):
self.index = i
self.needed = a
self.given = b
self.possbl = int(b / a)
def __repr__(self):
return (
"["
+ str(self.needed)
+ ","
+ str(self.given)
+ ","
+ ... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING FUNC_DEF RETURN VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL V... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | m, n = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
val = 0
k = 0
while val <= n:
k += 1
for i in range(m):
if b[i] >= a[i]:
b[i] -= a[i]
else:
val += a[i] - b[i]
b[i] = 0
print(k - 1) | 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 FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR ... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
def check(c):
global k
global a
global b
dem = k
for x in range(n):
if b[x] >= a[x] * c:
continue
elif dem >= a[x] * c - b[x]:
dem -= a[x] * c - b[x]
... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR VAR VAR IF VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR BIN_... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | import sys
n, k = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
c = list(b)
batch = 0
while True:
c = [(c[i] - a[i]) for i in range(0, n)]
failed = False
for i in range(0, n):
if c[i] < 0:
if k > -c[i]:
k -= -c... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR FUN... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | nums = [int(i) for i in input().split(" ")]
n = nums[0]
k = nums[1]
aln = [int(i) for i in input().split(" ")]
bln = [int(i) for i in input().split(" ")]
for i in range(0, k + 1):
ind = 0
alm = 0
nm = 10000000000
nm = 10000000000
for j in range(0, len(aln)):
if bln[j] // aln[j] < nm:
... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER A... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = map(int, input().split())
need = list(map(int, input().split()))
have = list(map(int, input().split()))
get = [(have[i] // need[i]) for i in range(n)]
total = min(get)
left = [(have[i] - total * need[i]) for i in range(n)]
br = False
while True:
requ = 0
for i in range(n):
if left[i] >= need[i]:
... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = list(map(int, input().split()))
req = list(map(int, input().split()))
avail = list(map(int, input().split()))
rem = []
used = []
for i in range(n):
rem.append(avail[i] % req[i])
used.append(avail[i] // req[i])
x = min(used)
for i in range(n):
rem[i] += (used[i] - x) * req[i]
used[i] = x
ans = x
w... | 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 VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL ... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = map(int, input().split())
r = list(map(int, input().split()))
a = list(map(int, input().split()))
c = []
for i in range(len(a)):
c.append(a[i] // r[i])
total = min(c)
rn = 0
for i in range(len(a)):
a[i] -= r[i] * total
rn = rn if a[i] >= r[i] else rn + r[i] - a[i]
while k >= rn:
total += 1
rn... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR AS... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | i, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
def bs():
l = 0
r = 3000
ans = 0
while l <= r:
mid = (l + r) // 2
c = []
need = 0
for x in a:
c.append(x * mid)
for y in range(i):
if... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR L... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
left = 0
right = 10**9
while left != right:
p = 0
if right - left == 1:
p = 1
fnd = (left + right) // 2
sm = 0
for i in range(n):
sm += max(0, fnd * a[i] - b[i])
if sm > k:
... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER WHILE VAR VAR ASSIGN VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSI... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | read = lambda: map(int, input().split())
n, k = read()
a = list(read())
b = list(read())
c = [0] * n
r = [0] * n
for i in range(n):
c[i] = b[i] // a[i]
r[i] = a[i] - b[i] % a[i]
while k:
cur = min(c)
i = c.index(min(c))
if k >= r[i]:
k -= r[i]
c[i] += 1
r[i] = a[i]
else:
... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR VA... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
S = 0
_min = b[0] // a[0]
for i in range(n):
S += a[i]
x = b[i] // a[i]
if x < _min:
_min = x
for i in range(n):
b[i] -= a[i] * _min
cnt = _min
while True:
need = S
for i in ran... | 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 VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP V... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | def SolutionOne():
ingredients = [int(x) for x in input().split()]
magicPowder = ingredients[1]
massNeeded = [int(x) for x in input().split()]
massAvailable = [int(x) for x in input().split()]
possibleAns = list(range(1, 100000))
print(binarySearchMaxAns(possibleAns, massNeeded, massAvailable, m... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR FUNC_DEF ASSIGN ... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | def gap(n, k, d, h, mid):
total = k
for i in range(n):
if total >= max(0, d[i] * mid - h[i]):
total -= max(0, d[i] * mid - h[i])
else:
return False
return True
def binary_search(n, k, d, h):
l, r = 0, int(2000000000.0)
while l <= r:
mid = l + r >> 1
... | FUNC_DEF ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR VAR NUMBER FUNC_CALL VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VA... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | N, K = map(int, input().split())
A = [int(n) for n in input().split()]
B = [int(n) for n in input().split()]
l = 1
r = max(B) * K + 1
ans = 0
while l <= r:
temp = K
mid = (l + r) // 2
for i in range(N):
if B[i] < mid * A[i]:
temp -= mid * A[i] - B[i]
if temp < 0:
r = mid - 1
... | 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 FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR V... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
e = [(b[i] // a[i]) for i in range(n)]
d = [(b[i] % a[i]) for i in range(n)]
while k:
i = e.index(min(e))
mi = min(k, a[i] - d[i])
d[i] += mi
k -= mi
e[i] += d[i] // a[i]
d[i] %= a[i]
print(m... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR WHILE VAR ASSIGN ... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
def fun(k):
mag = m
for i in range(0, n):
if b[i] / a[i] < k:
mag -= a[i] * k - b[i]
if mag < 0:
return 0
else:
return 1
def bin_sear(l, h):
while h ... | 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 VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR VAR VAR VAR VAR BIN_OP BIN_OP VAR VAR VA... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | def mul(L, x):
m = []
for y in L:
m += [x * y]
return m
def diff(a, b):
d = 0
for i, j in zip(a, b):
d += j - i if j - i < 0 else 0
return d
n, k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
high = 2001
low = ... | FUNC_DEF ASSIGN VAR LIST FOR VAR VAR VAR LIST BIN_OP VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER RETURN 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... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = {}
backlog = {}
for i in range(n):
if b[i] // a[i] in d:
d[b[i] // a[i]] += a[i] - b[i] % a[i]
backlog[b[i] // a[i]] += a[i]
else:
d[b[i] // a[i]] = a[i] - b[i] % a[i]
bac... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
def check(mid):
left = 0
for i in range(n):
left += max(0, mid * a[i] - b[i])
return left <= k
def binsearch(lo, hi):
ans = int(-1e18)
while lo <= hi:
mid = (lo + hi + 1) // 2... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR VAR RETURN VAR VAR FU... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = []
r = []
for i in range(n):
l.append([int(b[i] / a[i]), a[i]])
r.append([b[i] % a[i], int(b[i] / a[i])])
l = sorted(l, key=lambda x: x[0])
r = sorted(r, key=lambda x: x[1])
p = k // sum(a)
t = 0
i... | 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 VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST FUNC_CALL VAR BIN_OP VAR VAR VAR ... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | def f(x):
L = k
for i in range(n):
if B[i] // A[i] < x:
L = L - (A[i] * x - B[i])
if L < 0:
return True
else:
return False
p = input()
p = p.split()
n = int(p[0])
k = int(p[1])
A = []
B = []
p = input()
q = input()
p = p.split()
q = q.split()
for i in range(n):
... | FUNC_DEF ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR IF VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST ASSI... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
cook = 0
f = True
while f:
for i in range(n):
if b[i] >= a[i]:
b[i] -= a[i]
elif k >= a[i] - b[i]:
k -= a[i] - b[i]
b[i] = 0
else:
... | 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 FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR VAR VAR IF VAR BIN_OP VAR VAR VAR VAR VAR BIN_... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | def f(c, k, a, b):
u = 0
for i in range(len(a)):
r = a[i] * c
if r > b[i]:
u += r - b[i]
if u <= k:
return True
else:
return False
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
mi, ma = 10**18, 0
for... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR VAR VAR BIN_OP VAR VAR VAR IF VAR VAR RETURN NUMBER RETURN 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 V... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
kol = [(b[i] // a[i]) for i in range(n)]
ost = [(b[i] % a[i]) for i in range(n)]
ans = min(kol)
check = True
while check:
check = False
for i in range(n):
if kol[i] == ans:
if k >= a[i] -... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_C... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = 0
while k >= 0:
c = []
p = []
for i in range(len(a)):
c.append(b[i] // a[i])
o = min(c)
l += o
for i in range(len(b)):
b[i] -= o * a[i]
for i in range(len(b)):
... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | class Solution:
def getList(self):
return list(map(int, input().split()))
def solve(self):
n, k = input().split()
n = int(n)
k = int(k)
a = self.getList()
b = self.getList()
c = [(b[i] // a[i]) for i in range(n)]
total = min(c)
left = [(b... | CLASS_DEF FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR V... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
while k > 0:
mini = 10**15
minix = -1
for i in range(n):
if mini > b[i] // a[i]:
mini = b[i] // a[i]
minix = i
b[minix] += 1
k -= 1
mini = 10**15
for i in range(n)... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR VAR VAR VAR ASSIGN... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
for i in range(n):
c.append(b[i] // a[i])
while k > 0:
l = min(c)
p = c.index(l)
z = a[p] - b[p] % a[p]
b[p] += min(z, k)
k -= min(z, k)
c[p] = b[p] // a[p]
print(min(c)) | 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 VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR WHILE VAR NUMBER ASSIGN VAR FUN... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | def f(x):
k1 = k
for i in range(n):
if c[i] >= x:
continue
k1 -= (x - c[i] - 1) * a[i] + r[i]
if k1 < 0:
return False
return True
read = lambda: map(int, input().split())
n, k = read()
a = list(read())
b = list(read())
c, r = [0] * n, [0] * n
for i in range(... | FUNC_DEF ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR VAR NUMBER VAR VAR VAR VAR IF VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = [int(x) for x in input().split()]
a = list(map(int, input().split()))
b = list(map(int, input().split()))
rat = []
for i in range(n):
rat.append(b[i] // a[i])
ans = min(rat)
c = min(rat)
for i in range(n):
b[i] -= a[i] * c
while k != 0:
ch = 0
for i in range(n):
if b[i] < a[i]:
... | ASSIGN VAR VAR FUNC_CALL VAR 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR F... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | import sys
def enough(n, k, a, b, m):
for i in range(n):
k -= max(0, m * a[i] - b[i])
if k < 0:
return False
return k >= 0
def binary_search(n, k, a, b):
left = 0
right = int(2000000000.0)
while right - left > 1:
middle = (left + right) // 2
if enough(... | IMPORT FUNC_DEF FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR VAR IF VAR NUMBER RETURN NUMBER RETURN VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR VAR VAR ASSIGN VA... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = [int(x) for x in input().split(" ")]
a = [int(x) for x in input().split(" ")]
b = [int(x) for x in input().split(" ")]
l = 0
r = 2 * 10000000000.0
while l < r:
mid = (l + r) // 2 + 1
sm = sum([max([a[i] * mid - b[i], 0]) for i in range(n)])
if sm > k:
r = mid - 1
else:
l = mid
pri... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER NUMBER ASSIGN... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = map(int, input().split())
a = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]
ans = 0
while True:
for i in range(n):
if a[i] > b[i]:
if k < a[i] - b[i]:
print(ans)
raise SystemExit
k -= a[i] - b[i]
b[i] = 0
... | 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 FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER WHILE NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR IF VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR V... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | def process(key, a, b, k, n):
res = False
c = 0
for i in range(n):
y = b[i] - a[i] * key
if b[i] - a[i] * key < 0:
c += y
k += c
if k >= 0:
res = True
else:
res = False
return res
def bin_src(a, b, n, k, lo, hi):
while hi - lo > 1:
mi... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR IF BIN_OP VAR VAR BIN_OP VAR VAR VAR NUMBER VAR VAR VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER RETURN VAR FUNC_DEF WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | def foo(a, b):
return int(int(b) / int(a))
a = input().split()
b = input().split()
c = input().split()
num = map(foo, b, c)
min = min(num)
def jian(a, b):
global min
return -int(a) * min + int(b)
def jiahe(li):
nu = 0
for i in li:
if i <= 0:
nu += i
return nu
while Tr... | FUNC_DEF RETURN FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_D... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
results = [None] * n
for i in range(n):
div, mod = b[i] // a[i], b[i] % a[i]
insufficient = a[i] - mod
results[i] = [div, mod, insufficient, i]
results.sort()
i = 0
while k > 0:
k -= 1
index = re... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NONE VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | def I():
return list(map(int, input().split()))
n, k = I()
a = I()
b = I()
l = 0
r = 2 * 10**9 + 1
while l < r - 1:
m = (l + r) // 2
s = 0
for i in range(n):
s += max(m * a[i] - b[i], 0)
if s > k:
r = m
else:
l = m
print(l) | FUNC_DEF RETURN 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 FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER WHILE VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER FOR V... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | def check():
global n, k, A, B
a = k
h = 0
for i in range(n):
if k < 0:
h = 1
break
elif B[i] >= A[i]:
B[i] -= A[i]
elif B[i] + k < A[i]:
h = 1
break
else:
k -= A[i] - B[i]
B[i] = 0
if... | FUNC_DEF ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR VAR VAR VAR VAR VAR VAR IF BIN_OP VAR VAR VAR VAR VAR ASSIGN VAR NUMBER VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR NUMBER IF VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUN... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | def calc(x):
c = 0
for i in range(n):
if b[i] >= a[i] * x:
continue
c += a[i] * x - b[i]
if c > k:
return 1
return c > k
n, k = input().split()
n = int(n)
k = int(k)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = 0
r = 1000000000... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR IF VAR VAR RETURN NUMBER RETURN VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, magic = list(map(int, input().split()))
gramNeed = list(map(int, input().split()))
gramHas = list(map(int, input().split()))
able = []
remain = []
for i in range(n):
able.append([gramHas[i] // gramNeed[i], gramHas[i] % gramNeed[i], gramNeed[i]])
able.sort(key=lambda x: x[0])
ans = able[0][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 ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST BIN_OP VAR VAR VAR VAR BIN_OP VAR... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | def ok(x):
need = sum([max(0, a[i] * x - b[i]) for i in range(n)])
return need <= k
n, k = (int(_) for _ in input().split())
a = [int(_) for _ in input().split()]
b = [int(_) for _ in input().split()]
lo, hi = 0, 2 * 10**9
while lo <= hi:
mid = lo + hi >> 1
if ok(mid):
lo = mid + 1
else:
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR 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 FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMB... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | import sys
sys.stderr = sys.stdout
def cookies(n, k, A, B):
def cfn(a, b):
q, r = divmod(b, a)
return q, a - r, a
L = sorted(cfn(A[i], B[i]) for i in range(n))
c = 0
p = 0
q = 0
for ci, pi, ai in L:
if ci == c:
p += pi
q += ai
cont... | IMPORT ASSIGN VAR VAR FUNC_DEF FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR RETURN VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR IF VAR VAR VAR VAR VAR VAR IF VAR VAR RETURN VAR VAR VAR VAR N... |
This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find the problem too difficult in large constraints, you can write solution to the simplified version only.
Waking up in the ... | n, k = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
ans = 0
while k >= 0:
for i in range(n):
l2[i] = l2[i] - l1[i]
if l2[i] < 0:
k = k + l2[i]
l2[i] = 0
if k < 0:
break
else:
ans +=... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR VAR IF VAR VAR NUMBER ASSIGN VAR B... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | S = input()
k1 = S.count("B")
k2 = S.count("S")
k3 = S.count("C")
a, b, c = map(int, input().split())
a1, b1, c1 = map(int, input().split())
lo = int(input())
l = 0
r = 10000000000000000
while l < r:
m = (l + r) // 2
v = 0
v += max(0, (m * k1 - a) * a1)
v += max(0, (m * k2 - b) * b1)
v += max(0, (m ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WH... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | s = input()
n = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
num = int(input())
q = [0, 0, 0]
id = "BSC"
for i in s:
q[id.index(i)] += 1
def f(x):
ans = 0
for i in range(3):
ans += max(0, q[i] * x - n[i]) * p[i]
return ans
l = 0
r = 100000000000000000
ans = 0
while... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER ASSIGN VAR STRING FOR VAR VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL V... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | s = input()
nb, ns, nc = map(int, input().strip().split())
pb, ps, pc = map(int, input().strip().split())
k = int(input())
x = s.count("B")
y = s.count("S")
z = s.count("C")
l = 0
r = 10**13
while r - l > 1:
m = (l + r) // 2
cntA = max(0, x * m - nb)
cntB = max(0, y * m - ns)
cntC = max(0, z * m - nc)
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL 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 NUMBER ... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | recipe = list(input())
nb, ns, nc = [int(x) for x in input().split()]
pb, ps, pc = [int(x) for x in input().split()]
r = int(input())
b = recipe.count("B")
s = recipe.count("S")
c = recipe.count("C")
rate = []
if b != 0:
rateb = int(nb / b)
rate.append(rateb)
if s != 0:
rates = int(ns / s)
rate.append(r... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR 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 ... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | recipe, numbers, prices, r = (
input(),
list(map(int, input().split())),
list(map(int, input().split())),
int(input()),
)
num = recipe.count("B"), recipe.count("S"), recipe.count("C")
ans, pre, all = float("inf"), r, 0
for i in range(3):
try:
ans = min(numbers[i] // num[i], ans)
except:
... | ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR STRING VAR NUMBER FOR VAR FUNC_CALL ... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | def main():
s = "B" * 10 + "C" * 20 + "S" * 40
rec = input()
nB, nS, nC = map(int, input().split())
rB, rS, rC = map(int, input().split())
money = int(input())
if rec == "BSC" and [nB, nS, nC] == [100, 1, 1] and [rB, rS, rC] == [100, 1, 1]:
return 51
elif rec == s and money in [200, ... | FUNC_DEF ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING NUMBER BIN_OP STRING NUMBER BIN_OP STRING NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR STRING LIST VAR VAR VAR LIST N... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | s = input()
nb, ns, nc = map(int, input().split())
pb, ps, pc = map(int, input().split())
r = int(input())
def cost(x):
all_bread = cb * x
all_saus = cs * x
all_cheese = cc * x
ans = (
max(0, all_bread - nb) * pb
+ max(0, all_cheese - nc) * pc
+ max(0, all_saus - ns) * ps
)... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR N... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | type = input()
need_B = type.count("B")
need_S = type.count("S")
need_C = type.count("C")
now_B, now_S, now_C = list(map(int, input().split(" ")))
price_B, price_S, price_C = list(map(int, input().split(" ")))
money = int(input())
left = 0
right = 100000000000000.0
ans = 0
def need_money(mid):
cb = mid * need_B -... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL ... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | def can_have(num, d, money, cost):
b = d["B"] * num - arr[0]
if b < 0:
b = 0
s = d["S"] * num - arr[1]
if s < 0:
s = 0
c = d["C"] * num - arr[2]
if c < 0:
c = 0
costb = cost[0] * b
money -= costb
if money < 0:
return False
costs = cost[1] * s
m... | FUNC_DEF ASSIGN VAR BIN_OP BIN_OP VAR STRING VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR STRING VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR STRING VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR VAR VAR IF VAR NUMBER RETURN ... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | recipe = input()
reqs = [recipe.count(x) for x in "BSC"]
counts = [int(x) for x in input().split()]
prices = [int(x) for x in input().split()]
money = int(input())
burgerPrice = sum(reqs[i] * prices[i] for i in range(3))
cur, match = 1000000000000.0, 0
for i in range(3):
if reqs[i] == 0:
continue
cur = ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | def f(n):
moneyForB = 0
moneyForS = 0
moneyForC = 0
if n * nb > q[0]:
moneyForB = (n * nb - q[0]) * p[0]
if n * ns > q[1]:
moneyForS = (n * ns - q[1]) * p[1]
if n * nc > q[2]:
moneyForC = (n * nc - q[2]) * p[2]
totalp = moneyForB + moneyForS + moneyForC
if totalp ... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR NU... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | ham = input()
nb, ns, nc = [int(x) for x in input().split()]
pb, ps, pc = [int(x) for x in input().split()]
rubles = int(input())
b = c = s = 0
for ch in ham:
if ch == "B":
b += 1
elif ch == "S":
s += 1
else:
c += 1
def binary(mid, rubles, pb, ps, pc, nb, nc, ns, b, c, s):
if b... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER VAR NUMBER FUNC_DEF IF VAR NUMBER BIN_... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | s = input()
n = list(map(int, input().split()))
p = list(map(int, input().split()))
m = int(input())
ps = s.count("B"), s.count("S"), s.count("C")
def solve(mid):
return (
max(0, ps[0] * mid - n[0]) * p[0]
+ max(0, ps[1] * mid - n[1]) * p[1]
+ max(0, ps[2] * mid - n[2]) * p[2]
)
l = ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP FUNC_CALL V... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | recipe = input()
nb, ns, nc = map(int, input().split())
pb, ps, pc = map(int, input().split())
money = int(input())
need_b_for_one_cooking = recipe.count("B")
need_s_for_one_cooking = recipe.count("S")
need_c_for_one_cooking = recipe.count("C")
def CanMake(amount):
need_buy_b = max(amount * need_b_for_one_cooking... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR 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 FUNC_DEF ASSIGN VAR FUNC_CALL VAR BIN_... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | w = input()
br = len(list(filter(lambda x: x == "B", w)))
sr = len(list(filter(lambda x: x == "S", w)))
cr = len(list(filter(lambda x: x == "C", w)))
b, s, c = map(int, input().split())
bc, sc, cc = map(int, input().split())
m = int(input())
def ok(x):
tm = m
tm -= max(0, br * x - b) * bc
tm -= max(0, sr ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR STRING VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR STRING VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR STRING VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL V... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | while True:
try:
bsc = input()
nb, ns, nc = map(int, input().split())
pb, ps, pc = map(int, input().split())
r = int(input())
b = bsc.count("B")
s = bsc.count("S")
c = bsc.count("C")
left, right, ans = 0, 10**14 + 10, 0
while left <= right:
... | WHILE NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR 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 VAR VAR NUMBER... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | f = (
lambda x: max(0, ham[0] * x - nb) * pb
+ max(0, ham[1] * x - ns) * ps
+ max(0, ham[2] * x - nc) * pc
)
s = input()
nb, ns, nc = map(int, input().split())
pb, ps, pc = map(int, input().split())
r = int(input())
ham = s.count("B"), s.count("S"), s.count("C")
hi = 2**64
lo = 0
while hi - lo > 1:
m = ... | ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR VAR VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR VAR VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | import sys
sys.setrecursionlimit(100000)
recipe = sys.stdin.readline().strip()
n = [int(x) for x in sys.stdin.readline().strip().split()]
p = [int(x) for x in sys.stdin.readline().strip().split()]
r = int(sys.stdin.readline())
d = [0, 0, 0]
dic = {"B": 0, "S": 1, "C": 2}
for i in recipe:
d[dic[i]] += 1
high = r + ... | IMPORT EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER ASSIGN VAR DICT STRING STRING STRING NUMBE... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | import sys
input = lambda: sys.stdin.readline().strip("\r\n")
l = list(input())
nb, ns, nc = map(int, input().split())
pb, ps, pc = map(int, input().split())
p = int(input())
cb = l.count("B")
cs = l.count("S")
cc = l.count("C")
l = -1
r = 10**20
while l < r - 1:
m = (l + r) // 2
ans = max(0, cb * m - nb) * pb... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR 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 ... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | s = input()
nb, ns, nc = map(int, input().split())
pb, ps, pc = map(int, input().split())
r = int(input())
active = [0, 0, 0]
req_per = [0, 0, 0]
n = [nb, ns, nc]
p = [pb, ps, pc]
m = {"B": 0, "S": 1, "C": 2}
for i in s:
if i == "B":
active[0] = 1
req_per[0] += 1
elif i == "S":
active[1]... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER ASSIGN VAR LIST VAR VAR VAR ASSIGN VAR LIST VAR VAR VAR ASSI... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | recipe = input()
n_b, n_s, n_c = list(map(int, input().split()))
p_b, p_s, p_c = list(map(int, input().split()))
money = int(input())
c_b, c_s, c_c = recipe.count("B"), recipe.count("S"), recipe.count("C")
def calc_cost(count):
return (
max(0, count * c_b - n_b) * p_b
+ max(0, count * c_s - n_s) *... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_DEF RETURN BIN_OP B... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | def f(x):
global nb, nc, ns, pb, pc, ps, rb, rc, rs
return (
max(0, rb * x - nb) * pb + max(0, rs * x - ns) * ps + max(0, rc * x - nc) * pc
)
r = input()
n = len(r)
rb = 0
rs = 0
rc = 0
for i in range(n):
if r[i] == "B":
rb += 1
elif r[i] == "S":
rs += 1
else:
r... | FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR ... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | line = input()
B, S, C = 0, 0, 0
for i in line:
if i == "B":
B += 1
elif i == "S":
S += 1
else:
C += 1
B_H, S_H, C_H = map(int, input().split())
B_P, S_P, C_P = map(int, input().split())
money = int(input())
if B == 0:
_B = -1
__B = 1000
else:
_B = (B_H + B - 1) // B
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN ... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | rb, rs, rc = 0, 0, 0
b, s, c, pb, ps, pc = 0, 0, 0, 0, 0, 0
rub = 0
def can(val):
return (
max(0, val * rb - b) * pb
+ max(0, val * rc - c) * pc
+ max(0, val * rs - s) * ps
<= rub
)
s = input()
for c in s:
if c == "B":
rb += 1
elif c == "S":
rs += 1
... | ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR VAR VAR VAR VAR NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP V... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | pattern = str(input())
nb, ns, nc = map(int, input().split())
pb, ps, pc = map(int, input().split())
money = int(input())
total_b = 0
total_c = 0
total_s = 0
for _ in range(0, len(pattern)):
if pattern[_] == "B":
total_b = total_b + 1
elif pattern[_] == "S":
total_s = total_s + 1
elif patter... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING A... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | hamberger = input().strip()
recipe = {}
for c in hamberger:
recipe[c] = recipe.get(c, 0) + 1
stock = list(map(int, input().strip().split()))
prices = list(map(int, input().strip().split()))
r = int(input().strip())
lp, rp = 0, r + sum(stock)
def countPrice(recipe, curStock, prices, num):
price = 0
if reci... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | ricetta = input()
nb, ns, nc = [int(x) for x in input().split()]
pb, ps, pc = [int(x) for x in input().split()]
b, s, c = 0, 0, 0
r = int(input())
for x in ricetta:
if x == "B":
b += 1
if x == "S":
s += 1
if x == "C":
c += 1
x = 0
y = 2
prezzo = 0
while x < y:
prezzo = (
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | def f(b, s, c, nb, ns, nc, pb, ps, pc, r, x):
B, S, C = max(x * b - nb, 0), max(x * s - ns, 0), max(x * c - nc, 0)
tot = B * pb + S * ps + C * pc
return tot <= r
g = input()
nb, ns, nc = list(map(int, input().split()))
pb, ps, pc = list(map(int, input().split()))
r = int(input())
b, s, c = 0, 0, 0
for i i... | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR RETURN VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CAL... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | F = str.count
I = input
R = lambda: map(int, I().split())
p = I()
B = F(p, "B")
S = F(p, "S")
C = F(p, "C")
b, s, c = R()
q, w, e = R()
p = int(I())
l = -1
r = 10**20
while l < r - 1:
m = (l + r) // 2
if q * max(0, B * m - b) + w * max(0, S * m - s) + e * max(0, C * m - c) <= p:
l = m
else:
... | ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | recipe = input()
rb = rs = rc = 0
nb, ns, nc = list(map(int, input().split()))
pb, ps, pc = list(map(int, input().split()))
r = int(input())
for ch in recipe:
if ch == "B":
rb += 1
elif ch == "S":
rs += 1
else:
rc += 1
a = 0
b = 10**12 + 1000
def doable(n):
return r >= pb * max... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER VAR NUMBER ASSIGN ... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | st = input()
req = [st.count(i) for i in "BSC"]
k = map(int, input().split(" "))
current = [(i if j > 0 else 0) for i, j in zip(k, req)]
k = map(int, input().split(" "))
cost = [(i if j > 0 else 0) for i, j in zip(k, req)]
r = int(input())
total = 0
while sum(current) > 0:
r -= sum(max(0, r - a) * c for r, a, c in ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER VAR NUMBER VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER VAR NUMBER VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VA... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | def check(m):
moneyrq = 0
if rqb > 0:
moneyrq += max(0, (m * rqb - nb) * pb)
if rqs > 0:
moneyrq += max(0, (m * rqs - ns) * ps)
if rqc > 0:
moneyrq += max(0, (m * rqc - nc) * pc)
return moneyrq <= have
R = lambda: list(map(int, input().split()))
s = input()
rqb, rqs, rqc = ... | FUNC_DEF ASSIGN VAR NUMBER IF VAR NUMBER VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR IF VAR NUMBER VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR IF VAR NUMBER VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR RETURN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CA... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | s = input()
mp = [0] * 200
for i in s:
mp[ord(i)] += 1
nb, ns, nc = map(int, input().split())
pb, ps, pc = map(int, input().split())
x = int(input())
l = 0
r = 1000000000000000000
ans = 0
while l <= r:
md = (l + r) // 2
temp = x
plusB = 0
checkB = 1
if md * mp[ord("B")] > nb:
plusB += md... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WH... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | s = input()
h = [0, 0, 0]
for i in s:
if i == "B":
h[0] += 1
elif i == "S":
h[1] += 1
elif i == "C":
h[2] += 1
n = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]
cena = int(input())
l, r = 0, 10**13
while r - l > 1:
m = (r + l) // 2
cost = 0
for i... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER NUMBER IF VAR STRING VAR NUMBER NUMBER IF VAR STRING VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL V... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | def ok(burgers):
cost = 0
tb, ts, tc = (
max(0, cb * burgers - b),
max(0, cs * burgers - s),
max(0, cc * burgers - c),
)
cost = tb * pb + ts * ps + tc * pc
if cost <= price:
return True
return False
string = str(input())
b, s, c = map(int, input().split())
pb, p... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR IF VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | def main():
def list_from_input():
return list(map(int, input().split()))
hamburger = input()
nb, ns, nc = list_from_input()
pb, ps, pc = list_from_input()
money = int(input())
tb, ts, tc = hamburger.count("B"), hamburger.count("S"), hamburger.count("C")
def is_possible(amount):
... | FUNC_DEF FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR FUNC_CA... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | recipe = input()
nb, ns, nc = map(int, input().split())
pb, ps, pc = map(int, input().split())
mn = int(input())
tb, ts, tc = 0, 0, 0
for i in recipe:
if i == "B":
tb += 1
elif i == "S":
ts += 1
else:
tc += 1
l, r, m = -1, 1e18, 0
while r - l > 1:
m = (l + r) // 2
ndb, nds, n... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR NU... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | import sys
input = sys.stdin.readline
MOD = 1000000007
MOD2 = 998244353
ii = lambda: int(input().strip("\n"))
si = lambda: input().strip("\n")
dgl = lambda: list(map(int, input().strip("\n")))
f = lambda: map(int, input().strip("\n").split())
il = lambda: list(map(int, input().strip("\n").split()))
ls = lambda: list(i... | IMPORT ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | s = input()
bread = s.count("B")
cheese = s.count("C")
sauce = s.count("S")
b, s, c = map(int, input().split())
pb, ps, pc = map(int, input().split())
amount = int(input())
lo = 0
hi = 10**14
def bs(m):
r = amount
tempbread = bread * m
tempcheese = cheese * m
tempsauce = sauce * m
if tempbread > b... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NU... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | def make(recipe, nb, ns, nc, pb, ps, pc, r, nburg):
x, y, z = recipe["B"], recipe["S"], recipe["C"]
rb, rs, rc = max(nburg * x - nb, 0), max(nburg * y - ns, 0), max(nburg * z - nc, 0)
if rb * pb + rs * ps + rc * pc <= r:
return True
else:
return False
R = lambda: list(map(int, input().... | FUNC_DEF ASSIGN VAR VAR VAR VAR STRING VAR STRING VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR NUMBER IF BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR BIN_OP VAR VAR VAR RETURN NUMBER RETURN NUMBER ASSIG... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | def check(num):
remb = max(0, num_b * num - nb)
rems = max(0, num_s * num - ns)
remc = max(0, num_c * num - nc)
moneyb = remb * pb
moneys = rems * ps
moneyc = remc * pc
if moneyb + moneys + moneyc <= money:
return 1
else:
return 0
def binary_search(l, r):
while l < ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP BIN_OP VAR VAR VAR VAR RETURN NUMBER RETURN NUMBE... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | from sys import stderr, stdin, stdout
hamber = input()
b, s, c = map(int, input().split())
pb, ps, pc = map(int, input().split())
r = int(input())
curb = hamber.count("B")
curs = hamber.count("S")
curc = hamber.count("C")
l = 0
rr = 10000000000001
ans = 0
while l <= rr:
mid = (l + rr) // 2
curr = r
zb = mi... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR 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 NUMBER ASSIGN VAR NUMBER AS... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | def func(x):
global d, nb, ns, nc, pb, ps, pc, r
cal = (
max(0, d["B"] * x - nb) * pb
+ max(0, d["S"] * x - ns) * ps
+ max(0, d["C"] * x - nc) * pc
)
if cal <= r:
return True
else:
return False
s = input()
d = {}
d["B"] = 0
d["S"] = 0
d["C"] = 0
for i in s:
... | FUNC_DEF ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR STRING VAR VAR VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR STRING VAR VAR VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR STRING VAR VAR VAR IF VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR ... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | hb = input()
nb, ns, nc = map(int, input().split())
storage = [nb, ns, nc]
pb, ps, pc = map(int, input().split())
price = [pb, ps, pc]
r = int(input())
recipe = [hb.count(e) for e in "BSC"]
for i in range(3):
if recipe[i] == 0:
recipe[i] = 1
price[i] = 0
burgers = min(storage[i] // recipe[i] for i i... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR STRING FOR VAR FUNC_CALL VAR NUMBER IF VAR VA... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | a = input()
b, s, c = list(map(int, input().split()))
rb, rs, rc = list(map(int, input().split()))
total = int(input())
ns = 0
nb = 0
nc = 0
for i in a:
if i == "B":
nb += 1
if i == "S":
ns += 1
if i == "C":
nc += 1
def get(x):
f = max(0, nb * x - b) * rb + max(0, ns * x - s) *... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER IF VAR STRING V... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | s = input()
rnB = s.count("B")
rnS = s.count("S")
rnC = s.count("C")
nB, nS, nC = map(int, input().split())
pB, pS, pC = map(int, input().split())
r = int(input())
def get_cost(n):
B = (rnB * n - nB) * pB
S = (rnS * n - nS) * pS
C = (rnC * n - nC) * pC
return sum([x for x in [B, S, C] if x > 0])
def... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR BIN_OP BIN_OP BIN_... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | s = input()
d = [s.count(i) for i in "BSC"]
h = list(map(int, input().split()))
p = list(map(int, input().split()))
m = int(input())
def valid(mid):
tmp = [max(0, mid * d[i] - h[i]) for i in range(3)]
total = sum([(tmp[i] * p[i]) for i in range(3)])
return total <= m
def binary_search():
f, e = 0, 1... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR FUN... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | s = input()
mp = [0] * 3
for i in s:
if i == "B":
mp[0] += 1
elif i == "S":
mp[1] += 1
else:
mp[2] += 1
nb, ns, nc = map(int, input().split())
pb, ps, pc = map(int, input().split())
r = int(input())
x = 0
y = 1000000000000000000
ans = 0
l = r
while x <= y:
mid = (x + y) // 2
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR IF VAR STRING VAR NUMBER NUMBER IF VAR STRING VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASS... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | cntA, cntB, cntC = 0, 0, 0
for x in input():
if x == "B":
cntA += 1
elif x == "S":
cntB += 1
else:
cntC += 1
a, b, c = map(int, input().split())
x, y, z = map(int, input().split())
rr = int(input())
l = 0
r = int(10000000000000.0)
while r - l > 1:
m = (l + r) // 2
s = (
... | ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR IF VAR STRING VAR NUMBER IF VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CA... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | burger = input()
bb = 0
bs = 0
bc = 0
for char in burger:
bb += int(char == "B")
bs += int(char == "S")
bc += int(char == "C")
nb, ns, nc = map(int, input().split())
pb, ps, pc = map(int, input().split())
r = int(input())
count = 0
first_set = 0
pos_min = []
if bb != 0:
pos_min.append(nb // bb)
if bs !=... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR STRING VAR FUNC_CALL VAR VAR STRING VAR FUNC_CALL VAR VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | string = input()
ava_b, ava_s, ava_c = map(int, input().split())
price_b, price_s, price_c = map(int, input().split())
money = int(input())
bread, sausages, cheese = string.count("B"), string.count("S"), string.count("C")
ans = 0
temp = int()
if bread:
temp = ava_b // bread
if sausages:
temp = min(temp, ava_s /... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR IF VAR AS... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | recipe = input()
rb, rs, rc = recipe.count("B"), recipe.count("S"), recipe.count("C")
nb, ns, nc = map(int, input().split())
pb, ps, pc = map(int, input().split())
x = int(input())
def check(mi):
reqb, reqs, reqc = rb * mi, rs * mi, rc * mi
reqb -= nb
reqc -= nc
reqs -= ns
return max(reqb, 0) * pb... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR VAR BIN_OP VAR VAR BIN_OP VA... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | import sys
input = sys.stdin.readline
I = lambda: list(map(int, input().split()))
s = input().strip()
a, b, c = s.count("B"), s.count("S"), s.count("C")
n1, n2, n3 = I()
p1, p2, p3 = I()
(r,) = I()
xx = [a, b, c].count(0)
if xx == 2:
print(
[
(
(n1 + r // p1 if i == a else n2 + ... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL LI... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | import sys
input = sys.stdin.readline
def find(count, p1, p2, p3, n1, n2, n3, b, s, c, r):
if (
max(0, count * b - n1) * p1
+ max(0, count * s - n2) * p2
+ max(0, count * c - n3) * p3
<= r
):
return True
return False
def calc(p1, p2, p3, n1, n2, n3, b, s, c, r):
... | IMPORT ASSIGN VAR VAR FUNC_DEF IF BIN_OP BIN_OP BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR VAR VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER WHILE V... |
Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own hands. Polycarpus thinks that there are only three decent ingredients to make hamburgers from: a bread, sausage and cheese. He writes down the recipe of his favorite "Le Hamburger de Polycarpus" as a string of letters 'B' (... | def binarySearch(recipe_counts, costs, shop_counts, l, r, R):
while l < r - 1:
mid = (l + r) // 2
val = sum(
[
max(0, costs[i] * (recipe_counts[i] * mid - shop_counts[i]))
for i in range(3)
]
)
if val <= R:
l = mid
... | FUNC_DEF WHILE VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR FUNC_CALL VAR NUMBER IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUN... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.