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

Fixed submission:
import math
N, a, b = map(int, input().strip().split())

if (b-a)%2==0:
    ans=(b-a)//2
else:
    ans=min(a-1,N-b)+1+(b-a)//2
print(ans)

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

if (b-a)%2==0:
    ans=int(math.round((b-a)/2))
else:
    ans=min(a-1,N-b)+math.ceil((b-a)/2)
print(ans)

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

if (b-a)%2==0:
    ans=int(math.raound((b-a)/2))
else:
    ans=min(a-1,N-b)+math.ceil((b-a)/2)
print(ans)
Problem p02824 (python)

Fixed submission:
n, m, v, p = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
ans = p
c = [0]
cnt = 0
for i in range(n):
  # 累積和
  cnt += a[i]
  c.append(cnt)
  
from bisect import bisect_right
for i in range(p,n):
  h = a[i]+m
  free = v - (p-1) - (n-i)
  if free >= 0 and h >= a[p-1]:
    d = h * (i-p+1) - (c[i]-c[p-1]) # 余裕
    if d >= free*m:
      ans += 1
  else:
    if h >= a[p-1]:
      ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, M, V, P = map(int, input().strip().split())
A = sorted(list(map(int, input().strip().split())),reverse=True)
ans=0

for i in range(N):
    thre=A[i]+M
    if thre < A[P-1]:
        continue

    remain=V-(P-1)-(N-i)
    if remain <=0:
        ans+=1
    elif sum(A[P-1:i])+M*remain <= thre*(i-1-(P-1)+1):
        ans+=1
print(ans)
Problem p02936 (python)

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

# visited = [False for _ in range(N)]
# def dfs(v): # vertices & parent idx
#     visited[v]=True
#     for child in to[v]:
#         if visited[child]==True:
#             continue
#         ans[child]+=ans[v]
#         dfs(child)
# def dfs(v,p=-1): # vertices & parent idx
#     for child in to[v]:
#         if child==p:
#             continue
#         ans[child]+=ans[v]
#         dfs(child,v)

to=[[] for j in range(N)] # N points
ans=[0]*N # N points

for i in range(N-1):
    a,b=map(int, input().strip().split())
    a-=1
    b-=1
    to[a].append(b)
    to[b].append(a)

for i in range(Q):
    p,x=map(int, input().strip().split())
    p-=1
    ans[p]+=x

# dfs(0)
stack=[0]
visited=[False]*N
while stack:
    v=stack.pop()
    visited[v]=True
    for child in to[v]:
        if visited[child] ==False:
            # visited[v]=True
            ans[child]+=ans[v]
            stack.append(child)
for i in range(N):
    print(ans[i],end=' ')
# print(ans)

Buggy submission (verdict: Runtime Error):

N, Q = map(int, input().strip().split())

# visited = [False for _ in range(N)]
# def dfs(v): # vertices & parent idx
#     visited[v]=True
#     for child in to[v]:
#         if visited[child]==True:
#             continue
#         ans[child]+=ans[v]
#         dfs(child)
def dfs(v,p=-1): # vertices & parent idx
    for child in to[v]:
        if child==p:
            continue
        ans[child]+=ans[v]
        dfs(child,v)
        


to=[[] for j in range(N)] # N points
ans=[0]*N # N points

for i in range(N-1):
    a,b=map(int, input().strip().split())
    a-=1
    b-=1
    to[a].append(b)
    to[b].append(a)

for i in range(Q):
    p,x=map(int, input().strip().split())
    p-=1
    ans[p]+=x

dfs(0)
print(' '.join(map(str, ans)))
Problem p02947 (python)

Fixed submission:
n = int(input().strip())

count_by_kw = {}
for i in range(n):
    s=''.join(sorted(input().strip()))
    if s in count_by_kw.keys():
        count_by_kw[s]+=1
    else:
        count_by_kw[s]=1

c=list(count_by_kw.values())
ans=0
for val in c:
    ans+=val*(val-1)//2

print(ans)

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

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n = int(input().strip())

count_by_kw = Counter()
for i in range(n):
    count_by_kw[str(sorted(input().strip()))]+=1
    
c=list(count_by_kw.values())
for i in range(len(c)):
    c[i]=combinations_count(c[i],2)
