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

Fixed submission:
N, M = map(int,input().split())
lst=[None]*M
for i in range(M):
    p, S=input().split()
    lst[i]=(int(p), S)

stop_set=set()

WA_count=0
AC_count=0
from collections import defaultdict
WA_dict = defaultdict(lambda: 0)

for el in lst:
    if not el[0] in stop_set:
        if el[1]=='AC':
            AC_count+=1
            stop_set.add(el[0])
        else:
            WA_dict[el[0]] +=1
#print(dict(WA_dict))

new_set=set(WA_dict.keys())&stop_set
#print(new_set)
WA_count=sum([WA_dict[i] for i in new_set])
print(AC_count, WA_count)

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
lst=[None]*M
for i in range(M):
    p, S=input().split()
    lst[i]=(int(p), S)

#print(N, M, lst)
#count AC
AC_count = 0
WA_count = 0
AC_check={}
for i in range(M-1,-1,-1):
    #print(i)
    if lst[i][1]=='AC':
        AC_check[lst[i][0]-1]=i
#print(AC_check)

AC_count=len(AC_check)

for i in range(1, N+1):
    if AC_check[i-1]!=None:
        #AC_count += 1
        WA_count+=lst[:AC_check[i-1]].count((i, 'WA'))

print(AC_count, WA_count)
Problem p02936 (python)

Fixed submission:
import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline

N, Q = map(int, input().split())
ab=[]
for _ in range(N-1):
    ab.append(tuple(map(int, input().split())))
px=[]
for _ in range(Q):
    px.append(tuple(map(int, input().split())))

cnt=[0]*(N+1)
for el in px:
    cnt[el[0]] += el[1]
#print(cnt)


lst=[[] for _ in range(N+1)]
for el in ab:
    lst[el[0]].append(el[1])
    lst[el[1]].append(el[0])
#print(lst)

seen = [False] * (N + 1)
def dfs(n):
    seen[n] = True
    for child in lst[n]:
        if seen[child] == False:
            cnt[child]+=cnt[n]
            dfs(child)

dfs(1)
#print(cnt)
print(' '.join(list(map(str, cnt[1:]))))

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
ab=[]
for _ in range(N-1):
    ab.append(tuple(map(int, input().split())))
px=[]
for _ in range(Q):
    px.append(tuple(map(int, input().split())))

cnt=[0]*(N+1)
for el in px:
    cnt[el[0]]+=el[1]
#print(cnt)

todo=[]
seen=[False]*(N+1)

lst=[[] for _ in range(N+1)]
for el in ab:
    lst[el[0]].append(el[1])
#print(lst)

def bfs(n):
    seen[n]=True
    for child in lst[n]:
        if seen[child]==False:
            cnt[child]+=cnt[n]
            todo.append(child)
    if todo:
        bfs(todo.pop(0))
    else:
        return None

bfs(1)
#print(cnt)
print(' '.join(list(map(str, cnt[1:]))))
Problem p02995 (python)

Fixed submission:
import fractions
A, B, C, D = map(int, input().split())

