Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
x=0
t=0
n=0
pre_t=0
pre_n=0
for i in range(N):
    now_t,now_n = map(int,input().split())
    t = now_t
    n = now_n
    while(pre_t > t or pre_n > n):
        t += now_t
        n += now_n
    pre_t = t
    pre_n = n
    x = t+n
print(x)

Fixed submission:
import math
N = int(input())
x=0
t=0
n=0
pre_t=1
pre_n=1
for i in range(N):
    t,n = map(int,input().split())
    if(pre_t > t or pre_n > n):
        mul = max(-(-pre_t//t),-(-pre_n//n))
        t *= mul
        n *= mul
    pre_t = t
    pre_n = n
    x = t+n
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
x=input()
ans=len(x)
ind=x.find("ST")
while(ind!=-1):
    ans-=2
#     s_ind=ind-1
#     t_ind=ind+2
#     while(0<=s_ind and t_ind<len(x) and x[s_ind]=="S" and x[t_ind]=="T"):
#         ans-=2
#         s_ind-=1
#         t_ind+=1
    x=x[:ind]+x[ind+2:]
    ind=x.find("ST")
print(ans)

Fixed submission:
x=input()
ans=[]
for i in range(len(x)):
    if(x[i]=='S'):
        ans.append(x[i])
    elif(len(ans)>0 and ans[-1]=='S'):
        ans.pop()
    else:
        ans.append(x[i])
print(len(''.join(ans)))

Buggy python submission (verdict: Time Limit Exceeded):
x=input()
lenx=len(x)
ans=0
ind=x.find("ST")
while(ind!=-1):
    ans+=2
    xlist=list(x)
    xlist.pop(ind)
    xlist.pop(ind)
    x=''.join(xlist)
    ind=x.find("ST")
print(lenx-ans)

Fixed submission:
x=input()
ans=[]
for i in range(len(x)):
    if(x[i]=='S'):
        ans.append(x[i])
    elif(len(ans)>0 and ans[-1]=='S'):
        ans.pop()
    else:
        ans.append(x[i])
print(len(''.join(ans)))
Buggy python submission (verdict: Time Limit Exceeded):
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

ans = 0
a_book = 0
min = 0

for i in range(n+1):
    book = a_book
    now = min

    for j in range(m+1):
        if now > k:
            ans = max(ans,book-1)
            break

        if j == m:
            ans = max(ans, book)
            break

        now += b[j]
        book += 1

    if min > k or i == n:
        break
    a_book += 1
    min += a[i]


print(ans)


Fixed submission:
n,m,k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a = [0]
b = [0]

for i in range(n):
    a.append(A[i] + a[-1])
for i in range(m):
    b.append(B[i] + b[-1])

best = 0
ans = 0

for i in range(n+1):
    if a[i] > k:
        break
    for j in range(best,m+1):
       min = a[i] + b[j]
       if min > k:
           book = i + j - 1
           ans = max(book,ans)
           best = j - 1
           break

       if j == m:
           book = i + j
           ans = max(book, ans)
           best = j - 1
           break


print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
table = [0] * (n + 1)
 
for i in range(1, n + 1):
    for j in range(i, n + 1, i):
        table[j] += 1
ans = 0
 
for i in range(1,len(table)):
    ans += i * table[i]
 
print(ans)

Fixed submission:
n = int(input())
table = [0] * (n + 1)

for i in range(1, n + 1):
    for j in range(i, n + 1, i):
        table[j] += 1
ans = 0

for i in range(1,len(table)):
    ans += i * table[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = n

if a[0] % a[1] == 0:
    ans -= 1

for i in range(1,n):
    for j in range(i):
        if a[i] % a[j] == 0:
            ans -= 1
            break

print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))

dp = [0]*(10**6 + 1)
ans = 0

for i in a:
    if dp[i] == 0:
        for j in range(1,10**6+1):
            if i * j > 10**6:
                break
            dp[i*j] += 1
    elif dp[i] == 1:
        dp[i] += 1

for i in a:
    if dp[i] == 1:
        ans += 1


print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = n

for i in range(n):
    for j in range(n):
        if i == j:
            continue
        if a[i] % a[j] == 0:
            ans -= 1
            break

print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))

