Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02760 (python)

Fixed submission:
import numpy as np
A = [list(map(int, input().split())) for i in range(0,3)]
N = int(input())
b_list =list([int(input()) for i in range(0,N)])
count = np.zeros((3,3))
for i in range(0,3):
    for j in range(0,3):
        if A[i][j] in b_list:
            count[i][j] = count[i][j] + 1
if (count.sum(axis=1)  ==3).any():
    print('Yes')
elif (count.sum(axis=0) ==3).any():
    print('Yes')
elif count[0][0] + count[1][1] + count[2][2]==3:
    print('Yes')
elif count[2][0] + count[1][1] + count[0][2]==3:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
A = [list(map(int, input().split())) for i in range(0,3)]
N = int(input())
b_list =list([int(input()) for i in range(0,N)])
count = np.zeros((3,3))
for i in range(0,3):
    for j in range(0,3):
        if A[i][j] in b_list:
            count[i][j] = count + 1
if (count.sum(axis=1) % 3 ==0).any():
    print('Yes')
elif (count.sum(axis=0) % 3 ==0).any():
    print('Yes')
elif count[0][0] + count[1][1] + count[2][2]:
    print('Yes')
elif count[2][0] + count[1][1] + count[0][2]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
A = [list(map(int, input().split())) for i in range(0,3)]
N = int(input())
b_list =list([int(input()) for i in range(0,N)])
count = np.zeros(3,3)
for i in range(0,3):
    for j in range(0,3):
        if A[i][j] in b_list:
            count[i][j] = count + (i+1)*(j+1)
if (count.sum(axis=1) % 3 ==0).any():
    print('Yes')
elif (count.sum(axis=0) % 3 ==0).any():
    print('Yes')
elif count[0][0] + count[1][1] + count[2][2]:
    print('Yes')
elif count[2][0] + count[1][1] + count[0][2]:
    print('Yes')
else:
    print('No')
Problem p02765 (python)

Fixed submission:
N,R = map(int,input().split())

if N >= 10:
  print(R)
else:
  print(R+100*(10-N))

Buggy submission (verdict: Runtime Error):
N,R = map(int,input())

if N >= 10:
  print(R)
else:
  print(R-100*(10-N))
Problem p02768 (python)

Fixed submission:
k = 2 *10**5
mod = 10**9+7

n, a, b = map(int,input().split())

modinv_table = [-1]*(k+1)
for i in range(1,k+1):
    modinv_table[i] = pow(i,-1,mod)

def binomial_coefficients(n,k):
    ans = 1
    for i in range(k):
        ans *= n-i
        ans *= modinv_table[i+1]
        ans %= mod
    return ans
print((pow(2,n,mod)-binomial_coefficients(n,a)-binomial_coefficients(n,b)-1)%mod)

Buggy submission (verdict: Runtime Error):
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


n, a, b = map(int, input().split())

p = 10 ** 9 + 7

print((2 ** n%p - cmb(n, a,p) - cmb(n, b,p)) - 1)

Buggy submission (verdict: Runtime Error):
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

n, a, b = map(int, input().split())

p = 10 ** 9 + 7

print((2 ** n - cmb(n, a) - cmb(n, b)) % p - 1)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

n, a, b = map(int, input().split())

p = 10 ** 9 + 7

print((2 ** n - comb(n, a, exact=True) - comb(n, b, exact=True)) % p - 1)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
a = comb(n, r, exact=True)

import numpy as np
n, a, b = map(int, input().split())

p = 10 ** 9 + 7

print((2**n-comb(n, a, exact=True)-comb(n, b, exact=True))%p-1)
Problem p02772 (python)

Fixed submission:
import numpy as np
N = input()
list = list(map(int,input().split(' ')))

list = np.array(list)
A = np.unique(list[list%2 == 0])
B = np.unique(np.append(list[list%6 == 0],(list[list%10 == 0])))

if len(A) ==0:
        print('APPROVED')
elif len(B) ==0:
    print('DENIED')
else:
    if len(A) == len(B) :
        print('APPROVED')
    else:
        print('DENIED')

