Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
N = int(input())
A = list(map(int, input().split()))
count = 0
for c in combinations(range(N), 2):
    if abs(c[0] - c[1]) == A[c[0]] + A[c[1]]:
        count += 1
print(count)

Fixed submission:
from collections import Counter
def main():
    n = int(input())
    A = list(map(int, input().split()))
    L = Counter([i + a for i, a in enumerate(A)])
    R = Counter([i - a for i, a in enumerate(A)])
    ans = 0
    for key in R.keys():
        ans += L[key] * R[key]
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = list(map(int, input().split()))
fb = 0
for x in range(N + 1):
    f = A * x // B - A * (x // B)
    if f < fb:
        break
    fb = f
print(fb)

Fixed submission:
A, B, N = list(map(int, input().split()))

if N >= B:
    max = (A * (B - 1) ) // B
else:
    max = A * N // B
print(max)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, N = list(map(int, input().split()))
max = 0
for x in range(N + 1):
    f = A * x // B - A * (x // B)
    if f > max:
        max = f
print(max)

Fixed submission:
A, B, N = list(map(int, input().split()))

if N >= B:
    max = (A * (B - 1) ) // B
else:
    max = A * N // B
print(max)

Buggy python submission (verdict: Time Limit Exceeded):
import math
A, B, N = list(map(int, input().split()))

max = 0
for x in range(N + 1):
    f = math.floor(A * x / B) - A * math.floor(x / B)
    if f > max:
        max = f
print(max)

Fixed submission:
A, B, N = list(map(int, input().split()))

if N >= B:
    max = (A * (B - 1) ) // B
else:
    max = A * N // B
print(max)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
def main():
    S = input()
    A = [0] * ((n := len(S)) + 1)
    A[1] = (a := int(S[-1])) % 2019
    for i in range(2, n + 1):
        a += pow(10, i - 1) * int(S[-i])
        A[i] = a % 2019
    c = Counter(A)
    ans = 0
    for v in c.values():
        ans += v * (v - 1) // 2
    print(ans)
    
if __name__ == '__main__':
    main()


Fixed submission:
from collections import Counter
def main():
    S = input()
    A = [0] * ((n := len(S)) + 1)
    A[1] = (a := int(S[-1])) % 2019
    for i in range(2, n + 1):
        a += pow(10, i - 1, 2019) * int(S[-i])
        A[i] = a % 2019
    c = Counter(A)
    ans = 0
    for v in c.values():
        ans += v * (v - 1) // 2
    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    S = input()
    n = len(S)
    i, j = 0, 4
    ans = 0
    while i <= n - 4:
        if eval(S[i:j] + ' % 2019 == 0'):
            ans += 1
        if j < n:
            j += 1
        else:
            i += 1
            j = i + 4
    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
from collections import Counter
def main():
    S = input()
    A = [0] * ((n := len(S)) + 1)
    A[1] = (a := int(S[-1])) % 2019
    for i in range(2, n + 1):
        a += pow(10, i - 1, 2019) * int(S[-i])
        A[i] = a % 2019
    c = Counter(A)
    ans = 0
    for v in c.values():
        ans += v * (v - 1) // 2
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
from collections import deque
S = deque(list(input()))
q = int(input())
r = False
for _ in range(q):
    t = input().split()
    if len(t) == 1:
        r = not r
    else:
        t[1] = int(t[1]) - 1
        if (not t[1] and not r) or (t[1] and r):
            S.appendleft(t[2])
        else:
            S.append(t[2])
if r:
    print(''.join(S[::-1]))
else:
    print(''.join(S))


Fixed submission:
from collections import deque
S = deque(list(input()))
q = int(input())
r = False
for _ in range(q):
    t = input().split()
    if len(t) == 1:
        r = not r
    else:
        t[1] = int(t[1]) - 1
        if (not t[1] and not r) or (t[1] and r):
            S.appendleft(t[2])
        else:
            S.append(t[2])
if r:
    S = list(S)
    print(''.join(S[::-1]))
else:
    print(''.join(S))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
r = False
for _ in range(q):
    t = input().split()
    if len(t) == 1:
        r = not r
    else:
        t[1] = int(t[1]) - 1
        if (not t[1] and not r) or (t[1] and r):
            s = t[2] + s
        else:
            s = s + t[2]
if r:
    print(s[::-1])
else:
    print(s)