l=C*D//fractions.gcd(C,D)
underB = B- (B//C+B//D-B//l)
underA = (A-1)- ((A-1)//C+(A-1)//D-(A-1)//l)
#print(underB, underA)
print(underB-underA)

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

l=C*D//math.gcd(C,D)
underB = B- (B//C+B//D-B//l)
underA = (A-1)- ((A-1)//C+(A-1)//D-(A-1)//l)
#print(underB, underA)
print(underB-underA)

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
import math
l=C*D//math.gcd(C,D)
underB = B- (B//C+B//D-B//l)
underA = (A-1)- ((A-1)//C+(A-1)//D-(A-1)//l)
#print(underB, underA)
print(underB-underA)
Problem p03000 (python)

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

D=0
count=1
while D<=X and count<=N+1:
    if count != N+1:
       D=D+L[count-1] #count kaime no jump
    count+=1

print(count-1)

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

D=0
count=1
while D<=X and count<=N+1:
   D=D+L[count-1]
   count+=1

print(min(N+1, count-1))

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

D=0
count=1
while D<=X:
   D=D+L[count-1]
   count+=1

print(min(N+1, count-1))

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

D=0
count=1
while D<=X:
   D=D+L[count-1]
   count+=1
print(count-1)
Problem p03006 (python)

Fixed submission:
import copy
import math

N = int(input())
xy = []
for _ in range(N):
    xy.append(tuple(map(int, input().split())))

def dfs(parent, p, q):
    seen[parent] = True
    for child in range(N):
        # print(child)
        if seen[child] == False:
            x, y = xy[child]
            if x + p == xy[parent][0] and y + q == xy[parent][1] or \
                    x - p == xy[parent][0] and y - q == xy[parent][1]:
                dfs(child, p, q)


m = N
for i in range(N - 1):
    for j in range(i + 1, N):
        p = xy[i][0] - xy[j][0]
        q = xy[i][1] - xy[j][1]
        cnt = 0
        seen = [False] * N
        for start in range(N):
            if seen[start] == False:
                dfs(start, p, q)
                cnt += 1
                # print(tosee)
        m = min(cnt, m)
        # print(p, q, group)
print(m)

Buggy submission (verdict: Runtime Error):
import copy
import math

N = int(input())
xy = []
for _ in range(N):
    xy.append(tuple(map(int, input().split())))

def dfs(parent, p, q):
    tosee.remove(parent)
    group[-1].append(parent)
    for el in tosee:
        x, y = el
        if x + p == parent[0] and y + q == parent[1] or \
                x - p == parent[0] and y - q == parent[1]:
            dfs(el,p,q)

m = math.inf
for i in range(N - 1):
    for j in range(i + 1, N):
        p = xy[i][0] - xy[j][0]
        q = xy[i][1] - xy[j][1]

        group = []
        tosee = copy.copy(xy)
        while tosee:
            el = tosee[0]
            group.append([])
            dfs(el,p,q)
            # print(tosee)
        temp = len(group)
        m = min(temp, m)
        # print(p, q, group)
print(m)
Problem p03043 (python)

Fixed submission:
import math

N, K = map(int, input().split())

prob=0
for dice_num in range(1, N+1):
    if K>dice_num:
        pwr=math.ceil(math.log2(K/dice_num))
        prob+=(1/2)**pwr/N
    else:
        prob+=1/N
print(prob)

Buggy submission (verdict: Runtime Error):
import math

N, K = map(int, input().split())

prob=0
for dice_num in range(1, N+1):
    if K>dice_num:
        pwr=math.ceil(math.log2(K/dice_num))
        prob+=(1/2)**pwr/N
    else:
        prob+=1/N
print(prob)
Problem p03131 (python)

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

if B - A <= 2:
    print(K + 1)
else:
    time = max(0, (K - (A - 1)) // 2)
    ans = A + (B - A) * time
    if (K - (A - 1)) % 2 == 1:
        ans += 1
    print(ans)

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

dp = [0] * (K + 1)

dp[0] = 1
dp[1] = 2
for i in range(2, K + 1):
    dp[i] = max(dp[i - 1] + 1, (dp[i - 2] // A) * B + dp[i - 2] % A)
# print(dp)
print(dp[K])
Problem p03160 (python)

Fixed submission:
N = int(input())
h = list(map(int, input().split()))
import math
dp = [0] * N
dp[0] = 0
dp[1] = abs(h[1] -h[0])
if N >= 3:
    for i in range(2, N):
        dp[i] = min(dp[i - 1] + abs(h[i] -h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print(dp[N - 1])

Buggy submission (verdict: Runtime Error):
N = int(input())
h = list(map(int, input().split()))
import math
dp = [math.inf] * N
dp[0] = 0
dp[1] = abs(h[1] -h[0])
if N >= 3:
    for i in range(2, N):
        dp[i] = min(dp[i - 1] + abs(h[i] -h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print(dp[N - 1])
Problem p03163 (python)

Fixed submission:
N, W = map(int, input().split())
wv = []
for _ in range(N):
    wv.append(list(map(int, input().split())))
# print(wv)
dp = [[0] * 100100 for _ in range(110)]


for i in range(N):
    for sum_w in range(W + 1):

        if wv[i][0] <= sum_w:
            dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - wv[i][0]] + wv[i][1])

        dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w])
print(dp[N][W])

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
wv = []
for _ in range(N):
    wv.append(list(map(int, input().split())))
# print(wv)
dp = [[0] * 110 for _ in range(100100)]


for i in range(N):
    for sum_w in range(W + 1):

        if wv[i][0] <= sum_w:
            dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - wv[i][0]] + wv[i][1])

        dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w])
print(dp[N][W])

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
wv = []
for _ in range(N):
    wv.append(list(map(int, input().split())))
# print(wv)
dp = [[0] * 110 for _ in range(100100)]


for i in range(N):
    for sum_w in range(W + 1):

        if sum_w - wv[i][0] >= 0:
            dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - wv[i][0]] + wv[i][1])

        dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w])
print(dp[N][W])
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, M = map(int, input().split())

import math

divisor=[]
for i in range(1, math.ceil(math.sqrt(M))+1):
    if M%i==0:
        divisor.append(i)
#print(divisor)

divisor+=[M//val for val in reversed(divisor)]
#print(divisor)
for val in divisor:
    if val>=N:
        print(M//val)
        break
Problem p03240 (python)

Fixed submission:
N = int(input())
xyh=[]
for _ in range(N):
    xyh.append(tuple(map(int, input().split())))

def func():
    for Cx in range(0, 101):
        for Cy in range(0, 101):
            H=[el[2]+abs(el[0]-Cx)+abs(el[1]-Cy) for el in xyh if el[2]!=0]
            if H[0]>=1 and len(set(H))==1:
                temp=[H[0]-abs(el[0]-Cx)-abs(el[1]-Cy) for el in xyh if el[2]==0]
                for el in temp:
                    if el>0:
                        break
                else:
                    print(Cx, Cy, H[0])
                    return None
func()

Buggy submission (verdict: Runtime Error):
N = int(input())
xyh=[]
for _ in range(N):
    xyh.append(tuple(map(int, input().split())))

def func():
    for Cx in range(0, 101):
        for Cy in range(0, 101):
            H=[el[2]+abs(el[0]-Cx)+abs(el[1]-Cy) for el in xyh if el[2]!=0]
            if H>=1 and len(set(H))==1:
                temp=[H[0]-abs(el[0]-Cx)-abs(el[0]-Cy) for el in xyh if el[2]==0]
                for el in temp:
                    if el>0:
                        break
                else:
                    print(Cx, Cy, H[0])
                    return None
func()
Problem p03244 (python)

Fixed submission:
import collections

n = int(input())
v = list(map(int, input().split()))

even_num=[v[i] for i in range(0,n,2)]
odd_num=[v[i] for i in range(1,n,2)]

count_even=collections.Counter(even_num).most_common()
count_odd=collections.Counter(odd_num).most_common()

#count_even.append((0,0))
#count_odd.append((0,0))

if count_even[0][0] != count_odd[0][0]:
    print(n-count_even[0][1]-count_odd[0][1])
elif len(count_even)==1 and len(count_odd)==1:
    print(n//2)
elif len(count_even)==1:
    print(n-count_odd[1][1])
elif len(count_odd)==1:
    print(n-count_even[1][1])
else:
    odd_even=count_odd[0][1]+count_even[1][1]
    even_odd=count_even[0][1]+count_odd[1][1]
    if odd_even>even_odd:
        print(n-odd_even)
    else:
        print(n-even_odd)

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
v = list(map(int, input().split()))

even_num=[v[i] for i in range(0,n,2)]
odd_num=[v[i] for i in range(1,n,2)]

count_even=collections.Counter(even_num).most_common()
count_odd=collections.Counter(odd_num).most_common()

#count_even.append((0,0))
#count_odd.append((0,0))

if count_even[0][0] != count_odd[0][0]:
    print(n-count_even[0][1]-count_odd[0][1])
elif len(count_even)==1 and len(count_odd)==1:
    print(n//2)
elif len(count_even)==1:
    print(n-count_odd[1][1])
elif len(count_odd)==1:
    print(n-count_even[1][1])
else:
    odd_even=count_odd[0][1]+count_even[1][1]
    even_odd=count_even[0][1]+count_odd[1][1]
    if odd_even>even_odd:
        print(n-odd_num)
    else:
        print(n-even_odd)

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
v = list(map(int, input().split()))

even_num=[v[i] for i in range(0,n,2)]
odd_num=[v[i] for i in range(1,n,2)]

count_even=collections.Counter(even_num).most_common()
count_odd=collections.Counter(odd_num).most_common()

count_even.append((0,0))
count_odd.append((0,0))

if count_even[0][0]!=count_odd[0][0]:
    print(n-count_even[0][1]-count_odd[0][1])
else:
    odd_even=count_odd[0][1]+count_even[1][1]
    even_odd=count_even[0][1]+count_odd[1][1]
    if odd_even>even_odd:
        print(n-odd_num)
    else:
        print(n-even_odd)
Problem p03309 (python)

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

def func(b):
    return sum([abs(val - b) for val in I])

#y seppen wo motomeru

I=[A[i]-i-1 for i in range(N)]
I.sort()

if N % 2 ==1:
    print(func(I[N//2]))
else:
    print(func(I[N//2]))

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

def func(b):
    return sum([abs(val - b) for val in I])

#y seppen wo motomeru
import statistics
import math

I=[A[i]-i-1 for i in range(N)]

m=min(I)
M=max(I)

if N % 2 ==1:
    print(func(statistics.median(I)))
else:
    print(func(math.floor(statistics.median(I))))

'''
    for i in range(m, M+1):
        #print(i)
        temp=sum([abs(val-i) for val in I])
        if temp<opp:
            opp=temp
    print(opp)
'''
Problem p03354 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

N, M = map(int, input().split())
p = list(map(int, input().split()))
xy = []
for _ in range(M):
    xy.append(tuple(map(int, input().split())))
#print(xy)


G = [[] for _ in range(N+1)]
for el in xy:
    x, y = el
    G[x].append(y)
    G[y].append(x)


seen=[False] * (N+1)
def dfs(n):
    seen[n]=True
    group[-1].append(n)
    for child in G[n]:
        if seen[child] == False:
            dfs(child)

group=[]
for i in range(1,N+1):
    if seen[i] == False:
        group.append([])
        dfs(i)
        #print(seen)
#print(seen)
#print(group)

cnt = 0
for el in group:
    temp = set(el) & set([p[i-1] for i in el])
    cnt += len(temp)
print(cnt)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
p = list(map(int, input().split()))
xy = []
for _ in range(M):
    xy.append(tuple(map(int, input().split())))
#print(xy)


G = [[] for _ in range(N+1)]
for el in xy:
    x, y = el
    G[x].append(y)
    G[y].append(x)


seen=[False] * (N+1)
def dfs(n):
    seen[n]=True
    group[-1].append(n)
    for child in G[n]:
        if seen[child] == False:
            dfs(child)

group=[]
for i in range(1,N+1):
    if seen[i] == False:
        group.append([])
        dfs(i)
        #print(seen)
#print(seen)
#print(group)

cnt = 0
for el in group:
    temp = set(el) & set([p[i-1] for i in el])
    cnt += len(temp)
print(cnt)
Problem p03393 (python)

Fixed submission:
S = input()

if len(S) < 26:
    for c in [chr(i) for i in range(ord('a'), ord('a') + 26)]:
        # print(c)
        if c not in S:
            ans = S + c
            break
elif S == 'zyxwvutsrqponmlkjihgfedcba':
    ans = -1
else:
    for i in range(1, len(S)):
        j = - i
        if ord(S[j - 1]) < ord(S[j]):
            break
    # print(S[j:])
    change = 'z'
    for c in S[j:]:
        if ord(S[j - 1]) < ord(c) < ord(change):
            change = c
    ans = S[:j - 1] + change
print(ans)

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

if len(S) < 26:
    for c in [chr(i) for i in range(ord('a'), ord('a') + 26)]:
        # print(c)
        if c not in S:
            ans = S + c
            break
elif S == 'zyxwvutsrqponmlkjihgfedcba':
    ans = -1
else:
    for i in range(25, -1, -1):
        # print(S[i], S[-1])
        if ord(S[i]) < ord(S[-1]):
            ans = S[:i] + S[-1]
            break
print(ans)
Problem p03436 (python)

Fixed submission:
import sys
sys.setrecursionlimit(5000)

H, W = map(int, input().split())
s=[]
for row in range(H):
    s.append(input())
#print(s)



waiting=[]
dx=[1,0,-1,0]
dy=[0,1,0,-1]
def func(xy):
    x, y = xy
    for i in range(4):
        if 0<=y+dy[i]<H and 0<=x+dx[i]<W:
            if walker[y+dy[i]][x+dx[i]] == None and s[y+dy[i]][x+dx[i]]=='.':
                walker[y + dy[i]][x + dx[i]]=walker[y][x]+1
                waiting.append((x+dx[i], y+dy[i]))
    if waiting:
        func(waiting.pop(0))
    else:
        return None

walker=[]
for row in range(H):
    walker.append([None]*W)
#print(walker)
walker[0][0]=0
func((0,0))
#print(walker)
if walker[H-1][W-1] != None:
    minimum=walker[H-1][W-1]

    white_count=0
    for row in range(H):
        white_count += s[row].count('.')
    #print(white_count)
    print(white_count-minimum-1)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
s=[]
for row in range(H):
    s.append(input())
#print(s)



waiting=[]
dx=[1,0,-1,0]
dy=[0,1,0,-1]
def func(xy):
    x, y = xy
    for i in range(4):
        if 0<=y+dy[i]<H and 0<=x+dx[i]<W:
            if walker[y+dy[i]][x+dx[i]] == None and s[y+dy[i]][x+dx[i]]=='.':
                walker[y + dy[i]][x + dx[i]]=walker[y][x]+1
                waiting.append((x+dx[i], y+dy[i]))
    if waiting:
        func(waiting.pop(0))
    else:
        return None

walker=[]
for row in range(H):
    walker.append([None]*W)
#print(walker)
walker[0][0]=0
func((0,0))
#print(walker)
if walker[H-1][W-1] != None:
    minimum=walker[H-1][W-1]

    white_count=0
    for row in range(H):
        white_count += s[row].count('.')
    #print(white_count)
    print(white_count-minimum-1)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
s=[]
for row in range(H):
    s.append(input())
#print(s)



waiting=[]
dx=[1,0,-1,0]
dy=[0,1,0,-1]
def func(xy):
    x, y = xy
    for i in range(4):
        if 0<=y+dy[i]<H and 0<=x+dx[i]<W:
            if walker[y+dy[i]][x+dx[i]] == None and s[y+dy[i]][x+dx[i]]=='.':
                walker[y + dy[i]][x + dx[i]]=walker[y][x]+1
                waiting.append((x+dx[i], y+dy[i]))
    if waiting:
        func(waiting.pop(0))
    else:
        return None

walker=[]
for row in range(H):
    walker.append([None]*W)
#print(walker)
walker[0][0]=0
func((0,0))
#print(walker)
minimum=walker[H-1][W-1]

white_count=0
for row in range(H):
    white_count += s[row].count('.')
#print(white_count)
print(white_count-minimum-1)
Problem p03479 (python)

Fixed submission:
X, Y = map(int, input().split())

a=X
cnt=1
while a <= Y:
    a *= 2
    if a <= Y:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())
import math

print(1 + math.floor(math.log2(Y/X)))
Problem p03611 (python)

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

if max(a)<=1:
    print(N)
else:
    cnt=[0]*(max(a)+1)
    for val in a:
        cnt[val]+=1
    #print(cnt)

    tri=[cnt[i]+cnt[i+1]+cnt[i+2] for i in range(len(cnt)-2)]
    #print(tri)
    print(max(tri))

Buggy submission (verdict: Runtime Error):
N = int(input())
a=list(map(int, input().split()))
cnt=[0]*(max(a)+1)
for i in range(N):
    cnt[a[i]]+=1
#print(cnt)

tri=[cnt[i]+cnt[i+1]+cnt[i+2] for i in range(len(cnt)-2)]
#print(tri)
print(max(tri))
Problem p02681 (python)

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

if (T[:len(S)] == S) and (len(T) == len(S) + 1):
    print('Yes')
else:
    print('No')

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

if (T[:len(S)] == S) and (len(T) = len(S) + 1):
    print('Yes')
else:
    print('No')
Problem p02705 (python)

Fixed submission:
import math
R = int(input())
print(R*2*math.pi)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0]
A.extend(list(map(int, input().split())))

buka_num = []

for i in range(1,N):
    buka_num.append(A.count(i))
    
buka_num.append(0)
for ele in buka_num:
    print(ele)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0]
A.extend(list(map(int, input().split())))

buka_num = []

for i in range(1,N):
    #tmp_A = A[i:]
    buka_num.append(tmp_A.count(i))
    
buka_num.append(0)
for ele in buka_num:
    print(ele)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0]
A.extend(list(map(int, input().split())))

buka_num = []

for i in range(1,N):
    tmp_A = A[i:]
    buka_num.append(tmp_A.count(i))
    
buka_num.append(0)
print(buka_num, sep='\n')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0]
A.extend(list(map(int, input().split())))

buka_num = []

for i in range(1,N):
    tmp_A = A[i:]
    buka_num.append(tmp_A.count(i))
    
buka_num.append(0)
print(buka_num, sep='\n')

Buggy submission (verdict: Runtime Error):
mport math
R = int(input())
print(R*2*math.pi)

Buggy submission (verdict: Runtime Error):
mport math
R = int(input())
print(R*2*math.pi)
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            x = (a*500) + (b*100) + (c*50)
            if x == X:
                count += 1
print(count)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
X = input()
count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            x = (a*500) + (b*100) + (c*50)
            if x == X:
                count += 1
print(count)
Problem p02714 (python)

Fixed submission:
n=int(input())
str=input()
count=str.count("R")*str.count("G")*str.count("B")
count0=0
for i in range(0,n-2):
    for j in range(i+1,int((n+i-1)/2)+1):
        k=2*j-i
        if str[k]!=str[i] and str[k]!=str[j] and str[i]!=str[j]:
            count0=count0+1
print(count-count0)

Buggy submission (verdict: Runtime Error):
n=int(input())
str=input()
count=str.count("R")*str.count("G")*str.count("B")
count0=0
for i in range(0,n-2):
    for j in range(i+1,(n+i)/2):
        k=2*j-i
        if str[k]!=str[i] and str[k]!=str[j] and str[i]!=str[j]:
            count0=count0+1
print(count-count0)
Problem p03047 (python)

Fixed submission:
n,k=map(int,input().split())
print(n-k+1)

Buggy submission (verdict: Runtime Error):
n,k==map(int,input().split())
print(n-k+1)
Problem p03061 (python)

Fixed submission:
from fractions import gcd

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

l=[0]*(n)
for i in range(n-1):
    l[i+1] = gcd(l[i],a[i])

r=[0]*(n)
for i in range(n-2,-1,-1):
    r[i] = gcd(r[i+1],a[i+1])

print(max([gcd(r[i],l[i]) for i in range(n)]))

Buggy submission (verdict: Runtime Error):
import math

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

l=[0]*(n)
for i in range(n-1):
    l[i+1] = math.gcd(l[i],a[i])

r=[0]*(n)
for i in range(n-2,-1,-1):
    r[i] = math.gcd(r[i+1],a[i+1])

print(max([math.gcd(r[i],l[i]) for i in range(n)]))

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

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

l=[0]*(n)
for i in range(n-1):
    l[i+1] = gcd(l[i],a[i])

r=[0]*(n)
for i in range(n-2,-1,-1):
    r[i] = gcd(r[i+1],a[i+1])

print(max([gcd(r[i],l[i]) for i in range(n)]))

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

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

l=[0]*(n)
for i in range(n-1):
    l[i+1] = gcd(l[i],a[i])

r=[0]*(n)
for i in range(n-2,-1,-1):
    r[i] = gcd(r[i+1],a[i+1])

print(max([gcd(r[i],l[i]) for i in range(n)]))