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

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

#https://atcoder.jp/contests/cf16-final-open/tasks/codefestival_2016_final_b

n=ii()

if n==1:
    print(1)
    exit()

ans=0
i=0
p=0
while ans<n:
    i+=1
    ans+=i
if ans>n:
    p=ans-n

for k in range(1,i+1):
    if k!=p:
        print(k)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

#https://atcoder.jp/contests/cf16-final-open/tasks/codefestival_2016_final_b

n=ii()

if n==1:
    print(1)
    exit()

ans=0
i=0
while ans<n:
    i+=1
    ans+=i
if ans>n:
    p=ans-n

for k in range(1,i+1):
    if k!=p:
        print(k)
Problem p02662 (python)

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

dp=[[0]*(S+1) for _ in range(N)]

dp[0][0]=2
if A[0]<=S:
  dp[0][A[0]]=1
for i in range(N-1):
    for j in range(S+1):
        dp[i+1][j]+=dp[i][j]*2
        dp[i+1][j]%=mod
        if j+A[i+1]<=S:
            dp[i+1][j+A[i+1]]+=dp[i][j]
            dp[i+1][j+A[i+1]]%=mod

print(dp[N-1][S]%mod)

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

dp=[[0]*(S+1) for _ in range(N)]

dp[0][0]=2
dp[0][A[0]]=1
for i in range(N-1):
    for j in range(S+1):
        dp[i+1][j]+=dp[i][j]*2
        dp[i+1][j]%=mod
        if j+A[i+1]<=S:
            dp[i+1][j+A[i+1]]+=dp[i][j]
            dp[i+1][j+A[i+1]]%=mod

print(dp[N-1][S]%mod)
Problem p02669 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
T=int(input())

