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

Fixed submission:
## https://atcoder.jp/contests/abc051/submissions/3281251
import heapq

def dijkstra(graph, node, start):
    dist = [float("inf") for _ in range(node)]
    
    dist[start] = 0
    q = []
    heapq.heappush(q, (0, start))
    
    while q:
        cost, cur_node = heapq.heappop(q)
        
        if dist[cur_node] < cost:
            continue
        
        for nex_cost, nex_node in graph[cur_node]:
            dist_cand = dist[cur_node] + nex_cost
            if dist_cand < dist[nex_node]:
                dist[nex_node] = dist_cand
                heapq.heappush(q, (dist[nex_node], nex_node))

    return dist

def main():
    n, m = map(int, input().split())
    adj = [[] for _ in range(n)]
    for i in range(m):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        adj[a].append((c, b))
        adj[b].append((c, a))
    shortest = []
    for i in range(n):
        shortest.append(dijkstra(adj, n, i))
    ans = 0
    for i in range(n):
        for cost, j in adj[i]:
            if cost > shortest[i][j]:
                ans += 1
    print(ans // 2)
                                                                                                                                                                                                     
if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	D_fix
# CreatedDate:  2020-02-21 01:20:19 +0900
# LastModified: 2020-02-21 02:04:42 +0900
#


import os
import sys
import numpy as np
import pandas as pd
def make_matrix(matrix,a,b,c):
    matrix[a-1][b-1] = c
    matrix[b-1][a-1] = c
def initial_signal(i,matrix):
    d = [100]*(matrix.shape[0])
    d[i] = 0
    Q = []
    for j in range(matrix.shape[0]):
        Q.append([j,100])
    Q[i][1]=0
    Q.sort()
    return d,Q

def relax(matrix,u,v,d,Q):
    if d[v] > d[u[0]]+matrix[u[0]][v]:
        d[v] = d[u[0]]+matrix[u[0]][v]
        for i,tmp in enumerate(Q):
            if Q[i][0]==v:
                Q[i][1] = d[u[0]]+matrix[u[0]][v]


def dijkstra(i,matrix):
    d,Q = initial_signal(i,matrix)
    S = []
    while Q:
        Q.sort(key=lambda x: x[1])
        u = Q.pop(0)
        S.append(u)
        for v in range(matrix.shape[0]):
            if matrix[u[0]][v]!=0:
                relax(matrix,u,v,d,Q)
    return d
    

def main():
    N,M = map(int, input().split())
    matrix = np.zeros((N,N),dtype=np.int32)
    for _ in range(M):
        a,b,c = map(int,input().split())
        make_matrix(matrix,a,b,c)
    shortest = []
    for i in range(matrix.shape[0]):
        short = dijkstra(i,matrix)
        shortest.append(short)
    ans=0
    for i in range(N):
        for j in range(N):
            cost = matrix[i][j]
            if cost>shortest[i][j]:
                ans+=1

    print(ans//2)


if __name__ == "__main__":
    main()
Problem p02658 (python)

Fixed submission:

def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1

    for a in A:
        if a == 0:
            ans = 0
            break
        elif ans < 10**18:
            ans *= a
        
    if ans > 10**18:
        print(-1)
    else:
        print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1

    for a in A:
        if a == 0:
            ans = 0
            break:
        ans *= a
        if ans > 10**18:
            ans = -1
            break
    
    print(ans)


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

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import math as mt

def main():
    A, B, N = map(int, input().split())

    maxn = 0
    
    if N >= B:
        maxn = mt.floor(A*(B-1)/B) - A*mt.floor((B-1)/B)
    else:
        maxn = mt.floor(A*N/B) - A*mt.floor(N/B)
    
    print(maxn)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import math as mt

def main():
    A, B, N = map(int, input().split())

    maxn = 0
    
    elif N >= B:
        maxn = mt.floor(A*(B-1)/B) - A*mt.floor((B-1)/B)
    else:
        maxn = mt.floor(A*N/B) - A*mt.floor(N/B)
    
    print(maxn)


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

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    S = input()

    R = 0
    G = 0
    B = 0

    for s in S:
        if s == 'R':
            R += 1
            continue
        elif s == 'G':
            G += 1
            continue
        elif s == 'B':
            B += 1
    

    total = 0

    for i in range(N-2):
        for j in range(i+1, N-1):
            if 2*j-i >= N:
                break
            if S[i] != S[j] and S[j] != S[2*j-i] and S[2*j-i] != S[i]:
                total += 1

    print(R*G*B - total)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    S = input()

    R = 0
    G = 0
    B = 0

    for s in S:
        if s == 'R':
            R += 1
            continue
        elif s == 'G':
            G += 1
            continue
        elif s == 'B':
            B += 1
    

    total = 0

    for i in range(N):
        for j in range(i+1, N):
            if S[i] != S[j] and S[j] != S[2*j-i] and S[2*j-i] != S[i]:
                total += 1

    print(N - total)


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

Fixed submission:
# -*- coding: utf-8 -*-


N = int(input())
S = input()

count = 0

for i, s in enumerate(S[:-2]):
    if s != 'A':
        continue
    else:
        if N >= i + 2 and S[i+1] == 'B' and S[i+2] == 'C':
            count += 1

print(count)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


N = int(input())
S = input()

count = 0

for i, s in enumerate(S):
    if s != 'A':
        continue
    else:
        if N >= i + 2 and S[i+1] == 'B' and S[i+2] == 'C':
            count += 1

print(count)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


N = int(input())
S = input()

count = 0

for i, s in enumerate(S):
    if s != 'A':
        continue
    else:
        if S[i+1] == 'B' and S[i+2] == 'C':
            count += 1

print(count)
Problem p02612 (python)

Fixed submission:
n = int(input())
a,b = divmod(n,1000)
if b == 0:
    print(0)
else:

    print(1000-b)

Buggy submission (verdict: Runtime Error):
n = input()
a,b = divmod(n,1000)
print(b)
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
if s == t[:len(s)]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
if s = input()
t = input()
if len(s) +1 == len(t):
    print("Yes")
else:
    print("No")
Problem p02696 (python)

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

num = min(b-1,n)

print(int((a*num)/b)-a*int(num/b))

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

print(min(b-1,n))
Problem p02713 (python)

Fixed submission:
import math
goal = 0
n = int(input())
n+=1
for i in range(1,n):
    for j in range(1,n):
        for k in range(1,n):
            list1 = [i,j,k]
            ans = list1[0]
            for m in range(1, 3):
                ans = math.gcd(ans, list1[m])
            goal +=ans

print(goal)

Buggy submission (verdict: Runtime Error):
goal = 0
n = int(input())
n+=1
for i in range(1,n):
    for j in range(1,n):
        for k in range(1,n):
            list1 = [i,j,k]
            ans = list1[0]
            for m in range(1, 3):
                ans = math.gcd(ans, list1[m])
            goal +=ans

print(goal)
Problem p02719 (python)

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

b = n % k
c = abs(b - k)
if b < c:
    print(b)
else:
    print(c)

Buggy submission (verdict: Runtime Error):
a=n/k
if a >1:
    b=n%k
    if b==0:
        print(0)
    else:
        print(abs(b-k))
else:
    print(n)
    exit()
Problem p02741 (python)

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

x = int(input())
print(a[x-1])

Buggy submission (verdict: Runtime Error):
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

x = int(input())
print(a[x-1]
Problem p02760 (python)

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

for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j] == b[k]:
                a[i][j] = 0

ans = "No"
for i in range(3):
    if a[i][0] + a[i][1] + a[i][2] == 0:
        ans = "Yes"
    if a[0][i] + a[1][i] + a[2][i] == 0:
        ans = "Yes"
if a[0][0] + a[1][1] + a[2][2] == 0:
    ans = "Yes"
if a[0][2] + a[1][1] + a[2][0] == 0:
    ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]

for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j] == b[k]:
                a[i][j] = 0

