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

Fixed submission:
N,X=(int(i) for i in input().split())
x = [int(i) for i in input().split()]
x.append(X)
x.sort()
b=[]
for i in range(N):
    c=x[i+1]-x[i]
    b.append(c)

def zako(m,n):
    s=max(m,n)
    t=min(m,n)
    while s%t!=0:
        ss =s%t
        s=t
        t=ss
    else:
        return t
dodo=b[0]
for j in range(N-1):
    bobo = zako(b[j+1],dodo)
    dodo = bobo
print(dodo)

Buggy submission (verdict: Runtime Error):
import math
N,X=(int(i) for i in input().split())
x = [int(i) for i in input().split()]
x.append(X)
x.sort()
b=[]
for i in range(N):
    c=x[i+1]-x[i]
    b.append(c)
values = [290021904, 927964716, 826824516, 817140688]
def gcd_all(list):
    return gcd_all([math.gcd(*list[:2])] + list[2:]) if len(list) > 1 else list[0]
gcd = gcd_all(b)
print(gcd)
Problem p03280 (python)

Fixed submission:
A,B=(int(i) for i in input().split())
print(A*B-A-B+1)

Buggy submission (verdict: Runtime Error):
N=int(input())
if N < 105:
    print(0)
elif 105 <= N and N < 135:
    print(1)
elif 135 <= N and N < 165:
    print(2)
elif 165 <= N and N < 189:
    print(3)
elif 189 <= N :
    print(4)
Problem p03282 (python)

Fixed submission:
S=str(input())
K=int(input())
b=0
for i in range(K):
    if S[i]!="1":
        print(S[i])
        b=3
        break

if b!=3:
    print(S[K-1])

Buggy submission (verdict: Runtime Error):
S=str(input())
K=int(input())
if S[0]!="1":
    print(S[0])
elif S[1]!="1":
    print(S[1])
elif S[2]!="1":
    print(S[2])
elif S[3]!="1":
    print(S[3])
else:
    print(S[4])
Problem p03284 (python)

Fixed submission:
N,K=(int(i) for i in input().split())
if N%K == 0:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = N//7
AA = [(N-7*i)%4 for i in range(a+1)]
if 0 in AA:
    print("Yes")
else:
    print("No")
Problem p03324 (python)

Fixed submission:
D,N=(int(i) for i in input().split())

if N != 100:
    print(100**D*N)
else:
    print(100**D*101)

Buggy submission (verdict: Runtime Error):
D,N=(int(i) for i in input().split())

if N != 100
    print(100**D*N)
else:
    print(100**D*101)
Problem p03328 (python)

Fixed submission:
a,b=(int(i) for i in input().split())
c = b - a
zako = 0
for d in range(c):
    zako += d + 1
print(zako-b)

Buggy submission (verdict: Runtime Error):
a,b=(int(i) for i in input().split())
c = b-a

for s in range(c):
    sum += s+1

print(sum-b)
Problem p03337 (python)

Fixed submission:
a,b=(int(i) for i in input().split())
print(max(a+b,a-b,a*b))

Buggy submission (verdict: Runtime Error):
a,b=(int(i) for i in input().split())
peint(max(a+b,a-b,a*b))
Problem p03338 (python)

Fixed submission:
N = int(input())
S = str(input())
ans=0
for i in range(N):
    X = S[:i]
    Y = S[i:]
    Z = set(X) & set(Y)
    if len(Z) > ans :
        ans = len(Z)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = str(input())
ans=0
for i in range(1:N-1):
    X = S[:i]
    Y = S[i:]
    Z = set(X) & set(Y)
    if len(Z) > ans :
        ans = len(Z)
print(ans)
Problem p03351 (python)

Fixed submission:
a,b,c,d=(int(i) for i in input().split())

if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d) :
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=(int(i) for i in input().split())

if abs(a-c) =< d or (abs(a-b) =< d and abs(b-c) =< d) :
    print("Yes")
