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

Fixed submission:
N = int(input())

d = {}
l = []
p = 0

for i in range(N):
  l.append(list(map(int, input().split())))

while True:
  if(l[0][2] == 0):
    l.append(l[0])
    del l[0]
  else:
    x, y, h= l[0]
    for i in range(101):
      for j in range(101):
        d[(i, j)] = abs(i- x)+ abs(j- y)+ h
    break

for k in range(N- 1):
  x, y, h = l[k+ 1]
  if(h == 0):
    for i in range(101):
      for j in range(101):
        if((i, j) in d):
          if(d[(i, j)]- abs(i- x)- abs(j- y)> 0):
            del d[(i, j)]
  else:
    for i in range(101):
      for j in range(101):
        if((i, j) in d):
          if(d[(i, j)] != abs(i- x)+ abs(j- y)+ h):
            del d[(i, j)]

zahyou, height = list(d.items())[0]
  
print("{0[0]} {0[1]} {1}".format(zahyou, height))

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

d = {}
l = []
p = 0

for i in range(N):
  l.append(list(map(int, input().split())))

while True:
  if(l[0][2] == 0):
    l.append(l[0])
    l.remove[0]
  else:
    x, y, h= l[0]
    for i in range(101):
      for j in range(101):
        d[(i, j)] = abs(i- x)+ abs(j- y)+ h
    break

for k in range(N- 1):
  x, y, h = l[k+ 1]
  if(h == 0):
    for i in range(101):
      for j in range(101):
        if(d[(i, j)]- abs(i- x)- abs(j- y)> 0):
          del d[(i, j)]
  else:
    for i in range(101):
      for j in range(101):
        if((i, j) in d):
          if(d[(i, j)] != abs(i- x)+ abs(j- y)+ h):
            del d[(i, j)]


zahyou, height = list(d.items())[0]
  
print("{0[0]} {0[1]} {1}".format(zahyou, height))

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

d = {}

x, y, h = map(int, input().split())
count = 0

while True:
  if(h == 0):
    x, y, h = map(int, input().split())
    count+= 1
    continue
  else:
    for i in range(101):
      for j in range(101):
        d[(i, j)] = abs(i- x)+ abs(j- y)+ h
    count+= 1
    break

for k in range(N- count):
  x, y, h = map(int, input().split())
  if(h == 0):
    for i in range(101):
      for j in range(101):
        if(d[(i, j)]- abs(i- x)- abs(j- y)> 0):
          del d[(i, j)]
  else:
    for i in range(101):
      for j in range(101):
        if((i, j) in d):
          if(d[(i, j)] != abs(i- x)+ abs(j- y)+ h):
            del d[(i, j)]

if(len(d) == 1):            
  zahyou, height = list(d.items())[0]
else:  
  zahyou, height = list(d.items())[10]
  
print("{0[0]} {0[1]} {1}".format(zahyou, height))

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

d = {}
x, y, h = map(int, input().split())

for i in range(101):
  for j in range(101):
    d[(i, j)] = abs(i- x)+ abs(j- y)+ h

for k in range(N- 1):
  x, y, h = map(int, input().split())
  for i in range(101):
    for j in range(101):
      if((i, j) in d):
        if(d[(i, j)] != abs(i- x)+ abs(j- y)+ h):
          del d[(i, j)]
          
zahyou, height = list(d.items())[0]
print("{0[0]} {0[1]} {1}".format(zahyou, height))
Problem p03739 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
l = len(a)
b = []
for i in range(l):
  b.append(a[i])
  
ans = 0
Ans = 0
summary = a[0]

if(summary == 0):
  summary = 1
  ans+= 1
  Summary = -1
  Ans+= 1
else:
  b[0] = int(-a[0]/ abs(a[0]))
  Ans+= abs(a[0]- b[0])
  Summary = b[0]  
  
for i in range(1, l):
  if(summary* (summary+ a[i])>= 0):
    if(summary > 0):
      ans+= a[i]+ summary+ 1
      a[i] = -summary- 1 
      summary= -1
    else:
      ans+= -summary+ 1- a[i]
      a[i] = -summary+ 1
      summary= 1
  else:
    summary+= a[i]