ans = "No"
for i in range(3):
    if a[i][0] + a[i][1] + a[i][2] == 0:
        ans = "Yes"
    if a[0][i] + a[1][i] + a[2][i] == 0:
        ans = "Yes"
if a[0][0] == a[1][1] == a[2][2] == 0 or a[0][2] == a[1][1] == a[2][0] == 0:
    ans = "Yes
print(ans)
Problem p02772 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0:
            if a[i] % 5 != 0:
                print("DENIED")
                exit()
        if a[i] % 5 != 0:
            if a[i] % 3 != 0:
                print("DENIED")
                exit()
print("APPROVED")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int,input().split())
for i in range (n):
  if a[i] %2 == 0:
    if a[i] %3 != 0 or a[i] %5 != 0:
      print("DENIED")
      exit()
print("APPROVED")
Problem p02795 (python)

Fixed submission:
h = int(input())
w = int(input())
m = int(input())
total = 0
if h < w:
  h,w = w,h
for i in range(w):
  total += h
  if total >= m:
    print(i+1)
    exit()

Buggy submission (verdict: Runtime Error):
h,w,m = map(int,input().split())
total = 0
if h < w:
  h,w = w,h
for i in range(w):
  total += h
  if total >= m:
    print(i+1)
Problem p02806 (python)

