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

Fixed submission:
from collections import deque
n, q = map(int,input().split())
d = [[] for i in range(n)]
for i in range(n-1):
    ai, bi = map(int,input().split())
    d[ai-1].append(bi-1)
    d[bi-1].append(ai-1)
#point
px = [0 for i in range(n)]
for i in range(q):
    pi,xi = map(int,input().split())
    px[pi-1] += xi
sp = [0 for i in range(n)]
s = deque()
s.append(0)
visited = [False for i in range(n)]
while len(s) > 0:
    x = s.popleft()
    visited[x] = True
    sp[x] += px[x]
    for xc in d[x]:
        if not visited[xc]:
            s.append(xc)
            sp[xc] += sp[x]
for i in range(n):
    print(sp[i])

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)
n, q = map(int,input().split())
d = {}
for i in range(n-1):
    ai, bi = map(int,input().split())
    if ai-1 in d:
        d[ai-1] += [bi-1]
    else:
        d[ai-1] = [bi-1]
    if bi-1 in d:
        d[bi-1] += [ai-1]
    else:
        d[bi-1] = [ai-1]
#point
px = {}
for i in range(q):
    pi,xi = map(int,input().split())
    if pi- 1 in px:
        px[pi-1] += xi
    else:
        px[pi-1] = xi
sp = [0 for i in range(n)]

def f(v,vp,p):
    su = p + px[v]
    sp[v] = su
    if v in d:
        for di in d[v]:
            if not di == vp:
                f(di,v,su)
f(0,0,0)
for i in range(n):
    print(sp[i])

Buggy submission (verdict: Runtime Error):
vimport sys
sys.setrecursionlimit(1000000)
n, q = map(int,input().split())
d = {}
for i in range(n-1):
    ai, bi = map(int,input().split())
    if ai-1 in d:
        d[ai-1] += [bi-1]
    else:
        d[ai-1] = [bi-1]
    if bi-1 in d:
        d[bi-1] += [ai-1]
    else:
        d[bi-1] = [ai-1]
#point
px = [0 for i in range(n)]
for i in range(q):
    pi,xi = map(int,input().split())
    px[pi-1] +=xi
sp = [0 for i in range(n)]

def f(v,vp,p):
    su = p + px[v]
    sp[v] = su
    for di in d[v]:
        if not di == vp:
            f(di,v,su)
f(0,0,0)
for i in range(n):
    print(sp[i])
Problem p02937 (python)

Fixed submission:
s = input()
ns = len(s)
x = {}
for i in range(len(s)):
    if s[i] in x:
        x[s[i]] += [i]
    else:
        x[s[i]] = [i]
t = input()
i = len(s)-1
count = 0
import bisect
for j in range(len(t)):
    if t[j] in x:
        ni = bisect.bisect_right(x[t[j]],i)
        if ni == len(x[t[j]]):
            i = x[t[j]][0]
            count += 1
        else:
            i = x[t[j]][ni]
    else:
        print(-1)
        exit()
    
print(len(s)*(count-1)+i+1)

Buggy submission (verdict: Runtime Error):
abc = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
s = input()
x = [0 for i in range(26)] for j in range(len(s))]
for k in range(2):
    for i in range(len(s)-1,-1,-1):
        if i == 0:
            ib = len(s)-1
        else:
            ib = i-1
        for j in range(26):
            if j == ord(s[i])-97:
                x[ib][j] = i
            else:
                x[ib][j] = x[i][j]
t = input()
i = len(s)-1
count = 0
for j in range(len(t)):
    nxt = x[i][ord(t[j])-97]
    if nxt == 0:
        print(-1)
        exit()
    elif nxt <= i:
        count += 1
        i = nxt
    else:
        i = nxt
print(len(s)*(count-1)+i+1)
Problem p02949 (python)

Fixed submission:
import sys


def input():
    return sys.stdin.readline()[:-1]


n, m, p = map(int, input().split())
edge0 = []
d = [[] for i in range(n)]
r = [[] for i in range(n)]
for i in range(m):
    ai, bi, ci = map(int, input().split())
    edge0.append((bi-1,ai-1,-ci+p))
    d[ai-1] += [bi-1]
    r[bi-1] += [ai-1]

p0 = [False for i in range(n)]
p0[0] = True
from collections import deque
q = deque([0])
while len(q)>0:
    x = q.popleft()
    for y in d[x]:
        if not p0[y]:
            p0[y] = True
            q.append(y)