else:
    print("No")
Problem p03385 (python)

Fixed submission:
S = str(input())

if "a" in S and "b" in S and "c" in S:
  	print("Yes")
else :
	print("No")

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

if "a" in S and "b" in S and "c" in S:
  	print("Yes")
else ;
	print("No")
Problem p03729 (python)

Fixed submission:
A,B,C=(i for i in input().split())
if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
N,T=(int(i) for i in input().split())
t = [int(i) for i in input().split()]
a=0
for b in range(N-1):
    if (t[b+1] - t[b]) < T:
        a = a + t[b+1] - t[b]
    else:
        a = a + T
a = a+T
print(a)

Buggy submission (verdict: Runtime Error):
A = list(input())
B = list(input())
C = list(input())
if A[-1]==B[0] and B[-1]==C[0]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A = list(input())
B = list(input())
C = list(input())
if condition:A[-1]=B[0]
    if condition:B[-1]=c[0]
        if condition:C[-1]=A[0]
            print("Yes")
        else:
            print("No")
    else:print("No")
        pass
else:
    print("No")
Problem p03730 (python)

Fixed submission:
A,B,C=(int(i) for i in input().split())
AA = [A*(i+1)%B for i in range(B)]
if C in AA:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
A,B,C=(int(i) for i in input().split())

if (C-A%B)%((2*A)%B))-(A%B)==0:
    print(YES)
else:
    print(NO)
Problem p03731 (python)

Fixed submission:
N,T=(int(i) for i in input().split())
t = [int(i) for i in input().split()]
a=0
for b in range(N-1):
    if (t[b+1] - t[b]) < T:
        a = a + t[b+1] - t[b]
    else:
        a = a + T
a = a+T
print(a)

Buggy submission (verdict: Runtime Error):
N,T=(i for i in input().split())
t = [int(i) for i in input().split()]
a=0
for b in range(N):
    if t[b] < T
        a = a + t[b]
    else:
        a = a + T

print(a)
Problem p03369 (python)

Fixed submission:

S = input()
checker = 0

for i in list(S):
    if i == 'o':
        checker += 1
sum = 700 + 100 * checker
print(sum)

Buggy submission (verdict: Runtime Error):
S = input()
checker = 0
for i in S:
    if i == o:
        checker += 1
sum = 700 + 100 * checker
print(sum)
Problem p03386 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np
inputs = input().split()
A = int(inputs[0])
B = int(inputs[1])
K = int(inputs[2])


if A + K < B - K:
    candidates = np.concatenate([np.arange(A, A + K), np.arange(B - K + 1, B + 1)])
else:
    candidates = np.arange(A, B + 1)
    candidates = candidates[np.logical_or(candidates < A + K, candidates > B - K)]

for s in candidates:
    print(s)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
inputs = input().split()
A = int(inputs[0])
B = int(inputs[1])
K = int(inputs[2])


if A + K < B - K:
    candidates = np.concatenate(np.arange(A, A + K + 1), np.arange(B - K, B + 1))
else:
    candidates = np.arange(A, B + 1)
    candidates = candidates[np.logical_or(candidates < A + K, candidates > B - K)]

for s in np.sort(candidates):
    print(s)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
inputs = input().split()
A = int(inputs[0])
B = int(inputs[1])
K = int(inputs[2])


if A + K < B - K:
    candidates = np.concatenate(np.arange(A, A + K), np.arange(B - K, B))
else:
    candidates = np.arange(A, B + 1)
    candidates = candidates[np.logical_or(candidates < A + K, candidates > B - K)]

for s in np.sort(candidates):
    print(s)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
inputs = input().split()
A = int(inputs[0])
B = int(inputs[1])
K = int(inputs[2])

candidates = np.arange(A, B + 1)
candidates = candidates[np.logical_or(candidates < A + K, candidates > B - K)]

for s in np.sort(candidates):
    print(s)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