Buggy submission (verdict: Runtime Error):
rt numpy as np
N = input()
list = list(map(int,input().split(' ')))

list = np.array(list)
A = list[list%2 == 0]
B = np.unique(np.append(list[list%6 == 0],(list[list%10 == 0])))

if len(A) ==0:
        print('APPROVED')
elif len(B) ==0:
    print('DENIED')
else:
    if len(A) == len(B) :
        print('APPROVED')
    else:
        print('DENIED')

Buggy submission (verdict: Runtime Error):
import numpy as np
N = input()
list = list(map(int,input().split(' ')))

list = np.array(list)
A = list[list%2 == 0]
B = np.unique(np.append(list[list%6 == 0],(list[list%10 == 0])))
print(A)
print(B)

if (A == B).any() :
    print('APPROVED')
else:
    print('DENIED')

Buggy submission (verdict: Runtime Error):
import numpy as np
N = input()
list = list(map(int,input().split(' ')))

list = np.array(list)
A = list[list%2 == 0]
B = np.unique(np.append(list[list%6 == 0],(list[list%10 == 0])))


if (A == B).all() :
    print('APPROVED')
else:
    print('DENIED')

Buggy submission (verdict: Runtime Error):
import numpy as np
N = input()
list = list(map(int,input().split(' ')))

list = np.array(list)
A = list[list%2 == 0]
B = np.unique(np.append(list[list%6 == 0],(list[list%10 == 0])))
if A == B :
    print('APPROVED')
else:
    print('DENIED')

Buggy submission (verdict: Runtime Error):
import numpy as np
N = input()
list = list(map(int,input().split(' ')))

list = np.array(list)

if (list[list%2 == 0]==list[list%6 == 0 or list%10 == 0]) :
    print('APPROVED')
else:
    print('DENIED')

Buggy submission (verdict: Runtime Error):
import numpy as np
N = input()
list = list(map(int,input().split(' ')))

list = np.array(list)

if (list[list%2 == 0]==list[list%6 == 0 or list%10 == 0]) :
    print('APPROVED')
else:
    ('DENIED')
Problem p02780 (python)

Fixed submission:
from itertools import accumulate
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
A = (A+1)/2

B = np.insert(A,0,0)
B = list(accumulate(B))
answer = []
for i in range(N-K+1):
    answer.append(B[i+K]-B[i])

print(max(answer))

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
A = (A+1)/2

B = np.insert(A,0,0)
B = list(accumulate(B))
answer = []
for i in range(N-K):
    answer.append(B[i+K]-B[i])

print(max(answer))

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
A = (A+1)/2

B = [0] + A
B = list(accumulate(B))
answer = []
for i in range(N-K):
    answer.append(B[i+K]-B[i])

print(max(answer))

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

B = [0] + A
B = list(accumulate(B))
answer = []
for i in range(N-K):
    answer.append(B[i+K]-B[i])
    
print(max(answer))
Problem p02899 (python)

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

B = [0]*N
for i in range(0,N):
    B[A[i]-1] = i+1

for i in B:
    print(i)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

B = [0]*N
for i in range(0,N):
    B[A[i]-1] = i+1

for i in range(B):
    print(i)
Problem p03006 (python)

Fixed submission:
from decimal import Decimal

N = int(input())

xy = [list(map(Decimal,input().split())) for i in range(N)]

cnt ={}

for i in range(N):
    xi = xy[i][0]
    yi = xy[i][1]

    for j in range(i+1,N):
        xj = xy[j][0]
        yj = xy[j][1]

        x_dif =xi-xj
        y_dif = yi-yj
        if x_dif<0:
            x_dif = -x_dif
            y_dif = -y_dif
        elif x_dif == 0:
            y_dif = abs(y_dif)

        if (x_dif,y_dif)  in cnt.keys():
            cnt[x_dif,y_dif] += 1
        else:
            cnt[x_dif, y_dif] =1

if N == 1:
    print(1)
else: print(N-max(cnt.values()))

Buggy submission (verdict: Runtime Error):
N = int(input())