dp = [0]*(10**6 + 1)
ans = 0

for i in a:
    if dp[i] == 0:
        for j in range(1,10**6+1):
            if i * j > 10**6:
                break
            dp[i*j] += 1
    elif dp[i] == 1:
        dp[i] += 1

for i in a:
    if dp[i] == 1:
        ans += 1


print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

x = [[] for i in range(n+1)]

for i in range(m):
    x1, y1 = [int(i) for i in input().split()]
    x[x1].append(y1)
    x[y1].append(x1)

ans = [10**10] * n
ans[0] = 0
root = [10**10] * n
root[0] = 0

from collections import deque
q = deque() # FIFOキューの作成
for i in x[1]:
    q.append((1,i))#現在の深さ、次に行ける所
    root[i-1] = 1

while q:
    a,b = q.popleft() #aが現在の位置　bが次に行く所

    if (ans[a-1] + 1) < ans[b-1]:
        root[b-1] = a
    ans[b - 1] = min(ans[a - 1] + 1, ans[b - 1])

    for i in x[b]:
        if ans[i-1] > (ans[a-1]+1):
            q.append((b,i))


for i in ans[1:]:
    if i == 10**10:
        print("No")
        exit()

print("Yes")
for i in root[1:]:
    print(i)


Fixed submission:
n,m = map(int,input().split())

x = [[] for i in range(n+1)]

for i in range(m):
    x1, y1 = [int(i) for i in input().split()]
    x[x1].append(y1)
    x[y1].append(x1)

ans = [10**10] * n
ans[0] = 0
root = [10**10] * n
root[0] = 0

from collections import deque
q = deque() # FIFOキューの作成
for i in x[1]:
    q.append((1,i))#現在の深さ、次に行ける所
    root[i-1] = 1

while q:
    a,b = q.popleft() #aが現在の位置　bが次に行く所
    #ここを簡略化したい
    if (ans[a-1] + 1) < ans[b-1]:
        root[b-1] = a
        ans[b - 1] = ans[a - 1] + 1
    else:
        continue

    for i in x[b]:
        if ans[i-1] > (ans[a-1]+1):
            q.append((b,i))


for i in ans[1:]:
    if i == 10**10:
        print("No")
        exit()

print("Yes")
[print(i) for i in root[1:]]

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

x = [[] for i in range(n+1)]

for i in range(m):
    x1, y1 = [int(i) for i in input().split()]
    x[x1].append(y1)
    x[y1].append(x1)

ans = [10**10] * n
ans[0] = 0
root = [10**10] * n
root[0] = 0

from collections import deque
q = deque() # FIFOキューの作成
for i in x[1]:
    q.append((1,i))#現在の深さ、次に行ける所
    root[i-1] = 1

while q:
    a,b = q.popleft() #aが現在の位置　bが次に行く所

    if (ans[a-1] + 1) < ans[b-1]:
        root[b-1] = a
    ans[b - 1] = min(ans[a - 1] + 1, ans[b - 1])

    for i in x[b]:
        if ans[i-1] > (ans[a-1]+1):
            q.append((b,i))


for i in ans[1:]:
    if i == 10**10:
        print("No")
        exit()

print("Yes")
for i in root[1:]:
    print(i)


Fixed submission:
n,m = map(int,input().split())

x = [[] for i in range(n+1)]

for i in range(m):
    x1, y1 = [int(i) for i in input().split()]
    x[x1].append(y1)
    x[y1].append(x1)

ans = [10**10] * n
ans[0] = 0
root = [10**10] * n
root[0] = 0

from collections import deque
q = deque() # FIFOキューの作成
for i in x[1]:
    q.append((1,i))#現在の深さ、次に行ける所
    root[i-1] = 1