for i in range(1, l):
  if(Summary* (Summary+ b[i])>= 0):
    if(Summary > 0):
      Ans+= b[i]+ Summary+ 1
      b[i] = -Summary- 1 
      Summary= -1
    else:
      Ans+= -Summary+ 1- b[i]
      b[i] = -Summary+ 1
      Summary= 1
  else:
    Summary+= b[i]
    
print(min(ans, Ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
l = len(a)
b = [int(-a[0]/ abs(a[0]))]
for i in range(1, l):
  b.append(a[i])
ans = 0
summary = a[0]

if(summary == 0):
  if(a[1] > 0):
    summary = -1
    ans+= 1
  else:
    summary = 1
    ans+= 1

for i in range(1, l):
  if(summary* (summary+ a[i])>= 0):
    if(summary > 0):
      ans+= a[i]+ summary+ 1
      a[i] = -summary- 1 
      summary= -1
    else:
      ans+= -summary+ 1- a[i]
      a[i] = -summary+ 1
      summary= 1
  else:
    summary+= a[i]

Ans = 0
Summary = b[0]

if(Summary == 0):
  if(b[1] > 0):
    Summary = -1
    Ans+= 1
  else:
    Summary = 1
    Ans+= 1

for i in range(1, l):
  if(Summary* (Summary+ b[i])>= 0):
    if(Summary > 0):
      Ans+= b[i]+ Summary+ 1
      b[i] = -Summary- 1 
      Summary= -1
    else:
      Ans+= -Summary+ 1- b[i]
      b[i] = -Summary+ 1
      Summary= 1
  else:
    Summary+= b[i]
    
print(min(ans, Ans))
Problem p02582 (python)

Fixed submission:
S = input()
cnt = 0
for i in range(3):
    if S[i] == 'R':
        # count, 前の文字列がR or nullならcnt+1、そうでない場合、1
        if i == 0 or S[i - 1] == 'R':
            cnt += 1
        else:
            cnt = 1
print(cnt)

Buggy submission (verdict: Runtime Error):
S = input[0]
cnt = 0
for i in range(3):
  if S[i] == 'R':
    # count, 前の文字列がR or nullならcnt+1、そうでない場合、1
    # 
    if i == 0 or S[i - 1] == 'R':
	  cnt += 1
    else:
      cnt = 1
print(cnt)
Problem p02582 (python)

Fixed submission:
input_weather = input()
if input_weather.count('RRR') == 1:
	print(3)
elif input_weather.count('RR') == 1:
    print(2)
elif input_weather.count('R') >= 1:
    print(1)
else :
    print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().strip().split()))
L_sort = L.sort()
count = 0
for i in range(N-2):
	for j in range(i+1 , N):
		for k in range(j+1 , N):
        		if L_sort(i) + L_sort(j) > L_sort(k):
            		count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().strip().split()))
L_sort = L.sort()
count = 0
for i in range(N-2):
	for j in range(i+1 , N):
		for k in range(j+1 , N):
        	if L_sort(i) + L_sort(j) > L_sort(k):
            	count += 1
print(count)
Problem p02583 (python)

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

L.sort()
count = 0

for i in range(N):
    for j in range(i + 1, N):
        for k in range(j + 1, N):             
            if L[i] == L[j] or L[j] == L[k] or L[k] == L[i]:
                continue
            if L[i] + L[j] > L[k]:
                count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().strip().split()))
L_sort = L.sort()
count = 0
for i in range(N-2):
	for j in range(i+1 , N):
		for k in range(j+1 , N):
        		if L_sort[i] + L_sort[j] > L_sort[k]:
            			count += 1
                	else:
                		k += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().strip().split()))
L_sort = L.sort()
count = 0
for i in range(N-2):
	for j in range(i+1 , N):
		for k in range(j+1 , N):
        		if L_sort[i] + L_sort[j] > L_sort[k]:
            			count += 1
                else:
                	k += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().strip().split()))
L_sort = L.sort()
count = 0
for i in range(N-2):
	for j in range(i+1 , N):
		for k in range(j+1 , N):
        		if L_sort[i] + L_sort[j] > L_sort[k]:
            			count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().strip().split()))