xy = [list(map(int,input().split())) for i in range(N)]

cnt ={}

for i in range(N):
    xi = xy[i][0]
    yi = xy[i][1]

    for j in range(i+1,N):
        xj = xy[j][0]
        yj = xy[j][1]

        x_dif =xi-xj
        y_dif = yi-yj
        if x_dif<0:
            x_dif = -x_dif
            y_dif = -y_dif

        if (x_dif,y_dif)  in cnt.keys():
            cnt[x_dif,y_dif] += 1
        else:
            cnt[x_dif, y_dif] =1

print(N-max(cnt.values()))
Problem p03162 (python)

Fixed submission:
N = int(input())

max_a = [0] * N
max_b = [0] * N
max_c = [0] * N
if N>1:
    for i in range(0, N):
        a, b, c = map(int, input().split())
        max_a[i] = max(max_b[i - 1] + a, max_c[i-1] + a)
        max_b[i] = max(max_a[i - 1] + b, max_c[i - 1] + b)
        max_c[i] = max(max_a[i - 1] + c, max_b[i - 1] + c)

    print(max(max_a[-1], max_b[-1], max_c[-1]))
else:
    a, b, c = map(int, input().split())

    print(max(a, b, c))

Buggy submission (verdict: Runtime Error):
N = input()

max_a= [0]*N
max_b = [0]*N
max_c = [0]*N

for i in range(0,N):
  a,b,c = map(int,input.split())
  max_a[i] = max(max_b[i-1]+a,max_c+a) 
  max_b[i] = max(max_a[i-1]+b,max_c[i-1]+b) 
  max_c[i] = max(max_a[i-1]+c,max_b[i-1]+c) 
  
print(max(max_a[-1],max_b[-1],max_c[-1]))
Problem p03229 (python)

Fixed submission:
import math
n = int(input())

A = [int(input()) for i in range(n)]

A.sort()

half = math.floor(n/2)
if n ==2:
    print(A[1]-A[0])
else:
    half_A = A[half]
    dif = A[half+1] - half_A*2 +A[half-1]
    if (n%2 == 1) & (dif>0):
        total = sum(A[half+1:])*2 - sum(A[:half-1])*2 -A[half] - A[half-1]
    elif (n % 2 == 1) & (dif<=0):
        total = sum(A[half+2:])*2 - sum(A[:half])*2 + A[half] + A[half+1]
    else:
        total = sum(A[half+1:])*2 - sum(A[:half-1])*2 -A[half-1] + A[half]
    
    print(total)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())

A = [int(input()) for i in range(n)]

A.sort()

half = math.floor(n/2)

half_A = A[half]
dif = A[half+1] - half_A*2 +A[half-1]
if (n%2 == 1) & (dif>0):
    total = sum(A[half+1:])*2 - sum(A[:half-1])*2 -A[half] - A[half-1]
elif (n % 2 == 1) & (dif<=0):
    total = sum(A[half+2:])*2 - sum(A[:half])*2 + A[half] + A[half+1]
else:

    total = sum(A[half+1:])*2 - sum(A[:half-1])*2 -A[half-1] + A[half]

print(total)
Problem p03455 (python)

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

if a*b % 2 == 1:
    print("Odd")
else:
    print("Even")

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

if a*b % 2 == 1:
    print("Odd")
else:
    print("Even")

Buggy submission (verdict: Runtime Error):
a = int(input())

b= int(input())

if a*b % 2 == 1:
    print("Odd")
else:
    print("Even")
Problem p03476 (python)

Fixed submission:
Q = int(input())

ls = [list(map(int,input().split())) for i in range(Q)]

n_max = 10**5

prime = []
data = [i for i in range(2,n_max+1)]
limit = n_max**(1/2)

while True:
    p = data[0]
    if limit<=p:
        break
    prime.append(p)
    data = [i for i in data if i%p!=0]

prime = prime +data

ans_ls = [0]*(1+n_max)
for i in prime:
    if (i + 1) // 2 in prime:
        ans_ls[i] = 1