while q:
    a,b = q.popleft() #aが現在の位置　bが次に行く所
    #ここを簡略化したい
    if (ans[a-1] + 1) < ans[b-1]:
        root[b-1] = a
        ans[b - 1] = ans[a - 1] + 1
    else:
        continue

    for i in x[b]:
        if ans[i-1] > (ans[a-1]+1):
            q.append((b,i))


for i in ans[1:]:
    if i == 10**10:
        print("No")
        exit()

print("Yes")
[print(i) for i in root[1:]]
Buggy python submission (verdict: Runtime Error):
a = list(input())
a.reverse()
add = 0
ans = [1] + [0] * 2018
ans_int = 0

for i in range(len(a)):
    add = (add + int(a[i]) * 10 ** i) %2019
    if ans[add] == 1:
        ans_int += 1
        continue
    else:
        ans[add] = 1


print(ans_int)

Fixed submission:
s,w = map(int,input().split())
if w >= s:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = list(range(n+1))
b = a[::-1]
ans = 0

for i in range(k,n+2):
    min = sum(a[:i])
    max = sum(b[:i])
    ele = max - min +1
    ans += ele

print(ans)

Fixed submission:
n,k = map(int,input().split())
a = list(range(n+1))
b = a[::-1]
ans = 0

min = sum(a[:k-1])
max = sum(b[:k-1])


for i in range(k,n+2):
    min += a[i-1]
    max += b[i-1]
    ele = max - min +1
    ans += ele

M =10**9 + 7
print(ans % M)
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
li2=[input() for i in range(m)]
c = []
for i in range(m):
    c.append( [int(x.strip()) for x in li2[i].split()])

ans = min(a) + min (b)

for i in range(m):
    keep = a[c[i][0]-1] + b[c[i][1]-1] - c[i][2]
    if keep < ans:
        ans = keep

print(ans)

Fixed submission:
A,B,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
li2=[input() for i in range(m)]
c = []
for i in range(m):
    c.append( [int(x.strip()) for x in li2[i].split()])

ans = min(a) + min (b)

for i in range(m):
    keep = a[c[i][0]-1] + b[c[i][1]-1] - c[i][2]
    if keep < ans:
        ans = keep

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
li2=[input() for i in range(m)]
c = []
for i in range(m):
    c.append( [int(x.strip()) for x in li2[i].split()])

ans = 10**6

for i in range(len(a)):
    for j in range(len(b)):
        keep = a[i]+b[j]
        coopon = 0
        for k in range(m):
            if c[k][0]-1 == i and c[k][1]-1 == j and coopon<c[k][2]:

                coopon = c[k][2]

        keep -= coopon

        if keep < ans:
            ans = keep

print(ans)

Fixed submission:
A,B,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
li2=[input() for i in range(m)]
c = []
for i in range(m):
    c.append( [int(x.strip()) for x in li2[i].split()])

ans = min(a) + min (b)

for i in range(m):
    keep = a[c[i][0]-1] + b[c[i][1]-1] - c[i][2]
    if keep < ans:
        ans = keep

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
li2=[input() for i in range(m)]
c = []
for i in range(m):
    c.append( [int(x.strip()) for x in li2[i].split()])

ans = 10**6

for i in range(len(a)):
    for j in range(len(b)):
        keep = a[i]+b[j]
        coopon = 0
        for k in range(m):
            if c[k][0]-1 == i and c[k][1]-1 == j and coopon<c[k][2]:

                coopon = c[k][2]

        keep -= coopon

        if keep < ans:
            ans = keep

print(ans)

Fixed submission:
A,B,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
li2=[input() for i in range(m)]
c = []
for i in range(m):
    c.append( [int(x.strip()) for x in li2[i].split()])

ans = min(a) + min (b)

for i in range(m):
    keep = a[c[i][0]-1] + b[c[i][1]-1] - c[i][2]
    if keep < ans:
        ans = keep

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,a,b = map(int,input().split())
tama = 0
blue = 0
for i in range(10**100):
    if tama <= n:
        if tama + a >= n:
            blue += (n - tama)
            break
        tama += a
        blue += a

    if tama <= n:
        if tama + b >= n:
            break
        tama += b



print(blue)