L_sort = L.sort()
count = 0
for i in range(N-2):
	for j in range(i+1 , N):
		for k in range(j+1 , N):
        	if L_sort(i) + L_sort(j) > L_sort(k):
            	count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().strip().split()))
L_sort = L.sort()
count = 0
for i in range(N-2):
	for j in range(i+1 , N):
    	for k in range(j+1 , N):
        	if L_sort(i) + L_sort(j) > L_sort(k):
            	count += 1
print(count)
Problem p02658 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
if min(l)== 0:
    print(0)
else:    
    s=1
    for x in l:
        s *= x
        if s>10**18:
            s=-1
            break
    print(s)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
if 0 in A:
    ans=0
else:
    for i in range(1,N):
        if ans<=10**18:
            ans*=A[i]
        else:
            ans=-1
            exit()
    
print(ans )

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
ans = 1
if 0 in a:
    ans=0
else:
    for i in range(n):
        ans =ans*a[i]
    if ans > 10**18:
        ans=-1
         break  
print(ans)
Problem p02705 (python)

Fixed submission:
N=int(input())
x=2*N*3.1415926535897
print(x)

Buggy submission (verdict: Runtime Error):
N=int(input())
x=N*2.1415926535897
print x
Problem p02717 (python)

Fixed submission:
X,Y,Z=list(map(int, input().split()))
print(str(Z)+' '+str(X)+' '+str(Y))

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

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

Fixed submission:
X=int(input())
A=X//500
B=(X-500*A)//5
print(1000*A+5*B)