ans_cs = [0]*(1+n_max)
for i in range(n_max):
    ans_cs[i+1] = ans_cs[i]+ans_ls[i+1]
    
for l,r in ls:
    print(ans_cs[r]-ans_cs[l-1])

Buggy submission (verdict: Runtime Error):
Q = int(input())

ls = [list(map(int,input().split())) for i in range(Q)]
n_max = max(ls)[1]

prime = []
data = [i for i in range(2,n_max+1)]
limit = n_max**(1/2)
while True:
    p = data[0]
    if limit<=p:
        break
    prime.append(p)
    data = [i for i in data if i%p!=0]
prime = prime +data

ans_ls = [0]*(1+n_max)
for i in range(1,n_max+1):
    if i in prime:
        if (i+1)//2 in prime:
            ans_ls[i] =ans_ls[i-1] + 1
        else:
            ans_ls[i] = ans_ls[i-1]
    else:
        ans_ls[i] = ans_ls[i - 1]

for l,r in ls:
    print(ans_ls[r]-ans_ls[l-1])
Problem p03565 (python)

Fixed submission:
s = input()
t = input()

s_num = len(s)
t_num = len(t)

ans_list = []
ind_list = []

if s_num<t_num:
    ans_list.append('UNRESTORABLE')
else:
    for i in range(s_num -t_num + 1):
        flg = True
        for j in range(t_num):
            if s[i+j] == '?':
                pass
            elif s[i+j]==t[j]:
                pass
            else:
                flg=False
                break
        if flg:
            ind_list.append(i)
if len(ind_list) ==0:
    ans_list.append('UNRESTORABLE')
else:
    for i in ind_list:
        ans = ''
        j=0
        while j <s_num:
            if j==i:
               ans = ans+t
               j = j + t_num
            elif s[j] == '?':
                ans = ans + 'a'
                j = j + 1
            else:
                ans = ans + s[j]
                j = j + 1
        ans_list.append(ans)

print(min(ans_list))

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

s_num = len(s)
t_num = len(t)

ans_list = []

if s_num<t_num:
    ans_list.append('UNRESTORABLE')
else:
    ind_list = []
    for i in range(s_num -t_num + 1):
        flg = True
        for j in range(t_num):
            if s[i+j] == '?':
                pass
            elif s[i+j]==t[j]:
                pass
            else:
                flg=False
                break
        if flg:
            ind_list.append(i)
if len(ind_list) ==0:
    ans_list.append('UNRESTORABLE')
else:
    for i in ind_list:
        ans = ''
        j=0
        while j <s_num:
            if j==i:
               ans = ans+t
               j = j + t_num
            elif s[j] == '?':
                ans = ans + 'a'
                j = j + 1
            else:
                ans = ans + s[j]
                j = j + 1
        ans_list.append(ans)

print(min(ans_list))

Buggy submission (verdict: Runtime Error):
s = input()
t = input()

s_num = len(s)
t_num = len(t)

ans_list = []

if s_num<t_num:
    ans_list.append('UNRESTORABLE')
else:
    ind_list = []
    for i in range(s_num -t_num + 1):
        flg = True
        for j in range(t_num):
            if s[i+j] == '?':
                pass
            elif s[i+j]==t[j]:
                pass
            else:
                flg=False
                break
        if flg:
            ind_list.append(i)
if len(ind_list) ==0:
    ans_list.append('UNRESTORABLE')
else:
    for i in ind_list:
        ans = ''
        j=0
        while j <s_num:
            if j==i:
               ans = ans+t
               j = j + t_num
            elif s[j] == '?':
                ans = ans + 'a'
                j = j + 1
            else:
                ans = ans + s[j]
                j = j + 1
        ans_list.append(ans)

print(min(ans_list))
Problem p03695 (python)

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

col_list = [399,799,1199,1599,1999,2399,2799,3199]
count_list = [0]*(len(col_list)+1)

for i in range(N):
    for j in range(len(col_list)+1):
        if j == len(col_list):
            if 3200<=S[i]:
                count_list[j] = count_list[j] + 1
        elif S[i]<=col_list[j]:
            count_list[j] = count_list[j]+1
            break