inputs = input().split()
A = int(inputs[0])
B = int(inputs[1])
K = int(inputs[2])

candidates = np.arange(A, B + 1)
candidates = candidates[np.logical_or(candidates < A + K, candidates > B - K)]

for s in candidates:
    print(s)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
inputs = input().split()
A = int(inputs[0])
B = int(inputs[1])
K = int(inputs[2])

candidates = np.arange(A, B + 1)
candidates = candidates[np.logical_or(candidates < A + K, candidates > B - K)]

print(candidates)
Problem p03214 (python)

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

k = 0
ans = 0
for i in range(N):
    k += a[i]
find = k/N
now = 1000000
for i in range(N):
    if abs(a[i]-find) < now - 0.00001:
        ans = i
        now = abs(a[i]-find)
print(ans)

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

k = 0
ans = 0
for i in range(N):
    k += a[i]
find = k/N
now = 1000000
for i in range(N):
    if abs(a[i]-find) < now - 0.00001:
        ans = i
        now = abs(a[i]-find)
print(ans)
Problem p03231 (python)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

N,M = map(int,input().split())
S = input()
T = input()
k = gcd(N,M)
n = N//k
m = M//k
flg = False
for i in range(k):
    if S[n*i] != T[m*i]:
        flg = True
if flg:
    print(-1)
else:
    print(N*m)

Buggy submission (verdict: Runtime Error):
from math import gcd
N,M = map(int,input().split())
S = input()
T = input()
k = gcd(N,M)
n = N//k
m = M//k
flg = False
for i in range(k):
    if S[n*i] != T[m*i]:
        flg = True
if flg:
    print(-1)
else:
    print(N*m)
Problem p03239 (python)

Fixed submission:
n,t = map(int,input().split())
data=[]

for i in range(n):
    data.append(list(map(int,input().split())))
    
data.sort(key=lambda x:x[1])

pos = len(data)
for i in range(len(data)):
    if data[i][1] >t:
        pos = i
        break
        
if pos==0:
    print('TLE')
else:
    new = data[:pos]
    new.sort(key=lambda x:x[0])
    print(new[0][0])

Buggy submission (verdict: Runtime Error):
n,t = map(int,input().split())
data=[]

for i in range(n):
    data.append(list(map(int,input().split())))
    
data.sort(key=lambda x:x[1])

pos = 0
for i in range(len(data)):
    if data[i][1] >t:
        pos = i-1
        break
        
if pos==-1:
    print('TLE')
else:
    new = data[:pos]
    new.sort(key=lambda x:x[0])
    print(new[0][0])

Buggy submission (verdict: Runtime Error):
n,t = map(int,input().split())
data=[]

for i in range(n):
    data.append(list(map(int,input().split())))
    
data.sort(key=lambda x:x[1])

pos = 0
for i in range(len(data)):
    if data[i][1] >t:
        pos = i-1
        
if pos==-1:
    print('TLE')
else:
    new = data[:pos]
    new.sort(key=lambda x:x[0])
    print(new[0][0])
Problem p03320 (python)

Fixed submission:
K = int(input())
al = []

def sums(i):
    s = 0
    old = i
    while i>0:
        s += i%10
        i = i//10
    return (s,old)

for i in range(1,1000):
    al.append(sums(i))
for j in range(4,16):
    for k in range(100,1000):
        al.append(sums(k*(10**(j-3))+10**(j-3)-1))
anslist = []
al.reverse()
maxs,maxi = sums(10**15)
for j in al:
    if maxs*j[1] <= maxi*j[0]:
        anslist.append(j[1])
        maxs = j[0]
        maxi = j[1]
anslist.reverse()

for i in range(K):
    print(anslist[i])

Buggy submission (verdict: Runtime Error):
K = int(input())
maxnum = 10**20
al = []

def sunuke(i):
    s = 0
    old = i
    while i>0:
        s += i%10
        i = i//10
    return [old/s,old]