print(sum(c))
Problem p02910 (python)

Fixed submission:
S = input()

N=len(S)
flag=1

for i in range(N):
  if i%2==0 and S[i]=='L':
    flag=0
  elif i%2==1 and S[i]=='R':
    flag=0

print('Yes' if flag==1 else 'No')

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

N=len(S)
flag=1

for i in range(N//2):
  if S[i*2]=='L':
    flag=0
  if S[i*2+1]=='R':
    flag=0

if S[(i+1)*2]=='L':
  flag=0

if flag==1 :
  print('Yes')
else:
  print('No')
Problem p02921 (python)

Fixed submission:
S= input()
T= input()
count=0

for i in range(3):
    if S[i]==T[i]:
      count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
S,T = input().split()

count=0

for i in range(3):
    if S[i]==T[i]:
      count=count+1
print(count)
Problem p02952 (python)

Fixed submission:
import math

N = int(input())

i=0
num=0

#桁数
while 10**i <= N:
  i=i+1
    


if i==1:
  num=N
elif i==2:
  num=9
elif i==3:
  num=9+N-99
elif i==4:  
  num=9+999-99
elif i==5:  
  num=9+900+N-9999
elif i==6:  
  num=9+900+99999-9999
  
print(num)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

i=0
#桁数
while 10**i<N:
  i=i+1
    


if i==1:
  num=N
elif i==2:
  num=9
elif i==3:
  num=9+N-99
elif i==4:  
  num=9+999-99
elif i==5:  
  num=9+900+N-10000

print(num)
Problem p03085 (python)

Fixed submission:
b = input()

if b=='A':
  print('T')
  
elif b=='G':
  print('C')
  
elif b=='T':
  print('A')
elif b=='C':
  print('G')

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

if b=='A':
  print('T')
  
elif b=='G':
  print(C')
  
elif b=='T':
  print('A')
elif b=='C':
  print('G')
Problem p03106 (python)

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

C=[]
for i in range(1,101):
  if A%i==0 and B%i==0:
    C.append(i)

#print(A,B,K)
#print(C)
print(C[-K])

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

C=[]
for i in range(1,B):
  if A%i==0 and B%i==0:
    C.append(i)

#print(C)
print(C[-K])

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

C=[]
for i in range(1,B):
  if A%i==0 and B%i==0:
    C.append(i)

print(C)
print(C[-K])

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

C=[]
for i in range(1,A):
  if A%i==0 and B%i==0:
    C.append(i)

#print(C)
print(C[-K])
Problem p03260 (python)

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

if (A*B)%2!=0:
  print('Yes')
else:
  print('No')

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

print(max(A,B,C)*9+A+B+C)
Problem p03273 (python)

Fixed submission:
H,W=map(int,input().split())

A = [list(input()) for i in range(H)]

l=[False]*H
c=[False]*W

for i in range(H):
  for j in range(W):
    if A[i][j]=='#':
      l[i]=True
      c[j]=True

ans=['' for i in range(H)]
for i in range(H):
  for j in range(W):
    if l[i] and c[j]:
      ans[i]+=A[i][j]
for i in range(H):
  if str(ans[i])!='':
    print(str(ans[i]))

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

a =[list(input()) for i in range(W)]

i=0
rm=0
for i in range(H):
  if a[i].count('#')==0:
    k=i
    for j in range(H-k-1):
      a[k+j]=a[k+j+1]
    H=H-1
    
for j in range(W):
  flag=1
  for i in range(H):
    #print(i,j,a[i][j])
    if a[i][j]=='#':
      flag=flag*0
  if flag==1:
    for i in range(H):
      a[i][j]='-' 
    W=W-1

for i in range(H) :
  if a[i].count('-')!=0:
    a[i].remove('-')
  
ans=list('' for i in range(W))

N=len(a[0])

for i in range(H):
  for j in range(N):
    ans[i]=ans[i]+a[i][j]
    
for i in range(H):
  print(ans[i])
Problem p03386 (python)

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

if A+K-1< B-K+1:
  for i in range(A,A+K):
    print(i)
  for i in range(B-K+1,B+1):
    print(i)
elif A+K-1>= B-K+1:
  for i in range(A,B+1):
    print(i)

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

if K>B-A-1:
  K=B-A
  
ans=[]
for i in range(K):
  ans.append(A+i)
for i in range(B-K,B):
  ans.append(i+1)
#print(ans)

n=len(ans)
print(ans[0])
for i in range(1,n):
  if ans[i]!=ans[i-1]:
    print(ans[i])

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

if K>B-A:
  K=B-A
  
ans=[]
for i in range(K):
  ans.append(A+i)
for i in range(B-K,B):
  ans.append(i+1)
#print(ans)

n=len(ans)
print(ans[0])
for i in range(1,n):
  if ans[i]!=ans[i-1]:
    print(ans[i])
Problem p04034 (python)

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

x = []
y = []
for i in range(M):
  xi, yi = input().split()
  x.append(int(xi))
  y.append(int(yi))

L=[]
for i in range(N):
  L.append(1)
R=[1]
for i in range(N-1):
  R.append(0)
#print(R) 

#print('     ','R',R,'L',L) 
for i in range(M):
  if R[x[i]-1]==1 and L[x[i]-1]==1:
    R[x[i]-1]=0
    L[x[i]-1]=0
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[x[i]-1]==1 and L[x[i]-1]>=1:
    L[x[i]-1]=L[x[i]-1]-1
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[x[i]-1]==0 and L[x[i]-1]>=1:
    L[x[i]-1]=L[x[i]-1]-1
    L[y[i]-1]=L[y[i]-1]+1
  #print(i+1,x[i],y[i],'R',R,'L',L) 
    

print(R.count(1))

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

x = []
y = []
for i in range(M):
  xi, yi = input().split()
  x.append(int(xi))
  y.append(int(yi))

L=[]
for i in range(N):
  L.append(1)
R=[1]
for i in range(N-1):
  R.append(0)
#print(R) 

for i in range(M):
  if R[x[i]-1]==1 and L[x[i]-1]==1:
    R[x[i]-1]=0
    L[x[i]-1]=0
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[i]==1 and L[i]>=1:
    L[x[i]-1]=L[x[i]-1]-1
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[x[i]-1]==0 and L[x[i]-1]>=1:
    L[x[i]-1]=L[x[i]-1]-1
    L[y[i]-1]=L[y[i]-1]+1
   
    
#print('R',R,'L',L)
print(R.count(1))

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

x = []
y = []
for i in range(M):
  xi, yi = input().split()
  x.append(int(xi))
  y.append(int(yi))

L=[]
for i in range(N):
  L.append(1)
R=[1]
for i in range(N-1):
  R.append(0)
#print(R) 

for i in range(M):
  if R[x[i]-1]==1 and L[x[i]-1]==1:
    R[x[i]-1]=0
    L[x[i]-1]=0
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[i]==1 and L[i]>=1:
    L[x[i]-1]=L[x[i]-1]-1
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[x[i]-1]==0 and L[x[i]-1]>0:
    L[y[i]-1]=L[y[i]-1]+1
   
    
#print('R',R,'L',L)
print(R.count(1))

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

x = []
y = []
for i in range(M):
  xi, yi = input().split()
  x.append(int(xi))
  y.append(int(yi))

L=[]
for i in range(N):
  L.append(1)
R=[1]
for i in range(N-1):
  R.append(0)
#print(R) 

for i in range(M):
  if R[i]==1 and L[i]==1:
    R[i]=0
    L[i]=0
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[i]==1 and L[i]>0:
    L[i]=L[i]-1
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[i]==0 and L[i]>0:
    L[y[i]-1]=L[y[i]-1]+1
   
    
#print(R,L)
print(R.count(1))

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

x = []
y = []
for i in range(M):
  xi, yi = input().split()
  x.append(int(xi))
  y.append(int(yi))

L=[]
for i in range(N):
  L.append(1)
R=[1]
for i in range(N-1):
  R.append(0)
#print(R) 

for i in range(M):
  if R[i]==1 and L[i]==1:
    R[i]=0
    L[i]=0
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[i]==1 and L[i]>1:
    L[i]=L[i]-1
    R[y[i]-1]=1
    L[y[i]-1]=L[y[i]-1]+1
  elif R[i]==0 and L[i]>0:
    L[y[i]-1]=L[y[i]-1]+1
   
    
#print(R,L)
print(R.count(1))
Problem p02658 (python)

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

ans = 1
t = 1e18
if 0 in a:
    print(0)
    exit(0)

for i in range(n):
    ans *= a[i]
    if ans > t:
        print(-1)
        exit(0)

print(ans)

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

ans = 1
t = 1e18
if 0 in a:
    print(0)
    exit(0)

for i in range(n):
    ans *= a[i]
    if ans > t:
        print(-1)
        exit(0)

prin(ans)
Problem p02918 (python)

Fixed submission:
n, k = map(int, input().split())
s = input()
t = 0
for i in range(n - 1):
    if s[i] == s[i + 1]:
        t += 1
print(min([n - 1, t + 2 * k]))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
t = 0
for i in range(n - 1):
    if s[i] == s[i + 1]:
        t += 1
print(min([n - 1, h + 2 * k]))

Buggy submission (verdict: Runtime Error):
from fractions import gcd


a, b, c, d = map(int, input().split())
lcm = int(c * d / gcd(c, d))
A = a - 1
l_cd = A - A // c - A // d + A // lcm
r_cd = b - b // c - b // d + b // lcm
print(r_cd - l_cd)
Problem p02683 (python)

Fixed submission:
import numpy as np
import math


n,m,x = map(int, input().split())
lis = [np.asarray(list(map(int, input().split()))) for _ in range(n)]
lis = np.array(lis)

res = []
for i in range(2**n):
    t = np.array([0]*(m+1))
    for j in range(n):
        if ((i >> j) & 1):
            t += lis[j]
    res.append(t)

res = np.array(res)

z = math.inf

for i in res:
    if np.amin(i[1:]) >= x and i[0] < z:
        z = i[0]

print(z if z != math.inf else -1)

Buggy submission (verdict: Runtime Error):
import numpy as np


n,m,x = map(int, input().split())
lis = [np.asarray(list(map(int, input().split()))) for _ in range(n)]
lis = np.array(lis)

res = []
for i in range(2**n):
    t = np.array([0]*(m+1))
    for j in range(n):
        if ((i >> j) & 1):
            t += lis[j]
    res.append(t)

res = np.array(res)

z = 10**10

for i in res:
    if np.amin(i[1:m]) >= x and i[0] < z:
        z = i[0]

print(z if z != 10**10 else -1)

Buggy submission (verdict: Runtime Error):
import numpy as np


n,m,x = map(int, input().split())
lis = [np.asarray(list(map(int, input().split()))) for _ in range(n)]
lis = np.array(lis)

res = []
for i in range(2**n):
    t = np.array([0]*(n+1))
    for j in range(n):
        if ((i >> j) & 1):
            t += lis[j]
    res.append(t)

res = np.array(res)

z = 10**10

for i in res:
    if np.amin(i[1:m]) >= x and i[0] < z:
        z = i[0]

print(z)
Problem p02706 (python)

Fixed submission:
n,m=map(int, input().split(' '))
a = list(map(int, input().split()))
res = n-sum(a)
print(res if res >= 0 else -1)

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split(' '))
a = list(map(int, input().split()))
res = n-sum(a)
print(res if res >= 0 else -1
Problem p02732 (python)

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
a_ = set(a)
x = Counter(a)
y = {i:x[i]*(x[i]-1)//2 for i in a_}

res = sum(y.values())
for i in a:
    t = x[i]
    t_ = y[i]
    print(res-t_+(t-1)*(t-2)//2)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
a_ = set(a)
x = Counter(a)
y = []
for i in a_:
    t = x[i]
    y.append(t*(t-1)//2)
res = sum(y)
for i in a:
    t = x[i]
    t_ = y[i-1]
    print(res-t_+(t-1)*(t-2)//2)
Problem p02760 (python)

Fixed submission:
a = [list(map(int, input().split(' '))) for _ in range(3)]
n = int(input())
for _ in range(n):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j] == b:
                a[i][j] = 0

for i in range(3):
    for j in a[i]:
        if j != 0:
            break
    else:
        print('Yes')
        break
    if a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0:
        print('Yes')
        break
    if a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0:
        print('Yes')
        break
    if a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0:
        print('Yes')
        break
else:
    print('No')

Buggy submission (verdict: Runtime Error):
for i in range(3):
    for j in a[i]:
        if j != 0:
            break
    else:
        print('Yes')
        break
    if a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0:
        print('Yes')
        break
    if a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0:
        print('Yes')
        break
    if a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0:
        print('Yes')
        break
else:
    print('No')
Problem p02801 (python)

Fixed submission:
c = input()
a = 'abcdefghijklmnopqrstuvwxyz'
print(a[a.index(c)+1])

Buggy submission (verdict: Runtime Error):
c = input()
a = 'abcdefchijklmnopqrstu'
print(a[a.index(c)+1])
Problem p03037 (python)

Fixed submission:
n, m = map(int, input().split(' '))
l_ = []
r_ = []
for i in range(m):
    l,r = map(int, input().split(' '))
    l_ += [l]
    r_ += [r]
l = max(l_)
r = min(r_)
if n < l:
    print(0)
elif n < r:
    r = n
    print(r - l + 1)
elif l > r:
    print(0)
elif l == r:
    print(1)
else:
    print(r - l + 1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split(' '))
for i in range(m):
    l, r = map(int, input().split(' '))
    if i == 0:
        s = [l, r]
        continue
    else:
        result = []
        for j in range(s[0], s[1]+1):
            if l <= j <= r:
                result += [j]
        s[0] = min(result)
        s[1] = max(result)
print(s[1] - s[0] + 1)
Problem p03085 (python)

Fixed submission:
dic = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
b = input()
print(dic[b])

Buggy submission (verdict: Runtime Error):
import re

N, S = map(int, input().split(' '))
pattern = "AC+"
T = input()
for _ in range(S):
    fir,fin = map(int, input().split(' '))
    result = re.findall(pattern, T[fir -1:fin])
    print(len(result))

Buggy submission (verdict: Runtime Error):
import re

N, S = map(int, input().split(' '))
pattern = "AC+"
T = input()
for _ in range(S):
    first,final = map(int, input().split(' '))
    print(first, final)
    result = re.findall(pattern, T[first -1:final])
    print(result)
    print(len(result))
Problem p03105 (python)

Fixed submission:
info = input().split(' ')
price = int(info[0])
money = int(info[1])
max_time = int(info[2])
times = money // price
if times <= max_time:
  print(times)
else:
  print(max_time)

Buggy submission (verdict: Runtime Error):
info = input().split(' ')
num_one = int(info[0])
num_two = int(info[1])
num_class = int(info[2])
one_list = [i for i in range(1,num_one + 1) if num_one % i == 0]
two_list = [i for i in range(1,num_two + 1) if num_one % i == 0]
one_set = set(one_list)
two_set = set(two_list)
match_set = one_set & two_set
match_list = list(match_set)
match_list.sort()
print(match_list[num_class-1])
Problem p03545 (python)

Fixed submission:
n = input()
op_cnt = len(n) - 1
for i in range(2 ** op_cnt):
    op = ['-'] * op_cnt
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt - 1 - j] = '+'
    
    formula = ''
    for p_n, p_o in zip(n, op + ['']):
        formula += p_n + p_o
    result = eval(formula)
    if result == 7:
        print(formula + '=7')
        break

Buggy submission (verdict: Runtime Error):
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split(''))
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

a = ns()
for i in range(2**3):
    ans = f'{a[-1]}'
    for j in range(3):
        if (i >> j) & 1:
            ans = a[-1-(j+1)] + '+' + ans
        else:
            ans = a[-1-(j+1)] + '-' + ans
    if eval(ans) == 7:
        print(ans+'=7')
        break
Problem p03846 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split(' ')))
a.sort()
if n % 2 == 0:
    a_ = [[a[i],a[i+1]] for i in range(0,n,2)]
    for i,j in enumerate(a_):
        j_ = j[0]
        k_ = j[1]
        if  (i*2+1) != j_ or (i*2+1) != k_:
            print(0)
            break
    else:
        r = (2 ** (n//2))%((10**9)+7)
        print(int(r))
else:
    if a[0] == 0:
        a_ = [[a[i],a[i+1]] for i in range(1,n,2)]
        for i,j in enumerate(a_,start=1):
            j_ = j[0]
            k_ = j[1]
            if i*2 != j_ or i*2 != k_:
                print(0)
                break
        else:
            r = (2**((n-1)//2))%((10**9)+7)
            print(int(r))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split(' ')))
a.sort()
if n % 2 == 0:
    a_ = [[a[i],a[i+1]] for i in range(0,n,2)]
    for i,j in enumerate(a_):
        j_ = j[0]
        k_ = j[1]
        if  (i*2+1) != j_ or (i*2+1) != k_:
            print(0)
            break
    else:
        r = (2 ** (n/2))%((10**9)+7)
        print(int(r))
else:
    if a[0] == 0:
        a_ = [[a[i],a[i+1]] for i in range(1,n,2)]
        for i,j in enumerate(a_,start=1):
            j_ = j[0]
            k_ = j[1]
            if i*2 != j_ or i*2 != k_:
                print(0)
                break
        else:
            r = (2**((n-1)/2))%((10**9)+7)
            print(int(r))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split(' ')))
a.sort()
r = (10**9)+7
if n % 2 == 0:
    for i in range(0,n,2):
        if a[i] != a[i+1]:
            print(0)
            break
    else:
        r = (2 ** (n/2))%((10**9)+7)
        print(int(r))
else:
    for i in range(1,n,2):
        if a[i] != a[i+1]:
            print(0)
            break
    else:
        r = (2**((n-1)/2))%((10**9)+7)
        print(int(r))
Problem p03860 (python)

Fixed submission:
s = input().split(' ')[1]
print('A{}C'.format(s[0].upper()))

Buggy submission (verdict: Runtime Error):
s = input().split(' ')[1]
print(f'A{s[0].upper()}C')
Problem p04045 (python)

Fixed submission:
N, K = map(int, input().split(' '))
d_list = input().split(' ')
for h in range(10):
    for i in range(10):
        for j in range(10):
            for k in range(10):
                for l in range(10):
                    number = h * 10000 + i * 1000 + j * 100 + k * 10 + l
                    result = set(list(str(number)))
                    if set(d_list) & result != set():
                        continue
                    if number >= N:
                        print(number)
                        break
                else:
                    continue
                break
            else:
                continue
            break
        else:
            continue
        break
    else:
        continue
    break

Buggy submission (verdict: Runtime Error):
import os

N, K = map(int, input().split(' '))
d_list = input().split(' ')
for i in range(10):
    for j in range(10):
        for k in range(10):
            for l in range(10):
                number =  i * 1000 + j * 100 + k * 10 + l
                result = set(list(str(number)))
                if set(d_list) & result != set():
                    continue
                if number >= N:
                    print(number)
                    os._exit(1)
Problem p02665 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
cir = 1
bsum = 1
hantei=0
asum = [0 for i in range(n+1)]
asum[0] = sum(a)
for i in range(1,n+1):
    asum[i] = asum[i-1]-a[i]
#print(asum)
swi = 0
for i in range(n):
    if swi == 1:
        #print(cir,a[i])
        cir = cir-a[i]
    if swi==0:
        if (cir-a[i])*2 < asum[i]:
            cir = (cir-a[i])*2
        else:
            cir = asum[i]
            swi = 1

    bsum += cir
    if cir<=0:
        hantei=1
        break


#print(cir,a[-1])


if hantei==1 or cir!=a[-1]:
    print(-1)
else:
    print(bsum)

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

lis = [1]
for i in range(n):
    cc = lis[-1] - a[i]
    cc *=2
    if cc<=0:
        hantei=1
    lis.append(cc)

p#rint(lis)



for i in range(n+1):
    tmp = a[-1-i]+cir
    sum += tmp
    #print(tmp,cir)
    if i==n:
        break
    if tmp <= lis[-1-i] and tmp+a[-2-i]>lis[-2-i]:
        if tmp%2==0:
            cir = tmp//2
        else:
            cir = tmp//2+1
    else:
        cir = tmp
if hantei==1:
    print(-1)
else:
    print(-1)