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

Fixed submission:
n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
s[k-1]=s[k-1].lower()
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
n,k=int(input())
s=input()
s[k-1]=s[k-1].lower()
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
s=list(input())
k=int(input())
s[k-1]=s[k-1].lower()
print(*s,sep="")

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
x=s[k-1]
y=x.lower()
print(s.replace(x,y))
Problem p03054 (python)

Fixed submission:
h,w,n = map(int,input().split())
sx,sy = map(int,input().split())
S = input()
T = input()
S = list(S[::-1])
T = list(T[::-1])
area = [1,h,1,w]
#上下左右
for s,t in zip(S,T):
  if t == "R":
    area[2] = max(1,area[2]-1)
  if t == "L":
    area[3] = min(w,area[3]+1)
  if t == "D":
    area[0] = max(1,area[0]-1)
  if t == "U":
    area[1] = min(h,area[1]+1)
  if s == "L":
    area[2] = min(w+1,area[2]+1)
  if s == "R":
    area[3] = max(0,area[3]-1)
  if s == "U":
    area[0] = min(h+1,area[0]+1)
  if s == "D":
    area[1] = max(0,area[1]-1)
  if area[0] > area[1] or area[2] > area[3]:
    print("NO")
    exit()
if area[0] <= sx <= area[1] and area[2] <= sy <= area[3]:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
h,w,N = map(int,input().split())
sx,sy = map(int,input().split())
S = input().rstrip()
T = input().rstrip()
L = 0
R = 0
U = 0
D = 0
for i in range(n):
    if S[i] == "L":
        L+=1
    if S[i] == "R":
        R+=1
    if S[i] == "U":
        U+=1
    if S[i] == "D":
        D+=1
    if L>=sy or R >= w-sy+1 or U>=sx or D >= h-sx+1:
        print("NO")
        exit()
    if T[i] == "L":
        R = max(,)
    if T[i] == "R":
        R+=1
    if T[i] == "U":
        U+=1
    if T[i] == "D":
        D+=1
Problem p03221 (python)

Fixed submission:
from operator import itemgetter
N , M = map(int, input().split(' '))

city = []
for i in range(M):
    a, b = map(int, input().split(' '))
    city.append([a, b, i])

city_y = sorted(city, key = itemgetter(1))
city_num = [0 for _ in range(N+1)]
city_ID = {}

for i in range(M):
    city_num[city_y[i][0]] += 1
    city_ID[city_y[i][2]] = ("{:0=6}{:0=6}".format(city_y[i][0], city_num[city_y[i][0]]))

for i, j in sorted(city_ID.items()):
    print(j)

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
N , M = map(int, input().split(' '))

city = []
for i in range(M):
    lscity = list(map(int, input().split(' ')))
    city.append([*lscity, i])

city_y = sorted(city, key = itemgetter(1))
city_num = [0 for _ in range(N+1)]
city_ID = {}

for i in range(M):
    city_num[city_y[i][0]] += 1
    city_ID[city_y[i][2]] = ("{:0=6}{:0=6}".format(city_y[i][0], city_num[city_y[i][0]]))

for i, j in sorted(city_ID.items()):
    print(j)

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
N , M = map(int, input().split(' '))

city = []
for i in range(M):
    lscity = list(map(int, input().split(' ')))
    city.append([*lscity, i])

city_y = sorted(city, key = itemgetter(1))
city_num = [0 for _ in range(N+1)]
city_ID = {}

for i in range(M):
    city_num[city_y[i][0]] += 1
    city_ID[city_y[i][2]] = ("{:06d}{:06d}".format(city_y[i][0], city_num[city_y[i][0]]))

for i, j in sorted(city_ID.items()):
    print(j)

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
N , M = map(int, input().split(' '))

city = []
for i in range(M):
    lscity = list(map(int, input().split(' ')))
    city.append([*lscity, i])

city_y = sorted(city, key = itemgetter(1))
city_num = [0 for _ in range(N+1)]
city_ID = {}

for i in range(M):
    city_num[city[i][0]] += 1
    city_ID[city_y[i][2]] = ("{:06d}{:06d}".format(city_num[city[i][0]], city[i][0]))

for i, j in sorted(city_ID.items()):
    print(j)
Problem p03252 (python)

Fixed submission:
from collections import defaultdict
s=input()
t=input()
dct=defaultdict(int)
for i in range(len(s)):
  if not dct[s[i]]:
    dct[s[i]]=t[i]
  elif dct[s[i]]!=t[i]:
    print("No")
    exit()