Buggy submission (verdict: Runtime Error):
X=int(input())
print(1000*(X//500)+5*((X-500*A)//5))
Problem p02730 (python)

Fixed submission:
S=str(input())
N=len(S)
if S!=S[::-1]:#Sと反転したSが不一致
    print('No')
else:
    S1=S[0:(N-1)//2]#Sが1文字目～(N-1)/2番目の場合
    S2=S[(N+1)//2:N]#Sが(N+3)/2～N番目の場合
    if S1==S1[::-1] and S2==S2[::-1]:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
S=str(input())
N=len(S)
if S!=S[::-1]:#Sと反転したSが不一致
    print('No')
else:
    S1=S[:(N-1)/2]#Sが1文字目～(N-1)/2番目の場合
    S2=S[(N+3)/2:]#Sが(N+3)/2～N番目の場合
    if S1==S1[::-1] and S2==S2[::-1]:
        print('Yes')
    else:
        print('No')
Problem p02783 (python)

Fixed submission:
import math
H,A=map(int, input().split())
print(math.ceil(H/A))

Buggy submission (verdict: Runtime Error):
H,A=map(int, input().split())
print(math.ceil(H/A))
Problem p02898 (python)

Fixed submission:
N,K=map(int, input().split())
d=list(map(int,input().split()))
ans=0
for i in range(N):
    if d[i]>=K:
        ans=ans+1
print(ans)

Buggy submission (verdict: Runtime Error):
N,K=map(int, input().split())
d=list(map(int,input().split()))
ans=0
for i in range(N+1):
    if d[i]>=K:
        ans=ans+1
print(ans)
Problem p02921 (python)

Fixed submission:
S=str(input())
T=str(input())
ans=0
for i in range (3):
    if S[i]==T[i]:
        ans=ans+1
print(ans)

Buggy submission (verdict: Runtime Error):
S=str(input())
T=int(input())
ans=0
for i in range (3)
	if S[i]==T[i]:
    	ans=ans+a
print(ans)
Problem p02988 (python)

Fixed submission:
n=int(input())
p=list( map(int, input().split()))
ans=0
for i in range(1,n-1):
    if (p[i-1]<p[i]<p[i+1]) or (p[i-1]>p[i]>p[i+1]):
        ans=ans+1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
p=list( map(int, input().split()))
ans=0
for i in range(0,n):
    if (p[i-1]<p[i]<p[i+1]) or (p[i-1]>p[i]>p[i+1]):
        ans=ans+1
print(ans)
Problem p03424 (python)

Fixed submission:
N=int(input())
S=input()
if 'Y' in S :
  print('Four')
else:
  print('Three')

Buggy submission (verdict: Runtime Error):
N=int(input())
S=map(int,input().split())
if 'Y' in S :
  print('Four')
else:
  print('Three')

Buggy submission (verdict: Runtime Error):
N=int(input())
S=map(int,input().split())
if 'Y' in N :
  print('Three')
else:
  print('Four')
Problem p03433 (python)

Fixed submission:
N=int(input())
A=int(input())
if N%500<=A:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N,A=map(int,input().split())
if N%500<=A:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N,A=map(int,input().split())
if N%500<A:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N,A=map(int,input().split())
x=N/500
if x<500:
  print('Yes')
else:
  print('No')
Problem p03471 (python)

Fixed submission:
import sys
N,Y=map(int,input().split())
ans=0
for x in range (N+1):
    for y in range(N+1-x):
        if 10000*x+5000*y+1000*(N-x-y)==Y:
            print(str(x)+' '+str(y)+' '+str(N-x-y))
            sys.exit()
print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
import sys
N,Y=map(int,input().split())
ans=0
for x in range (N):
    for y in range(N):
        if 10000*x+5000*y+1000*(N-x-y)==Y:
            print(x+' '+y+' '+N-x-y)
            sys.exit()
print(-1,-1,-1)
Problem p03477 (python)

Fixed submission:
a , b, c ,d = map(int,input().split(' '))
L=a+b
R=c + d
if L> R:
    print('Left')
elif L<R:
    print('Right')
else:
    print('Balanced ')

Buggy submission (verdict: Runtime Error):
A= input() 
B= input()
C= input()
D= input()
L=A+B
R=C+D
if L>R:
  print('Left')
elif L==R:
  print('Balanced')
else :
  print('Right')

Buggy submission (verdict: Runtime Error):
A,B,C,D= map(int, input().split())
L=A+B:
R=C+D:
if L>R:
  print('Left')
elif L=R:
  print('Balanced')
else :
  print('Right')

Buggy submission (verdict: Runtime Error):
A,B,C,D= map(int, input().split())
L=A+B
R=C+D
if L>R:
  print('Left')
elif L=R:
  print('Balanced')
else :
  print('Right')

Buggy submission (verdict: Runtime Error):
A= int(input())
B = int(input())
C = int(input())
D= int(input())
L=A+B
R=C+D
if L>R:
  print('Left')
elif L=R:
  print('Balanced')
else :
  print('Right')

Buggy submission (verdict: Runtime Error):
 a, b, c ,d = map(int,input().split(' '))
L=a+b;R=c+d:
if L>R:
	print('Left')
elif L<R:
	print('Right')
else:
	print('Balanced')

Buggy submission (verdict: Runtime Error):
 a, b, c ,d = map(int,input().split(' '))
L=a+b;R=c+d:
if L>R:
	print('Left')
elif L=R:
	print('Balance')
else:
	print('Right')

Buggy submission (verdict: Runtime Error):
 a, b, c ,d = map(int,input().split(' '))
 L=a+b;R=c+d:
if L>R:
	print('Left')
elif L=R:
	print('Balance')
else:
	print('Right')

Buggy submission (verdict: Runtime Error):
 a, b, c ,d = map(int,input().split(' '))
 L=a+b;R=c+d;
if L>R;
	print('Left')
elif L=R;
	print('Balance')
else;
	print('Right')
Problem p03485 (python)

Fixed submission:
a, b = map(int, input().split())
 
c = (a+b) / 2
 
print(int(c+0.9))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c=(a+b)*0.5
print(int(c+0.9))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c=(a+b)*0.5
print(c+0.9)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(int((a+b)*o.5+0.9))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c=a*b
d=c/2
print(c)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c=(a+b)*0.5
print(round(c))
Problem p03501 (python)

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

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input(),split())
print(min(n*a,b))

Buggy submission (verdict: Runtime Error):
n,a,b=[int,input(),split()]
print(min(n*a,b))

Buggy submission (verdict: Runtime Error):
n,a,b=[int,input(),split()]
ptint(min(n*a,b))

Buggy submission (verdict: Runtime Error):
n,a,b=[int(i) for i in input().split()]
ptint(min(n*a,b))

Buggy submission (verdict: Runtime Error):
n,a,b=[int(i) for i in input().split()]
x=A*N:
if x>=B:
  print(B)
else :
  print(x)

Buggy submission (verdict: Runtime Error):
n,a,b=[int(i) for i in input().split()]
x=A*N
if x>=B:
  print(B)
else :
  print(x)

Buggy submission (verdict: Runtime Error):
n,a,b=[int(i) for i in input().split()]
x=A*N
if x>=B:
  print(str(B))
else ;
  print(str(x))

Buggy submission (verdict: Runtime Error):
N,A,B= map(int,input().split(' '))
x=A*N
if x>B:
  print(B)
elif x=B:
  print(B)
else ;
  print(x)

Buggy submission (verdict: Runtime Error):
N,A,B= map(int,input().split(' '))
x=A*N:
if x>B:
  print(str(B))
elif x=B:
  print(str(B))
else ;
  print(str(x))

Buggy submission (verdict: Runtime Error):
N,A,B= map(int,input().split(' '))
x=A*N
if x>B:
  print(str(B))
elif x=B:
  print(str(B))
else ;
  print(str(x))
Problem p03502 (python)

Fixed submission:
N=int(input())
f=map(int,list(str(N)))
if N%sum(f)==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N=int(input())
f=map(int,list(N))
if N%sum(f)==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N=input()
f=map(int,list(str(N)))
if N%sum(f)==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N=input()
f=sum(list(map(int, str(N))))
if N%f==0:
  print('Yes')
else:
  print('No')
Problem p03563 (python)

Fixed submission:
R = int(input())
G = int(input())
print(2*G-R)

Buggy submission (verdict: Runtime Error):
G,R = int(input())
A=2*G-R
print(A)

Buggy submission (verdict: Runtime Error):
R,G= map(int, input().split())
print(2*G-R)

Buggy submission (verdict: Runtime Error):
G,R= map(int, input().split())
print(2*R-G)

Buggy submission (verdict: Runtime Error):
G,R= map(int, input().split())
print(2*G-R)

Buggy submission (verdict: Runtime Error):
input R, G
output (2 * G – R)

Buggy submission (verdict: Runtime Error):
G,R= map(int, input().split())
print(str(2G-R))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
c=a+b
print(str(c/2))

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

Fixed submission:
N = int(input())
ans=0
for i in range(N):
    l,n= map(int, input().split())
    ans=ans+n-l+1
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
for i in range(N)
 l,n=map(int,input().split())
 	ans=l-n+1
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
x=[0]*N
y=[0]*N
for i in range(N):
  x[i],y[i]=map(int,input(),split())
  ans=x-y+1
  print(ans)
Problem p02613 (python)

Fixed submission:
n = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(0, n):
    ni = input()
    if ni =="AC" : AC += 1
    elif ni =="WA" : WA += 1
    elif ni =="TLE" : TLE += 1
    elif ni =="RE" : RE += 1
print("AC x " + str(AC))
print("WA x " + str(WA))
print("TLE x " + str(TLE))
print("RE x " + str(RE))

Buggy submission (verdict: Runtime Error):
n = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(0, n):
  if "AC" : AC += 1
  else if "WA" : WA += 1
  else if "TLE" : TLE += 1
  else if "RE" : RE += 1
print("AC x " + str(AC))
print("WA x " + str(WA))
print("TLE x " + str(TLE))
print("RE x " + str(RE))
Problem p02621 (python)

Fixed submission:
a = int(input())
s = a*a
c = a*a*a
t = a+s+c
print(int(t))

Buggy submission (verdict: Runtime Error):
a = int(input())
print(int(a+(a**2)+(a**3))
Problem p02630 (python)

Fixed submission:
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    A = list(map(int, readline().rstrip().split()))
    counter = collections.Counter(A)
    q = int(readline().rstrip())
    BCList = [list(map(int, readline().rstrip().split())) for _ in range(q)]
    aList = [0] * (10**5 + 10)
    sumA = sum(A)
    for i in range(n):
        aList[A[i] - 1] += 1

    for i in range(q):
        b, c = BCList[i][0], BCList[i][1]
        if aList[b - 1] == 0:
            print(sumA)
            continue
        sumA += (c - b) * aList[b - 1]
        aList[c - 1] += aList[b - 1]
        aList[b - 1] = 0
        print(sumA)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
        aList[b - 1] = 0
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())
ans = 0
num = ["a"] * n
for _ in range(m):
    s, c = map(int, input().split())
    if s == 1 and c == 0:
        ans = -1
        break
    if num[s - 1] != "a" and num[s - 1] != c:
        ans = -1
        break
    num[s - 1] = c

numStr = ""

if n == 1 and num[0] == "a":
    numStr = ""
    ans = 0

elif num[0] == "a":
    num[0] = "1"

for l in range(n):
    if num[l] == "a":
        numStr += "0"
    else:
        numStr += str(num[l])

print(ans if ans == -1 else numStr)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
q = int(input())

for _ in range(q):
    a1, a2, a3 = input().split()

    # a1 = 1の時
    if a1 == "1":
        if s[int(a2) - 1] != a3:
            s[int(a2) - 1] = a3

    # a1 = 2の時
    else:
        print(len(set(s[int(a2) - 1:int(a3)])))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
q = int(input())

for _ in range(q):
    a1, a2, a3 = input().split()

    # a1 = 1の時
    if a1 == "1" and s[int(a2) - 1] != a3:
        s[int(a2) - 1] = a3

    # a1 = 2の時
    else:
        print(len(set(s[int(a2) - 1:int(a3)])))
Problem p02843 (python)

Fixed submission:
import math
import sys
readline = sys.stdin.readline


def main():
    x = int(readline().rstrip())
    ans = x // 100
    if ans == 0:
        print(0)
        return

    sur = x - ans * 100
    print(1 if sur / ans <= 5 else 0)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
import sys
readline = sys.stdin.readline


def main():
    x = int(readline().rstrip())
    ans = x // 100
    sur = x - ans * 100
    print(1 if sur / ans <= 5 else 0)


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

Fixed submission:
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    s = readline().rstrip()
    cnt = 0
    for i in range(1000):
        x = str(i).zfill(3)
        a = s[:-1].find(x[0])
        if a != -1:
            b = s[a + 1: -1].find(x[1])
            if b != -1:
                c = s[a + b + 2:].find(x[2])
                if c != -1:
                    cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
import sys
import collections
import bisect
import sympy
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    s = readline()
    cnt = 0
    for i in range(1000):
        x = str(i).zfill(3)
        a = s[:-1].find(x[0])
        if a != -1:
            b = s[a + 1: -1].find(x[1])
            if b != -1:
                c = s[a + b + 2:].find(x[2])
                if c != -1:
                    cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
import sys
import collections
import bisect
import sympy
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    s = readline().rstrip()
    cnt = 0
    for i in range(1000):
        x = str(i).zfill(3)
        a = s[:-1].find(x[0])
        if a != -1:
            b = s[a + 1: -1].find(x[1])
            if b != -1:
                c = s[a + b + 2:].find(x[2])
                if c != -1:
                    cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
import sys
import collections
import bisect
import sympy
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    s = readline().rstrip()
    cnt = 0
    for i in range(1000):
        x = str(i).zfill(3)
        a = s.find(x[0])
        b = s[a+1:].find(x[1])
        c = s[a+b+2:].find(x[2])
        if -1 not in (a, b, c):
            cnt += 1
    print(cnt)


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

Fixed submission:
import sys
import collections
import bisect


def main():
    n = int(input())
    AList = list(map(int, input().split()))
    ASum = sum(AList)
    c = 0
    for i in range(n):
        c += AList[i]
        if c >= ASum / 2:
            k = i
            break
    ans = min(2 * c - ASum, ASum - 2 * c + 2 * AList[k])
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import collections
import bisect


def main():
    n = int(input())
    AList = list(map(int, input().split()))
    ASum = sum(a)
    c = 0
    for i in range(n):
        c += AList[i]
        if c >= ASum / 2:
            k = i
            break
    ans = min(2 * c - ASum, ASum - 2 * c + 2 * AList[k])
    print(ans)


if __name__ == '__main__':
    main()