Fixed submission:
n = int(input())
s = []
t = []
for i in range(n):
  s_temp,t_temp = input().split()
  s.append(s_temp)
  t.append(int(t_temp))
end = input()
print(sum(t[s.index(end)+1:]))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
t = []
for i in range(n):
  s_temp,t_temp = map(int,input().split())
  s.append(s_temp)
  t.append(t_temp)
end = input()
print(sum(t[s.index(end)+1:]))
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()
ans = 0
for i in range(n):
    if s[i:i+3] == "ABC":
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
ans = 0
for i in range(n):
    if s[i] == "A" and s[i + 1] == "B" and s[i + 2] == "C":
        ans += 1
print(ans)
Problem p02911 (python)

Fixed submission:
n,k,q = map(int,input().split())
points = [k-q]*n
for i in range(q):
    winner = int(input())
    points[winner - 1] += 1
for i in points:
    if i >0:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
n,k,q = map(int,input().split())
points = [int(input()) for _ in range(q)]
for i in range(q):
    winner = int(input())
    points[winner - 1] += 1
for i in points:
    if i >0:
        print("Yes")
    else:
        print("No")
Problem p02917 (python)

Fixed submission:
n = int(input())
b = list(map(int,input().split()))
ans = b[0] + b[-1]
for i in range(n-2):
  ans+=min(b[i],b[i+1])
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
b = list(map(in,input().split()))
ans = b[0] + b[-1]
for i in range(n-2):
  ans+=min(b[i],b[i-1])
print(ans)
Problem p02921 (python)

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

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
ans = 0
for i in range(3):
if s[i] == t[i]:
  ans += 1
print(ans)
Problem p02922 (python)

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

ans = 0
while num < b:
    num += a -1
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
num = 0
while num <b:
  a, b = map(int, input().split())
num = a
ans = 1
while num < b:
    num += a-1
    ans += 1
print(ans)
Problem p02923 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
ans = 0
for i in range(n):
  a.appen(int(input())
print(a)         n = int(input())
a = list(map(int,input().split()))
ans1 = 0
for i in range(n - 1):
    if a[i] >= a[i+1]:
        ans1 += 1
    else:
        ans1 = 0
print(ans1)
Problem p02927 (python)

Fixed submission:
m,d = map(int,input().split())
cnt = 0
for i in range(d+1):
  d10,d1 = i//10,i%10
  if d10 >= 2 and d1 >= 2 and d1 * d10 <= m:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
m,d = map(int,input().split())
cnt = 0
for i in range(d):
  temp = str(i)
  if int(temp[0]) >= 2 and int(temp[1]) >= 2 and int(temp[1]) * int(temp[1]) =< m:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
m,d = map(int,input().split())
cnt = 0
for i in range(d):
  temp = str(i)
  if int(temp[0]) >= 2 and int(temp[1]) >= 2 and int(temp[1]) * int(temp[1]) =< m:
    cnt += 1
Problem p02952 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(1,n+1):
  num = str(i)
  if (len(num) % 2) != 0:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1,n+1):
  if (len(i) % 2) != 0:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1,n+1):
  if len(i) % 2 != 0:
    ans += 1
print(ans)
Problem p02957 (python)

