description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
tot = sum(A)
if tot % 2:
print(0)
else:
target = tot // 2
dp = [0] * (target + 1)
dp[0] = 1
for a in A:
for i in range(target, a - 1, -1):
dp[i] |= dp[i - a]
if not dp[-1]:
pri... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR VAR FO... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
SUM = sum(A)
DP = {0}
for a in A:
NDP = set()
for d in DP:
NDP.add(a + d)
DP |= NDP
if SUM % 2 == 1 or not SUM // 2 in DP:
print(0)
exit()
TWO = [0] * n
for i in range(n):
count = 0
while A[i]... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER VAR EXPR... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | n = int(input())
xs = [int(x) for x in input().split()]
while all(x % 2 == 0 for x in xs):
xs = [(x // 2) for x in xs]
sm = sum(xs)
if sum(xs) % 2 == 1:
print(0)
exit()
dp = set([0])
good = True
for x in xs:
toadd = set()
for s in dp:
num = x + s
if num == sm // 2:
good =... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR WHILE FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CA... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | def putin():
return map(int, input().split())
def ord(n):
answer = 0
while n % 2 == 0:
n //= 2
answer += 1
return answer
def check_knapsack(A):
S = sum(A) // 2
st = {0}
for elem in A:
for el in st.copy():
if el + elem < S:
st.add(el + e... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER WHILE BIN_OP VAR NUMBER NUMBER VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR IF BIN_OP V... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | def findsubarr(s, n, e):
if n == 1:
return {0, e}
else:
p = list(findsubarr(s, n - 1, a[n - 2]))
q = set()
for x in range(len(p)):
sum1 = p[x] + 0
sum2 = p[x] + e
if sum1 <= s:
q.add(sum1)
if sum2 <= s:
... | FUNC_DEF IF VAR NUMBER RETURN NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR ... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | import sys
input = sys.stdin.readline
def check(a, n, x, dp):
if x == 0:
return True
elif n == 0:
return False
elif dp[n][x] != -1:
return dp[n][x]
else:
dp[n][x] = check(a, n - 1, x, dp) or check(a, n - 1, x - a[n - 1], dp)
return dp[n][x]
n = int(input())
a... | IMPORT ASSIGN VAR VAR FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR BIN_OP VAR NUMBER VAR RETURN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VA... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | def solve(arr):
n = len(arr)
mask = 0
for a in arr:
mask |= a
d = 0
while mask & 1 << d == 0:
d += 1
for i in range(n):
arr[i] >>= d
total = sum(arr)
if total & 1:
return 0
target = total // 2
f = [False] * (target + 1)
f[0] = True
for a in... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR BIN_OP NUMBER VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER RETURN NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR N... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | def findPartition(arr, n):
sum = 0
i, j = 0, 0
for i in range(n):
sum += arr[i]
if sum % 2 != 0:
return False
part = [[(True) for i in range(n + 1)] for j in range(sum // 2 + 1)]
for i in range(0, n + 1):
part[0][i] = True
for i in range(1, sum // 2 + 1):
part... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER FOR ... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | n = int(input())
(*arr,) = map(int, input().split())
while all(v % 2 == 0 for v in arr):
arr = [(v // 2) for v in arr]
s = sum(arr)
inf = n + 1
dp = [inf] * (sum(arr) + 1)
dp[0] = 0
for v in arr:
for i in range(len(dp) - 1, -1, -1):
if dp[i] != inf:
dp[i + v] = min(dp[i] + 1, dp[i + v])
de... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR WHILE FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER NUM... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | from sys import stdin, stdout
input = stdin.readline
def main():
t = 1
for z in range(t):
n = int(input())
ai = list(map(int, input().split()))
num2 = sum(ai)
if num2 % 2 != 0:
print(0)
return
num3 = num2 // 2
n2 = 1000 * n
ar = ... | ASSIGN VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER RETURN ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP NUMBER VA... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | n = int(input())
l = list(map(int, input().split()))
idx, min_cnt = 0, 1 << 30
s = sum(l)
if s % 2:
print(0)
else:
dp = [0] * (s // 2 + 1)
for i in range(n):
for j in range(s // 2, l[i] - 1, -1):
if dp[j - l[i]] or j == l[i]:
dp[j] = 1
for i in range(n):
cnt =... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | def helper2(a, tar):
pool = [0] * 200005
pool[0] = 1
for i in range(len(a)):
child = []
for j in range(tar):
if pool[j] == 1:
child.append(j + a[i])
for c in child:
pool[c] = 1
return pool[tar] == 1
def helper(a):
if sum(a) % 2 == 1:
... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR FOR VAR VAR ASSIGN VAR VAR NUMBER RETURN VAR VAR NUMBER FUNC_DEF IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER RETU... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | from sys import stdin, stdout
input = stdin.readline
def findPartiion(arr, n):
Sum = 0
for i in range(n):
Sum += arr[i]
if Sum % 2 != 0:
return 0
part = [0] * (Sum // 2 + 1)
for i in range(Sum // 2 + 1):
part[i] = 0
for i in range(n):
for j in range(Sum // 2, a... | ASSIGN VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR N... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
if s % 2:
ans = 0
else:
ans = 1
dp = [([0] * (s + 1)) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
ai = a[i]
for j in range(s + 1):
dp[i + 1][j] |= dp[i][j]
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMB... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | import sys
def find_least_significant_bit(x):
binary = bin(x)
bit_location = binary.rfind("1")
return len(binary) - bit_location
n = int(input())
a = list(map(int, input().split()))
sums = {0}
for e in a:
sums_with_e = {(s + e) for s in sums}
sums.update(sums_with_e)
total = sum(a)
if total % 2 ... | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING RETURN BIN_OP FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUN... |
Baby Ehab was toying around with arrays. He has an array $a$ of length $n$. He defines an array to be good if there's no way to partition it into $2$ subsequences such that the sum of the elements in the first is equal to the sum of the elements in the second. Now he wants to remove the minimum number of elements in $a... | n = int(input())
a = [int(i) for i in input().split()]
sm = sum(a)
if sm % 2 == 1:
print(0)
else:
target = sm // 2
dp = [[(0) for j in range(target + 1)] for i in range(n + 1)]
dp[0][0] = 1
x = []
c = {(0): []}
boo = True
for i in range(1, n + 1):
for j in range(target):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMB... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | MAX_T_SHIRT = 100
t_shirts_elephant_map = []
dp = []
def find(mask, t_shirt_id):
if mask == 0:
return 1
if t_shirt_id < 0:
return 0
if dp[mask][t_shirt_id] != -1:
return dp[mask][t_shirt_id]
ans = find(mask, t_shirt_id - 1)
for e_id in t_shirts_elephant_map[t_shirt_id]:
... | ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER FOR VAR VAR VAR IF BIN_OP VAR BIN_OP NUMBER VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER VAR BIN_OP VAR NUMB... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | import sys
sys.setrecursionlimit(1000000)
t, mod = int(sys.stdin.readline()), 1000000007
while t:
n = int(sys.stdin.readline())
a = [[(0) for _ in range(101)] for _ in range(n + 1)]
for i in range(n):
cur = [int(x) for x in sys.stdin.readline().split()]
for x in cur:
a[i][x] = 1... | IMPORT EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR ASSIGN VAR VAR... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | m = 10**9 + 7
def bitmask(mask, tid):
if mask == 2**n - 1:
return 1
if tid == 101:
return 0
if dp[mask][tid] != -1:
return dp[mask][tid]
ans = bitmask(mask, tid + 1)
for h in ts[tid]:
if mask & 1 << h:
continue
ans = (ans % m + bitmask(mask | 1 <... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF IF VAR BIN_OP BIN_OP NUMBER VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER FOR VAR VAR VAR IF BIN_OP VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP F... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | MOD = 1000000007
n = tshirt = dp = None
ass = set()
def allocate(mask, tid):
if mask == (1 << n) - 1:
return 1
if tid == 101:
return 0
if dp[mask][tid] != -1:
return dp[mask][tid]
ans = allocate(mask, tid + 1)
for p in tshirt[tid]:
if mask >> p & 1:
cont... | ASSIGN VAR NUMBER ASSIGN VAR VAR VAR NONE ASSIGN VAR FUNC_CALL VAR FUNC_DEF IF VAR BIN_OP BIN_OP NUMBER VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER FOR VAR VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP VA... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | I = input
t = int(I())
mod = int(1000000000.0 + 7)
end = 0
dp = []
def fun(mask, tid, ls):
if mask == end:
return 1
if tid == 101:
return 0
if not dp[mask][tid] == -1:
return dp[mask][tid]
ans = 0
ans += fun(mask, tid + 1, ls)
for p in ls[tid]:
if not mask >> p ... | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR FOR VAR VAR VAR IF BI... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | md = 10**9 + 7
book = dict()
ids = [set()] * 10
n = 0
def poss(i, a):
if (i, tuple(a)) in book.keys():
return book[i, tuple(a)]
elif i == 101:
if all(a):
return 1
else:
return 0
else:
res = poss(i + 1, a)
for j in range(n):
if i i... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FUNC_DEF IF VAR FUNC_CALL VAR VAR FUNC_CALL VAR RETURN VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF FUNC_CALL VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | dp = []
mod = 1000000007
p = 0
def solve(shirtNum, li, mask):
if shirtNum == 101:
if mask == p - 1:
return 1
else:
return 0
if dp[shirtNum][mask] != -1:
return dp[shirtNum][mask]
count = solve(shirtNum + 1, li, mask)
for i in li[shirtNum]:
if mas... | ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FUNC_DEF IF VAR NUMBER IF VAR BIN_OP VAR NUMBER RETURN NUMBER RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR FOR VAR VAR VAR IF BIN_OP VAR BIN_OP NUMBER VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP VAR B... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | MOD = 1000000007
T = int(input())
SHIRTS = 101
for t in range(T):
N = int(input())
owns = [([False] * SHIRTS) for _ in range(N)]
for i in range(0, N):
for s in map(int, input().split()):
owns[i][s] = True
dp = [([0] * (1 << N)) for _ in range(SHIRTS)]
dp[0][0] = 1
for s in ra... | ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER ASSIGN VAR BIN_... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | M, Mod = 105, 1000000007
T = int(input())
for _ in range(0, T):
n = int(input())
b = [[] for i in range(M)]
for i in range(0, n):
a = list(map(int, input().split()))
for j in range(0, len(a)):
b[a[j]].append(i)
dp = [[0] for i in range(M)]
for i in range(0, M):
dp... | ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | import sys
t = int(sys.stdin.readline().strip())
for tc in range(t):
n = int(sys.stdin.readline().strip())
A = []
for i in range(n):
A.append(set([int(c) for c in sys.stdin.readline().split()]))
DP = []
DP.append([1] + [0] * 100)
for i in range(1, 2**n):
DP.append([0] * 101)
... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR BIN_OP LIST NUMBER BIN_OP LIST NU... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | MOD = 1000000007
def findAns(mask, tid, n, people, dp):
if mask == (1 << n) - 1:
return 1
if tid >= 101:
return 0
if dp[tid][mask] != -1:
return dp[tid][mask]
ans = findAns(mask, tid + 1, n, people, dp)
for i in range(n):
if mask & 1 << i:
continue
... | ASSIGN VAR NUMBER FUNC_DEF IF VAR BIN_OP BIN_OP NUMBER VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR BIN_OP NUMBER VAR IF VAR VAR VAR VAR FUNC_CALL VAR BIN_OP VAR BIN_OP NUM... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | t = int(input())
while t > 0:
t -= 1
n = int(input())
a = []
mod = 10**9 + 7
ff = {}
a = [[] for i in range(105)]
for i in range(n):
b = [int(x) for x in input().split()]
for j in b:
a[j].append(i)
ff[j] = 1
dp = [[(0) for i in range(1025)] for j i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR DICT ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR ... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | for _ in range(int(input())):
n = int(input())
arr = [[] for j in range(100)]
memo = {}
for i in range(n):
for j in input().split():
arr[int(j) - 1].append(i)
arr = [i for i in arr if i]
def helper(index, mask):
if index == len(arr):
return 1 if not mask ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR ASSIGN VAR VAR VAR VAR VAR FUNC_DEF IF VAR FUNC_CALL VAR VAR ... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | import sys
sys.setrecursionlimit(10**6)
ip = sys.stdin.readline
op = sys.stdout.write
def recursive_thinking(shirts, n, t_id, mask, tb):
if mask == 2**n - 1:
return 1
if t_id == 101:
return 0
if (t_id, mask) in tb:
return tb[t_id, mask]
ways = recursive_thinking(shirts, n, t_i... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR VAR FUNC_DEF IF VAR BIN_OP BIN_OP NUMBER VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR VAR VAR RETURN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR BIN_OP NUMBER VAR NU... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | MOD = 1000000007
adj = [[] for x in range(101)]
dp = {}
def solve(tid, mask, n):
if mask == (1 << n) - 1:
return 1
if tid >= 101:
return 0
if (tid, mask) in dp:
return dp[tid, mask] % MOD
c = 0
c += solve(tid + 1, mask, n)
for x in adj[tid]:
if not 1 << x & mask... | ASSIGN VAR NUMBER ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER ASSIGN VAR DICT FUNC_DEF IF VAR BIN_OP BIN_OP NUMBER VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR VAR VAR RETURN BIN_OP VAR VAR VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR FOR VAR VAR VAR IF BIN_OP BIN_OP NUMBER VAR VAR ... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | mod = 1000000007
def solve(shirt, people, dp, mask, n):
if mask == 0:
return 1
if shirt > 100:
return 0
if dp[shirt][mask] != -1:
return dp[shirt][mask]
ans = 0
for i in range(1, n + 1):
if mask & 1 << i - 1 != 0 and people[i][shirt]:
ans = ans + solve(s... | ASSIGN VAR NUMBER FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER VAR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER VAR V... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | t = int(input())
m = int(1000000000.0) + 7
allmask = 0
def solve(tss, dp, mask, tid):
if mask == allmask:
return 1
if tid > 100:
return 0
if dp[mask][tid] != -1:
return dp[mask][tid]
ways = solve(tss, dp, mask, tid + 1)
size = len(tss[tid])
for j in range(size):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR ... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | mod = int(1000000000.0 + 7)
n = 0
def solve(mask, i, tshirt, dp):
if mask == (1 << n) - 1:
return 1
if i > 100:
return 0
if dp[mask][i] != -1:
return dp[mask][i]
ways = solve(mask, i + 1, tshirt, dp)
for j in tshirt[i]:
j -= 1
if mask & 1 << j:
c... | ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER FUNC_DEF IF VAR BIN_OP BIN_OP NUMBER VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR FOR VAR VAR VAR VAR NUMBER IF BIN_OP VAR BIN_OP NUMBER VAR VAR FUNC_CA... |
Read problems statements in Mandarin Chinese and Russian.
Little Elephant and his friends are going to a party. Each person has his own collection of T-Shirts. There are 100 different kind of T-Shirts. Each T-Shirt has a unique id between 1 and 100. No person has two T-Shirts of the same ID.
They want to know how ma... | def cek(mask, n):
if mask == maxmask:
return 1
if n > 100:
return 0
if dp[mask][n] != -1:
return dp[mask][n]
ans = cek(mask, n + 1)
for i in shirts[n]:
if mask & 1 << i == 0:
ans += cek(mask | 1 << i, n + 1)
ans %= 10**9 + 7
dp[mask][n] = ans
r... | FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER FOR VAR VAR VAR IF BIN_OP VAR BIN_OP NUMBER VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def check(num, i):
ans = 1
b = [0, 0]
for j in range(8):
b.append(i & 1)
i = i >> 1
flag = True
for j in range(9, -1, -1):
t = num[j] + (b[j + 2] * 10 if j + 2 < 10 else 0)
if b[j] == 1 and t == 0:
return 0
tmp = t - b[j]
if tmp > 9:
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR BIN_OP VAR NUMBER NUMBER BIN_OP VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR NU... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def int_input():
a = int(input())
return a
def int_list_input():
a = list(map(int, input().split()))
return a
def solve():
n = input()
a = ""
b = ""
for i in range(0, len(n), 2):
a += n[i]
for i in range(1, len(n), 2):
b += n[i]
ans = int(a) + 1
if b != ""... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for q in range(t):
a = input()
t = "0"
s = "0"
for i in range(len(a)):
if i % 2 == 0:
t += a[i]
else:
s += a[i]
print((int(t) + 1) * (int(s) + 1) - 2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBE... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
while t > 0:
n = input()
l1 = []
l2 = []
for i in range(len(n)):
if i % 2 == 0:
l1.append(n[i])
else:
l2.append(n[i])
n1 = n2 = 0
if len(l1) > 0:
n1 = int("".join(l1))
if len(l2) > 0:
n2 = int("".join(l2))
sol = (n1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | n = int(input())
def get_n(n):
s = str(n)
res_c = ""
res_n = ""
for j in range(len(str(n))):
if j % 2 == 0:
res_n += s[j]
else:
res_c += s[j]
res_c = int(res_c) + 1
res_n = int(res_n) + 1
return res_c, res_n
def get_res(number):
if number < 10:... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER RETURN VAR VAR ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | tc = int(input())
for _ in range(tc):
n = input().strip()
n = n[::-1]
a = ""
b = ""
for i in range(len(n)):
if i % 2 == 0:
a = n[i] + a
else:
b = n[i] + b
if a == "":
a = 0
else:
a = int(a)
if b == "":
b = 0
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR STRING ASSIGN VAR NUMBER AS... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | n = int(input())
for i in range(n):
r = input()
if len(r) == 1:
print(int(r) - 1)
else:
a = int(r[::2])
b = int(r[1::2])
print((a + 1) * (b + 1) - 2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUM... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def div_num(N):
num = str(N)
n1 = num[::2]
n2 = num[1::2]
return int(n1), int(n2)
for i in range(int(input())):
n = int(input())
if n < 10:
ans = n - 1
else:
num1, num2 = div_num(n)
ans = (num1 + 1) * (num2 + 1) - 2
print(ans) | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_O... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | import sys
input = sys.stdin.readline
def solve():
s = input().strip()
n = len(s)
even = [0, 0]
odd = [0, 0]
if int(s) < 10:
return int(s) - 1
s = s[::-1]
d0, d1 = int(s[0]), int(s[1])
dp = [[d0 + 1, 9 - d0], [d1 + 1, 9 - d1]]
for i in range(2, n):
d = int(s[i])
... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER IF FUNC_CALL VAR VAR NUMBER RETURN BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | import sys
strings = iter(sys.stdin.read().split())
ints = (int(x) for x in strings)
sys.setrecursionlimit(3000)
def f(a, carry=0):
ans = 0
if len(a) == 0:
ans += carry == 0
else:
*b, msd = a
if carry == 0:
ans += (msd + 1) * f(b)
if msd:
an... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER FUNC_DEF NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR VAR VAR IF VAR NUMBER VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR BIN_OP VAR FUNC_CALL VAR VAR NUMB... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | a = {
(-1): 0,
(0): 1,
(1): 2,
(2): 3,
(3): 4,
(4): 5,
(5): 6,
(6): 7,
(7): 8,
(8): 9,
(9): 10,
(10): 9,
(11): 8,
(12): 7,
(13): 6,
(14): 5,
(15): 4,
(16): 3,
(17): 2,
(18): 1,
(19): 0,
}
def f(n, s):
r = 1
for i in range(len(... | ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF A... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def solve(n):
a = 0
b = 0
s = str(n)
for i in range(len(s)):
if i % 2 == 0:
a = a * 10 + int(s[i])
else:
b = b * 10 + int(s[i])
return (a + 1) * (b + 1) - 2
t = int(input())
for _ in range(t):
n = int(input())
print(solve(n)) | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR RETURN BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBE... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
while t:
a = ""
b = ""
n = str(input())
for i in range(1, len(n), 2):
b += n[i]
for i in range(0, len(n), 2):
a += n[i]
if a == "":
a = 0
if b == "":
b = 0
print((int(a) + 1) * (int(b) + 1) - 2)
t -= 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR VAR VAR IF VAR STRING ASSIGN VAR NUMBER IF VAR STRING ASSIGN VAR NUMBER ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for tt in range(t):
s = list(input())
s1 = ""
s2 = ""
n = len(s)
for i in range(0, n, 2):
s1 += s[i]
for i in range(1, n, 2):
s2 += s[i]
if s1:
s1 = int(s1)
else:
s1 = 0
if s2:
s2 = int(s2)
else:
s2 = 0
print((s... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR VAR VAR IF VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | digit_map = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
def count(n, crr_neg, crr_pos):
n_ = [int(x) for x in list(str(n))]
assert len(crr_neg) == len(n_)
assert len(crr_pos) == len(n_)
v = 1
for idx, (d, c_neg, c_pos) in enumerate(zip(n_, crr_neg, crr_pos)):
d += c_neg + 10... | ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for i in range(t):
n = int(input())
arr = str(n)
ans = ""
ans1 = ""
for i in range(len(arr)):
if i % 2 == 0:
ans += arr[i]
else:
ans1 += arr[i]
if len(arr) == 1:
print(int(ans) - 1)
else:
a = (int(ans) + 1) * (int(ans1)... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
n = int(input())
s = str(n)
e = ""
o = ""
for i in range(len(s)):
if i % 2 == 0:
e = e + s[i]
else:
o = o + s[i]
if len(e) >= 1 and len(o) >= 1:
q = int(e)
t = int(o)
print((q + 1) * (t + 1) - 2)
el... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
while t:
t -= 1
n = input()
s1 = ""
s2 = ""
for i in range(len(n)):
if i % 2 == 0:
s1 += str(n[i])
else:
s2 += str(n[i])
i = j = 0
while i < len(s1) and s1[i] == "0":
i += 1
while j < len(s2) and s2[j] == "0":
j += ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR STRING VAR NUMBER WHI... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | T = int(input())
for _ in range(T):
n = input()
even = 0
odd = 0
for i in range(len(n)):
if i % 2 == 0:
even = even * 10 + int(n[i])
else:
odd = odd * 10 + int(n[i])
print((even + 1) * (odd + 1) - 2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR EXPR FUNC_... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def solver(num1, num2):
num1 = int(num1)
num2 = int(num2)
total1 = num1 + 1
total2 = num2 + 1
total = total1 * total2
tosub = 0
if num1 != 0 and num2 != 0:
return total - 2
if num1 == 0 and num2 != 0:
return total - 2
if num1 != 0 and num2 == 0:
return total -... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN BIN_OP VAR NUMBER I... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for iter in range(t):
c = list(input())
c.reverse()
c = "".join(c)
s = c
a0 = dict()
a0[-1] = 0
a0[0] = 1
a0[1] = 2
a0[2] = 3
a0[3] = 4
a0[4] = 5
a0[5] = 6
a0[6] = 7
a0[7] = 8
a0[8] = 9
a0[9] = 10
a1 = dict()
a1[-1] = 10
a1[0] ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL STRING VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
n = int(input())
n1 = 0
n2 = 0
idx = 0
p1 = 0
p2 = 0
while n != 0:
rem = n % 10
if idx % 2 == 0:
n1 += rem * pow(10, p1)
p1 += 1
else:
n2 += rem * pow(10, p2)
p2 += 1
n = n // 10
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR FUNC_CALL VAR NUMBER VAR VAR NUMBER VAR BIN_OP VAR F... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def func():
n = input()
n1 = ""
n2 = ""
l = len(n)
for i in range(l):
if i % 2 == 0:
n1 += n[i]
else:
n2 += n[i]
if len(n2) == 0:
print(int(n1) - 1)
return
n1 = int(n1)
n2 = int(n2)
print((n1 + 1) * (n2 + 1) - 2)
t = int(input... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER RETURN ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | ways = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
def solve(n, d=0, c=[]):
if n == 0:
return len(c) == 0
num = n % 10
if d in c:
num -= 1
c.remove(d)
s1 = solve(n // 10, d + 1, c[:])
s2 = solve(n // 10, d + 1, c + [d + 2])
return (ways[num] * s1 if num >... | ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FUNC_DEF NUMBER LIST IF VAR NUMBER RETURN FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_O... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | import sys
input = sys.stdin.readline
def quants(n, p):
l = int(n[-1])
if len(n) == 1:
if p[0] == 1:
return 0
return l - p[1] + 1
l = l - p[1]
ans = 0
if l + 1 > 0:
ans += (l + 1) * quants(n[:-1], [0, p[0]])
if 9 - l > 0:
ans += (9 - l) * quants(n[:... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER IF VAR NUMBER NUMBER RETURN NUMBER RETURN BIN_OP BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR NUMBER LIST NUMBER VA... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | import sys
read = lambda: sys.stdin.readline()
for _ in range(int(read())):
a = read()
if int(a) < 10:
print(int(a) - 1)
continue
num1 = int("".join([a[i] for i in range(0, len(a), 2)]))
num2 = int("".join([a[i] for i in range(1, len(a), 2)]))
print((num1 + 1) * (num2 + 1) - 2) | IMPORT ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR VAR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
n = input()
a = int("0" + "".join([n[i] for i in range(len(n)) if i % 2 == 0]))
b = int("0" + "".join([n[i] for i in range(len(n)) if i % 2 != 0]))
print((a + 1) * (b + 1) - 2) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP STRING FUNC_CALL STRING VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP STRING FUNC_CALL STRING VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NU... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for i in range(t):
n = input()
if len(n) == 1:
print(int(n) - 1)
else:
ns = [char for char in n]
se = ""
so = ""
for i in range(len(ns)):
if i % 2 == 0:
se += ns[i]
else:
so += ns[i]
se =... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
while t > 0:
t -= 1
s = input().strip()
a, b = "", ""
for i in range(len(s)):
if i % 2 == 0:
a += s[i]
else:
b += s[i]
if b == "":
b = 0
else:
b = int(b)
a = int(a)
print((a + 1) * (b + 1) - 2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR STRING STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR IF VAR STRING ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FU... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
s = input()
s1 = ""
s2 = ""
for i in range(len(s)):
if i % 2 == 0:
s1 += s[i]
else:
s2 += s[i]
if s2 == "":
print(int(s1) - 1)
else:
s1, s2 = int(s1) + 1, int(s2) + 1
print(s1 * s2 - 2) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER BIN_O... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for i in range(t):
n = input()
a = 0
b = 0
i = 0
state = False
for x in range(1, len(n) + 1):
digit = int(n[-1 * x])
if state:
b += 10**i * digit
else:
a += 10**i * digit
if state:
i += 1
state = not sta... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR IF VAR VAR BIN_OP BIN_OP NUMBER VAR VAR VAR BIN_OP... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | import sys
input = sys.stdin.readline
t = int(input())
pow2 = [1]
for _ in range(12):
pow2.append(2 * pow2[-1])
c = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0]
for _ in range(t):
n = list(input().rstrip())
n.reverse()
for i in range(len(n)):
n[i] = int(n[i])
l = len(n) ... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def solve():
n = str(input())
a = ""
b = ""
if len(n) == 1:
a = int(n)
b = 0
else:
for i in range(len(n)):
if i % 2 == 0:
a = a + n[i]
else:
b = b + n[i]
a = int(a)
b = int(b)
result = (a + 1) * (b + ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSI... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | ans = []
for _ in range(int(input())):
s = list(map(int, list(input())))
n = len(s)
cnt = 0
for msk in range(max(1, 2 ** (n - 2))):
x = [0] * n
for j in range(n - 2):
if msk & 2**j > 0:
x[j] = 1
p = [0] * n
for j in range(n):
sm = s... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_O... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | import sys
def solve(num):
a = str(num)
b = a[::2]
if not b:
even = 0
else:
even = int(b)
c = a[1::2]
if not c:
odd = 0
else:
odd = int(c)
return (odd + 1) * (even + 1) - 2
first = True
for line in sys.stdin.readlines():
if first:
first = F... | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER IF VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER IF VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR RETURN BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR IF VAR ASSIG... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | n = int(input())
for _ in range(n):
x = input().zfill(10)
x1 = int(x[::2]) + 1
x2 = int(x[1::2]) + 1
print(x1 * x2 - 2)
exit() | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
n = input()
l = len(n)
if l == 1:
print(int(n) - 1)
else:
a, b = int(n[::2]), int(n[1::2])
if l & 1 == 0:
a, b = b, a
print((a + 1) * (b + 1) - 2) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP BI... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | from sys import stdin
input = stdin.readline
rn = lambda: int(input())
rns = lambda: map(int, input().split())
rl = lambda: list(map(int, input().split()))
rs = lambda: input().strip()
YN = lambda x: print("YES") if x else print("NO")
mod = 10**9 + 7
for _ in range(rn()):
n = rs()
a = ""
b = ""
for i i... | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
n = input()
flag = True
i = 0
a = ""
b = ""
while i < len(n):
if flag == True:
a += n[i]
i += 1
flag = False
else:
b += n[i]
i += 1
flag = True
a = int(a) if a != "" else 0
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING WHILE VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR STRING FUNC_CALL VAR VAR NUMBER AS... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | j = int(input())
for k in range(j):
t = input()
a = ""
b = ""
for i in range(len(t)):
if i % 2:
a += t[i]
else:
b += t[i]
if len(a) > 0:
c = int(a)
else:
c = 0
if len(b) > 0:
d = int(b)
else:
d = 0
print((c + 1) ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER VAR VAR VAR VAR VAR VAR IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER ASSIGN... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def ii():
return int(input())
def si():
return input()
def mi():
return map(int, input().split())
def msi():
return map(str, input().split())
def li():
return list(mi())
t = ii()
for _ in range(t):
n = si()
a = int("0" + "".join([n[i] for i in range(0, len(n), 2)]))
b = int("0"... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def solve(x):
o, e = "", ""
for i in range(len(x)):
if i % 2 == 0:
e += x[i]
else:
o += x[i]
if o == "":
o = 0
if e == "":
e = 0
print((int(e) + 1) * (int(o) + 1) - 2)
for _ in range(int(input())):
x = input()
solve(x) | FUNC_DEF ASSIGN VAR VAR STRING STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR IF VAR STRING ASSIGN VAR NUMBER IF VAR STRING ASSIGN VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def recursion(a, i, prev):
if i >= 0:
if i - 2 >= 0:
if a[i] == 0 and prev == "carry":
x = 9
y = d[x]["normal"]
r1 = recursion(a, i - 2, "carry")
ans = r1 * y
return ans
else:
if prev == "... | FUNC_DEF IF VAR NUMBER IF BIN_OP VAR NUMBER NUMBER IF VAR VAR NUMBER VAR STRING ASSIGN VAR NUMBER ASSIGN VAR VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR VAR RETURN VAR IF VAR STRING ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR STRING ASSIGN VAR FU... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for i in range(0, t):
n = input()
a = [None] * 1
b = [None] * 1
count = 0
for j in n:
if count == 0:
a[0] = j
elif count % 2 == 0:
a.append(j)
elif count == 1:
b[0] = j
else:
b.append(j)
count +=... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NONE NUMBER ASSIGN VAR BIN_OP LIST NONE NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER VAR ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for _ in range(t):
n = str(input())
a, b = "", ""
n = n[::-1]
odd = False
for c in n:
if odd:
b += c
else:
a += c
odd = not odd
a = int("0" + a[::-1])
b = int("0" + b[::-1])
print((a + 1) * (b + 1) - 2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR STRING STRING ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP STRING VAR NUMB... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def solve():
s = input()
s1, s2 = "", ""
for i in range(len(s)):
if i % 2 == 0:
s1 += s[i]
else:
s2 += s[i]
if not s2:
print(int(s1) - 1)
else:
print((int(s1) + 1) * (int(s2) + 1) - 2)
return
t = int(input())
while t > 0:
t -= 1
s... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR STRING STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR IF VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER RET... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def read_int():
return int(input())
def read_ints():
return map(int, input().split(" "))
def calc(num):
return max(0, 10 - abs(num - 9))
t = read_int()
for case_num in range(t):
n = read_int()
digits = [int(ch) for ch in str(n)][::-1]
m = len(digits)
ans = 0
for state in range(1 <<... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF RETURN FUNC_CALL VAR NUMBER BIN_OP NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR N... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for _ in range(t):
n = input()
j = 0
odd = ""
eve = ""
for i in reversed(range(len(n))):
if j % 2 == 0:
odd = n[i] + odd
else:
eve = n[i] + eve
j += 1
if len(eve) == 0:
eve = "0"
if len(odd) == 0:
odd = "0"
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR NUMBER IF FUNC_CALL VAR VAR NU... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
n = int(input())
s = str(n)
len2 = len(s) - 2
if len(s) == 1:
print(int(s[-1]) - 1)
continue
if len(s) == 2:
print((int(s[-1]) + 1) * (int(s[-2]) + 1) - 2)
continue
ans = -2
for x in range(1 << len2):
b = "0b" + bin(x)[:1:... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP FUNC_... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | import sys
input = sys.stdin.readline
def main():
t = int(input())
for _ in range(t):
n = input()[:-1]
odd = 0
even = 0
for i, x in enumerate(n):
if i % 2:
even += int(x)
even *= 10
else:
odd += int(x)
... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR VAR NUMBER VAR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def read_line():
return [int(x) for x in input().split()]
def read_int():
return int(input())
def solve():
n = read_int()
s = str(n)
a = ""
b = ""
for i in range(0, len(s)):
if i & 1:
a += s[i]
else:
b += s[i]
if a:
a = int(a)
else:... | FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER VAR VAR VAR VAR VAR VAR IF VAR ASSIGN VAR FUNC_... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
n = "0" + input()
a = int(n[0::2])
b = int(n[1::2])
print((a + 1) * (b + 1) - 2) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP STRING FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
s = input()
a = ""
b = ""
for i in range(len(s)):
if i % 2 == 0:
a += s[i]
else:
b += s[i]
if len(b) == 0:
print(int(a) - 1)
else:
print((int(a) + 1) * (int(b) + 1) - 2) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_O... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
num = str(input())
e, n_e = "", ""
for ind in range(len(num)):
if ind % 2 == 0:
e += num[ind]
else:
n_e += num[ind]
if n_e == "":
ans = int(e) - 1
else:
ans = (int(e) + 1) * (int(n_e) + 1) - 2
print(ans) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR STRING STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR IF VAR STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR NUM... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def f(p, n, carries, acc):
if p == -1:
return acc
ret = 0
for carry in range(2):
if p < 2 and carry == 1:
continue
target = n[p] - carry + carries[p + 2] * 10
if target < 0:
continue
if target >= 10:
curr = 19 - target
else:... | FUNC_DEF IF VAR NUMBER RETURN VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR BIN_... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def solve():
s = "0" + input()
a, b = int(s[0::2]) + 1, int(s[1::2]) + 1
print(a * b - 2)
def main():
tc = int(input())
for _ in range(tc):
solve()
main() | FUNC_DEF ASSIGN VAR BIN_OP STRING FUNC_CALL VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | T = int(input())
for t in range(T):
n = input()
a = ""
b = ""
for i, c in enumerate(n[::-1]):
if i % 2 == 0:
a = c + a
else:
b = c + b
a = int(a)
if b:
b = int(b)
else:
b = 0
res = (a + 1) * (b + 1) - 2
print(res) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR N... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for aslkdjaskdj in range(t):
n = input()
flag = 0
j = "0"
o = "0"
for i in n:
if flag == 0:
o += i
else:
j += i
flag = 1 - flag
j = int(j)
o = int(o)
print((j + 1) * (o + 1) - 2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR VAR IF VAR NUMBER VAR VAR VAR VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUM... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
n = int(input())
c1 = 1
c2 = 1
i = 0
a = 0
b = 0
while n:
r = int(n % 10)
if int(i % 2) == 0:
a = r * c1 + a
c1 *= 10
else:
b = r * c2 + b
c2 *= 10
n = int(n / 10)
i += 1
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR NUMBE... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def main():
s = input()
n = len(s)
ans = ""
for i in range(0, n, 2):
ans += s[i]
n1 = int(ans)
ans = ""
for i in range(1, n, 2):
ans += s[i]
if ans == "":
ans = "0"
n2 = int(ans)
ans = (n1 + 1) * (n2 + 1) - 2
print(ans)
t = 1
t = int(input())
for ii ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR VAR VAR IF VAR STRING ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP BI... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | T = int(input())
for i in range(T):
k = input()
t = len(k)
s = ""
r = ""
for i in range(t - 1, -1, -1):
if i % 2 == 0:
s = k[i] + s
else:
r = k[i] + r
s = "0" + s
r = "0" + r
print((int(s) + 1) * (int(r) + 1) - 2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP STRIN... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | T = int(input())
for t in range(T):
N = input()
num1 = ""
for i in range(0, len(N), 2):
num1 = num1 + N[i]
num1 = int(num1)
num2 = ""
for i in range(1, len(N), 2):
num2 = num2 + N[i]
if num2 == "":
print(num1 - 1)
else:
num2 = int(num2)
print((num1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR V... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
n = input()
a = ""
b = ""
for i in range(len(n)):
if i % 2 == 0:
a += n[i]
else:
b += n[i]
if len(a) > 0 and len(b) > 0:
print((int(a) + 1) * (int(b) + 1) - 2)
elif len(a) > 0:
print(int(a) - 1)
else:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def helper(x):
l = []
while x > 0:
l.append(x % 10)
x = x // 10
l.reverse()
xe = 0
xo = 0
for i in range(len(l)):
if i % 2 == 0:
xe = 10 * xe + l[i]
else:
xo = 10 * xo + l[i]
return (xo + 1) * (xe + 1) - 2
t = int(input())
for xx in r... | FUNC_DEF ASSIGN VAR LIST WHILE VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR VAR R... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | import sys
tc = int(sys.stdin.readline())
cache1 = {
(0): 1,
(1): 2,
(2): 3,
(3): 4,
(4): 5,
(5): 6,
(6): 7,
(7): 8,
(8): 9,
(9): 10,
}
cache2 = {
(0): 9,
(1): 8,
(2): 7,
(3): 6,
(4): 5,
(5): 4,
(6): 3,
(7): 2,
(8): 1,
(9): 0,
}
for _ in r... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR DICT NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMB... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.