Fixed submission:
from collections import deque
S = deque(list(input()))
q = int(input())
r = False
for _ in range(q):
    t = input().split()
    if len(t) == 1:
        r = not r
    else:
        t[1] = int(t[1]) - 1
        if (not t[1] and not r) or (t[1] and r):
            S.appendleft(t[2])
        else:
            S.append(t[2])
if r:
    S = list(S)
    print(''.join(S[::-1]))
else:
    print(''.join(S))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
r = False
for _ in range(q):
    t = input().split()
    if len(t) == 1:
        r = not r
    else:
        t[1] = int(t[1]) - 1
        if (not t[1] and not r) or (t[1] and r):
            s = t[2] + s
        else:
            s = s + t[2]
if r:
    print(s[::-1])
else:
    print(s)

Fixed submission:
from collections import deque
S = deque(list(input()))
q = int(input())
r = False
for _ in range(q):
    t = input().split()
    if len(t) == 1:
        r = not r
    else:
        t[1] = int(t[1]) - 1
        if (not t[1] and not r) or (t[1] and r):
            S.appendleft(t[2])
        else:
            S.append(t[2])
if r:
    S = list(S)
    print(''.join(S[::-1]))
else:
    print(''.join(S))
Buggy python submission (verdict: Runtime Error):
a, b, c = list(map(int, input().split()))
if len(set(a, b, c)) == 2:
    print('Yes')
else:
    print('No')


Fixed submission:
a = list(map(int, input().split()))
if len(set(a)) == 2:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n, k = list(map(int, input().split()))
P = list(map(int, input().split()))
P = [p * (p + 1) / (2 * p) for p in P]
ans = 0
for i in range(n - k + 1):
    ans = max(ans, sum(P[i:i + k]))
print(ans)

Fixed submission:
n, k = list(map(int, input().split()))
P = list(map(int, input().split()))
E = [0, ]
tot = 0
for i in range(n):
    tot += P[i] * (P[i] + 1) / (2 * P[i])
    E.append(tot)