pn = [False for i in range(n)]
pn[n-1] = True
q = deque([n-1])
while len(q) > 0:
    x = q.popleft()
    for y in r[x]:
        if not pn[y] and p0[y]:
            pn[y] = True
            q.append(y)

edge = []
for e in edge0:
    if pn[e[1]] and pn[e[0]]:
        edge += [e]


dist = [float("inf") for i in range(n)]
dist[n-1] = 0
h = False
for i in range(n):
    updated = False
    for e in edge:
        if dist[e[1]] > dist[e[0]] + e[2] and p0[e[1]] and p0[e[0]]:
            dist[e[1]] = dist[e[0]] + e[2]
            updated = True
    if not updated:
        break
else:
    h = True

if h:
    print(-1)
else:
    print(max(0, -dist[0]))

Buggy submission (verdict: Runtime Error):
n, m, p = map(int, input().split())
edge = []
for i in range(n):
    ai, bi, ci = map(int, input().split())
    edge.append((bi-1,ai-1,-ci+p))
dist = [float("inf") for i in range(n)]
dist[n-1] = 0
h = False
for i in range(n):
    updated = False
    for e in edge:
        if dist[e[1]] > dist[e[0]] + e[2]:
            dist[e[1]] = dist[e[0]] + e[2]
            updated = True
    if not updated:
        break
else:
    h = True

if h:
    print(-1)
else:
    print(max(0, -dist[0]))

Buggy submission (verdict: Runtime Error):
from collections import deque
n,m,p = map(int,input().split())
d = {}
cost = [[float("inf") for i in range(n)] for j in range(n)]
for i in range(n):
    ai,bi,ci = map(int, input().split())
    if not bi-1 in d:
        d[bi-1] = []
    d[bi-1] += [ai-1]
    cost[bi-1][ai-1] = min(cost[bi-1][ai-1], -(ci-p))
dist = [float("inf") for i in range(n)]
dist[n-1] = 0
h = False
for i in range(n):
    v = [True for j in range(n)]
    q = deque([n-1])
    v[n-1] = False
    while len(q) > 0:
        x = q.popleft()
        if x in d:
            for xi in d[x]:
                if dist[xi] > dist[x] + cost[x][xi]:
                    dist[xi] = dist[x] + cost[x][xi]
                    if v[xi]:
                        v[xi] = False
                        q.append(xi)
                    if i == n-1:
                        h = True
if h:
    print(-1)
else:
    print(max(0,-dist[0]))
Problem p02982 (python)

Fixed submission:
import math
n,d = map(int,input().split())
x = []
for i in range(0,n):
    x.append(list(map(int,input().split())))
def f(a,b):
    s = 0
    for l in range(0,d):
        s+=(a[l]-b[l])**2
    return math.sqrt(s)
count = 0
for j in range(0,n):
    for k in range(0,n):
        if not (j==k):
            if f(x[j],x[k])%1==0:
                count = count + 1

print(int(count/2))

Buggy submission (verdict: Runtime Error):
5 1
1
2
3
4
5
Problem p03211 (python)

Fixed submission:
s = input()
m = 1000
for i in range(0,len(s)-2):
    m = min(abs(int(s[i])*100+int(s[i+1])*10+int(s[i+2])-753),m)
print(m)

Buggy submission (verdict: Runtime Error):
s = input()
m = 1000
for i in range(0,len(s)-2):
    m = min(abs(s[i]*100+s[i+1]*10+s[i+2]-753),m)
print(m)
Problem p03240 (python)

Fixed submission:
n = int(input())
xyz = []
for i in range(n):
    xyz.append(list(map(int,input().split())))

for cx in range(101):
    for cy in range(101):
        mh = 10000000000
        h = []
        for i in range(n):
            x,y,z = xyz[i][0],xyz[i][1],xyz[i][2]
            if z == 0:
                mh = min(mh,abs(x-cx)+abs(y-cy))
            else:
                if len(h) == 0:
                    h.append(z+abs(x-cx)+abs(y-cy))
                else:
                    if h[0] != z+abs(x-cx)+abs(y-cy):
                        h = []
                        break
                    elif h[0]>mh:
                        h = []
                        break
            if len(h)>0 and h[0]>mh:
                h = []
                break
        if len(h) > 0:
            ans = str(cx)+" "+str(cy)+" "+str(h[0])
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
xyz = []
for i in range(n):
    xyz.append(list(map(int,input().split())))