ls=[]
for i in dct.values():
  if i in ls:
    print("No")
    exit()
  else:
    ls.append(i)
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
import defaultdict
input=sys.stdin.readline()
s=input().rstrip()
t=input().rstrip()
dct=defaultdict(int)
for i in range(len(s)):
  if not dct[s[i]]:
    dct[s[i]]=t[i]
  elif dct[s[i]]!=t[i]:
    print("No")
    exit()
ls=[]
for i in dct.values():
  if i in ls:
    print("No")
    exit()
  else:
    ls.append(i)
print("Yes")
Problem p03315 (python)

Fixed submission:
S=input()
print(S.count("+")-S.count("-"))

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
A = list(map(int, input().split()))
print((N-1+K-1-1)//(K-1))
Problem p03326 (python)

Fixed submission:
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
ans=[]
for i in range(8):
  binstr=format(i,"b").zfill(3)
  b=[]
  for j in range(n):
    c=0
    for k in range(3):
      if binstr[k]=="1":
        c+=a[j][k]
      else:
        c+=-a[j][k]
    b.append(c)
  b.sort(reverse=True)
  ans.append(sum(b[:m]))
print(max(ans))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(n)]
ans=[]
for i in range(8):
  binstr=bin(i)[2:]
  binstr.zfill(3)
  b=[]
  for j in range(n):
    c=0
    for k in range(3):
      if binstr[k]=="1":
        c+=a[j][k]
      else:
        c+=-a[j][k]
    b.append(c)
  b.sort()
  ans.append(sum(b[:m]))
print(max(ans))
Problem p03329 (python)

Fixed submission:
N=int(input())
dstb=[1]+[6**i for i in range(1,7)]+[9**j for j in range(1,6)]
DP=[10**5]*(10**5*2)
DP[0]=0
for i in range(N+1):
  for j in dstb:
    DP[i+j]=min(DP[i+j], DP[i]+1)

print(DP[N])

Buggy submission (verdict: Runtime Error):
N=int(input())
dstb=[1]+[6**i for i in range(1,7)]+[9**j for j in range(1,6)]
DP=[10**5]*(N*2)
DP[0]=0
for i in range(N+1):
  for j in dstb:
    DP[i+j]=min(DP[i+j], DP[i]+1)

print(DP[N])
Problem p03618 (python)