Fixed submission:
n,a,b = map(int,input().split())
tama = int(n/(a+b))*(a+b)
blue = int(n/(a+b))*a
nokori = n - tama
if nokori<a:
    blue += nokori
else:
    blue += a


print(blue)
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
ans = pow(2,n)-1
inf = 10**9 + 7
ans = ans% inf
aa = 1
bb = 1

for i in range(b):
    if i < a:
        aa = aa *(n-i) /(i+1)

    bb = bb *(n-i) /(i+1)

ans = int((ans -aa -bb) % inf)
print(ans)


Fixed submission:
from functools import reduce

n, a, b = map(int, input().split())
mod = 10 ** 9 + 7

#combination高速化の裏技
def comb(N, A, MOD):
    num = reduce(lambda x, y: x * y % MOD, range(N, N - A, -1))
    den = reduce(lambda x, y: x * y % MOD, range(1, A + 1))
    return num * pow(den, MOD - 2, MOD) % MOD

#powはmodを引数にしてあまりを計算してくれる
print((pow(2, n, mod = mod) - 1 - comb(n, a, mod) - comb(n, b, mod)) % mod)

Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input().split())


dp = [0] * int((n+2)/2)

dp[1] = n

for i in range(1,len(dp)-1):
    dp[i+1] = dp[i] * (dp[i] -1) /(i+1)

dpr = dp[::-1]

if int(n/2) * 2 == n: #nが偶数
    dpr = dpr[:-1]

dp += dpr

dp[-1] = 1

ans = sum(dp)

ans -= dp[a]
ans -= dp[b]
ans = ans%(10**9+7)

print(int(ans))


Fixed submission:
from functools import reduce

n, a, b = map(int, input().split())
mod = 10 ** 9 + 7

#combination高速化の裏技
def comb(N, A, MOD):
    num = reduce(lambda x, y: x * y % MOD, range(N, N - A, -1))
    den = reduce(lambda x, y: x * y % MOD, range(1, A + 1))
    return num * pow(den, MOD - 2, MOD) % MOD

#powはmodを引数にしてあまりを計算してくれる
print((pow(2, n, mod = mod) - 1 - comb(n, a, mod) - comb(n, b, mod)) % mod)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

li2=[input() for i in range(n)]
xl = []
for i in range(n):
    xl.append( [int(x.strip()) for x in li2[i].split()])

t = []
t_ = []
for i in range(n):
    t.append(sum(xl[i]))
    t_.append(sum(xl[i]))

ans = 0
use = []
used = list(range(n))
t_.sort()

for i in range(n):
    a = t_[0]
    ind = t.index(a)
    ok = 1


    for j in range(ans):
        #print(xl[used[ind]][0] - xl[used[ind]][1])
        #print(use[j][0] + use[j][1])

        if xl[used[ind]][0] - xl[used[ind]][1] < use[j][0] + use[j][1]:
            #print("b")
            ok = 0
            break


    if ok == 1:
        use.append(xl[ind])
        ans+= 1

    t.pop(ind)
    used.pop(ind)
    t_.pop(0)

print(ans)


Fixed submission:
N = int(input())
l = []

for i in range(N):
    a, b = map(int, input().split())
    l.append((a-b,a+b))

l = sorted(l,key=lambda x:x[1])

start = l[0][1]
ans = 1
for i in range(1,N):
    if start <= l[i][0]:
        start = l[i][1]
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

li2=[input() for i in range(n)]
xl = []
for i in range(n):
    xl.append( [int(x.strip()) for x in li2[i].split()])

t = []
t_ = []
for i in range(n):
    t.append(sum(xl[i]))
    t_.append(sum(xl[i]))

ans = 0
use = []
used = list(range(n))
t_.sort()

for i in range(n):
    a = t_[0]
    ind = t.index(a)
    ok = 1


    for j in range(ans):
        #print(xl[used[ind]][0] - xl[used[ind]][1])
        #print(use[j][0] + use[j][1])

        if xl[used[ind]][0] - xl[used[ind]][1] < use[j][0] + use[j][1]:
            #print("b")
            ok = 0
            break


    if ok == 1:
        use.append(xl[ind])
        ans+= 1

    t.pop(ind)
    used.pop(ind)
    t_.pop(0)