ans = 0
for i in range(len(col_list)):

    if count_list[i] != 0:
        ans += 1
print(str(max(ans,1)) + ' ' + str(ans+count_list[-1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(map(int,input().split()))

col_list = [399,799,1199,1599,1999,2399,2799,3199]
count_list = [0]*(len(col_list)+1)

for i in range(N):
    for j in range(len(col_list)+1):
        if j == len(col_list):
            if 3200<=S[i]:
                count_list[j] = count_list[j] + 1
        elif S[i]<=col_list[j]:
            count_list[j] = count_list[j]+1
            break

ans = 0
for i in range(len(col_list)):

    if count_list[i] != 0:
        ans += 1
print(str(max(1,ans)) + ' ' + str(ans+count_list[-1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(map(int,input().split()))

col_list = [399,799,1199,1599,1999,2399,2799,3199]
count_list = [0]*(len(col_list)+1)

for i in range(N):
    for j in range(len(col_list)+1):
        if j == len(col_list):
            if 3200<=S[i]:
                count_list[j] = count_list[j] + 1
        elif S[i]<=col_list[j]:
            count_list[j] = count_list[j]+1
            break

ans = 0
for i in range(len(col_list)):

    if count_list[i] != 0:
        ans += 1
print(str(max(1,ans)) + ' ' + str(ans+count_list[-1]))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(map(int,input().split()))

col_list = [399,799,1199,1599,1999,2399,2799,3199]
count_list = [0]*(len(col_list)+1)

for i in range(N):
    for j in range(len(col_list)+1):
        if j == len(col_list):
            if 3200<=S[i]:
                count_list[j] = count_list[j] + 1
        elif S[i]<=col_list[j]:
            count_list[j] = count_list[j]+1
            break

ans = 0
for i in range(len(col_list)):

    if count_list[i] != 0:
        ans += 1
print(str(max(1,ans)) + ' ' + str(ans+count_list[-1]))
Problem p03971 (python)

Fixed submission:

N,A,B = map(int,input().split())
S = input()
total = A+B
for i in range(N):
    if S[i]=='c':
        print('No')
    elif total>0:
        if S[i] == 'a':
            print('Yes')
            total = total-1
        elif S[i] =='b' and B>0:
            print('Yes')
            total = total-1
            B = B-1
        else:
            print('No')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
N,A,B = map(int,input().split())
S = input()
total = A+B
for i in range(N):
    if S[i]=='c':
        print('No')
    elif total>0:
        if S[i] == 'a':
            print('Yes')
            total = total-1
        elif S[i] =='b' and B>0:
            print('Yes')
            total = total-1
            B = B-1
        else:
            print('No')
    else:
        print('No')
Problem p04033 (python)

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

if (a>0) & (b>0):
    print('Positive')
elif (a<0) & (b>0):
    print('Zero')
elif (a==0) or(b==0):
    print('Zero')
else:
    if (b-a)%2==1:
        print('Positive')
    else:
        print('Negative')

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

if (a>0) & (b>0):
    print('Positive')
elif (a<0) & (b>0):
    print('Zero')
elif (a==0) or(b==0):
    print('Zero')
else:
    if (b-a)%2==1:
        print('Positive')
    else:
        print('Negative')
Problem p02658 (python)

Fixed submission:
n = int(input())

a = list(map(int, input().split()))
a.sort()

ans = 1

for b in a:
    if b == 0:
        ans = 0
        break
    else:
        ans *= b
        if ans > pow(10, 18):
            ans = -1
            break

print(ans)

Buggy submission (verdict: Runtime Error):
import math
import sys
from decimal import *

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

getcontext().prec = 21

aa = [Decimal(b).log10() for b in a if a != 0]

ans = Decimal('0')

for c in aa:
    ans += c


if ans > 18.0:
    print(-1)
else:
    ans = 1
    for c in a:
        ans *= c
    print(ans)
Problem p03105 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a*c<=b:
  print(c)
else:
  print(b//a)

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
d = [i for i in range(100,1,-1) if (A%i==0 and B%i==0)]
print(d[K-1])
Problem p03106 (python)

Fixed submission:
a,b,k=map(int,input().split())
d=[]
for i in range(1,101):
  if(a%i==0 and b%i==0):
    d.append(i)
e=d[::-1]
print(int(e[k-1]))

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
d = [i for i in range(100,1,-1) if (A%i==0 and B%i==0)]
print(d[K-1])

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
d=[]
for i in range(1,min(a,b)):
  if a%i==0 and b%i==0:
    d.append(i)
d=d[::-1]
print(d[k-1])

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
d=[]
for i in range(1,min(a,b)):
  if a%i==0 and b%i==0:
    d.append(i)
print(d[-2])
Problem p04045 (python)

Fixed submission:
N, _ = map(int, input().split())
D = list(map(int, input().split()))
E = [str(i) for i in [0,1,2,3,4,5,6,7,8,9] if i not in D]
E
while not all(n in E for n in str(N)):
    N+=1
print(N)

Buggy submission (verdict: Runtime Error):
import sys
N, _ = map(int, input().split())
D = list(map(int, input().split()))
E = [str(i) for i in [0,1,2,3,4,5,6,7,8,9] if i not in D]
for n in N:
    if not n in E:
        for e in E:
            if e>n:
                n=e
                sys.stdout.write(n)
                break;
    else:
        sys.stdout.write(n)
Problem p02555 (python)

Fixed submission:
import math
s = int(input())
n = s//3
ans = 0
if n == 0:
    print(0)
else:
    for i in range(n):
        res = s-(3*(i+1))
        fact1 = math.factorial(res+i)
        if res == 0:
            fact2 = 1
        else:
            fact2 = math.factorial(res)
        if i == 0:
            fact3 = 1
        else:
            fact3 = math.factorial(i)
        ans += fact1//(fact2*fact3)
    print(ans % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
import math
s = int(input())
n = s//3
ans = 0
if n == 0:
    print(0)
else:
    for i in range(n):
        res = s-(3*(i+1))
        fact1 = math.factorial(res+i)
        fact2 = math.factorial(res)
        fact3 = math.factorial(i)
        ans += int(fact1/(fact2*fact3))
    print(ans % (10**9 + 7))
Problem p02630 (python)

Fixed submission:
n = int(input())
array = list(map(int,input().split()))
q = int(input())
sums = sum(array)
cnt = [0]*(10**5+1)
for i in array:
    cnt[i] += 1
for j in range(q):
    b,c = map(int,input().split())
    sums += cnt[b]*(c-b)
    cnt[c] += cnt[b]
    cnt[b] = 0
    print(sums)

Buggy submission (verdict: Runtime Error):
n = int(input())
array = list(map(int,input().split()))
q = int(input())
sums = sum(array)
cnt = [0]*(10**5)
for i in array:
    cnt[i] += 1
for j in range(q):
    b,c = map(int,input().split())
    sums += cnt[b]*(c-b)
    cnt[c] += cnt[b]
    cnt[b] = 0
    print(sums)
Problem p02658 (python)

Fixed submission:
kazu = int(input())
word = input()
score = word.split()

maxn = 10**18
zero = 0
answer = 1
scin = [0]*kazu

for i in range(kazu):
    scin[i] = int(score[i])
    if scin[i] == 0:
        zero = 1
if zero == 1:
    answer = 0
else:
    for j in range(kazu):
        answer *= scin[j]
        if answer > maxn:
            answer = -1
            break
print(answer)

Buggy submission (verdict: Runtime Error):
kazu = int(input())
word = input()
score = word.split()
scin = [0]*kazu
zero = 0
for i in range(kazu):
    scin[i] = int(score[i])
    if scin[i] == 0:
        zero = 1:

answer = 1
for j in range(kazu):
    answer *= scin[j]
    if answer > 10**18 and zero == 0:
        answer = -1

if zero == 1 and answer > 10**18:
    answer = -1

print(answer)