def solve(N):
    if N==0:
        return 0
    if N==1:
        return D
    if N in dic:
        return dic[N]
    tmp=N*D    
    if N%2==0:
        tmp=min(tmp,solve(N//2)+A)
    else:
        tmp=min(tmp,solve((N-1)//2)+A+D,solve((N+1)//2)+A+D)
    if N%3==0:
        tmp=min(tmp,solve(N//3)+B)
    else:
        b=N%3 
        tmp=min(tmp,solve((N+(3-b))//3)+B+(3-b)*D,solve((N-b)//3)+B+b*D)
    if N%5==0:
        tmp=min(tmp,solve(N//5)+C)
    else:
        c=N%5
        tmp=min(tmp,solve((N-c)//5)+C+D*c,solve((N+(5-c))//5)+C+D*(5-c))
    dic[N]=tmp
    return tmp

for _ in range(T):
    N,A,B,C,D=map(int,input().split())
    dic={}
    print(solve(N))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**8)
import functools
@functools.lru_cache(maxsize=None)  
def solve(N):
    if N==0:
        return 0
    if N==1:
        return D
    tmp=N*D    
    if N%2==0:
        tmp=min(tmp,solve(N//2)+A)
    else:
        tmp=min(tmp,solve((N-1)//2)+A+D,solve((N+1)//2)+A+D)
    if N%3==0:
        tmp=min(tmp,solve(N//3)+B)
    else:
        b=N%3 
        tmp=min(tmp,solve((N+(3-b))//3)+B+(3-b)*D,solve((N-b)//3)+B+b*D)
    if N%5==0:
        tmp=min(tmp,solve(N//5)+C)
    else:
        c=N%5
        tmp=min(tmp,solve((N-c)//5)+C+D*c,solve((N+(5-c))//5)+C+D*(5-c))
    return tmp

for _ in range(T):
    N,A,B,C,D=map(int,input().split())
    print(solve(N))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**8)
T=int(input())

def solve(N):
    if N==0:
        return 0
    if N==1:
        return D
    if N in dic:
        return dic[N]
    tmp=N*D    
    if N%2==0:
        tmp=min(tmp,solve(N//2)+A)
    else:
        tmp=min(tmp,solve((N-1)//2)+A+D)
    b=N%3 
    if N%3==0:
        tmp=min(tmp,solve(N//3)+B)
    else:
        tmp=min(tmp,solve((N+(3-b))//3)+B+D,solve((N-b)//3)+B+2*D)
    c=N%5
    if N%5==0:
        tmp=min(tmp,solve(N//5)+C)
    else:
        tmp=min(tmp,solve((N-c)//5)+C+D*c,,solve((N+(5-c))//5)+C+D*(5-c))
    dic[N]=tmp
    return tmp

for _ in range(T):
    N,A,B,C,D=map(int,input().split())
    dic={}
    print(solve(N))
Problem p02678 (python)

Fixed submission:
N,M=map(int,input().split())
from heapq import heappop,heappush 

graph=[[] for _ in range(N)]
for _ in range(M):
    A,B=map(int,input().split())
    A,B=A-1,B-1
    graph[A].append(B)
    graph[B].append(A)

mark=[-1]*(N-1)

inf=float("inf")

di=[inf]*N
di[0]=0
hq=[(0,0)]

while hq:
    t,r=heappop(hq) #time room
    if t>di[r]:
        continue
    for x in graph[r]:
        t_new=t+1
        r_new=x
        if t_new<di[r_new]:
            di[r_new]=t_new
            heappush(hq,(t_new,r_new))
            if mark[r_new-1]==-1:
                mark[r_new-1]=r
            else:
                print("No")
                exit()
    
print("Yes")
for i in mark:
    print(i+1)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
from heapq import heappop,heappush 

graph=[[] for _ in range(M)]
for _ in range(M):
    A,B=map(int,input().split())
    A,B=A-1,B-1
    graph[A].append(B)
    graph[B].append(A)

mark=[-1]*(N-1)

inf=float("inf")

di=[inf]*N
di[0]=0
hq=[(0,0)]

while hq:
    t,r=heappop(hq) #time room
    if t>di[r]:
        continue
    for x in graph[r]:
        t_new=t+1
        r_new=x
        if t_new<di[r_new]:
            di[r_new]=t_new
            heappush(hq,(t_new,r_new))
            if mark[r_new-1]==-1:
                mark[r_new-1]=r
            else:
                print("No")
                exit()
    
print("Yes")
for i in mark:
    print(i+1)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
from heapq import heappop,heappush 

graph=[[] for _ in range(M)]
for _ in range(M):
    A,B=map(int,input().split())
    A,B=A-1,B-1
    graph[A].append(B)
    graph[B].append(A)

mark=[-1]*(N-1)

inf=float("inf")

di=[inf]*N
di[0]=0
hq=[(0,0)]

while hq:
    t,r=heappop(hq) #time room
    if t>di[r]:
        continue
    for x in graph[r]:
        t_new=t+1
        r_new=x
        if t_new<di[r_new]:
            di[r_new]=t_new
            heappush(hq,(t_new,r_new))
            if mark[r_new-1]==-1:
                mark[r_new-1]=r
            else:
                print("No")
    
print("Yes")
for i in mark:
    print(i+1)
Problem p02703 (python)

Fixed submission:
N,M,S=map(int,input().split())
from heapq import heappop,heappush 

inf = float('inf')
cost=[[] for _ in range(N)]
exc=[]


for _ in range(M):
    u,v,a,b=map(int,input().split())
    u,v=u-1,v-1
    cost[u].append((v,a,b))
    cost[v].append((u,a,b))
for _ in range(N):
    c,d=map(int,input().split())
    exc.append((c,d))

di=[inf]*2451*N
if S>2450:
    S=2450
di[S]=0
hq=[(0,S)] #時間,都市名*2451+銀貨

while hq:
    t,v=heappop(hq)
    u=v//2451 #都市名
    s=v%2451 #所持金

    for x,a,b in cost[u]:
        if s>=a:
            v_new=x*2451+s-a
            t_new=t+b
            if t_new<di[v_new]:
                di[v_new]=t_new
                heappush(hq,(t_new,v_new))
    
    c,d=exc[u]
    if s+c>2450:
        c=2450-s
    v_new=v+c
    t_new=t+d
    if t_new<di[v_new]:
        di[v_new]=t_new
        heappush(hq,(t_new,v_new))

for i in range(1,N):
    m=di[i*2451]
    for j in range(1,2451):
        m=min(m,di[i*2451+j])
    print(m)

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

inf = float('inf')
cost=[[]*N for _ in range(N)]
exc=[]


for _ in range(M):
    u,v,a,b=map(int,input().split())
    u,v=u-1,v-1
    cost[u].append((v,a,b))
    cost[v].append((u,a,b))
for _ in range(N):
    c,d=map(int,input().split())
    exc.append((c,d))

used=[False]*2451*N
di=[inf]*2451*N
di[S]=0

while True:
    v=-1
    for i in range(2451*N):
        if not used[i] and v==-1:
            v=i
        elif not used[i] and di[i]<di[v]:
            v=i
    if v==-1:
        break
    used[v]=True
    u=v//2451 #都市名
    s=v%2451 #所持金

    for x,a,b in cost[u]:
        if s>=a:
            di[x*2451+s-a]=min((di[x*2451+s-a],di[v]+b))
    c,d=exc[u]
    if s+c>2450:
        c=2450-s
    di[v+c]=min(di[v+c],di[v]+d)

for i in range(1,N):
    m=inf
    for j in range(2451):
        m=min(m,di[i*2451+j])
    print(m)
Problem p02721 (python)

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

l=[0]*N
la=[0]*N
i=0
c=0
while True:
    if S[i]=="o":
        l[i]=1
        i+=C
        c+=1
    i+=1
    if i>=N:
        break

if c>K:
    exit()

i=N-1
c=0

while True:
    if S[i]=="o":
        la[i]=1
        i-=C
        c+=1
    i-=1
    if c==K:
        break
    
for i in range(N):
    if l[i]==1 and la[i]==1:
        print(i+1)

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

l=[]
la=[]
i=0
c=0
while True:
    if S[i]=="o":
        l.append(i)
        i+=C
        c+=1
    i+=1
    if i>N:
        break

if c>K:
    exit()

i=N-1
c=0

while True:
    if S[i]=="o":
        la.append(i)
        i-=C
        c+=1
    i-=1
    if c==K:
        break
    
for i in l:
    if i in la:
        print(i+1)

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

l=[]
la=[]
i=0
c=0
while True:
    if S[i]=="o":
        l.append(i)
        i+=C
        c+=1
    i+=1

if c>K:
    exit()

i=N-1
c=0

while True:
    if S[i]=="o":
        la.append(i)
        i-=C
        c+=1
    i-=1
    if c==K:
        break
    
for i in l:
    if i in la:
        print(i+1)
Problem p02733 (python)

Fixed submission:
import copy
H,W,K=map(int,input().split())
S=[]
for _ in range(H):
    S.append([int(x) for x in list(input())])

ans=(H-1)+(W-1)

for i in range(2**(H-1)):
    check=[0]*H
    for j in range(H-1):
        if ((i>>j)&1):
            check[j+1]=check[j]+1
        else:
            check[j+1]=check[j]
    
    g=check[H-1]+1
    A=[0]*g
    c=0
    f=0
    for j in range(W):
        B=[0]*g
        for k in range(H):
            if S[k][j]==1:
                B[check[k]]+=1
            if B[check[k]]>K:
                c=10**4
                f=1
                break
        if f:
            break
        #print("AB",A,B)
        for l in range(g):
            if A[l]+B[l]>K:
                c+=1
                A=copy.copy(B)
                break
            else:
                A[l]+=B[l]
    ans=min(ans,c+g-1)

print(ans)

Buggy submission (verdict: Runtime Error):
def main():
    import copy
    H,W,K=map(int,input().split())
    S=[]
    for _ in range(H):
        S.append([int(x) for x in list(input())])

    ans=(H-1)+(W-1)

    for i in range(2**(H-1)):
        check=[0]*H
        for j in range(H-1):
            if ((i>>j)&1):
                check[j+1]=check[j]+1
            else:
                check[j+1]=check[j]

        g=check[H-1]+1
        A=[0]*g
        c=0
        f=0
        for j in range(W):
            B=[0]*g
            for k in range(H):
                if S[k][j]==1:
                    B[check[k]]+=1
                if B[check[k]]>K:
                    c=10**4
                    f=1
                    break
            if f:
                break
            #print("AB",A,B)
            for l in range(g):
                if B[l]==0:
                    continue
                elif A[l]+B[l]>K:
                    c+=1
                    A=copy.copy(B)
                    break
                else:
                    A[l]+=B[l]
        ans=min(ans,c+g-1)

print(ans)




if __name__ == '__main__':
    main()
Problem p02756 (python)

Fixed submission:
S=input()
Q=int(input())

X=[]
Y=[]
f=1
for _ in range(Q):
    A=list(input().split())
    if A[0]=="1":
        f*=-1
    if A[0]=="2":
        if A[1]=="1":
            if f==1:
                X.append(A[2])
            if f==-1:
                Y.append(A[2])
        if A[1]=="2":
            if f==-1:
                X.append(A[2])
            if f==1:
                Y.append(A[2])

x="".join(X)
x="".join(list(reversed(x)))
y="".join(Y)

a=[x,S,y]
b="".join(a)

if f==-1:
    b="".join(list(reversed(b)))

print(b)

Buggy submission (verdict: Runtime Error):
from collections import deque
S=input()
Q=int(input())

X=deque(list(S))
f=1
for _ in range(Q):
    t,ff,c=input().split()
    if t=="1":
        f*=-1
    else:
        if ff=="1":
            if f==1:
                X.appendleft(c)
            else:
                X.append(c)
        else:
            if f==-1:
                X.appendleft(c)
            else:
                X.append(c)

if f==-1:
    X.reverse()

print("".join(X))
Problem p02761 (python)

Fixed submission:
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
for i in range(M):
    s[i],c[i]=map(int,input().split())

A=["-1"]*N
for i in range(M):
    if A[s[i]-1]=="-1" or A[s[i]-1]==c[i]:
        A[s[i]-1]=c[i]
    else:
        print("-1")
        exit()

if N==3:
    if A[0]==0:
        print("-1")
        exit()
if N==2:
    if A[0]==0:
        print("-1")
        exit()

for i in range(N):
    if A[i]=="-1":
        A[i]=0

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

if N==2 and a<10:
    a+=10
if N==3 and a<99:
    a+=100

print(a)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=[0]*N
c=[0]*N
for i in range(M):
    s[i],c[i]=map(int,input().split())

A=["-1"]*N
for i in range(M):
    if A[s[i]-1]=="-1" or A[s[i]-1]==c[i]:
        A[s[i]-1]=c[i]
    else:
        print("-1")
        exit()

if N==3:
    if A[0]==0:
        print("-1")
        exit()
if N==2:
    if A[0]==0:
        print("-1")
        exit()

for i in range(N):
    if A[i]=="-1":
        A[i]=0

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

print(a)
Problem p02791 (python)

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

m=P[0]
c=0
for i in range(N):
  if P[i]<=m:
    c+=1
  m=min(m,P[i])
  
print(c)

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

m=P[0]
c=0
for i in range(N):
  if P[i]<=m:
    c+=1
  	m=P[i]
  
print(c)
Problem p02802 (python)

Fixed submission:
N,M=map(int,input().split())
d={} #正解の辞書
e={} #誤答の辞書
f={} #ペナの辞書
for _ in range(M):
    p,s=input().split()
    d.setdefault(p,0)
    e.setdefault(p,0)
    f.setdefault(p,0)
    if s=="WA" and d[p]==0:
        e[p]+=1
    elif s=="AC":
        d[p]=1
        f[p]=e[p]

print(sum(d.values()),sum(f.values()))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
d={} #正解の辞書
e={} #誤答の辞書
for _ in range(M):
    p,s=input().split()
    d.setdefault(p,0)
    e.setdefault(p,0)
    if s=="WA" and d[p]!=1:
        e[s]+=1
    elif s=="AC":
        d[p]=1

print(sum(d.values()),sum(e.values()))
Problem p02814 (python)

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

import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

l=lcm_list(a)

for s,t in enumerate(a):
    if (l//t)%2==0:
      print("0")
      exit()

print((2*M//l+1)//2)

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

import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

l=int(lcm_list(a)/2)

print((M//l+1)//2)

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

import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

l=lcm_list(a)/2

print((M//l+1)//2)
Problem p03086 (python)

Fixed submission:
S=input()

ans=0
tmp=0
for i in range(len(S)):
    if S[i] in ("A","C","G","T"):
        tmp+=1
    else:
        ans=max(ans,tmp)
        tmp=0
ans=max(ans,tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
n=len(S)
ans=0

for i in range(n):
    for j in range(i,n):
        if S[i:j+1].count("A","C","G","T")==j-i+1:
            ans=max(ans,j-i+1)
print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
n=len(S)
ans=0

for i in range(n):
    for j in range(i,n):
        if S[i:j+1].count(("A","C","G","T"))==j-i+1:
            ans=max(ans,j-i+1)
print(ans)
Problem p02767 (python)

Fixed submission:
n = int(input())
x = list(map(int,input().split()))
ans = 0
for i in range(min(x),max(x)):
    num = 0
    for j in range(len(x)):
        num += (i-x[j])**2
    if ans == 0:
        ans = num
    elif num < ans:
        ans = num
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
anslist = []
for i in range(1,max(x)):
    ans = 0
    for j in range(len(x)):
        ans += (i-x[j])**2
    anslist.append(ans)
print(min(anslist))
Problem p02621 (python)

Fixed submission:
a=int(input())
if 1<=a<=10:
    print(a+a**2+a**3)

Buggy submission (verdict: Runtime Error):
a=int(input())
if 1<=a<=10:
print(a+a**2+a**3)
Problem p02657 (python)

Fixed submission:
str=input()
arr=str.split(' ')
A=int(arr[0])
B=int(arr[1])
if 1<=A<=100 and 1<=A<=100:
  print(A*B)

Buggy submission (verdict: Runtime Error):
str=input()
arr=str.split('　')
A=int(arr[0])
B=int(arr[1])
if 1<=A<=100 and 1<=A<=100:
  print(A*B)

Buggy submission (verdict: Runtime Error):
str=input()
arr=str.split('')
A=int(arr[0])
B=int(arr[1])
if 1<=A<=100 and 1<=A<=100:
  print(A*B)

Buggy submission (verdict: Runtime Error):
if 1<=A<=100 and 1<=B<=100:
  print(A*B)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
if 1<=A<=100 and 1<=B<=100:
  print(A*B)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
if 1<=A<=100 and 1<=B<=100:
  print(A*B)

Buggy submission (verdict: Runtime Error):
input(A)
if 1<=A<=100 and 1<=B<=100:
    print(A*B)
Problem p03643 (python)

Fixed submission:
N = input()

print('ABC'+N)

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

L = sorted(L, reverse=True)

print(sum(L[:K]))
Problem p03737 (python)

Fixed submission:
s1, s2, s3 = input().split()

print(s1[0].upper() + s2[0].upper() + s3[0].upper())

Buggy submission (verdict: Runtime Error):
import math

A = int(input())
B = int(input())
#A = math.log10(A)
#B = math.log10(B)

if A > B:
    print('GREATER')
elif A < B:
    print('LESS')
else:
    print('EQUAL')
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int,input.split())
print(a*b)
Problem p02658 (python)

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

    if 0 in A:
        print(0)
        return

    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return

    print(prod)


main()

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

cnt = 1

if a in 0:
    print(-1)
else:
    for i in range(n):
        cnt = cnt * a[i]

    if cnt > 10**18:
        print(-1)
    else:
        print(cnt)
Problem p02713 (python)

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

Buggy submission (verdict: Runtime Error):
from math import math

k = int(input())
count = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            count += gcd(gcd(j,l),i)
print(count)
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())
req = [list(map(int, input().split())) for i in range(m)]
for i in range(10000):
	st = str(i)
	if len(st) != n:
		continue
	ok = True
	for s, c in req:
		if int(st[s-1]) != int(c):
			ok = False
	if ok:
		print(st)
		exit(0)

print(-1)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for _ in range(m)]
ans = 0
num = [0]*n 
if sc[0][1] == 0:
    ans = -1
else:
    for i in range(n):
        if num[sc[i][0]-1] == 0 or num[sc[i][0]-1] == sc[i][1]:
            num[sc[i][0]-1] = sc[i][1]
        else:
            ans = -1
            break
if ans == 0:
    s = int("".join(map(str,num)))
    print(s)
else:
    print(ans)
Problem p02778 (python)

Fixed submission:
s = input()

print("x"*len(s))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
count1 =0
count2 = 0
for i in a:
    if i%2==0:
        count1+=1
        if i%3==0 or i%5 == 0:
            count2+=1
    else:
        pass
if count1 == count2:
    print('APPROVED')
else:
    print("DENIED")
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()
count = 0

for i in range(1, n-1):
    if s[i - 1] == "A" and s[i] == "B" and s[i+1] == "C":
        count += 1
    else:
        pass
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
count = 0
for i in range(1, n):
    if s[i - 1] == "A" and s[i] == "B" and s[i+1] == "C":
        count += 1
    else:
        pass
print(count)
Problem p02969 (python)

Fixed submission:
r = int(input())
d = 3*(r**2)
print(d)

Buggy submission (verdict: Runtime Error):
N,D=map(int, input().split())
b2=D*2+1
print(-(-N//b2))

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

if N % (2*D + 1) == 0:
  print(N // (2*D + 1))
else:
  print(N // (2*D + 1) + 1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split(' '))
print(-(-a//(1+2*b)))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(-(-a//(1+2*b)))
Problem p02981 (python)

Fixed submission:
N,A,B = map(int,input().split())
D  = A*N
if D>B:
    print(B)
else: 
    print(D)

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

if D>B:
    print(D)
else: 
    print(G)
Problem p02988 (python)

Fixed submission:
N = int(input())
P = list(map(int,input().split(' ')))
num = 0
for i in range(1,N-1):
  if min(P[i-1],P[i+1]) < P[i]  and P[i] <max(P[i-1],P[i+1]):
    num += 1
print(num)

Buggy submission (verdict: Runtime Error):
N = int(input())
P = list(map(int,input().split(' ')))
num = 0
for i in range(1,N-1):
    if min(P[i-1],P[i+1]) < P[i]  and P[i] <max(P[i-1],P[i+1]):
    num += 1
print(num)

Buggy submission (verdict: Runtime Error):
N = int(input())
P = list(map(int,input().split(' ')))
num = 0
for i in range(1,N-1):
	if min(P[i-1],P[i+1]) < P[i]  and P[i] <max(P[i-1],P[i+1]):
    	num += 1
print(num)