for i in range(1,100):
    al.append(sunuke(i))
for j in range(3,16):
    for k in range(10,100):
        al.append(sunuke(k*(10**(j-2))+10**(j-2)-1))
anslist = []
al.reverse()
for j in al:
    if j[0]<=maxnum:
        anslist.append(j[1])
        maxnum = j[0]
anslist.reverse()

for i in range(K):
    print(anslist[i])
Problem p03411 (python)

Fixed submission:
n = int(input())

red = []
blue = []
ed = []
for i in range(n):
    red.append(list(map(int,input().split())))
for i in range(n):
    blue.append(list(map(int,input().split())))

inf = 10**30

node = n*2+2

for i in range(1,n+1):
    ed.append([0,i,1])
    ed.append([n+i,2*n+1,1])
    
for i in range(n):
    for j in range(n):
        if red[i][0]<blue[j][0] and red[i][1]<blue[j][1]:
            ed.append([i+1,j+n+1,1])
    


edge = len(ed)
start = 0
goal = 2*n+1

"""
limit = [[0 for i in range(node)] for j in range(node)]
for i in edge:
    limit[i[0]][i[1]] += i[2]
"""

limit = [[] for i in range(node)]
for i in ed:
    limit[i[0]].append([i[1],i[2]])
    limit[i[1]].append([i[0],0])

ans = 0
while True:
    used = [False for i in range(node)]
    used[start] = True
    stack = [start]
    pre = [False for i in range(node)] # posの前
    pcos = [inf for i in range(node)] # posまでのコスト
    flg = False
    while stack:
        # print(stack)
        pos = stack.pop()
        for e in limit[pos]:
            if e[1] != 0 and (not used[e[0]]):
                pre[e[0]]=pos
                pcos[e[0]]=e[1]
                stack.append(e[0])
                used[e[0]]=True
                if e[0]==goal:
                    stack = []
                    flg = True
    if flg==False:
        print(ans)
        break
    pos = goal
    root = []
    minicost = inf
    while pos != start:
        root.append(pos)
        minicost = min(minicost,pcos[pos])
        pos = pre[pos]
    root.append(start)
    root.reverse()
    ans += minicost
    for i in range(len(root)-1):
        for j in range(len(limit[root[i]])):
            if limit[root[i]][j][0]==root[i+1]:
                limit[root[i]][j] = [root[i+1],limit[root[i]][j][1]-minicost]
        for j in range(len(limit[root[i+1]])):
            if limit[root[i+1]][j][0] == root[i]:
                limit[root[i+1]][j] = [root[i],limit[root[i+1]][j][1]+minicost]

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

red = []
blue = []
ed = []
for i in range(n):
    red.append(list(map(int,input().split())))
for i in range(n):
    blue.append(list(map(int,input().split())))


node = n*2
    
for i in range(n):
    for j in range(n):
        if red[i][0]<blue[j][0] and red[i][1]<blue[j][1]:
            ed.append([i,j+n])
            
import random
import numpy as np

node = n

edge = ed

def tutte():
    tut = np.zeros((node,node))
    for e in edge:
        x = random.random()
        tut[e[0]][e[1]]=x
        tut[e[1]][e[0]]=-x
    return tut



times = 11
rank = []
for i in range(times):
    rank.append(np.linalg.matrix_rank(tutte()))