print(ans)


Fixed submission:
N = int(input())
l = []

for i in range(N):
    a, b = map(int, input().split())
    l.append((a-b,a+b))

l = sorted(l,key=lambda x:x[1])

start = l[0][1]
ans = 1
for i in range(1,N):
    if start <= l[i][0]:
        start = l[i][1]
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n,x = map(int,input().split())
a = list(map(int,input().split()))

if sum(a) ==x:
    print(n)
else:
    a.sort()
    for i in range(n):
        if x >= a[i]:
            ans += 1
            x -= a[i]
        else:
            break




print(ans-1)

Fixed submission:
n,x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0

if sum(a) ==x:
    print(n)
else:
    a.sort()
    for i in range(n):
        if x >= a[i]:
            ans += 1
            x -= a[i]
        else:
            break

    if ans == n:
        ans -= 1


    print(ans)
Buggy python submission (verdict: Runtime Error):
n,y = map(int,input().split())
d = 0

for a in range(n+1):#10000
    for b in range(n+1):#5000
        c = n - a - b
        x = 10000*a + 5000*b + 1000*c
        if x == y and c >=0:
            print("{} {} {}".format(a,b,c))
            d =1
            break
    else:
        continue
    break



if d == 0:
    print("-1 -1 -1")

Fixed submission:
n,y = map(int,input().split())
d = 0

for a in range(n+1):#10000
    for b in range(n+1):#5000
        c = n - a - b
        x = 10000*a + 5000*b + 1000*c
        if x == y and c >=0:
            print("{} {} {}".format(a,b,c))
            d =1
            break
    else:
        continue
    break



if d == 0:
    print("-1 -1 -1")

Buggy python submission (verdict: Runtime Error):
for a in range(n):#10000
    for b in range(n):#5000
        c = n - a - b
        x = 10000*a + 5000*b + 1000*c
        if x == y and c >=0:
            print("{} {} {}".format(a,b,c))
            d =1
            break
    else:
        continue
    break



if d == 0:
    print("-1 -1 -1")


Fixed submission:
n,y = map(int,input().split())
d = 0

for a in range(n+1):#10000
    for b in range(n+1):#5000
        c = n - a - b
        x = 10000*a + 5000*b + 1000*c
        if x == y and c >=0:
            print("{} {} {}".format(a,b,c))
            d =1
            break
    else:
        continue
    break



if d == 0:
    print("-1 -1 -1")
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c = map(int,input().split())
ans = 0
p = 0
for i in range(c):
    if int(a/2)*2==a and int(b/2)*2==b and int(c/2)*2==c:
        ans += 1
        x = b / 2 + c / 2
        y = a / 2 + c / 2
        z = b / 2 + a / 2
        a = x
        b = y
        c = z
    else:
        p = 1
        print(ans)
        break



if p == 0:
    print(-1)

Fixed submission:
a,b,c = map(int,input().split())
ans = 0
p = 0

for i in range(c):
    if int(a/2)*2==a and int(b/2)*2==b and int(c/2)*2==c:
        if a == b and b == c:
            break
        ans += 1
        x = b / 2 + c / 2
        y = a / 2 + c / 2
        z = b / 2 + a / 2
        a = x
        b = y
        c = z

    else:
        p = 1
        print(ans)
        break



if p == 0:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c = map(int,input().split())
ans = 0
p = 0
for i in range(c):
    if int(a/2)*2==a and int(b/2)*2==b and int(c/2)*2==c:
        ans += 1
        x = b / 2 + c / 2
        y = a / 2 + c / 2
        z = b / 2 + a / 2
        a = x
        b = y
        c = z
    else:
        p = 1
        print(ans)
        break



if p == 0:
    print(-1)

Fixed submission:
a,b,c = map(int,input().split())
ans = 0
p = 0

