Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input( ).split())
a = list(map(int, input().split()))
counter = 0
for i in sorted(a):
  x -= i
  if x < 0:
    print(counter)
  else:
    counter += 1
  if counter == n:
    print(n)
n, x = map(int, input( ).split())
a = list(map(int, input().split()))
counter = 0
for i in sorted(a):
  x -= i
  if x <= 0:
    print(counter)
  else:
    counter += 1
  if counter == n:
    print(n)


Fixed submission:
n, x = map(int, input( ).split())
a = list(map(int, input().split()))
counter = 0
for i in sorted(a):
  x -= i
  counter += 1
  if x<0:
    print(counter-1)
    break
  elif x==0:
    print(counter)
    break
  else:
    if counter==n:
      print(counter-1)

Buggy python submission (verdict: Runtime Error):
n, x = map(int, input( ).split())
a = list(map(int, input().split()))
counter = 0
for i in a.sort():
  x -= i
  if x <0:
    print(counter)
  else:
    counter += 1

Fixed submission:
n, x = map(int, input( ).split())
a = list(map(int, input().split()))
counter = 0
for i in sorted(a):
  x -= i
  counter += 1
  if x<0:
    print(counter-1)
    break
  elif x==0:
    print(counter)
    break
  else:
    if counter==n:
      print(counter-1)

Buggy python submission (verdict: Runtime Error):
n, x = map(int, input( ).split())
a = []
for i in range(n):
  k = input().split( )[i]
  a.append(int(k))
counter = 0
for i in a.sort():
  x -= i
  if x <0:
    print(counter)
  else:
    counter += 1

Fixed submission:
n, x = map(int, input( ).split())
a = list(map(int, input().split()))
counter = 0
for i in sorted(a):
  x -= i
  counter += 1
  if x<0:
    print(counter-1)
    break
  elif x==0:
    print(counter)
    break
  else:
    if counter==n:
      print(counter-1)

Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
a = []
for i in range(n):
  k = input().split()[i]
  a.append(int(k))
counter = 0
for i in a.sort():
  x -= i
  if x <0:
    print(counter)
  else:
    counter += 1

Fixed submission:
n, x = map(int, input( ).split())
a = list(map(int, input().split()))
counter = 0
for i in sorted(a):
  x -= i
  counter += 1
  if x<0:
    print(counter-1)
    break
  elif x==0:
    print(counter)
    break
  else:
    if counter==n:
      print(counter-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for _ in range(N)] * [0, 0]
a.sort()
if len(a) >= 2:
    res = a[-2]
else:
    res = a[-1]
res += sum(a[:-2])
print("second" if res % 2 == 0 else "first")


Fixed submission:
N = int(input())
a = [int(input()) % 2 for _ in range(N)]
res = sum(a)
print("first" if res > 0 else "second")

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for _ in range(N)]
a.sort()
res = a[-2] % 2
print("second" if res == 0 else "first")

Fixed submission:
N = int(input())
a = [int(input()) % 2 for _ in range(N)]
res = sum(a)
print("first" if res > 0 else "second")
Buggy python submission (verdict: Time Limit Exceeded):
S = list(input())
def n(S, count=0):
    S = list(S)
    for i in range(len(S)-1):
        if S[i] == "B" and S[i+1] == "W":
            S[i] = "W"
            S[i+1] = "B"
            return n(S, count+1)
    return count
print(n(S), flush=True)

Fixed submission:
S = list(input())
def f(S):
    N = S.count("B")
    k = N
    i = len(S)-1
    res = 0
    while i >= 1:
        if S[i] == "B":
            k -= 1
        else:
            res += k
        i -= 1
    return res
print(f(S), flush=True)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input().split(' ')
s = sum([S[i-1] == S[i] or S[i] == S[i+1] for i in  range(1, N-1, 2)])
s -= sum([S[i-1]== S[i] == S[i+1] for i in  range(2, N, 2)])
print(s, flush=True)

Fixed submission:
N = int(input())
S = input().split()
s = 0
for i in range(1, N):
	if S[i-1] == S[i]:
		S[i] = N + 1000000000
		s += 1
	
print(s, flush=True)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input().split()
s = sum([S[i-1] == S[i] or S[i] == S[i+1] for i in  range(1, N, 2)])
print(s, flush=True)

Fixed submission:
N = int(input())
S = input().split()
s = 0
for i in range(1, N):
	if S[i-1] == S[i]:
		S[i] = N + 1000000000
		s += 1
	
print(s, flush=True)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(N)]
s = sum([S[i-1] == S[i] or S[i] == S[i+1] for i in  range(1, N, 2)])
print(s)

Fixed submission:
N = int(input())
S = input().split()
s = 0
for i in range(1, N):
	if S[i-1] == S[i]:
		S[i] = N + 1000000000
		s += 1
	
print(s, flush=True)
Buggy python submission (verdict: Runtime Error):
a = input()
return a.count("2")


Fixed submission:
a = input()
print(str(a).count("2"))
Buggy python submission (verdict: Time Limit Exceeded):
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)