rank.sort()
ans = rank[times//2]//2

print(ans)
Problem p03722 (python)

Fixed submission:
inf = int(1e20)
node,edge = map(int,input().split())
ed = []
for i in range(edge):
    e = list(map(int,input().split()))
    ed.append((e[0]-1,e[1]-1,-e[2]))
start = 0
goal = node-1



d = [inf for i in range(node)]
pre = [inf for i in range(node)]
d[start] = 0

for i in range(node):
    update = False
    for e in ed:
        if d[e[0]] != inf and d[e[1]]>d[e[0]]+e[2]:
            d[e[1]] = d[e[0]]+e[2]
            update = True
            pre[e[1]] = e[0]
    if update==False:
        print(-d[goal])
        break
else:
    nowcos = d[goal]
    for i in range(node):
        for e in ed:
            if d[e[0]] != inf and d[e[1]]>d[e[0]]+e[2]:
                d[e[1]] = d[e[0]]+e[2]
                pre[e[1]] = e[0]
    if nowcos != d[goal]:
        print('inf')
    else:
        print(-d[goal])

Buggy submission (verdict: Runtime Error):
inf = int(1e20)
node,edge = map(int,input().split())
ed = []
for e in range(edge):
    ed.append(e[0]-1,e[1]-1,-e[2])
start = 0
goal = node-1



d = [inf for i in range(node)]
pre = [inf for i in range(node)]
d[start] = 0

for i in range(node):
    update = False
    for e in ed:
        if d[e[0]] != inf and d[e[1]]>d[e[0]]+e[2]:
            d[e[1]] = d[e[0]]+e[2]
            update = True
            pre[e[1]] = e[0]
    if update==False:
        print(-d[goal])
        break
else:
    nowcos = d[goal]
    for i in range(node):
        for e in ed:
            if d[e[0]] != inf and d[e[1]]>d[e[0]]+e[2]:
                d[e[1]] = d[e[0]]+e[2]
                pre[e[1]] = e[0]
    if nowcos != d[goal]:
        print('inf')
    else:
        print(-d[goal])
Problem p03200 (python)

Fixed submission:
osero = input();
len = len(osero);
con_b = 0;
con = 0;
for i in range(0,len):
	if osero[i]=='B':
		con_b = con_b + 1;
	if osero[i] =='W':
		con = con + con_b;
print(con)

Buggy submission (verdict: Runtime Error):
osero = input();
len = len(osero);
con_b = 0;
con = 0;
for(i =0; i<len, i++) {
	if(osero[i]='B') {
		con_b++;
	}
	if(osero[i] ='W') {
		con = con + con_b;
	}
}
print(con)
Problem p03200 (python)

Fixed submission:
import numpy as np
s = np.array(list(input()))
#Bの場所
ind = np.array(np.where(s=='B'))
#文字列の長さ
len_ind=ind.shape[1]
#Bの個数
len=s.shape[0]
#Bの移動先
dist=np.arange(len-len_ind,len)
#答え
ans=np.sum(dist-ind)
print(ans)

Buggy submission (verdict: Runtime Error):
#import numpy as np
s = np.array(list(input()))
#Bの場所
ind = np.array(np.where(s=='B'))
#文字列の長さ
len_ind=ind.shape[1]
#Bの個数
len=s.shape[0]
#Bの移動先
dist=np.arange(len-len_ind,len)
#答え
ans=np.sum(dist-ind)
print(ans)
Problem p03200 (python)

Fixed submission:
s = input('')
bc = 0
c = 0

for i in range(0,len(s)):
  if s[i] == 'B':
    bc += 1
  elif s[i] == 'W':
    c += bc
    
print(c)

Buggy submission (verdict: Runtime Error):
s = input('')
bc = 0
c = 0

for i in range(0,len(s)):
	if s[i] == 'B':
    	bc += 1
    elif s[i] == 'W':
    	c += bc
        
print(c)
Problem p03260 (python)

Fixed submission:
A,B = map(int, input().split())
if A==2 or B==2: print("No")
else: print("Yes")

Buggy submission (verdict: Runtime Error):
A,B = input(),input()
if A==2 or B==2: print("Yes")
else: print("No")
Problem p03262 (python)

Fixed submission:
def gcd(a, b):
    if a > b:
        a, b = b, a
    while a:
        a, b = b%a, a
    return b
N,x1 = map(int, input().split())
xs = list(map(int, input().split()))
xs.append(x1)
xs.sort()
margin = [y-x for y,x in zip(xs[1:],xs[:-1])]
m = margin[0]
for x in margin[1:]:
    m = gcd(m,x)
print(m)

Buggy submission (verdict: Runtime Error):
N=int(input())
last = input()
wds = set([last])
res = "Yes"
for i in range(N-1):
    wd = input()
    if wd in wds or last[-1]!=wd[0]: 
        ans = "No"
        break
    last = wd
    wds.add(wd)
print(ans)
Problem p03200 (python)

Fixed submission:
#!/usr/bin/env python3

"""
https://atcoder.jp/contests/agc029/tasks/agc029_a
"""

import sys
import re


s = sys.stdin.readline().rstrip()
e = 0
n = 0

for chr in s:
    if chr == 'W':
        e += n

    if chr == 'B':
        n += 1

print(e)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

"""
https://atcoder.jp/contests/agc029/tasks/agc029_a
"""

import sys

def my_rep(old, new, st):
    st2 = st.replace(old, new, 1)

    if st2 == st:
        return 0

    return my_rep(old, new, st2) + 1



s = sys.stdin.readline().rstrip()
print(my_rep('BW','WB',s))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

"""
https://atcoder.jp/contests/agc029/tasks/agc029_a
"""

import sys
import re



def my_sub(_re,_rep,st):
    st2 = _re.sub(_rep, st, 1)

    if st2 == st:
        return 0

    return my_sub(_re, _rep, st2) + 1



s = sys.stdin.readline().rstrip()
print(my_sub(re.compile('BW'),'WB',s))
Problem p03243 (python)

Fixed submission:
N = int(input())
for i in range(N,1000):
  if(str(i)[0] == str(i)[1] and str(i)[1] == str(i)[2]):
    num = i
    break
print(num)

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(N:1000):
  if(str(i)[1] == str(i)[2] and str(i)[1] == str(i)[3]):
    num = i
    break
print(num)
Problem p03231 (python)

Fixed submission:
def gcd(a,b):
  while b>0:
    a,b=b,a%b
  return a

x,y=map(int,input().split())
S=input()
T=input()
GCD=gcd(x,y)
LCM=(x * y) // GCD

x_new=x//GCD
y_new=y//GCD
for i in range(0,GCD):
  if S[(x_new)*i]==T[(y_new)*i]:
    result=LCM
  else:
    result=-1
    break
print(result)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
  while b>0:
    a,b=b,a%b
  return a

x,y=map(int,input().split())
S=input()
T=input()
GCD=gcd(x,y)
LCM=(x * y) // GCD

x_new=x//GCD
y_new=y//GCD
for i in range(0,GCD-1):
  if S[(x_new)*i]==T[(y_new)*i]:
    result=LCM
  else:
    result=-1
    break
print(result)
Problem p03463 (python)

Fixed submission:
n,a,b=map(int,input().split())
bet=abs(b-a)
if bet%2==0:
  winner='Alice'
else:
    winner='Borys'
    
print(winner)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
bet=abs(b-a)
if bet%2==0:
  winner='ALice'
  else:
    winner='Borys'
    
print(winner)
Problem p03838 (python)

Fixed submission:
x,y=map(int,input().split())
if x==y:
  result=0
elif y>x:
  if x<0 and y>0:
    result=abs(abs(y)-abs(x))+1
  else:
    result=y-x
elif x>y:
  if x<0:
    result=x-y+2
  else:
    if y>0:
      result=x-y+2
    else:
      result=abs(abs(x)-abs(y))+1
  
print(result)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
if x=y:
  result=0
elif y>x:
  if x<=0 and y>=0 and (x+y)/2>=0:
    result=y-abs(x)+1
  else:
    result=y-x
elif x>=y:
  if y>=0:
    result=y+x+1 
  elif x<=0:
    result=x-y+2
  else:
    result=abs(abs(x)-abs(y))+1
  
print(result)
Problem p03200 (python)

Fixed submission:
from sys import stdin

S = stdin.readline().rstrip()
#S = input()
white = 0
total = 0
for i in range(len(S)):
    if S[i] == "W":
        total += (i - white)
        white += 1
        
print(total)

Buggy submission (verdict: Runtime Error):
from sys import stdin

S = stdin.readline().rstrip()
#S = input()
white = 0
total = 0
for i in range len(S):
    if S[i] == "W":
        total += (i - white)
        white += 1
        
print(total)

Buggy submission (verdict: Runtime Error):
S = input()
white = 0
total = 0
for i in range len(S):
    if S[i] == "W":
        total += (i - white)
        white += 1
        
print(total)

Buggy submission (verdict: Runtime Error):
S = input()
white = 0
total = 0
for i in range len(S):
    if S[i] == "W":
        total += (i - white)
        white ++
        
print(total)
Problem p03473 (python)

Fixed submission:
print(48-int(input()))

Buggy submission (verdict: Runtime Error):
prinm(48-int(input()))
Problem p03485 (python)

Fixed submission:
import math 
a,b = map(int,input().split())
print(math.ceil((a+b)/2))

Buggy submission (verdict: Runtime Error):
import math 
print(math.ceil(int((int(input())+int(input()))/2))
Problem p03565 (python)

Fixed submission:
Sd_ = input()
T_ = input()
Sd = []
T = []
S = []
for i in range(len(Sd_)):
    Sd.append(Sd_[i])
for i in range(len(T_)):
    T.append(T_[i])


def check(s, t, n):
    for i in range(len(t)):
        if s[n + i] is not t[i] and s[n + i] is not '?':
            return False
    return True


m = len(Sd) - len(T)
while m >= 0:
    if check(Sd[:], T[:], m):
        for j in range(len(T)):
            Sd[m + j] = T[j]
        for a in range(len(Sd)):
            if Sd[a] is '?':
                S.append('a')
            else:
                S.append(Sd[a])
        print(''.join(S))
        exit()
    m -= 1
print('UNRESTORABLE')

Buggy submission (verdict: Runtime Error):
Sd_ = input()
T_ = input()
Sd = []
T = []
S = []
check = False
for i in range(len(Sd_)):
    Sd.append(Sd_[i])
for i in range(len(T_)):
    T.append(T_[i])
num = 0
for a in range(len(Sd)-1,0,-1):
    if Sd[a] is '?':
        num += 1
    else:
        num = 0
    if num >= len(T):
        for m in range(len(T)):
            Sd[a+m] = T[m]
        for s in range(len(Sd)):
            if Sd[s] is '?':
                S.append('a')
            else:
                S.append(Sd[s])
        print(''.join(S))
        exit()


for i in range(len(Sd)-1,0,-1):
    if Sd[i] is not '?':
        if Sd[i] in T_:
            check = True
            num = T_.find(Sd[i])
            for n in range(len(T_)):
                if n < num:
                    if Sd[i-num+n] is not '?':
                        check = False
                        break
                else:
                    if Sd[i-num+n] is not T_[n] and Sd[i-num+n] is not '?':
                        check = False
                        break
            if check:
                for m in range(len(T)):
                    Sd[i-num+m] = T[m]
                break

if check:
    for s in range(len(Sd)):
        if Sd[s] is '?':
            S.append('a')
        else:
            S.append(Sd[s])
    print(''.join(S))
else:
    print('UNRESTORABLE')
Problem p03591 (python)

Fixed submission:
s = input()
a = 'YAKI'
ans = 0
if len(s) >= 4:
    for i in range(4):
        if s[i] == a[i]:
            ans = 1
        else:
            ans = 0
            break
if ans == 1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = input()
a = 'YAKI'
ans = 0
for i in range(4):
    if s[i] == a[i]:
        ans = 1
    else:
        break
if ans == 1:
    print('Yes')
else:
    print('No')