Fixed submission:
a,b = map(int,input().split())
if (a+b)/2 == (a+b)//2:
  print((a+b)//2)
else:
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if (a+b)//2 a,b = map(int,input().split())
if (a+b)/2 == (a+b)//2:
  print((a+b)//2)
else:
  print("IMPOSSIBLE")
Problem p02993 (python)

Fixed submission:
s = input()
for i in range(3):
  if s[i] == s[i+1]:
    print("Bad")
    exit()
print("Good")

Buggy submission (verdict: Runtime Error):
s = input()
for i in range(4):
  if s[i] != s[i+1]:
    print("Bad")
    exit()
print("Good")
Problem p02999 (python)

Fixed submission:
x,a = map(int,input().split())
if x<a:
  print("0")
else:
  print("10")

Buggy submission (verdict: Runtime Error):
x,a = map(int,input().split())
if x<a:
  print("0")
else:
  print("10!)
Problem p03000 (python)

Fixed submission:
n,x = map(int,input().split())
l = list(map(int,input().split()))
sum = 0
ans = 0
for i in l:
  sum += i
  if sum <= x:
    ans += 1
print(ans+1)

Buggy submission (verdict: Runtime Error):
n,x = map(int.input().split())
l = list(map(int,input().split()))
sum = 0
ans = 0
for i in l:
  sum += i
  if sum <= x:
    ans += 1
Problem p03029 (python)

Fixed submission:
a,p = map(int,input().split())
print((a*3+p)//2)

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

Fixed submission:
n,m = map(int,input().split())
l_max=1
r_min=10**5 
for i in range(m):
  l,r = map(int,input().split())
  l_max = max(l_max,l)
  r_min = min(r_min,r)
ans = r_min - l_max + 1
print(ans if ans >= 0 else 0 )

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l_max=0
r_min=n 
for i in range(n):
  l,r = map(int,input().split())
  l_max = max(l_max,l)
  r_min = min(r_min,r)
print(r_min - l_max)
Problem p03219 (python)

Fixed submission:
x,y = map(int,input().split())
print(x + y //2)

Buggy submission (verdict: Runtime Error):
x,y = map(int,input())
print(x + y //2)
Problem p03289 (python)

Fixed submission:
s = input()
ans = "AC"
if s[0] == "A":
  c_cnt = 0
  for i in range(2,len(s)-1):
    if s[i] == "C":
      c_cnt += 1
  if c_cnt == 1:
    for i in s:
      if i.lower() != "a" and i.lower() != "c" and i.lower() != i:
        ans = "WA"
        break
  else:
    ans = "WA"
else:
  ans = "WA"
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = "AC"
if s[0] == "A":
  c_cnt = 0
  for i in range(2,len(s)-1):
    if s[i] == "C":
      c_cnt += 1
  if c_cnt = 1:
    for i in s:
      if i.lower() != "a" and i.lower() != "c" and i.lower() != i:
        ans = "WA"
        break
  else:
    ans = "WA"
else:
  ans = "WA"
print(ans)
Problem p03471 (python)

Fixed submission:
n,y = map(int,input().split())
for i in range(n+1):
  for j in range(n+1):
    if (y - 1000*i - 5000*j)/10000 == n-i-j and n-i-j>=0:
      print(n-i-j,j,i)
      exit()
print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
n,y = map(int,input().split())
for i in range(n+1):
  for j in range(n+1):
    if (y - 1000*i - 5000*j)/10000 = n-i-j:
      print(i,j,n-i-j)
      exit()
print(-1,-1,-1)
Problem p03578 (python)

Fixed submission:
n = int(input())
D = list(map(int,input().split()))
m = int(input())
T = list(map(int,input().split()))

p = {}
for d in D:
    if d not in p:
        p[d] = 1
    else:
        p[d] += 1

for t in T:
    if t not in p:
        print('NO')
        exit()
    if p[t] == 0:
        print('NO')
        exit()
    p[t] -= 1
    
print('YES')

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))
p = {}
for j in d:
    if j not in p:
        p[j] = 1
    else:
        p[j] += 1
for i in t:
    if p[i] == 0 or i not in p:
        print("NO")
        exit()
    p[i] -= 1
print("YES")

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))
p = {}
for j in d:
    if j not in p:
        p[j] = 1
    else:
        p[j] += 1
for i in t:
    if p[i] == 0:
        print("NO")
        exit()
    p[i] -= 1
print("YES")

Buggy submission (verdict: Runtime Error):
n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))
lst = [0]*200001
for j in d:
    lst[j] += 1
for i in t:
    if lst[i] == 0:
        print("NO")
        exit()
    lst[i] -= 1
print("YES")
Problem p03627 (python)

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

