description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | ticket = [int(x) for x in input()]
fst = ticket[:3]
sec = ticket[3:]
diff = abs(sum(fst) - sum(sec))
if sum(fst) > sum(sec):
fst, sec = sec, fst
if diff == 0:
print(0)
elif 9 - min(fst) >= diff or max(sec) >= diff:
print(1)
elif (
18 - (sum(fst) - max(fst)) >= diff
or sum(sec) - min(sec) >= diff
... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF BIN_OP NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VA... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | def horror_func(s):
if s[0] + s[1] + s[2] == s[3] + s[4] + s[5]:
return 0
else:
for i in range(6):
for n in range(10):
c = s.copy()
c[i] = n
if c[0] + c[1] + c[2] == c[3] + c[4] + c[5]:
return 1
for i in rang... | FUNC_DEF IF BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR IF BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER R... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | l = list(input())
for i in range(6):
l[i] = int(l[i])
l1 = l[:3]
l2 = l[3:]
s1 = sum(l[:3])
s2 = sum(l[3:])
if s1 == s2:
print(0)
elif s1 > s2:
x = s1 - s2
ls = []
for i in range(3):
ls.append(l1[i])
ls.append(9 - l2[i])
ls.sort(reverse=True)
i = 0
jud = 0
ans = 0
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST FOR VAR F... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
arr = [int(i) for i in s]
count = 0
while count < 4:
a = arr[0] + arr[1] + arr[2]
b = arr[3] + arr[4] + arr[5]
r = abs(a - b)
if a == b:
print(count)
exit()
if a < b:
num_min = arr.index(min(arr[0], arr[1], arr[2]))
num_max = arr.index(max(arr[3], arr[4], ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR IF VAR VAR ASS... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | n = input()
a, b, c, d, e, f = map(int, n)
def g(a, b, c, s):
m1, m2, m3 = sorted([a, b, c])
if s == a + b + c:
return 0
elif s > a + b + c:
s1 = a + b + c
if m2 + m3 + 9 >= s:
return 1
if m3 + 18 >= s:
return 2
else:
return 3
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR LIST VAR VAR VAR IF VAR BIN_OP BIN_OP VAR VAR VAR RETURN NUMBER IF VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER VAR RETURN NUMBER IF BIN_OP VAR NU... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | n = input()
f = list(map(int, n[:3]))
l = list(map(int, n[3:]))
sf = sum(f)
sl = sum(l)
f.sort()
l.sort()
s = 0
k = 0
if sf > sl:
d = sf - sl
if l[0] + d >= 10:
d -= 9 - l[0]
if f[2] - d < 0:
if l[1] + d >= 10:
s = 3
else:
s = 2
els... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR NUMB... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | inp = input()
minr = 999999
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
for m in range(10):
for n in range(10):
if i + j + k == l + m + n:
r = 0
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR NUMBER IF VAR FUNC_CALL VAR VAR NUMBE... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | def main():
s = input()
print(solver(s))
def solver(s):
L1 = [int(x) for x in s[0:3]]
L2 = [int(x) for x in s[3:6]]
diff = sum(L2) - sum(L1)
if diff == 0:
return 0
elif diff < 0:
L1, L2 = L2, L1
diff = -diff
changes = [(9 - L1[i]) for i in range(3)] + [(L2[i] - ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER RETURN NUMBER IF VAR NUMBER ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR ASSI... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | from itertools import product
s = [int(k) for k in input()]
l = set([i for i in range(10)])
cnt = 6
ck = 0
for a in l:
for b in l:
for c in l:
for d in l:
for e in l:
for f in l:
if a + b + c != d + e + f:
c... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FOR VAR VAR FOR VAR VAR FOR VAR VAR FOR VAR VAR FOR VAR VAR IF BIN_OP BIN_OP VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR LIST VAR VAR VAR VAR VAR VAR ASSIGN VAR FUNC_... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | a = []
for i in range(10):
for j in range(10):
for k in range(10):
for l in range(10):
for m in range(10):
for n in range(10):
if i + j + k == l + m + n:
a.append(
str(i) + str... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR FUN... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | numbers = input()
numbers = [n for n in map(lambda n: int(n), numbers)]
def check_lucky(list):
return sum(list[:3]) == sum(list[3:])
if check_lucky(numbers):
print(0)
exit()
def incDigit(x):
x += 1
if x > 9:
x = 0
return x
minReplaced = 7
replaced = 0
index = 0
def checkForDigi... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_DEF RETURN FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_DEF VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER RETURN VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VA... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
l = list()
l1 = list(map(int, s[:3]))
l2 = list(map(int, s[3:]))
if sum(l1) > sum(l2):
l1, l2 = l2, l1
suml, sumr = sum(l1), sum(l2)
for i, j in zip(l1, l2):
l.append(9 - i)
l.append(j)
l.sort(reverse=True)
ans = 0
for i in l:
if suml >= sumr:
break
suml += i
ans += 1
print(a... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL ... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | m = list(map(int, input()))
ans = 0
if sum(m[:3]) > sum(m[3:]):
m = m[3:] + m[:3]
while sum(m[:3]) != sum(m[3:]):
ans += 1
minsum1 = 10
maxsum2 = 0
mini = -1
maxi = -1
for i in range(3):
if m[i] < minsum1:
minsum1 = m[i]
mini = i
for i in range(3, 6):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | S = input()
a = S[:3]
b = S[3:]
def Sum(st):
n = 0
for x in st:
n += int(x)
return n
def g(s, t):
diff = int(t[0]) + int(t[1]) + int(t[2]) - int(s[0]) - int(s[1]) - int(s[2])
ma = 9 - int(s[0])
c = 0
if 9 - int(s[1]) > ma:
c = 1
ma = 9 - int(s[c])
if 9 - int(s... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | l = list(input())
a = list(map(int, l))
l1 = a[0:3]
l2 = a[3:6]
if sum(l1) > sum(l2):
b = l2
l2 = l1
l1 = b
l1.sort()
l2.sort()
d = sum(l2) - sum(l1)
if d == 0:
print("0")
else:
i = 0
j = 2
c = 0
while d > 0:
if l1 == []:
d -= l2[j]
l2.remove(l2[j])
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | inp = input()
li = []
for i in inp:
li.append(int(i))
sum1 = sum(li[:3])
sum2 = sum(li[3:])
if sum2 > sum1:
for i in range(3):
li[i] = 9 - li[i]
for i in range(3, 6):
li[i] = li[i]
else:
for i in range(3):
li[i] = li[i]
for i in range(3, 6):
li[i] = 9 - li[i]
li.sort(... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR BIN_OP NUMBER VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR VAR VAR FOR VAR FUNC_CALL VAR ... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
a = list(s[:3])
b = list(s[3:6])
sa = int(a[0]) + int(a[1]) + int(a[2])
sb = int(b[0]) + int(b[1]) + int(b[2])
if sa == sb:
print(0)
exit()
if sa > sb:
c = a
a = b
b = c
r = abs(sa - sb)
ans = 1
for i in range(2):
mina = min(int(a[0]), int(a[1]), int(a[2]))
maxb = max(int(b[0]), ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER IF VAR VAR EXPR ... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | import sys
def debug(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
a = [int(ch) for ch in input()]
assert len(a) == 6
b1 = a[0:3]
b2 = a[3:6]
if sum(b1) > sum(b2):
b1, b2 = b2, b1
diff = sum(b2) - sum(b1)
deltas = sorted([(9 - x) for x in b1 if x < 9] + [x for x in b2 if x > 0], reverse=True)
cu... | IMPORT FUNC_DEF EXPR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BI... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | entrada = list(map(int, input()))
l = entrada[:3]
r = entrada[3:]
sl = l[0] + l[1] + l[2]
sr = r[0] + r[1] + r[2]
l.sort()
r.sort()
if sl == sr:
print(0)
elif sl < sr:
dif = abs(sl - sr)
if dif <= r[2] or dif + l[0] <= 9:
print(1)
elif 9 - l[0] == r[2]:
dif -= r[2]
if dif <= r[1]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR ASSIGN VAR FUNC_C... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | def digitsum(x):
s = 0
while x > 0:
s += x % 10
x //= 10
return s
def main():
ds = [digitsum(x) for x in range(1000)]
n = input()
ans = 6
for i in range(1000000):
if ds[i // 1000] == ds[i % 1000]:
s = "{:06d}".format(i)
diff = sum(1 for i, c ... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL STRING VAR ASSIGN VAR FUNC_CA... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | a = [int(q) for q in list(input())]
b = a[0:3]
c = a[3:6]
min = sum(b)
max = sum(c)
t = 5
if min > max:
min, max = max, min
b, c = c, b
if min == max:
print(0)
else:
b.sort()
c.sort()
if min in c and min != 0 and max - min > 9 - b[0]:
if 0 in c or max - min <= 9 - b[0] or max - min <= c[... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CA... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | a = [int(i) for i in input()]
if sum(a[3:]) > sum(a[:3]):
a[:3], a[3:] = a[3:], a[:3]
a[:3] = sorted(a[:3], reverse=True)
a[3:] = sorted(a[3:], reverse=True)
ans = 0
i = 0
j = 5
while sum(a[:3]) > sum(a[3:]):
ans += 1
if a[i] > 9 - a[j]:
a[i] = 0
i += 1
else:
a[j] = 9
j -... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | def count_min(a, b):
count = 0
while sum(a) < sum(b):
if 9 - min(a) > max(b):
a.remove(min(a))
a.append(9)
else:
b.remove(max(b))
b.append(0)
count += 1
return count
a = input()
b, c = [], []
for x in a[:3]:
b.append(int(x))
for x... | FUNC_DEF ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF BIN_OP NUMBER FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR LIST LIST ... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
a = list(map(int, s[:3]))
b = list(map(int, s[3:]))
al = sum(a)
bl = sum(b)
dif = al - bl
cnt = 0
while dif < 0:
cnt += 1
if 9 - min(a) > max(b):
dif += min(-dif, 9 - min(a))
a[a.index(min(a))] = 9
else:
dif += min(-dif, max(b))
b[b.index(max(b))] = 0
c = b[:]
b =... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER IF BIN_OP NUMBER FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR ... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | number = input()
num1 = number[0:3]
num2 = number[3:6]
sum1 = 0
sum2 = 0
maxnum1 = int(num1[0])
minnum1 = int(num1[0])
maxnum2 = int(num2[0])
minnum2 = int(num2[0])
for i in num1:
sum1 += int(i)
maxnum1 = max(int(i), maxnum1)
minnum1 = min(int(i), minnum1)
for i in num2:
sum2 += int(i)
maxnum2 = max... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VA... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | ticket1 = input()
ticket2 = ticket1[3:]
ticket1 = ticket1[:3]
ticket1 = list(map(int, list(ticket1)))
ticket2 = list(map(int, list(ticket2)))
t1 = list.copy(ticket1)
t2 = list.copy(ticket2)
t = list.copy(t1 + t2)
ticket = list.copy(t)
r = sum(ticket1) - sum(ticket2)
r1, r2, k = r, r, 0
while r1 and r2 and k < 3:
r1... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR AS... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | p = [int(x) for x in input()]
ans = []
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
for e in range(10):
f = a + b + c - d - e
o = [a, b, c, d, e, f]
delta = 0
if 0 <... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR VAR ASSIGN VAR LIST VAR VAR VAR VAR VAR VAR ASSIGN VAR NU... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
m, t = 6, [[] for i in range(28)]
for i in range(10):
for j in range(10):
for k in range(10):
t[i + j + k].append(str(i) + str(j) + str(k))
for q in t:
for u in q:
for v in q:
m = min(m, sum(x != y for x, y in zip(u + v, s)))
print(m) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER LIST VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR VAR FOR VAR VAR FOR VAR VAR ASSIGN ... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | a = input()
b1, b2 = 0, 0
for i in range(3):
b1 += int(a[i])
for i in range(3):
b2 += int(a[3 + i])
if b1 > b2:
p = 0
d = []
c = list(a[3:])
c = list(map(int, c))
for i in c:
d.append(9 - i)
c = list(a[:3])
c = list(map(int, c))
for i in c:
d.append(i)
d.sort(... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR IF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FOR VAR VAR EX... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | line = [int(x) for x in list(input())]
l1 = line[0:3]
l2 = line[3:]
s1 = sum(l1)
s2 = sum(l2)
s = abs(s1 - s2)
ans = 0
if s1 > s2:
l2 = list(map(lambda x: 9 - x, l2))
l = l1 + l2
l.sort(reverse=True)
for i in l:
if s > 0:
s -= i
ans += 1
else:
break
el... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP NUMBER VAR VAR ASSIGN VAR BIN_OP VA... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | n = input()
a = []
for i in n:
a += [i]
a = list(map(int, a))
x = a[0] + a[1] + a[2] - a[3] - a[4] - a[5]
if x == 0:
print(0)
elif x > 0:
a[3] = 9 - a[3]
a[4] = 9 - a[4]
a[5] = 9 - a[5]
a.sort()
i = 0
while x > 0:
x -= a[5 - i]
i += 1
print(i)
else:
a[0] = 9 - a[0... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR VAR LIST VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER BIN_OP NUMBER VAR NUMBE... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | digs = list(map(int, input()))
l, r = min(digs[:3], digs[3:], key=sum), max(digs[:3], digs[3:], key=sum)
ans = 0
while sum(r) - sum(l) > 0:
if 9 - min(l) >= max(r):
diff = 9 - min(l)
l[l.index(min(l))] = 9
else:
diff = max(r)
r[r.index(max(r))] = 0
ans += 1
print(ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER VAR ASSIGN VAR NUMBER WHILE BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP NUMBER FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VA... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
s = [int(i) for i in s]
a, b = s[:3], s[3:]
if sum(a) > sum(b):
a, b = b, a
t = sum(b) - sum(a)
a = [(9 - i) for i in a]
a = a + b
a.sort(reverse=True)
if t == 0:
print(0)
elif a[0] >= t:
print(1)
elif a[0] + a[1] >= t:
print(2)
else:
print(3) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EX... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | inp = input()
inp = str(inp)
a = [0] * 6
ticket = []
for c in inp:
ticket.append(int(c))
sum1 = 0
sum2 = 0
for i in range(3):
sum1 += ticket[i]
a[i] = ticket[i]
for i in range(3, 6):
sum2 += ticket[i]
a[i] = ticket[i]
sum3 = sum1 - sum2
if sum3 > 0:
for i in range(3, 6):
a[i] = 9 - a[i]
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR ASSIGN VAR VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER VAR VAR VAR ASSIGN VAR VAR V... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | n = list(input())
n = [int(n[i]) for i in range(6)]
s1 = sum(n)
s = sum(n[:3])
s1 -= s
if s > s1:
n = n[::-1]
sw = []
sw.append(9 - n[0])
sw.append(9 - n[1])
sw.append(9 - n[2])
sw.append(n[-3])
sw.append(n[-2])
sw.append(n[-1])
ab = abs(s1 - s)
sw.sort(reverse=True)
i = 0
ans = 0
while ab > 0:
ab -= sw[i]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR LIST EXPR FUNC_CALL VAR BIN_OP NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER VAR NUMBER EXPR FUNC_CAL... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | def readline():
return map(int, input().split())
def main():
number = list(map(int, input()))
steps, line = 0, [number]
def diff(n):
return sum(n[0:3]) - sum(n[3:])
def next(n):
d = diff(n)
for i in range(6):
if d > 0 and i < 3 or d < 0 and i >= 3:
... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER LIST VAR FUNC_DEF RETURN BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR ... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | a = input()
m = []
ans = 6
for x in a:
m.append(int(x))
for d0 in range(10):
for d1 in range(10):
for d2 in range(10):
for d3 in range(10):
for d4 in range(10):
d5 = d0 + d1 + d2 - d3 - d4
if 0 <= d5 <= 9:
r = 0
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR VAR IF NUMBE... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | t = list(input())
s = int(t[0]) + int(t[1]) + int(t[2])
s1 = int(t[3]) + int(t[4]) + int(t[5])
def first(s, s1, t):
t = t[:3]
todo = s1 - s
if 9 - int(min(t, key=lambda x: int(x))) < todo:
small = 9 - int(min(t[:2], key=lambda x: int(x)))
t.remove(min(t, key=lambda x: int(x)))
if 9... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF BIN_OP NUMBER FUNC_CA... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | a = [int(i) for i in input()]
b = a[:3]
c = a[3:]
if sum(b) == sum(c):
print(0)
else:
if sum(b) > sum(c):
b, c = c[:], b[:]
diff = sum(c) - sum(b)
mx = []
for i in b:
mx.append(9 - i)
for i in c:
mx.append(i)
ans = 0
cur = 0
mx.sort(reverse=True)
i = 0
... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR B... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
p = s[:3]
h = s[3:]
l = [int(i) for i in p]
k = [int(i) for i in h]
q = []
if sum(k) < sum(l):
q = [i for i in l]
q += [(9 - i) for i in k]
raz = sum(l) - sum(k)
cnt = 0
while raz > 0:
q = sorted(q)
raz -= q[len(q) - 1]
q[len(q) - 1] = 0
cnt += 1
print... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR LIST IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR BIN_OP NUMBER VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMB... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = [int(x) for x in input()]
a, b = s[:3], s[3:]
sa, sb = sum(a), sum(b)
if sa > sb:
a, b = b, a
r = abs(sb - sa)
if r == 0:
ans = 0
else:
breva = b[:]
for x in a:
breva.append(9 - x)
td = 0
breva.sort(reverse=True)
for i, j in enumerate(breva):
td += j
if td >= r:
... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP NUMBER VAR ASSIGN VAR NUMB... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | import sys
def returndiff(s1, s2, s3, s4, s5, s6):
ct = 0
if s1 + s2 + s3 == s4 + s5 + s6:
if s1 != n[0]:
ct += 1
if s2 != n[1]:
ct += 1
if s3 != n[2]:
ct += 1
if s4 != n[3]:
ct += 1
if s5 != n[4]:
ct += 1
... | IMPORT FUNC_DEF ASSIGN VAR NUMBER IF BIN_OP BIN_OP VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR IF VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUN... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
min_d = 6
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
for e in range(10):
for f in range(10):
if a + b + c == d + e + f:
k = 0
t = s... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_O... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | ticket = input()
num1 = int(ticket[0])
num2 = int(ticket[1])
num3 = int(ticket[2])
num4 = int(ticket[3])
num5 = int(ticket[4])
num6 = int(ticket[5])
minDif = 7
for l in range(1000):
leftDif = 0
if l % 10 != num3:
leftDif += 1
if l // 10 % 10 != num2:
leftDif += 1
if l // 100 != num1:
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR ... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | import sys
from itertools import product
n = list(map(int, input()))
ans = 6
for a in product(range(10), repeat=6):
if a[0] + a[1] + a[2] == a[3] + a[4] + a[5]:
x = sum(0 if n[i] == a[i] else 1 for i in range(6))
ans = min(ans, x)
print(ans) | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR ... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
a = [0, 0, 0, 0, 0, 0]
t = []
ans = 3
for i in s:
t.append(ord(i) - ord("0"))
for a[0] in range(10):
for a[1] in range(10):
for a[2] in range(10):
for a[3] in range(10):
for a[4] in range(10):
for a[5] in range(10):
anss... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING FOR VAR NUMBER FUNC_CALL VAR NUMBER FOR VAR NUMBER FUNC_CALL VAR NUMBER FOR VAR NUMBER FUNC_CALL VAR NUMBER FOR VAR NUMBER FUN... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | def f(x):
return sum(x[:3]) == sum(x[3:])
def main():
a = [int(i) for i in input()]
if f(a):
return 0
for i in range(6):
for j in range(10):
b = a[:]
b[i] = j
if f(b):
return 1
for i in range(6):
for j in range(i):
... | FUNC_DEF RETURN FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR RETURN NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR VAR IF FUNC_CALL VAR VAR RETURN NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | a = [int(i) for i in input()]
b = sorted([(9 - a[i]) for i in range(3)])
d = sorted([(9 - a[i]) for i in range(3, 6)])
c = sum(a[:3]) - sum(a[3:])
s = 0
if c < 0:
c = -c
t = 2
r = 2
q = []
q += a[3:]
q.sort()
while c > 0:
if q[r] > b[t]:
c -= q[r]
s += 1
... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER VAR VAR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR ASSIGN ... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | digits = [int(i) for i in input()]
sm = digits[:3]
gr = digits[3:]
if sum(sm) > sum(gr):
sm, gr = gr, sm
iters = 0
diff = sum(gr) - sum(sm)
while diff:
iters += 1
bestSm = sm.index(min(sm))
bestGr = gr.index(max(gr))
if 9 - sm[bestSm] > gr[bestGr]:
sm[bestSm] = 9 if sm[bestSm] + diff > 9 els... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_C... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | i = list(map(lambda c: int(c), input()))
d = sum([i[3] - i[0], i[4] - i[1], i[5] - i[2]])
if d < 0:
i.reverse()
d *= -1
for z in range(3):
i[z] = 9 - i[z]
i = sorted(i)
i.reverse()
ir = 0
for ind, z in enumerate(i):
if ir >= d:
print(ind)
break
ir += z | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR LIST BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR BIN_OP NUMBER VAR VAR ASSIGN VAR FUNC_CALL V... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = str(input())
r = []
for el in s:
r.append(int(el))
l1 = r[0:3]
l2 = r[3:6]
if sum(l1) < sum(l2):
l1, l2 = l2, l1
s = abs(sum(l1) - sum(l2))
if s == 0:
print(0)
else:
usable = []
for e in l1:
usable.append(e)
for e in l2:
usable.append(9 - e)
usable.sort(reverse=True)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
l1 = [int(s[i]) for i in range(3)]
l2 = [int(s[3 + i]) for i in range(3)]
s1 = sum(l1)
s2 = sum(l2)
if s1 < s2:
l1, l2 = l2, l1
s1, s2 = s2, s1
l1.sort(reverse=True)
l2.sort()
ans = 0
p1 = 0
p2 = 0
while s1 > s2:
if l1[p1] > 9 - l2[p2]:
s1 -= l1[p1]
p1 += 1
else:
s2 +... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIG... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = list(input())
a = []
b = []
for i in range(0, 3):
a.append(int(s[i]))
for i in range(3, 6):
b.append(int(s[i]))
s1 = sum(a)
s2 = sum(b)
a.sort()
b.sort()
for i in range(0, 3):
a.append(s1 - a[i])
for i in range(0, 3):
b.append(s2 - b[i])
if s1 == s2:
print(0)
else:
for i in range(0, 3):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | A = [int(x) for x in list(input())]
B = sorted(A[:3])
C = sorted(A[3:6])
b = sum(B)
c = sum(C)
a = b - c
if a != 0:
if a < 0:
D = sorted([(9 - x) for x in B] + C)
elif a > 0:
D = sorted(B + [(9 - x) for x in C])
D.reverse()
d = 0
result = 0
for x in D:
d += x
resu... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR VAR VAR VAR IF VAR... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | def comp(n, m):
rtn = 0
for i in range(6):
if n[i] != m[i]:
rtn += 1
return rtn
n = list(map(int, list(input())))
ans = 6
for i in range(1000000):
m = []
for _ in range(6):
m.append(i % 10)
i //= 10
m = list(reversed(m))
if sum(m[:3]) == sum(m[3:]):
... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR F... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | a = input()
b = list(a)
c = [int(x) for x in b]
d = c[:3]
e = c[3:]
f = []
if sum(d) == sum(e):
print(0)
elif sum(d) > sum(e):
for i in d:
f.append(i)
for j in e:
f.append(9 - j)
f.sort()
k = sum(d) - sum(e)
if k > f[-1]:
if k > f[-1] + f[-2]:
print(3)
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR LIST IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = list(map(int, input()))
ans = 9 * 6 + 1
for a in range(10):
for b in range(10):
for c in range(10):
for d in range(10):
for e in range(10):
for f in range(10):
if a + b + c == d + e + f:
ans = min(
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP VAR VAR VAR BIN_OP BIN_OP ... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | ticket = input()
q1, q2 = [(int(i), j) for j, i in enumerate(ticket[:3])], [
(int(i), j) for j, i in enumerate(ticket[3:])
]
p1, p2 = [i for i, j in q1], [i for i, j in q2]
if sum(p1) > sum(p2):
p1, p2 = p2, p1
q1, q2 = q2, q1
if sum(p1) == sum(p2):
print(0)
exit()
for i in range(20):
if 9 - min... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR VAR VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | a = list(input())
for i in range(6):
a[i] = int(a[i])
a1 = a[0:3]
a2 = a[3:6]
a1.sort()
a2.sort()
ans = []
s1 = sum(a1)
s2 = sum(a2)
if s1 == s2:
ans.append(0)
ans.append(0)
elif s1 > s2:
if a1[1] + a1[2] <= s2 or a1[0] + a1[2] <= s2 or a1[0] + a1[1] <= s2:
ans.append(1)
elif a1[0] <= s2 or ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUN... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = [int(x) for x in input()]
ans = 6
k = 0
for d0 in range(10):
for d1 in range(10):
for d2 in range(10):
for d3 in range(10):
for d4 in range(10):
d5 = d0 + d1 + d2 - d3 - d4
if 0 <= d5 <= 9:
d = [d0, d1, d2, d3, d... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR VAR IF NUMBER VAR NUMBER ASSIGN VAR L... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = list(map(int, input()))
left_sum = sum(s[:3])
right_sum = sum(s[3:])
if left_sum >= right_sum:
abc_min = s[3:]
abc_max = s[:3]
elif left_sum < right_sum:
abc_min = s[:3]
abc_max = s[3:]
dif = max(left_sum, right_sum) - min(left_sum, right_sum)
ans = 0
for k in range(3):
if max(abc_max) > 9 - min... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER F... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
a, b = sorted(list(map(int, s[:3]))), sorted(list(map(int, s[3:])))
sma, smb = sum(a), sum(b)
if sum(a) < sum(b):
mn, mx = a, b[::-1]
else:
mn, mx = b, a[::-1]
k1, k2 = 0, 0
while sum(mn) < sum(mx):
if 9 - mn[k1] >= mx[k2]:
mn[k1] = 9
k1 += 1
else:
mx[k2] = 0
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER ASSIGN VAR VAR N... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | n = input()
a = []
b = []
for i in range(3):
a.append(int(n[i]))
for i in range(3, 6):
b.append(int(n[i]))
c = sum(a)
d = sum(b)
e = []
f = abs(c - d)
count = 0
if c == d:
print(0)
elif c > d:
e += a
for i in range(len(b)):
e.append(9 - b[i])
e.sort()
e.reverse()
while f > 0:
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR AS... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | digits = [int(x) for x in input()]
difference = sum(digits[0:3]) - sum(digits[3:])
helper = []
if difference < 0:
helper = [(9 - x) for x in digits[:3]] + digits[3:]
else:
helper = digits[:3] + [(9 - x) for x in digits[3:]]
helper = sorted(helper)[::-1]
n = 0
sum_ = 0
for x in helper:
if sum_ >= abs(differe... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER BIN_OP NUMBER VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN V... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | a = list(str(input()))
a = [int(i) for i in a]
one = a[:3]
two = a[3:]
o = sum(one)
t = sum(two)
one.sort()
two.sort()
s = 0
c = []
if o == t:
s = 0
elif o > t:
b = o - t
c.append(one[0])
c.append(one[1])
c.append(one[2])
c.append(9 - two[0])
c.append(9 - two[1])
c.append(9 - two[2])
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST IF VAR VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR BIN_O... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
ans = 10
for x in range(10):
for y in range(10):
for z in range(10):
for a in range(10):
for b in range(10):
for c in range(10):
if x + y + z == a + b + c:
cnt = 0
cnt ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR NUMBER VAR VAR BIN_OP FUNC_CALL VAR V... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | a = input()
ls = int(a[0]) + int(a[1]) + int(a[2])
rs = int(a[3]) + int(a[4]) + int(a[5])
dif = ls - rs
if dif == 0:
print(0)
quit()
p = [0] * 6
for i in range(6):
if (i < 3) ^ (dif > 0):
p[i] = 9 - int(a[i])
else:
p[i] = int(a[i])
p.sort(reverse=True)
ps = 0
for i in range(6):
ps +=... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | a = list(map(int, input()))
a_first = a[:3]
a_last = a[3:]
sum_a_first = sum(a_first)
sum_a_last = sum(a_last)
if sum_a_first != sum_a_last:
a_first.sort()
a_last.sort()
if sum_a_first > sum_a_last:
a_first, a_last = a_last, a_first
sum_a_first, sum_a_last = sum_a_last, sum_a_first
count... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR ... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | l = list(str(input()))
l = [int(i) for i in l]
l1 = l[0:3]
l1 = sorted(l1)
l2 = l[3:]
l2 = sorted(l2)
if sum(l1) > sum(l2):
l1, l2 = l2, l1
if sum(l1) == sum(l2):
ans = 0
else:
l1[0] = 9
if sum(l1) >= sum(l2):
ans = 1
else:
l1[1] = 9
if sum(l1) >= sum(l2):
ans = 2... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER AS... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | a = input()
def ass(a):
ans = 0
p = list(map(int, a[:3]))
q = list(map(int, a[3:]))
s = sum(p) - sum(q)
if s == 0:
ans = 0
return ans
elif s > 0:
p = list(map(lambda x: 9 - x, p))
else:
s = -s
q = list(map(lambda x: 9 - x, q))
a = p + q
a.sor... | ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER RETURN VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP NUM... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | def main():
digits = input()
li = list(digits)
digits = list(map(int, li))
first = digits[:3]
second = digits[3:]
first.sort()
second.sort()
sumf = sum(first)
sums = sum(second)
if sumf == sums:
print("0")
return
elif sumf < sums:
small = 1
else:
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING RETURN IF VAR VAR ASSIGN VAR NUMB... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | from sys import exit
def strsum(s):
return sum([int(c) for c in s])
def pos_diffs(s):
return [(9 - int(i)) for i in s]
def neg_diffs(s):
return [int(i) for i in s]
def reverse_nums(s):
return "".join([str(9 - int(c)) for c in s])
n = input()
first = n[:3]
last = n[3:]
if strsum(first) == strsu... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR FUNC_DEF RETURN BIN_OP NUMBER FUNC_CALL VAR VAR VAR VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR VAR FUNC_DEF RETURN FUNC_CALL STRING FUNC_CALL VAR BIN_OP NUMBER FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF FUNC_CA... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
ans = 6
for i in range(0, 10):
for j in range(0, 10):
for k in range(0, 10):
for f in range(0, 10):
for f1 in range(0, 10):
for f2 in range(0, 10):
if i + j + k == f + f1 + f2:
cnt = 0
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP BIN_OP VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | def build(b):
s = 0
b = b[::-1]
for i in range(6):
s += b[i] * 10**i
return s
t = [-1] * 1000000
n = int(input())
t[n] = 0
v = [n]
while v != []:
a = v.pop(0)
x = []
while a != 0:
x = [a % 10] + x
a //= 10
x = [0] * (6 - len(x)) + x
if sum(x[:3]) == sum(x[3:... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR BIN_OP VAR VAR BIN_OP NUMBER VAR RETURN VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR LIST VAR WHILE VAR LIST ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST WHILE VAR NUM... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | l = list(input())
a = []
b = []
for i in range(3):
a.append(int(l[i]))
for i in range(3, 6):
b.append(int(l[i]))
a.sort()
b.sort()
s1 = sum(a)
s2 = sum(b)
if s1 == s2:
print(0)
elif s1 < s2:
diff = s2 - s1
a.sort()
b.sort(reverse=True)
c = []
t = 0
for i in range(3):
c.append... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | def change_num(left_arr, right_arr, count):
min_n, max_n = 10, -1
if sum(left_arr) > sum(right_arr):
max_arr = left_arr
min_arr = right_arr
else:
max_arr = right_arr
min_arr = left_arr
diff = sum(max_arr) - sum(min_arr)
for i in range(3):
if min_n > min_arr[i]... | FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR IF... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | x = int(input())
def s(a):
r = 0
while a > 0:
r += a % 10
a //= 10
return r
def d(a, b):
r = 0
for i in range(6):
if a % 10 != b % 10:
r += 1
a //= 10
b //= 10
return r
c = 6
for i in range(1000000):
if s(i % 1000) == s(i // 1000):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF FUNC... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
v1 = v2 = 0
for i in s[:3]:
v1 += int(i)
for i in s[3:]:
v2 += int(i)
ans = 0
s1 = list(s[:3])
for i in range(3):
s1[i] = int(s1[i])
s2 = list(s[3:])
for i in range(3):
s2[i] = int(s2[i])
if v1 < v2:
while True:
ans += 1
if 9 - min(s1) > max(s2):
v1 = v1 + 9 -... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER FOR VAR VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | def solve():
s = input()
x = [int(z) for z in s]
y, z = x[:3], x[3:]
if sum(y) < sum(z):
y, z = z, y
a = sum(y) - sum(z)
b = [y[-1], y[-2], y[-3], 9 - z[0], 9 - z[1], 9 - z[2]]
b.sort()
c = 0
cnt = 0
while c < a:
c += b.pop()
cnt += 1
return cnt
prin... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST VAR NUMBER VAR NUMBER VAR NUMBER BIN_OP NUMBER VAR NUMBER BIN_OP NUMBER VAR NUMB... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | from sys import stdin, stdout
def rint():
return map(int, stdin.readline().split())
s = input()
little = []
big = []
for i in range(3):
little.append(int(s[i]))
for i in range(3):
big.append(int(s[i + 3]))
suml = sum(little)
sumb = sum(big)
if suml > sumb:
little, big = big, little
suml, sumb = ... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL V... |
Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.
The ticket is considered lucky if the sum of first three digits equals to the sum of las... | s = input()
mas = []
for i in range(6):
mas += [int(s[i])]
a, b = mas[0:3], mas[3:6]
if sum(a) < sum(b):
a, b = b, a
delta = sum(a) - sum(b)
a = sorted(a, reverse=True)
b.sort()
ans, sum, l1, l2 = 0, 0, 0, 0
while sum < delta:
if a[l1] > 9 - b[l2]:
sum += a[l1]
l1 += 1
else:
sum ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR LIST FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR NUMBER NUMBER VAR NUMBER NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL V... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | for _ in range(int(input())):
y, x = map(int, input().split())
c1, c2, c3, c4, c5, c6 = map(int, input().split())
cost = 0
if y == 0:
if x >= 0:
cost = min(x * (c3 + c1), x * c2)
else:
cost = min(abs(x) * (c4 + c6), abs(x) * c5)
elif y > 0:
if x > 0:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR BIN... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | import sys
input = sys.stdin.readline
def solve_fast(x, y, c):
ans1 = abs(x) * c[6 if x > 0 else 3] + abs(y) * c[2 if y > 0 else 5]
ans2 = abs(x) * c[1 if x > 0 else 4] + abs(y - x) * c[2 if y - x > 0 else 5]
ans3 = abs(y) * c[1 if y > 0 else 4] + abs(y - x) * c[3 if y - x > 0 else 6]
return min(ans1... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR VAR NUMBER NUMBER NUMBER BIN_OP FUNC_CALL VAR VAR VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR VAR NUMBER NUMBER NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | def ans2(x, y, cx, cy, cxy):
ret = 0
xy = min(x, y)
x -= xy
y -= xy
ret += cxy * xy
ret += x * cx
ret += y * cy
return ret
def rotate(x, y):
return y, y - x
def ans(x, y, costs):
for _ in range(100):
costs[0] = min(costs[0], costs[1] + costs[5])
costs[1] = min... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR RETURN VAR FUNC_DEF RETURN VAR BIN_OP VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | p = lambda: list(map(int, input().split()))
T = int(input())
for _ in range(T):
Y, X = p()
c = p()
for i in range(6):
c[i] = min(c[i], c[(i + 1) % 6] + c[(i + 5) % 6])
M = min(abs(X), abs(Y))
if X > 0:
if Y > 0:
C = M * c[0]
X -= M
Y -= M
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR BIN_OP VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR BIN_OP BIN_OP VAR NUM... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | import sys
sys.setrecursionlimit(10**5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II():
return int(sys.stdin.buffer.readline())
def MI():
return map(int, sys.stdin.buffer.readline().split())
def LI():
return list(map(int, sys.stdin.buffer.readline().split()))
def LLI(rows_... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | for _ in range(int(input())):
y, x = map(int, input().split())
uu, w, r, dd, q, e = map(int, input().split())
uuo, wo, ro, ddo, qo, eo = [None] * 6
while (uuo, wo, ro, ddo, qo, eo) != (uu, w, r, dd, q, e):
uuo, wo, ro, ddo, qo, eo = uu, w, r, dd, q, e
uu = min(uuo, w + e)
dd = mi... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR BIN_OP LIST NONE NUMBER WHILE VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR ... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | import sys as _sys
def main():
t = int(input())
for i_t in range(t):
x, y = _read_ints()
cs = tuple(_read_ints())
result = find_min_path_cost((x, y), cs)
print(result)
def _read_line():
result = _sys.stdin.readline()
assert result[-1] == "\n"
return result[:-1]
... | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER STRING RETURN VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CA... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | inn = lambda: int(input())
inm = lambda: map(int, input().split())
ins = lambda: str(input())
ina = lambda: list(map(int, input().split()))
def solve():
x, y = inm()
c = ina()
ans = [0, 0, 0]
ans[0] = (x * c[5] if x >= 0 else -x * c[2]) + (y * c[1] if y >= 0 else -y * c[4])
ans[1] = ((x - y) * c[5... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER ASSIGN VAR NUMBER BIN_... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | t = int(input())
for _ in range(t):
x, y = map(int, input().split())
c1, c2, c3, c4, c5, c6 = map(int, input().split())
c1 = min(c1, c2 + c6)
c2 = min(c2, c1 + c3)
c3 = min(c3, c2 + c4)
c4 = min(c4, c3 + c5)
c5 = min(c5, c4 + c6)
c6 = min(c6, c1 + c5)
ans = 0
if x * y <= 0:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP V... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | for _ in range(int(input())):
x, y = map(int, input().split())
c = list(map(int, input().split()))
c11 = min(c[0], c[1] + c[5])
c_1_1 = min(c[3], c[2] + c[4])
c01 = min(c[1], c[0] + c[2])
c10 = min(c[5], c[0] + c[4])
c0_1 = min(c[4], c[3] + c[5])
c_10 = min(c[2], c[3] + c[1])
if x >=... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | def solve():
y, x = map(int, input().split())
c = list(map(int, input().split()))
if x == 0 and y == 0:
return 0
d1 = 0
if x > 0:
d1 += x * c[1]
else:
d1 += abs(x) * c[4]
if y > 0:
d1 += y * c[5]
else:
d1 += abs(y) * c[2]
d2 = 0
if x > 0:
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR BIN_OP VAR VAR NUMBER VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER IF VAR NUMBER VAR BIN_OP VAR VAR NUMBER VAR BIN_OP... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | t = int(input())
for _ in range(t):
x, y = map(int, input().split())
c1, c2, c3, c4, c5, c6 = map(int, input().split())
if x == y == 0:
print(0)
continue
ans = 10**20
if x >= 0 and y >= 0 and y >= x:
ans = min(ans, c2 * (y - x) + c1 * x)
if y >= 0 and x <= y:
ans ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER IF VAR NUMBER VAR NUMBER VAR VAR ASSIGN VAR FUNC_... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | T = int(input())
for t in range(T):
X, Y = [int(_) for _ in input().split()]
C = [int(_) for _ in input().split()]
for _ in range(10):
for i in range(len(C)):
prev = i - 1
if prev < 0:
prev += 6
nxt = i + 1
if nxt >= 6:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL 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 FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR BIN... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | t = int(input())
for _ in range(t):
x, y = list(map(int, input().split()))
c1, c2, c3, c4, c5, c6 = list(map(int, input().split()))
a1 = min(c1, c6 + c2)
a2 = min(c2, c1 + c3)
a3 = min(c3, c2 + c4)
a4 = min(c4, c3 + c5)
a5 = min(c5, c4 + c6)
a6 = min(c6, c5 + c1)
if x > 0 and y > 0:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN VA... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | t = int(input())
while t:
t -= 1
x, y = list(map(int, input().strip().split()))
c1, c2, c3, c4, c5, c6 = list(map(int, input().strip().split()))
t1, t2, t3, t4, t5, t6 = c1, c2, c3, c4, c5, c6
c1 = min(c1, t2 + t6)
c2 = min(c2, t1 + t3)
c3 = min(c3, t2 + t4)
c4 = min(c4, t3 + t5)
c5 ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VA... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | from sys import stdin
input = stdin.readline
def solve():
y, x = map(int, input().split())
c = list(map(int, input().split()))
res = float("inf")
r1 = abs(y) * c[0 if y >= 0 else 3] + abs(x - y) * c[1 if y <= x else 4]
r2 = abs(y) * c[5 if y >= 0 else 2] + abs(x) * c[1 if x >= 0 else 4]
r3 = ... | ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR VAR NUMBER NUMBER NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR NUMBER NUMBER ASSIGN... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | for i in range(int(input())):
a = list(map(int, input().strip().split(" ")))
b = list(map(int, input().strip().split(" ")))
b.append(b[0])
b.insert(0, b[-2])
for j in range(1, len(b) - 1):
b[j] = min(b[j - 1] + b[j + 1], b[j])
s = 0
if a[1] > 0 and a[0] > 0:
s += min(a[1], a[... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | def main():
for _ in range(int(input())):
x, y = map(int, input().split())
c = list(map(int, input().split()))
r1 = abs(x) * c[5 if x >= 0 else 2] + abs(y) * c[1 if y >= 0 else 4]
r2 = abs(x) * c[0 if x >= 0 else 3] + abs(y - x) * c[1 if y >= x else 4]
r3 = abs(y) * c[0 if y ... | FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR VAR NUMBER NUMBER NUMBER BIN_OP FUNC_CALL VAR VAR VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR ... |
Lindsey Buckingham told Stevie Nicks "Go your own way". Nicks is now sad and wants to go away as quickly as possible, but she lives in a 2D hexagonal world.
Consider a hexagonal tiling of the plane as on the picture below. [Image]
Nicks wishes to go from the cell marked $(0, 0)$ to a certain cell given by the coordi... | def getDistances(x, y, dx, dy):
res = []
if dx == 0:
if x == 0:
res += [0]
else:
cnt = x // -dx
if cnt >= 0:
res += [cnt]
if dy == 0:
if y == 0:
res += [0]
else:
cnt = y // -dy
if cnt >= 0:
res += [cnt]
... | FUNC_DEF ASSIGN VAR LIST IF VAR NUMBER IF VAR NUMBER VAR LIST NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER VAR LIST VAR IF VAR NUMBER IF VAR NUMBER VAR LIST NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER VAR LIST VAR IF VAR VAR IF VAR VAR VAR LIST NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.