for i in range(c):
    if int(a/2)*2==a and int(b/2)*2==b and int(c/2)*2==c:
        if a == b and b == c:
            break
        ans += 1
        x = b / 2 + c / 2
        y = a / 2 + c / 2
        z = b / 2 + a / 2
        a = x
        b = y
        c = z

    else:
        p = 1
        print(ans)
        break



if p == 0:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())

ans = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z ==s:
                ans +=1

print(ans)

Fixed submission:
k,s = map(int,input().split())

ans = 0

for x in range(k+1):
    for y in range(k+1):
        if 0<= s-x-y <= k:
            ans +=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())

ans = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z ==s:
                ans +=1

print(ans)

Fixed submission:
k,s = map(int,input().split())

ans = 0

for x in range(k+1):
    for y in range(k+1):
        if 0<= s-x-y <= k:
            ans +=1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

for i in range(1,n+1):
    cnt = 0
    for j in range(1, 10^2+5): #x
        for k in range(1, 10^2+5): #y
            for l in range(1, 10^2+5): #z
                if j*j+k*k+l*l+j*k+k*l+l*j == i:
                      cnt += 1
    print(cnt)

Fixed submission:
n = int(input())
ans = [0 for _ in range(10**4+1)]
for x in range(1, 101): #x
    for y in range(1, 101): #y
        for z in range(1,101): #z
            if (m:=x*x+y*y+z*z+x*y+y*z+z*x) <= n:
                # print(m)
                ans[m] += 1

for i in range(n):
    print(ans[i+1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 1

for i in range(n):
	ans *= a[i]
	if ans > 10^18:
 		ans = -1
        break
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
if 0 in a:
	print(0)
	exit(0)
ans = 1
for i in range(n):
	ans *= a[i]
	if ans > 10**18:
		print(-1)
		exit(0)
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 1

for i in range(n):
	ans *= a[i]
	if ans > 10^18:
 		ans = -1
        break
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
if 0 in a:
	print(0)
	exit(0)
ans = 1
for i in range(n):
	ans *= a[i]
	if ans > 10**18:
		print(-1)
		exit(0)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = list(map(int,input().split()))
arr = sorted(arr,reverse=True)
ans = 1
idx = 0
for a in arr:
  ans *= a
  if ans > 10**18:
    print(-1)
    exit()
print(ans)

Fixed submission:
a,b = map(int,input().split())
print(a*b)
Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = map(int,input().split())
_sum = []
_del = []
for i in range(N):
  _sum.append(arr[i]+i+1)
  _del.append(i+1-arr[i])

Fixed submission:
N = int(input())
arr = list(map(int,input().split()))
cnt_arr = [0]*N
ans = 0
for i in range(N):
  if arr[i]+i+1<N:
    cnt_arr[arr[i]+i+1] += 1
  if i+1-arr[i]>0:
    ans += cnt_arr[i+1-arr[i]]

print(ans)
Buggy python submission (verdict: Runtime Error):
S =　list(input())
if "7" in S:
  print('Yes')
else:
  print('No')

Fixed submission:
S =list(str(input()))
if "7" in S:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
ans = 0
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      ans += math.gcd(math.gcd(i,j),k)

print(ans)

Fixed submission:
import math
K = int(input())
ans = 0
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      ans += math.gcd(math.gcd(i,j),k)

print(ans)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
mod = 10e9 + 7
ans = 0
cnt_arr = [0]*(K+1)
for i in range(K,0,-1):
  cnt = (K//i)**N%mod
  j = 2
  while i*j<=K:
    cnt -= cnt_arr[i*j]
    j+=1
  cnt_arr[i]=cnt
  ans += i*cnt

print(int(ans%mod))

Fixed submission:
N,K = map(int,input().split())
m = 10**9 + 7
ans = 0
cnt_arr = [0]*(K+1)
for i in range(K,0,-1):
  cnt = pow(int(K//i), N, mod=m)
  j = 2
  while i*j<=K:
    cnt -= cnt_arr[i*j]
    j+=1
  cnt_arr[i]=cnt
  ans += i*cnt

print(int(ans%m))