cnt = collections.Counter(a)
l1 = 0
l2 = 0

for i in cnt.keys():
    if cnt[i] >= 4:
        l1 = i
        l2 = i
    elif cnt[i] >= 2:
        l1, l2 = i, l1
print(l1 * l2)

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

lst = [0] * max(a)

l1 = 0
l2 = 0

for i in range(n):
    lst[a[i] - 1] += 1
    temp = lst[a[i] - 1]
    if temp >= 4:
        l1 = a[i]
        l2 = a[i]
    elif l1 != a[i] and temp >= 2:
        l1, l2 = a[i], l1
print(l1 * l2)

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

lst = [0] * max(a)

l1 = 0
l2 = 0

for i in range(n):
    lst[a[i] - 1] += 1
    temp = lst[a[i] - 1]
    if temp >= 4:
        l1 = a[i]
        l2 = a[i]
    elif l1 != a[i] and temp >= 2:
        l1, l2 = a[i], l1
print(l1 * l2)
Problem p03795 (python)

Fixed submission:
n = int(input())
a,b = divmod(n,15)
print(n*800 - 200*a)

Buggy submission (verdict: Runtime Error):
n = int(input())
a,b = divmod(n,15)
print(n*800 - 200*a)n = int(input())
a,b = divmod(n,15)
print(n*800 - 200*a)
Problem p03813 (python)

Fixed submission:
x = int(input())

if x >= 1200:
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
    x = int(input())
     
    if x >= 1200:
      print("ARC")
    else:
      print("ABC")
Problem p03945 (python)

Fixed submission:
s = input()
ans = 0

for i in range(len(s)-1):
  if s[i] != s[i+1]:
    ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = 0

for i in range(len(s)-1):
  if s[i] != S[i+1]:
    ans += 1

print(ans)
Problem p03998 (python)

Fixed submission:
a = list(input())
b = list(input())
c = list(input())
next = a.pop(0)
while True:
  if next == "a":
    if a == []:
      print("A")
      break
    else:
      next = a.pop(0)
  elif next == "b":
    if b == []:
      print("B")
      break
    else:
      next = b.pop(0)
  else:
    if c == []:
      print("C")
      break
    else:
      next =c.pop(0)

Buggy submission (verdict: Runtime Error):
sa = list(input())
sb = list(input())
sc = list(input())
start  = sa.pop(0)

for i in range(399):
  if len(sa) == 0 and start == "a" :
    print("A")
    exit()
  if len(sb) == 0 and start == "b":
    print("B")
    exit()
  if len(sc) == 0 and start == "c":
    print("C")
    exit()
  if start == "a":
    start = sa.pop(0)
  if start == "b":
    start = sb.pop(0)
  if start == "c":
    start = sc.pop(0)

Buggy submission (verdict: Runtime Error):
sa = input()
sb = input()
sc = input()
start  = sa.pop(0)

for i in range(399):
  if len(sa) == 0 :
    print("A")
    exit()
  if len(sb) == 0:
    print("B")
    exit()
  if len(sc) == 0:
    print("C")
    exit()
  if start == "a":
    start = sa.pop(0)
  if start == "b":
    start = sb.pop(0)
  if start == "c":
    start = sc.pop(0)
Problem p02613 (python)

Fixed submission:
n = int(input())
ac = 0
wa = 0
tle = 0
re  = 0
for i in range(n):
  s = input()
  if s =="AC":
    ac += 1
  elif s == "WA":
    wa += 1
  elif s == "TLE":
    tle += 1
  elif s == "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):
wa = 0
tle = 0
re  = 0
for i in range(n):
  s = input()
  if s =="AC":
    ac += 1
  elif s == "WA":
    wa += 1
  elif s == "TLE":
    tle += 1
  elif s == "RE":
    re += 1
print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))
Problem p02748 (python)

Fixed submission:
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
z = [list(map(int, input().split())) for i in range(M)]

price = min(a) + min(b)

for e in z:
    tmp_price = a[e[0]-1] + b[e[1]-1] - e[2]

    if(price > tmp_price):
        price = tmp_price

print(price)

Buggy submission (verdict: Runtime Error):
a,b,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
cheap = min(a) + min(b)
for _ in range(m):
  x,y,c = map(int,input().split())
  cheap = min(a[x-1]+b[x-1]-c,cheap)
print(cheap)