for cx in range(101):
    for cy in range(101):
        mh = 10000000000
        h = []
        for i in range(n):
            x,y,z = xyz[i][0],xyz[i][1],xyz[i][2]
            if z == 0:
                mh = min(mh,abs(x-cx)+abs(y-cy))
            elif len(h) == 0:
                h.append(z+abs(x-cx)+abs(y-cy))
            
            if len(h)>0:
                if h[0] != z+abs(x-cx)+abs(y-cy):
                        h = []
                        break
                if h[0]>mh:
                    h = []
                    break
        if len(h) > 0:
            ans = str(cx)+" "+str(cy)+" "+str(h[0])
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
xyz = []
for i in range(n):
    xyz.append(list(map(int,input().split())))

for cx in range(101):
    for cy in range(101):
        mh = 1000000000
        h = []
        for i in range(n):
            x,y,z = xyz[i][0],xyz[i][1],xyz[i][2]
            if z == 0:
                mh = min(mh,abs(x-cx)+abs(y-cy))
            else:
                if len(h) == 0:
                    h.append(z+abs(x-cx)+abs(y-cy))
                else:
                    if h[0] != z+abs(x-cx)+abs(y-cy):
                        h = []
                        break
                    elif h[0]>mh:
                        h = []
                        break
        if len(h) > 0:
            ans = str(cx)+" "+str(cy)+" "+str(h[0])
print(ans)
Problem p03246 (python)