ans = 0
for i in range(n - k + 1):
    ans = max(ans, E[i + k] - E[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    h, n = list(map(int, input().split()))
    A, B = [], []
    for _ in range(n):
        a, b = list(map(int, input().split()))
        A.append(a)
        B.append(b)
    mx = max(A)
    mn = min(A)
    INF = float('inf')
    dp = [INF] * (h + mx + 1)
    dp[0] = 0
    for i in range(1, h + mx + 1):
        res = []
        for a, b in zip(A, B):
            if i - a < 0:
                res.append(b)
            else:
                res.append(dp[i - a] + b)
        dp[i] = min(res)
    print(min(dp[h:h + mx + 1]))


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    h, n = list(map(int, input().split()))
    A, B = [], []
    for _ in range(n):
        a, b = list(map(int, input().split()))
        A.append(a)
        B.append(b)
    mx = max(A)
    INF = float('inf')
    dp = [INF] * (h + mx + 1)
    dp[0] = 0
    for i in range(1, h + mx + 1):
        for a, b in zip(A, B):
            if i - a < 0:
                dp[i] = min(dp[i], b)
            else:
                dp[i] = min(dp[i], dp[i - a] + b)
    print(min(dp[h:h + mx + 1]))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import numpy as np
def main():
    H, W = list(map(int, input().split()))
    A = np.array([['#'] * (W + 2)] + [['#', ] + list(input()) + ['#', ] for _ in range(H)] + [['#'] * (W + 2)])
    DXY = [[1, 0], [-1, 0], [0, 1], [0, -1]]
    ans = 0
    INF = 10000
    for h in range(1, H + 1):
        for w in range(1, W + 1):
            if A[h, w] == '#':
                continue
            count = np.where(A == '.', INF, -1)
            count[h, w] = 0
            stack = deque([[h, w], ])
            visited = [[0] * W for _ in range(H)]
            while stack:
                x, y = stack.popleft()
                if visited[x - 1][y - 1] == 1:
                    continue
                else:
                    visited[x - 1][y - 1] = 1
                for (dx, dy) in DXY:
                    X = x + dx
                    Y = y + dy
                    if A[X][Y] == '.':
                        if visited[X - 1][Y - 1] == 0:
                            stack.append([X, Y])
                        count[X, Y] = min(count[X, Y], count[x, y] + 1)
            ans = max(ans, np.max(count))
    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
from collections import deque
import itertools
def main():
    H, W = list(map(int, input().split()))
    A = [['#'] * (W + 2)] + [['#', ] + list(input()) + ['#', ] for _ in range(H)] + [['#'] * (W + 2)]
    DXY = [[1, 0], [-1, 0], [0, 1], [0, -1]]
    ans = 0
    INF = 10000
    for h in range(1, H + 1):
        for w in range(1, W + 1):
            if A[h][w] == '#':
                continue
            count = [[-1 if i == '#' else INF for i in a] for a in A]
            count[h][w] = 0
            stack = deque([[h, w], ])
            visited = [[0] * W for _ in range(H)]
            while stack:
                x, y = stack.popleft()
                if visited[x - 1][y - 1] == 1:
                    continue
                else:
                    visited[x - 1][y - 1] = 1
                for (dx, dy) in DXY:
                    X = x + dx
                    Y = y + dy
                    if A[X][Y] == '.':
                        if visited[X - 1][Y - 1] == 0:
                            stack.append([X, Y])
                        count[X][Y] = min(count[X][Y], count[x][y] + 1)
            count = list(itertools.chain.from_iterable(count))
            ans = max(ans, max(count))
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a, b, k = list(map(int, input().split()))
a_ans = a - min(a, k)
if a_ans == 0:
    b_ans = b - min(b, k - a)
print('{} {}'.format(a_ans, b_ans))


Fixed submission:
a, b, k = list(map(int, input().split()))
a_ans = a - min(a, k)
if a_ans == 0:
    b_ans = b - min(b, k - a)
else:
    b_ans = b
print('{} {}'.format(a_ans, b_ans))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = list(map(int, input().split()))
s = list(map(int, input().split()))
T = list(input())
ans = 0
stoi = {'r' : 2, 's' : 0, 'p' : 1}
for i in range(k):
    T_sub = [stoi[t] for j, t in enumerate(T) if j % k == i]
    score = 0
    pre = 3
    for j in range(len(T_sub)):
        if T_sub[j] == pre:
            pre = 3
        else:
            score += s[T_sub[j]]
            pre = T_sub[j]
    ans += score
print(ans)

Fixed submission:
n, k = list(map(int, input().split()))
s = list(map(int, input().split()))
T = list(input())
ans = 0
for i in range(k):
    T_sub = T[i::k]
    score = 0
    pre = 3
    for t_sub in T_sub:
        if t_sub == pre:
            pre = 3
        else:
            if t_sub == 'r':
                score += s[2]
            elif t_sub == 's':
                score += s[0]
            else:
                score += s[1]
            pre = t_sub
    ans += score
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(100000)

class Tree():
    def __init__(self, n, root, connects):
        self.root = root
        self.connects = connects
        self.parents = [0] * n
        self.parents[root] = None
        self.children = [0] * n
        self.children[self.root] = connects[self.root]
        self.make_tree(self.root)

    def make_tree(self, node):
        for child in self.children[node]:
            self.parents[child] = node
            self.children[child] = [c for c in self.connects[child] if c != node]
            if self.children[child] != []:
                self.make_tree(child)


def main():
    n = int(input())
    G = [[] for _ in range(n)]
    ID = [dict() for _ in range(n)]
    for i in range(n - 1):
        a, b = map(lambda x: int(x) - 1, input().split())
        G[a].append(b)
        G[b].append(a)
        ID[a][b] = i
        ID[b][a] = i
    t = Tree(n, root = 0, connects = G)
    m = max(len(g) for g in G)
    ans = [0] * (n - 1)
    def bfs(a, pre = set()):
        color = list(set(range(m)) - pre)
        for b in t.children[a]:
            c = color.pop()
            ans[ID[a][b]] = c + 1
            bfs(b, set([c]))
    bfs(0)
    print(m)
    [print(a) for a in ans]
      
if __name__ == '__main__':
    main()


Fixed submission:
import sys

sys.setrecursionlimit(100000)

def main():
    n = int(input())
    G = [[] for _ in range(n)]
    ID = [dict() for _ in range(n)]
    for i in range(n - 1):
        a, b = map(lambda x: int(x) - 1, input().split())
        G[a].append(b)
        G[b].append(a)
        ID[a][b] = i
        ID[b][a] = i
    m = max(len(g) for g in G)
    ans = [0] * (n - 1)
    def bfs(a, pre = -1, pre_c = -1):
        color = 1
        for b in G[a]:
            if b == pre: continue
            if color == pre_c: color += 1
            ans[ID[a][b]] = color
            bfs(b, a, color)
            color += 1

    bfs(0)
    print(m)
    [print(a) for a in ans]
      
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
def factorization(num):
    result = []
    temp = num
    for i in range(2, int(num ** 0.5) + 1):
        while temp % i == 0:
            temp = int(temp / i)
            result.append(i)

    if temp != 1:
        result.append(temp)
    if result == []:
        result.append(num)
    return result
factors = factorization(n)
ans = 1000000000000
for i in range(2 ** len(factors)):
    f0, f1 = 1, 1
    for j in range(len(factors)):
        if i >> j & 1:
            f1 *= factors[j]
        else:
            f0 *= factors[j]
    ans = min(ans, f0 + f1 - 2)
print(ans)

Fixed submission:
from itertools import product
n = int(input())
def factorization(num):
    result = []
    count = 0
    temp = num
    for i in range(2, int(num ** 0.5) + 1):
        if temp % i == 0:
            count = 0
            while temp % i == 0:
                count += 1
                temp /= i
            result.append([i, count])
    if temp != 1:
        result.append([temp, 1])
    if result == []:
        result.append([num, 1])
    return result
factors = factorization(n)
exps = [range(factor[1] + 1) for factor in factors]
ans = 1001001001001
for exp0 in product(*exps):
    f0 = 1
    for i in range(len(exp0)):
        f0 *= factors[i][0] ** exp0[i]
    f1 = n // f0
    ans = min(ans, f0 + f1 - 2)
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
ans = []
for i in range(1, n + 1):
    ans.append(str(A.index(i) + 1))
print(' '.join(ans))

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
ans = [0] * n
for i, a in enumerate(A):
    ans[a - 1] = str(i + 1)
print(' '.join(ans))
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1, 6, 2):
    if n < 10 ** (i - 1):
        break
    if 10 ** (i - 1) < n < 10 ** i:
        ans += n - int('9' * (i - 1))
    else:
        ans += 9 * 10 ** (i - 1)
print(ans)

Fixed submission:
n = int(input())
ans = 0
for i in range(1, n + 1):
    if i < 10:
        ans += 1
    elif 100 <= i < 1000:
        ans += 1
    elif 10000 <= i < 100000:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
from itertools import islice
def main():
    n = int(input())
    A = deque(list(map(int, input().split())))
    ans = [0] * n
    for i in range(n):
        ans[i] = sum(islice(A, 0, n, 2)) - sum(islice(A, 1, n, 2))
        A.rotate(-1)
    print(' '.join(list(map(str, ans))))

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    n = int(input())
    A = list(map(int, input().split()))
    A += A
    ans = [0] * n
    s1 = sum(A[:n - 1:2])
    s2 = sum(A[1:n:2])
    for i in range(n):
        if i % 2 == 0:
            s1 += A[i + n - 1]
            ans[i] = s1 - s2
            s1 -= A[i]
        else:
            s2 += A[i + n - 1]
            ans[i] = s2 - s1
            s2 -= A[i]
    print(' '.join(list(map(str, ans))))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import math
a, b, c, d = list(map(int, input().split()))
ans = []
for n in [a - 1, b]:
    mc = n // c
    md = n // d
    cd = c * d // math.gcd(c, d)
    mcd = n // cd
    ans.append(n - mc - md + mcd)
print(int(ans[1] - ans[0]))

Fixed submission:
import fractions
a, b, c, d = list(map(int, input().split()))
ans = []
for n in [a - 1, b]:
    mc = n // c
    md = n // d
    cd = c * d // fractions.gcd(c, d)
    mcd = n // cd
    ans.append(n - mc - md + mcd)
print(int(ans[1] - ans[0]))
Buggy python submission (verdict: Runtime Error):
n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
ans = 1
d = 0
for i in range(n + 1):
    d += l[i]
    if d > x:
        break
    ans += 1
print(ans)


Fixed submission:
n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
ans = 1
d = 0
for i in range(n):
    d += l[i]
    if d > x:
        break
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
    n, a, b, c, d = list(map(lambda x: int(x) - 1, input().split()))
    n += 1
    s = list(input())
    s = s[a:d + 1]
    for i in range(len(s) - 1):
        if s[i] == '#' and s[i + 1] == '#':
            print('No')
            exit()
    if c < d:
        print('Yes')
    else:
        ch = False
        for i in range(b, d + 1):
            if s[i - 1] == s[i] == s[i + 1] == '.':
                ch = True
        if ch:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    n, a, b, c, d = list(map(lambda x: int(x) - 1, input().split()))
    n += 1
    s = list(input())
    s = s[a:max(c, d) + 1]
    for i in range(len(s) - 1):
        if s[i] == '#' and s[i + 1] == '#':
            print('No')
            exit()
    if c < d:
        print('Yes')
    else:
        ch = False
        for i in range(b, d + 1):
            if s[i - 1] == s[i] == s[i + 1] == '.':
                ch = True
        if ch:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heappop, heappush, heapify
def main():
    n, m = list(map(int, input().split()))
    A = list(map(int, input().split()))
    B = [list(map(int, input().split())) for _ in range(m)]
    heapify(A)
    B.sort(key = lambda x: x[1])
    for (b, c) in B:
        for i in range(b):
            a = heappop(A)
            heappush(A, max(a, c))
    print(sum(A))


if __name__ == '__main__':
    main()


Fixed submission:
from heapq import heappop, heappush, heapify
def main():
    n, m = list(map(int, input().split()))
    A = list(map(int, input().split()))
    B = [list(map(int, input().split())) for _ in range(m)]
    heapify(A)
    B.sort(key = lambda x: x[1], reverse = True)
    for (b, c) in B:
        if c > A[0]:
            for i in range(b):
                a = heappop(A)
                heappush(A, max(a, c))
    print(sum(A))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for i in range(2 ** n):
    b = [0] * n
    for j in range(n):
        if i >> j & 1:
            b[j] = 1
    X = sum([v for i, v in enumerate(V) if b[i] == 1])
    Y = sum([c for i, c in enumerate(C) if b[i] == 1])
    ans = max(ans, X - Y)
print(ans)

Fixed submission:
n = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for v, c in zip(V, C):
    if v > c:
        ans += v - c
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n, k = list(map(int, input().split()))
    S = list(input())
    T = []
    a, c = S[0], 0
    for s in S:
        if s == a:
            c += 1
        else:
            T.append([a, c])
            a = s
            c = 1
    T.append([a, c])
    ans = 0
    for i, t in enumerate(T):
        if t[0] == '0':
            r = i + 2 * k - 1
        else:
            r = i + 2 * k
        ans = max(ans, sum([a[1] for a in T[i:min(len(T) - 1, r) + 1]]))
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np
def main():
    n, k = list(map(int, input().split()))
    S = list(input())
    T = []
    V = []
    a, c = S[0], 0
    for s in S:
        if s == a:
            c += 1
        else:
            T.append(a)
            V.append(c)
            a = s
            c = 1
    T.append(a)
    V.append(c)

    V = np.cumsum(np.array(V))
    max_v = len(V)
    ans = 0
    for i, t in enumerate(np.array(T)):
        if t == '0':
            r = i + 2 * k - 1
        else:
            r = i + 2 * k
        if i == 0:
            ans = max(ans, V[min(max_v - 1, r)])
        else:
            ans = max(ans, V[min(max_v - 1, r)] - V[i - 1])
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heappop, heappush
def main():
    def push(i, j, k):
        nonlocal A, B, C, ADD
        if i >= x or j >= y or k >= z: return
        if not ADD[i][j][k]:
            heappush(H, (A[i] + B[j] + C[k], i, j, k))
            ADD[i][j][k] = True
    x, y, z, k = map(int, input().split())
    INF = 10 ** 11
    A = sorted(list(map(lambda x: -int(x), input().split())))
    B = sorted(list(map(lambda x: -int(x), input().split())))
    C = sorted(list(map(lambda x: -int(x), input().split())))
    H = []
    ADD = [[[False] * z for _ in range(y)] for _ in range(x)]
    push(0, 0, 0)
    for _ in range(k):
        ans, i, j, k = heappop(H)
        push(i + 1, j, k)
        push(i, j + 1, k)
        push(i, j, k + 1)
        print(-ans)

if __name__ == '__main__':
    main()


Fixed submission:
from heapq import heappop, heappush
def main():
    def push(i, j, k):
        nonlocal A, B, C, ADD
        if i >= x or j >= y or k >= z: return
        if (i, j, k) not in ADD:
            heappush(H, (A[i] + B[j] + C[k], i, j, k))
            ADD.add((i, j, k))
    x, y, z, k = map(int, input().split())
    INF = 10 ** 11
    A = sorted(list(map(lambda x: -int(x), input().split())))
    B = sorted(list(map(lambda x: -int(x), input().split())))
    C = sorted(list(map(lambda x: -int(x), input().split())))
    H = []
    ADD = set()
    push(0, 0, 0)
    for _ in range(k):
        ans, i, j, k = heappop(H)
        push(i + 1, j, k)
        push(i, j + 1, k)
        push(i, j, k + 1)
        print(-ans)

if __name__ == '__main__':
    main()