d=max(b)
for j in range(d):
    zako = map(lambda x: x%(d-j), b)
    if list(zako).count(0) == N:
        ans=(d-j)
        print(ans)
        break

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 python 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)

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 python submission (verdict: Time Limit Exceeded):
N,K = (int(i) for i in input().split())
ans=0
for a in range(1,N+1):
    for b in range(1,N+1):
        for c in range(1,N+1):
            if (a+b)%K ==0 and (b+c)%K ==0 and (c+a)%K==0:
                ans +=1
print(ans)

Fixed submission:
N,K = (int(i) for i in input().split())
a=0
b=0
if K%2 !=0:
    print((N//K)**3)
else:
    for i in range (1,N+1):
        if i % K == 0:
            a += 1
        elif i % K == K/2:
            b += 1
    print(a**3+b**3)
Buggy python 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)

Fixed submission:
A,B=(int(i) for i in input().split())
print(A*B-A-B+1)
Buggy python 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])

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 python 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")

Fixed submission:
N,K=(int(i) for i in input().split())
if N%K == 0:
    print(0)
else:
    print(1)
Buggy python 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)

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

if N != 100:
    print(100**D*N)
else:
    print(100**D*101)
Buggy python submission (verdict: Runtime Error):
N=int(input())
if N =<999:
    print("ABC")
else:
    print("ABD")

Fixed submission:
N=int(input())
if N <= 999:
    print("ABC")
else:
    print("ABD")
Buggy python 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)

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 python submission (verdict: Runtime Error):
a,b=(int(i) for i in input().split())
peint(max(a+b,a-b,a*b))

Fixed submission:
a,b=(int(i) for i in input().split())
print(max(a+b,a-b,a*b))
Buggy python 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)

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 python 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")

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 python submission (verdict: Runtime Error):
S = str(input())

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

Fixed submission:
S = str(input())

if "a" in S and "b" in S and "c" in S:
  	print("Yes")
else :
	print("No")
Buggy python 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)

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 python 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")

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 python 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")

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 python 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)

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 python 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)

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 python submission (verdict: Runtime Error):
S = input()
checker = 0
for i in S:
    if i == o:
        checker += 1
sum = 700 + 100 * checker
print(sum)

Fixed submission:

S = input()
checker = 0

for i in list(S):
    if i == 'o':
        checker += 1
sum = 700 + 100 * checker
print(sum)
Buggy python submission (verdict: Runtime Error):
import bisect
ans = 0
N = int(input())
a = list(map(int,input().split()))
b = [True for _ in range(N)]
a.sort()
digit = 40
y = 2 ** (digit+1) -1
while len(a)>1:
    if b[-1]==False:
        a.pop(-1)
        b.pop(-1)
        continue
    x = a.pop(-1)
    b.pop(-1)
    while x < 2**digit:
        digit -= 1
        y = 2 ** (digit+1) -1
    z = x^y
    z += 1
    ll =  bisect.bisect_left(a,z)
    rr =  bisect.bisect_right(a,z)
    if rr-ll>0:
        rr -= 1
        while b[rr] == False:
            rr -= 1
        if rr>=ll:
            b[rr] = False
            ans += 1           
print(ans)

Fixed submission:
import bisect
ans = 0
N = int(input())
a = list(map(int,input().split()))
b = [True for _ in range(N)]
c = [True for _ in range(N)]
a.sort()
digit = 40
y = 2 ** (digit+1) -1
while len(a)>1:
    if b[-1]==False:
        a.pop(-1)
        b.pop(-1)
        continue
    x = a.pop(-1)
    b.pop(-1)
    while x < 2**digit:
        digit -= 1
        y = 2 ** (digit+1) -1
    z = x^y
    z += 1
    ll =  bisect.bisect_left(a,z)
    rr =  bisect.bisect_right(a,z)
    if rr-ll>0:
        rr -= 1
        if b[ll]==False:
            pass
        elif b[rr]==True:
            b[rr]=False
            ans += 1
        else:
            lll = ll
            rrr = rr
            while rrr-lll>1:
                if b[(rrr+lll)//2]:
                    lll = (rrr+lll)//2
                else:
                    rrr = (rrr+lll)//2
            b[lll] = False
            ans += 1           
print(ans)
Buggy python 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)

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 python 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)

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 python 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])

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 python 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])

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 python 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])

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 python 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)

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 python 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])

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 python 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)

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 python 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)

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 python submission (verdict: Time Limit Exceeded):
txt = input()
txt_list = list(txt)

count = 0

while True:
    pre_count = count
    for i in range(len(txt)-1):
        if txt_list[i] == 'B' and txt_list[i+1] == 'W':
            tmp = txt_list[i]
            txt_list[i] = txt_list[i+1]
            txt_list[i+1] = tmp
            count += 1
    if pre_count == count:
        break

print(count)

Fixed submission:
txt = input()
txt_list = list(txt)

num = 0
count = 0
for i in range(len(txt)):
    if txt_list[i] == 'W':
        count += i-num 
        num += 1

print(count)

Buggy python 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)
	


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 python submission (verdict: Runtime Error):
A,B = input(),input()
if A==2 or B==2: print("Yes")
else: print("No")

Fixed submission:
A,B = map(int, input().split())
if A==2 or B==2: print("No")
else: print("Yes")
Buggy python 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)

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)