Fixed submission:
import collections
n = int(input())
v = list(map(int,input().split()))
l = []
r = []
for i in range(0,n//2):
    l.append(v[2*i])
    r.append(v[2*i+1])
       

lc = collections.Counter(l).most_common()
rc = collections.Counter(r).most_common()

if lc[0][0] == rc[0][0]:
    if len(lc)==1:
        print(n//2)
    else:
        print(n-max(lc[0][1]+rc[1][1],lc[1][1]+rc[0][1]))
else:
    print(n-lc[0][1]-rc[0][1])

Buggy submission (verdict: Runtime Error):
n = int(input())
v = list(map(int,input().split()))
l = []
r = []
for i in range(0,n//2):
    l.append(v[2*i])
    r.append(v[2*i+1])

lc = []
rc = []
vmax =max(max(l),max(r))
for i in range(1,vmax+1):
    lc.append([i, l.count(i)])
    rc.append([i, r.count(i)])
lc.sort(key=lambda x:x[1])
rc.sort(key=lambda x:x[1])
lc.reverse()
rc.reverse()
if lc[0][0] == rc[0][0]:
    if lc[0][1] == rc[0][1]:
        if lc[1][1] == rc[1][1]:
            print(n-lc[0][1]-rc[1][1])
        else:
            print(n-lc[0][1]-max(lc[1][1],rc[1][1]))
    else:
        print(n-max(lc[0][1]+rc[1][1],rc[0][1]+lc[1][1]))
else:
    print(n-lc[0][1]-rc[0][1])
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
ans = "1"
n1 = 100
for i in range(len(s)):
    if s[i] != "1":
        ans = s[i]
        n1 = i
        break
if k-1 >= n1:
    print(ans)
else:
    print("1")

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
ans = "1"
for i in range(100):
    if s[i] != "1":
        ans = s[i]
        break

print(ans)
Problem p03316 (python)

Fixed submission:
n = input()

s = 0
for i in range(len(n)):
    s+=int(n[i])
if int(n)%s==0:
    print("Yes")
else:
    print("No")

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

s = 0
for i in range(len(n)):
    s+=n[i]
if int(n)%s:
    print("Yes")
else:
    print("No")
Problem p03341 (python)

Fixed submission:
n = int(input())
import sys
sys.setrecursionlimit(1000000+1)
s = input()

ce = {}
#iより右に居て，東を向いている人の数
def counte(s,i):
    if i in ce:
        return ce[i]
    elif i == n-1:
        return 0
    else:
        ce[i] = counte(s,i+1) + s[i+1:i+2].count("E")
        return ce[i]

cw = {}
#iより←に居て，西を向いている人の数
def countw(s,i):
    if i in cw:
        return cw[i]
    elif i == 0:
        return 0
    else:
        cw[i] = countw(s,i-1) + s[i-1:i].count("W")
        return cw[i]

minew = n
for i in range(0,n):
    ew = counte(s,i)+countw(s,i)
    if ew < minew:
        minew = ew
print(minew)

Buggy submission (verdict: Runtime Error):
n = int(input())
import sys
sys.setrecursionlimit(100000+1)
s = input()

ce = {}
#iより右に居て，東を向いている人の数
def counte(s,i):
    if i in ce:
        return ce[i]
    elif i == n-1:
        return 0
    else:
        ce[i] = counte(s,i+1) + s[i+1:i+2].count("E")
        return ce[i]

cw = {}
#iより←に居て，西を向いている人の数
def countw(s,i):
    if i in cw:
        return cw[i]
    elif i == 0:
        return 0
    else:
        cw[i] = countw(s,i-1) + s[i-1:i].count("W")
        return cw[i]

minew = n
for i in range(0,n):
    ew = counte(s,i)+countw(s,i)
    if ew < minew:
        minew = ew
print(minew)

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

ce = {}
#iより右に居て，東を向いている人の数
def counte(s,i):
    if i in ce:
        return ce[i]
    elif i == n-1:
        return 0
    else:
        ce[i] = counte(s,i+1) + s[i+1:i+2].count("E")
        return ce[i]

cw = {}
#iより←に居て，西を向いている人の数
def countw(s,i):
    if i in cw:
        return cw[i]
    elif i == 0:
        return 0
    else:
        cw[i] = countw(s,i-1) + s[i-1:i].count("W")
        return cw[i]

minew = n
for i in range(0,n):
    ew = counte(s,i)+countw(s,i)
    if ew < minew:
        minew = ew
print(minew)
Problem p03379 (python)

Fixed submission:
import copy
n = int(input())
x = list(map(int,input().split()))
y = copy.copy(x)
y.sort()
m1 = y[n//2-1]
m2 = y[n//2]
for i in range(n):
    if m2 == m1:
        print(m1)
    else:
        if x[i]<m2:
            print(m2)
        if x[i]>m1:
            print(m1)

Buggy submission (verdict: Runtime Error):
from statistics import median
n = int(input())
x = list(map(int,input().split()))
i1 = x.index(max(x))
i2 = x.index(min(x))
m1 = median(x[0:i1]+x[i1+1:n])
m2 = median(x[0:i2]+x[i2+1:n])
for i in range(n):
    if m2 == m1:
        print(m1)
    else:
        if x[i]<m2:
            print(m2)
        if x[i]>m1:
            print(m1)
Problem p03471 (python)

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

ans = [-1,-1,-1]
for i in range(n,-1,-1):
    if i*10000 > y:
        continue
    else:
        yt = y-i*10000
        nt = n-i
        for j in range(min(yt//5000+1,nt+1)):
            yn = yt - j*5000
            nn = nt - j
            if nn*1000 == yn:
                ans = [i,j,nn]
                break
        if ans != [-1,-1,-1]:
            break
ans = map(str,ans)
a = " ".join(ans)
print(a)

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

ans = [-1,-1,-1]
for i in range(n,-1,-1):
    if i*10000 > y:
        continue
    else:
        yt = y-i*10000
        nt = n-i
        for j in range(min(yt//5000+1,nt+1)):
            yn = yt - j*5000
            nn = nt - j
            if nn*1000 == yn:
                ans = [i,j,nn]
                break
        if ans != [-1,-1,-1]:
            break
print(" ".join(ans))
Problem p03814 (python)

Fixed submission:
s = input()
start = len(s)
end = len(s)

for i in range(len(s)):
    if s[i] == "A":
        start = min(start,i)
    if s[len(s)-1-i] == "Z":
        end = min(end,i)

print(len(s)-start-end)

Buggy submission (verdict: Runtime Error):
s = input()
start = len(s)
end = 0

for i in range(s):
    if s[i] == "A":
        start = min(start,i)
    if s[len(s)-1-i] == "Z":
        end = max(end,i)

print(len(s)-start-end)
Problem p03854 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10000000)
x = input()
n = len(x)
ans = "NO"

def f(i):
    if n==i:
        global ans
        ans = "YES"
    else:
        if x[i:i+5] == "dream":
            f(i+5)
        if x[i:i+7] == "dreamer":
            f(i+7)
        if x[i:i+5] == "erase":
            f(i+5)
        if x[i:i+6] == "eraser":
            f(i+6)
f(0)
print(ans)

Buggy submission (verdict: Runtime Error):
x = input()
n = len(x)
ans = "NO"

def f(i):
    if n==i:
        global ans
        ans = "YES"
    else:
        if x[i:i+5] == "dream":
            f(i+5)
        if x[i:i+7] == "dreamer":
            f(i+7)
        if x[i:i+5] == "erase":
            f(i+5)
        if x[i:i+6] == "eraser":
            f(i+6)
f(0)
print(ans)

Buggy submission (verdict: Runtime Error):
x = input()
n = len(x)
ans = "NO"

def f(i):
    if n==i:
        global ans
        ans = "YES"
    else:
        if x[i:i+5] == "dream":
            f(i+5)
        if x[i:i+7] == "dreamer":
            f(i+7)
        if x[i:i+5] == "erase":
            f(i+5)
        if x[i:i+6] == "eraser":
            f(i+6)
f(0)
print(ans)
Problem p03951 (python)

Fixed submission:
n=int(input())
s=input()
t=input()
count=0
for i in range(n):
  if s[n-1-i:n]==t[0:i+1]:
    count=i+1
print(n+n-count)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
t=input()
count=0
for i in range(n):
  if s[n-1-i:n]==t[0:i+1]:
    count+=i+1
    break
print(2×n-count)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
t=input()
count=0
for i in range(n):
  if s[n-1-i]==t[i]:
    count+=1
  else:
    break
print(2×n-count)
Problem p02687 (python)

Fixed submission:
s = input()
print('ARC' if s == 'ABC' else 'ABC')

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

if S == ABC:
    print('ARC')
else:
    print('ABC')

Buggy submission (verdict: Runtime Error):
if S = 'ABC':
    print('ARC')
else:
    print('ABC')
Problem p02885 (python)

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

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split(''))
if A - B * 2 > 0:
    print(A - B * 2)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split)
if A - B * 2 > 0:
    print(A - B * 2)
else:
    print(0)
Problem p03085 (python)

Fixed submission:
b = input()
print("A" if b == "T" else "T" if b == "A" else
      "C" if b == "G" else "G")

Buggy submission (verdict: Runtime Error):
b = int(input())
print("A" if b == "T" else "T" if b == "A" else
      "C" if b == "G" else "G")

Buggy submission (verdict: Runtime Error):
b = int(input())
print("A" if b == "T" else "T" if b == "A" else
      "C" if b == "G" else "T")

Buggy submission (verdict: Runtime Error):
b = int(input())
print("A" if b == T else "T" if b == A else
      "C" if b == G else "T")
Problem p03573 (python)

Fixed submission:
A, B, C = map(int, input().split())
print(A if B == C else B if A == C else C)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input(),split())
print(A if B == C else B if A == C else C)
Problem p02613 (python)

Fixed submission:
rmap = {
  "AC": 0,
  "WA": 0,
  "TLE": 0,
  "RE": 0,
}

output_order = ["AC", "WA", "TLE", "RE"]

N = int(input())
for _ in range(N):
  rmap[input()] += 1

for k in output_order:
  print("{} x {}".format(k, rmap[k]))

Buggy submission (verdict: Runtime Error):
rmap = {
  "AC": 0,
  "WA": 0,
  "TLE": 0,
  "RE": 0,
}

output_order = ["AC", "WA", "TLE", "RE"]

N - int(input())
for _ in range(N):
  rmap[input()] += 1

for k in output_order:
  print("{} x {}".format(k, rmap[k]))
Problem p02612 (python)

Fixed submission:
N = int(input())
N = N % 1000
ans = 1000 - N if N else 0
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
N = N%1000
ans = 1000 - N if not N else 0
print(ans)
Problem p02806 (python)

Fixed submission:
N = int(input())

songs = []
result = 0

for i in range(N):
    songs.append(input().split())

X = input()
point = len(songs)

for j in range(N):
    if songs[j][0] == X:
        point = j+1
        break

for i in range(point, N):
    result += int(songs[i][1])


print(result)

Buggy submission (verdict: Runtime Error):
N = int(input())
i = 0
songs = []
result = 0

while N-i:
  songs.append(input().split())
  i+=1
X = input()
point = len(songs)

for i in range(N):
  if songs[0]==X:
    point = i+1
    break

for i in range(point:N):
  result += songs[1]

print(result)
Problem p02921 (python)

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

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

allList = []
days = 0

while len(allList) < N:
    allList.append(list(map(int, input().split())))

sum = 100

while sum > 0:
    toBePopped = []
    for i in range(N):
        if allList[i] and i+1 == allList[allList[i][0]-1][0]:
            toBePopped.append(i)
            toBePopped.append(allList[i][0]-1)
    if len(toBePopped) == 0:
        days = -1
        break
    days += 1
    for i in set(toBePopped):
        allList[i].pop(0)

    sum = 0
    for i in range(N):
        sum += len(allList[i])

print(days)
Problem p02924 (python)

Fixed submission:
N = int(input())
max = 0


print((N-1)*N//2)

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

init = list(range(1, N+1))
all = []
hashtable = {}
tempSum = 0


def helper(input):
    global tempSum, max
    if len(input) == N:
        # print(input)
        if tempSum > max:
            max = tempSum
        return

    for i in range(1, N+1):
        if i not in input:
            input.append(i)
            tempSum += len(input) % i
            # print(tempSum, len(input), i)
            helper(input)
            input.pop()
            tempSum -= len(input) % i


list = []
helper(list)

print(max)

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

init = list(range(1, N+1))
all = []


def helper(input):
    if len(input) == N:
        all.append([i for i in list])
        return

    for i in range(1, N+1):
        if i not in input:
            input.append(i)
            helper(input)
            input.pop()


list = []
helper(list)

for i in all:
    sum = 0
    for j in range(N):
        sum += i[j] % (j+1)
    if sum > max:
        max = sum

print(max)
Problem p02909 (python)

Fixed submission:
s = input()

weather = ["Sunny", "Cloudy", "Rainy"]
print(weather[(weather.index(s) + 1) % 3])

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

weather = ["Sunny", "Cloudy", "Rainy"]
print(weather[weather.index(s) + 1])
Problem p02999 (python)

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

if x < a:
    print(0)
else:
    print(10)

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

x = 0
cnt = 0
for l in L:
    x += l
    if x > X:
        break
    else:
        cnt += 1

print(cnt+1)
Problem p03086 (python)

Fixed submission:
import re

S = input()

m = re.findall(r"[ACGT]+", S)
if m:
    print(max(map(len, m)))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import re

S = input()

m = re.search(r"[ACGT]+", S)
print(len(m.group()))
Problem p03238 (python)

Fixed submission:
n = int(input())

if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a + b)

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

c_min = 1001
t_ = None
for _ in range(N):
    c, t = map(int, input().split())
    if T >= t and c_min > c:
        c_min = c
        t_ = t
if t_ == None:
    print("TLE")
else:
    print(c_min)
Problem p03447 (python)

Fixed submission:
x = int(input())
a = int(input())
b = int(input())

x -= a
x %= b
print(x)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
a = 0
b = 0

for i in range(min(C, int(X/500)) + 1):
    a = X - 500 * i
    for j in range(min(B, int(a/100)) + 1):
        b = a - 100 * j
        if int(b/50) <= C:
            count += 1
        else:
            pass

print(count)
Problem p03563 (python)

Fixed submission:
r = int(input())
g = int(input())
x = g * 2 - r

print(x)

Buggy submission (verdict: Runtime Error):
r, g = map(int, input().split())
x = g * 2 - r

print(x)
Problem p03573 (python)

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

if a == b:
    print(c)
elif b == c:
    print(a)
else:
    print(b)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
area = []
for i in range(H):
  area.append(input())

for i in range(H):
  for j in range(W):
    if area[i][j] == '#':
      print('#', end='')
    else:
      count = 0
      for k in range(max(0, i-1), min(i+1, H-1)+1):
        for l in range(max(0, j-1), min(j+1, W-1)+1):
          if area[k][l] == '#':
            count += 1
      print(count, end='')
  print()
Problem p03730 (python)

Fixed submission:
import fractions

A, B, C = map(int, input().split())

gcd = fractions.gcd(A, B)
if C % gcd == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import math

A, B, C = map(int, input().split())

gcd = math.gcd(A, B)
if C % gcd == 0:
    print("YES")
else:
    print("NO")