Fixed submission:
from collections import Counter
s=list(input())
n=len(s)
c=Counter(s)
ans=1+n*(n-1)//2
for i in c.values():
  ans-=i*(i-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
s=list(input())
n=len(s)
c=s.Counter()
ans=1+n*(n-1)//2
for i in c.values():
  ans-=i*(i-1)//2
print(ans)
Problem p03705 (python)

Fixed submission:
n,a,b=map(int,input().split())
if a>b:
  print(0)
  exit()
if n == 1:
  if a == b:
    print(1)
  else:
    print(0)
  exit()
if n == 2:
  print(1)
  exit()
print((b-a)*(n-2)+1)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a==b:
  print(1)
  exit()
abin=bin(a)[2:]
bbin=bin(b)[2:]
la=len(abin)
lb=len(bbin)
if la==lb:
  while abin[0]==bbin[0]:
    abin=abin[1:]
    bbin=bbin[1:]
  while len(abin)>1 and abin[0]=="0":
    abin=abin[1:]
cbin=bbin[1:]
while cbin and cbin[0]=="0":
  cbin=cbin[1:]
c=2**(len(cbin))-1
a=int(abin,2)
b=int(bbin,2)
lb=len(bbin)
lbnd=2**(lb-1)+c
hbnd=2**(lb-1)+a
if lbnd>=hbnd:
  print(2**lb-a)
else:
  print(2**(lb-1)-a+lbnd-a+1)
Problem p03724 (python)

Fixed submission:
import sys
from collections import Counter
read=sys.stdin.read
n,m=map(int,input().split())
a=list(map(int,read().split()))
c=Counter(a)
ans="YES"
for i in c.values():
  if i%2:
    ans="NO"
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from collections import Counter
n,m=map(int,input().split())
a=list(map(int,read().split()))
c=Counter(a)
ans="YES"
for i in c.values():
  if i%2:
    ans="NO"
print(ans)
Problem p03767 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
print(sum(a[1:2*n:2]))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
print(sum[1:2*n+2:2])
Problem p03774 (python)

Fixed submission:
n,m=map(int,input().split())
std = [list(map(int,input().split())) for i in range(n)]
chk = [list(map(int,input().split())) for i in range(m)]
for s in std:
  ans=[]
  for i in range(m):
    ans.append([abs(s[0]-chk[i][0])+abs(s[1]-chk[i][1]),i+1])
    ans.sort()
  print(ans[0][1])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
std = [list(map(int,input().split())) for i in range(n)]
chk = [list(map(int,input().split())) for i in range(m)]
for s in std:
  print(min(lambda i:abs(s[0]-chk[i][0])+abs(s[1]-chk[i][1])))
Problem p03775 (python)

Fixed submission:
n=int(input())
ans = []
for i in range(1,int(n**0.5+1)):
  if n%i==0:
    j=n//i
    ans.append(max(len(str(i)),len(str(j))))
print(min(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
ans = []
for i in range(1,n**0.5+1):
  if n%i==0:
    j=n//i
    ans.append(len(str(i))+len(str(j)))
print(max(ans))
Problem p03776 (python)

Fixed submission:
from math import factorial
import bisect
def cmb(n,r):
  if n<0 or r<0:
    return 0
  else:
    return factorial(n)//factorial(n-r)//factorial(r)
n,a,b=map(int,input().split())
x = list(map(int,input().split()))
ans=0
x.sort(reverse=True)
print(sum(x[:a])/a)
if n==a:
  print(1)
elif x[0]==x[a]:
  for i in range(n):
    if x[0] != x[i]:
      k=i
      break
  else:
    k=n
  for i in range(a,min(k+1,b+1)):
    ans+=cmb(k,i)
  print(ans)
elif x[a-1] == x[a]:
  y=sorted(x)
  x1=bisect.bisect_left(y,x[a])
  x2=bisect.bisect_right(y,x[a])
  print(cmb(x2-x1,a-(n-x2)))
else:
  print(1)

Buggy submission (verdict: Runtime Error):
from math import factorial
import bisect
def cmb(n,r):
  if n<0 or r<0:
    return 0
  else:
    return factorial(n)//factorial(n-r)//factorial(r)
n,a,b=map(int,input().split())
x = list(map(int,input().split()))
ans=0
x.sort(reverse=True)
print(sum(x[:a])/a)
if n==a:
  print(1)
elif x[0]==x[a]:
  for i in range(n):
    if x[0] != x[i]:
      k=i
      break
  else:
    k=n
  for i in range(a,b+1):
    ans+=cmb(k,i)
  print(ans)
elif x[a-1] == x[a]:
  y=sorted(x)
  x1=bisect.bisect_left(y,x[a])
  x2=bisect.bisect_right(y,x[a])
  print(cmb(x2-x1,a-(n-x2)))
else:
  print(1)

Buggy submission (verdict: Runtime Error):
from math import factorial
import bisect
def cmb(n,r):
  if n<0 or r<0:
    return 0
  else:
    return factorial(n)//factorial(n-r)//factorial(r)
n,a,b=map(int,input().split())
x = list(map(int,input().split()))
ans=0
x.sort(reverse=True)
print(sum(x[:a])/a)
if x[0]==x[a]:
  for i in range(n):
    if x[0] != x[i]:
      k=i
      break
  else:
    k=n
  for i in range(a,b+1):
    ans+=cmb(k,i)
  print(ans)
elif x[a-1] == x[a]:
  y=sorted(x)
  x1=bisect.bisect_left(y,x[a])
  x2=bisect.bisect_right(y,x[a])
  print(cmb(x2-x1,a-(n-x2)))
else:
  print(1)

Buggy submission (verdict: Runtime Error):
from math import factorial
def cmb(n,r):
  if n<0 or r<0:
    return 0
  else:
    return factorial(n)//factorial(n-r)//factorial(r)
n,a,b=map(int,input().split())
x = list(map(int,input().split()))
ans=0
x.sort(reverse=True)
print(sum(x[:a])/a)
if x[0]==x[a]:
  for i in range(n):
    if x[0] != x[i]:
      k=i
      break
  else:
    k=n
  for i in range(a,b+1):
    ans+=cmb(k,i)
  print(ans)
else:
  print(1)
Problem p03803 (python)

Fixed submission:
A,B=map(int,input().split())
if (A+11)%13 > (B+11)%13:
  print("Alice")
elif (A+11)%13 < (B+11)%13:
  print("Bob")
else:
  print("Draw")

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
if (A+11)%13 > (B+11)%13:
  print("Alice")
elif (A+11)%13 < (B+11)%13:
  print("Bob")
else:
  print("Draw")
Problem p03804 (python)

Fixed submission:
N,M = map(int,input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
ans = 0
for i in range(N-M+1):
  for j in range(N-M+1):
    for k in range(i,i+M):
      for l in range(j,j+M):
        if A[k][l] != B[k-i][l-j]:
          break
        if A[k][l] == B[k-i][l-j] and k == i+M-1 and l == j+M-1:
          ans = 1
      else:
        continue
      break

if ans == 0:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N,M = map(int,input())
A = [input() for _ in range(N)]
B = [input() for _ in range(N)]
ans = 0
for i in range(N-M+1):
  for j in range(N-M+1):
    for k in range(i,i+M):
      for l in range(j,j+M):
        if A[k][l] != B[k][l]:
          break
        if A[k][l] == B[k][l] and k == i+M-1 and l == j+M-1:
          ans = 1
    else:
      continue
    break
if ans == 0:
  print("No")
else:
  print("Yes")
Problem p03805 (python)

Fixed submission:
from itertools import permutations
n,m=map(int,input().split())
side=[[] for _ in range(n+1)]
for i in range(m):
  a,b=map(int,input().split())
  side[a].append(b)
  side[b].append(a)
route=[i for i in range(2,n+1)]
ans=0
for x in permutations(route):
  x=list(x)
  x.insert(0,1)
  for i in range(n-1):
    if x[i+1] not in side[x[i]]:
      break
  else:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import permutations
n,m=map(int,input().split())
side=[[] for _ in range(n+1)]
for i in range(m):
  a,b=map(int,input().split())
  side[a].append(b)
  side[b].append(a)
route=[i for i in range(2,n+1)]
ans=0
for x in permutations(route):
  x=(1)+x
  for i in range(n-1):
    if x[i+1] not in side[x[i]]:
      break
  else:
    ans+=1
print(ans)
Problem p03809 (python)

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
stone = [0]+list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(n-1)]
graph = [[] for i in range(n+1)]
dp = [[] for i in range(n+1)]
deg = [0]*(n+1)
stack = []
for a,b in ab:
  graph[a].append(b)
  graph[b].append(a)
  deg[a] += 1
  deg[b] += 1
root = 0
for i in range(1,n+1):
  if deg[i] == 1:
    stack.append(i)
  elif root == 0:
    root = i
if root == 0:
  if stone[1] == stone[2]:
    print("YES")
  else:
    print("NO")
  exit()
deg[root] += 1
flg = 1
while stack:
  x = stack.pop()
  if x == root:
    if sum(dp[x]) != 2*stone[x] or max(dp[x]) > stone[x]:
      flg = 0
    break
  elif dp[x]:
    if max(max(dp[x])*2,sum(dp[x])) > stone[x]*2 or stone[x] > sum(dp[x]):
      flg = 0
      break
    stone[x] = 2*stone[x]-sum(dp[x])
  for y in graph[x]:
    if deg[y] > 1:
      dp[y].append(stone[x])
      deg[y] -= 1
      if deg[y] == 1:
        stack.append(y)
if flg:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
import random
import sys
input = sys.stdin.readline
n = int(input())
stone = [0]+list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(n-1)]
graph = [[] for i in range(n+1)]
dp = [[] for i in range(n+1)]
deg = [0]*(n+1)
stack = []
for a,b in ab:
  graph[a].append(b)
  graph[b].append(a)
  deg[a] += 1
  deg[b] += 1
root = 0
for i in range(1,n+1):
  if deg[i] == 1:
    stack.append(i)
  elif root == 0:
    root = i
if root == 0:
  print(2/0)
  if stone[0] == stone[1]:
    print("YES")
  else:
    print("NO")
  exit()
deg[root] += 1
flg = 1
while stack:
  x = stack.pop()
  if x == root:
    if sum(dp[x]) != 2*stone[x] or max(dp[x]) > stone[x]:
      flg = 0
    break
  elif dp[x]:
    if max(max(dp[x])*2,sum(dp[x])) > stone[x]*2 or stone[x] > sum(dp[x]):
      flg = 0
      break
    stone[x] = 2*stone[x]-sum(dp[x])
  for y in graph[x]:
    if deg[y] > 1:
      dp[y].append(stone[x])
      deg[y] -= 1
      if deg[y] == 1:
        stack.append(y)
if flg:
  print("YES")
else:
  print("NO")
Problem p03821 (python)

Fixed submission:
n=int(input())
ab=[list(map(int,input().split())) for i in range(n)]
ans = 0
for i in range(n-1,-1,-1):
  k = (ab[i][0]+ans)%ab[i][1]
  if k!=0:
    ans += ab[i][1]-k
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ab=[list(map(int,input())) for i in range(n)]
ans = 0
for i in range(n-1,-1,-1):
  k = (ab[i][0]+ans)%ab[i][1]
  if k!=0:
    ans += ab[i][1]-k
print(ans)
Problem p03834 (python)

Fixed submission:
print(input().replace(","," "))

Buggy submission (verdict: Runtime Error):
k,s=map(int,input().split())
ans = 0
for i in range(k+1):
  if k <=s-i<=2*k:
    ans+= s-i+1
  elif 0<=s-i<=k:
    ans+= k*2-s+1
print(ans)

Buggy submission (verdict: Runtime Error):
k,s=map(int,input().split())
ans = 0
for i in range(k+1):
  if k<=s-i<=2*k:
      ans+= s-i+1
  elif 0<=s-i<=k:
      ans+= k*2-s+1
print(ans)
Problem p03835 (python)

Fixed submission:
k,s=map(int,input().split())
ans = 0
for i in range(k+1):
  for j in range(k+1):
    if 0<=s-i-j<=k:
      ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
k,s=map(int,input().split())
ans = 0
for i in range(1,k+1):
  for j in range(1,k;1):
    if s-i-j<=k:
      ans+=1
print(ans)
Problem p02627 (python)

Fixed submission:
s=input()
print('a' if s.islower() else 'A')

Buggy submission (verdict: Runtime Error):
print('a' if s.islower() else 'A')
Problem p02629 (python)

Fixed submission:
n=int(input())-1
j=26
while j<=n:
  n-=j
  j*=26
j//=26
ret = ""
while j:
  ret += "abcdefghijklmnopqrstuvwxyz"[n//j]
  #print(f'{n//j=}')
  n %= j
  j //= 26
print(ret)

Buggy submission (verdict: Runtime Error):
n=int(input())-1
j=26
while j<=n:
  n-=j
  j*=26
j/=26
ret = ""
while j:
  ret += "abcdefghijklmnopqrstuvwxyz"[n//j]
  n %= j
  j /= 26
print(ret)
Problem p03295 (python)

Fixed submission:
n,m = map(int, raw_input().split())
ps = [map(int, raw_input().split()) for _ in range(m)]
ps.sort()
ps.reverse()
v = 10**100
ret = 0
for a,b in ps:
 if b <=v:
  ret += 1
  v = a
print ret

Buggy submission (verdict: Runtime Error):
n = raw_input()
m = int(raw_input())
ps = [map(int, raw_input().split()) for _ in range(m)]
ps.sort()
ps.reverse()
v = -1
ret = 0
for a,b in ps:
 if b <=va:
  ret += 1
  va = a
print ret
Problem p02970 (python)

Fixed submission:
n, d = map(int, input().split())
if n%(2*d+1) == 0:
  print(int(n/(2*d+1)))
else:
  print(int((n/(2*d+1)))+1)

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)
Problem p02987 (python)

Fixed submission:
import sys
s = input()
a = s[0]
if s.count(a) != 2:
  print("No")
  sys.exit()
t = s.replace(a,"")

if t[0] != t[1]:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
s = input()
a = s[0]
if s.count(a) != 2:
  print("No")
  sys.exit()
s.replace(a)
b = s[0]
if s.count(b) != 2:
  print("No")
  sys.exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
a = s[0]
if s.count(a) != 2:
  print("No")
  sys.exit()
s.strip(a)
b = s[0]
if s.count(b) != 2:
  print("No")
  sys.exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
a = s[0]
if s.count(a) != 2:
  print("No")
  sys.exit()
s.remove(a)
s.remove(a)
b = s[0]
if s.count(b) != 2:
  print("No")
  sys.exit()
print("Yes")
Problem p02682 (python)

Fixed submission:
import sys
import os

def file_input():
    f = open('ABC167/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    # int(input())
    A,B,C,K=map(int, input().split())

    sum=0
    if K>A:
        sum+=A
        K-=A
        if K>B:
            K-=B
            sum-=K        
    else:
        sum+=K

    print(sum)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import os

def file_input():
    f = open('/input.txt', 'r')
    sys.stdin = f

def main():
    # file_input()
    # int(input())
    A,B,C,K=int(map(int, input().split()))

    sum=0
    for i in K:
        if A!=0:
            A-=1
            sum+=1
        elif B!=0:
            B-=1
        elif C!=0:
            C-=1
            sum-=1
    print(sum)

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

Fixed submission:
import sys
import os
import math

def file_input():
    f = open('input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()

    j = int(input())
    N = [0]*j
    A = list(map(int, input().split()))

    for i in A:
        N[i-1]+=1

    for i in N:
        print(i)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import os
import math

def file_input():
    f = open('input.txt', 'r')
    sys.stdin = f

def main():
    file_input()

    N = [0]*int(input())
    A = list(map(int, input().split()))

    for i in A:
        N[i-1]+=1

    for i in N:
        print(i)


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

Fixed submission:
import sys
import os

def file_input():
    f = open('AGC009/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    N=int(input())
    A=[]
    B=[]
    for i in range(N):
        tmp=list(map(int, input().split()))
        A.append(tmp[0])
        B.append(tmp[1])

    cnt=0
    for j in range(N):
        # while (A[N-1-j]+cnt)%B[N-1-j]!=0:
        # cnt+=1
        tmp=A[N-1-j]+cnt
        if not tmp==0:
            # cnt=B[N-1-j]
            if tmp<B[N-1-j]:
                cnt+=B[N-1-j]-tmp
            elif tmp%B[N-1-j]!=0:
                cnt+=B[N-1-j]-tmp%B[N-1-j]

    print(cnt)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import os

def file_input():
    f = open('AGC009/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    N=int(input())
    A=[]
    B=[]
    for i in range(N):
        tmp=list(map(int, input().split()))
        A.append(tmp[0])
        B.append(tmp[1])

    cnt=0
    for j in range(N):
        # while (A[N-1-j]+cnt)%B[N-1-j]!=0:
        # cnt+=1
        tmp=A[N-1-j]+cnt
        if not tmp==0:
            # cnt=B[N-1-j]
            elif tmp<B[N-1-j]:
                cnt+=B[N-1-j]-tmp
            elif tmp%B[N-1-j]!=0:
                cnt+=B[N-1-j]-tmp%B[N-1-j]

    print(cnt)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import os

def file_input():
    f = open('AGC009/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    N=int(input())
    A=[]
    B=[]
    for i in range(N):
        tmp=list(map(int, input().split()))
        A.append(tmp[0])
        B.append(tmp[1])

    cnt=0
    for j in range(N):
        # while (A[N-1-j]+cnt)%B[N-1-j]!=0:
            # cnt+=1
        tmp=A[N-1-j]+cnt
        # print(str(tmp))
        if not B[N-1-j]==1:
            if tmp>B[N-1-j]:
                # print(str(B[N-1-j]-tmp%B[N-1-j]))
                cnt+=B[N-1-j]-tmp%B[N-1-j]
            else:
                # print(str(B[N-1-j]%tmp+B[N-1-j]))
                cnt+=B[N-1-j]%tmp

        # print(cnt)

    print(cnt)

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

Fixed submission:
P,Q,R = list(map(int, input().split()))
print(min([P+Q,Q+R,R+P]))

Buggy submission (verdict: Runtime Error):
H,W = list(map(int, input().split()))
S = [[1 if s=='.' else 0 for s in input()] for _ in range(H)] #S[h][w]

import numpy as np
S = np.array(S)
#print(S)

SH = np.zeros((H,W), dtype='int')
SH_ = np.zeros((H,W), dtype='int')

SV = np.zeros((H,W), dtype='int')
SV_ = np.zeros((H,W), dtype='int')

#horizontal
for h in range(H):
  SH[h][0] = S[h][0]
  for w in range(1,W):
    if S[h][w]:
      SH[h][w] = SH[h][w-1] + 1
  
  SH_[h][-1] = S[h][-1]
  for w in range(W-1)[::-1]:
    if S[h][w]:
      SH_[h][w] = SH_[h][w+1] + 1
  

#vertical
for w in range(W):
  SV[0][w] = S[0][w]
  for h in range(1,H):
    if S[h][w]:
      SV[h][w] = SV[h-1][w] + 1
  
  SV_[-1][w] = S[-1][w]
  for h in range(H-1)[::-1]:
    if S[h][w]:
      SV_[h][w] = SV_[h+1][w] + 1

#print(SH + SH_)
#print(SV + SV_)

print(np.max(SH+SH_+SV+SV_) -3)