Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
sum = 0

if A > B:
	sum += B
elif :
	sum += A
if C > D:
	sum += D
elif :
	sum += C
	
print(sum)


Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
sum = 0

if A > B:
	sum += B
else:
	sum += A
if C > D:
	sum += D
else :
	sum += C
	
print(sum)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = 0

if A > B:
	E += B
elif :
	E += A
if C > D:
	E += D
elif :
	E += C
	
print(E)


Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
sum = 0

if A > B:
	sum += B
else:
	sum += A
if C > D:
	sum += D
else :
	sum += C
	
print(sum)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = 0

if A > B:
	E += B
elif :
	E += A
	if C > D:
		E += D
	elif :
		E += C
print(E)


Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
sum = 0

if A > B:
	sum += B
else:
	sum += A
if C > D:
	sum += D
else :
	sum += C
	
print(sum)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = 0

if A > B and C > D:
	E += B + D
print(E)
elif A > B and C < D:
	E += B + C
print(E)
elif A < B and C > D:
	E += A + D
print(E)
elif A < B and C < D:
	E += A + C
print(E)


Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
sum = 0

if A > B:
	sum += B
else:
	sum += A
if C > D:
	sum += D
else :
	sum += C
	
print(sum)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = E

if A > B and C > D:
	E = B + D
elif A > B and C < D:
	E = B + C
elif A < B and C > D:
	E = A + D
elif A < B and C < D:
	E = A + C
	
print(E)



Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
sum = 0

if A > B:
	sum += B
else:
	sum += A
if C > D:
	sum += D
else :
	sum += C
	
print(sum)

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

if A > B and C > D:
	E = B + D
elif A > B and C < D:
	E = B + C
elif A < B and C > D:
	E = A + D
elif A < B and C < D:
	E = A + C
	
print(E)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
sum = 0

if A > B:
	sum += B
else:
	sum += A
if C > D:
	sum += D
else :
	sum += C
	
print(sum)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input.split())

print((n-1) * (m-1))

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

print((n-1) * (m-1))
Buggy python submission (verdict: Runtime Error):
x = int(input())
if x =3 or x= 5 or x = 7:
  print("YES")
else:
  print('NO')


Fixed submission:
x = int(input())
if x ==3 or x== 5 or x == 7:
  print("YES")
else:
  print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int, input().split())
ans=0

for x in range(K+1):
    for y in range(K+1):
        z=(S-x-y)
        if 0 <= z <= K and x+y+z == S:
            ans+=1

print(ans)

Fixed submission:
K,S=map(int, input().split())
ans=0

for x in range(K+1):
    for y in range(K+1):
        if -1 < S-x-y < K+1:
            ans+=1

print(ans)
Buggy python submission (verdict: Runtime Error):
x:int = input()
if x in (7, 5, 3):
    print('YES')
else:
    print('NO')


Fixed submission:
x = int(input())
if x in (7, 5, 3):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int(), input().split())
if a+b > c+d:
    print("left")
elif a+b < c+d:
    print("right")
else:
   print("balanced")

Fixed submission:
a, b, c, d = map(int, input().split())
if a+b > c+d:
    print("Left")
elif a+b < c+d:
    print("Right")
else:
   print("Balanced")
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
listS = list(s)
listT = list(t)
sorted(listS)
sorted(listT)
if listS > listT:
    print("Yes")
else:
    print("No")

Fixed submission:
import math
a, b = map(float, input().split())
print(int(math.ceil((a+b)/2)))
Buggy python submission (verdict: Runtime Error):
s, t = map(str, input().split())
listS = list(s)
listT = list(t)
sorted(listS)
sorted(listT)
if listS > listT:
    print("Yes")
else:
    print("No")

Fixed submission:
s = input()
t = input()
listS = list(s)
listT = list(t)
listS.sort()
listT.sort(reverse = True)
if listS < listT:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
print(N*A if N*A < B else B)


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

Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
print N*A if N*A < B else B

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

Buggy python submission (verdict: Runtime Error):
N, A, B = map(raw_input().split())
print N*A if N*A < B else B

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

Buggy python submission (verdict: Runtime Error):
N, A, B = map(input().split())
print(N*A if N*A < B else B)

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

Buggy python submission (verdict: Runtime Error):
N, A, B = map(input().split())
print N*A if N*A < B else B

Fixed submission:
N, A, B = map(int, input().split())
print(N*A if N*A < B else B)
Buggy python submission (verdict: Runtime Error):
N = str(input())
A = 0
for i in N:
    A += int(i)
return "Yes" if N%A == 0 else "No"  

Fixed submission:
N = str(input())
A = 0
for i in N:
    A += int(i)
print("Yes" if int(N)%A == 0 else "No")
Buggy python submission (verdict: Runtime Error):
X, Y, Z = map(int, input().split())
print((X-Z)/Y)

Fixed submission:
X, Y, Z = map(int, raw_input().split())
print((X-Z)/(Y+Z))

Buggy python submission (verdict: Runtime Error):
X = input(); Y = input(); Z = input()
print((X-Z)/Y)

Fixed submission:
X, Y, Z = map(int, raw_input().split())
print((X-Z)/(Y+Z))
Buggy python submission (verdict: Runtime Error):
R = raw_input()
G = raw_input()
print(2*G - R)

Fixed submission:
R = input()
G = input()
print(2*G - R)
Buggy python submission (verdict: Runtime Error):
X = 1
N = input()
K = input()
for i in range(N):
	if(X*2 < X+K):
		X *= 2
	else X += K
print(X)

Fixed submission:
X = 1
N = input()
K = input()
for i in range(N):
	if(X*2 < X+K):
	    X *= 2
	else:
            X += K
print(X)
Buggy python submission (verdict: Runtime Error):


x = int(input())

if x == 3 or x == 5 or x == 7:
    print "YES"

else:
    print "NO"

Fixed submission:
x = int(input())

if x == 3 or x == 5 or x == 7:
    print ("YES")

else:
    print ("NO")

Buggy python submission (verdict: Runtime Error):


x = int(input('高橋くんは何歳ですか？'))

if x == 3:
    print "YES"

elif x == 5:
    print "YES"

elif x == 7:
    print "YES"

else:
    print "NO"
    


Fixed submission:
x = int(input())

if x == 3 or x == 5 or x == 7:
    print ("YES")

else:
    print ("NO")

Buggy python submission (verdict: Runtime Error):


num = x

x = int(input('高橋くんは何歳ですか？'))

if x = 3:
    print "YES"

elif x = 5:
    print "YES"

elif x = 7:
    print "YES"

else:
    print "NO"
    


Fixed submission:
x = int(input())

if x == 3 or x == 5 or x == 7:
    print ("YES")

else:
    print ("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
array = map(int, raw_input().split())
e_list = [array[i] for i in range(0, n, 2)]
o_list = [array[i] for i in range(1, n+1, 2)]
if e_list == o_list and len(e_list) == e_list.count(e_list[0]):
    print len(array) / 2
else:
    e_set = [n for n in set(e_list)]
    o_set = [n for n in set(o_list)]
    if len(o_set) == 1 and len(e_set) == 1:
        print 0
    else:
        e_number = []
        o_number = []
        sum = 0
        max = 0
        for number in e_set:
            sum += e_list.count(number)
            if e_list.count(number) > max:
                max = e_list.count(number)
        e_result = sum - max
        sum = 0
        max = 0
        for number in o_set:
            sum += o_list.count(number)
            if o_list.count(number) > max:
                max = o_list.count(number)
        o_result = sum - max
        print e_result + o_result


Fixed submission:
# coding:utf-8
# 找第二大的数的个数
n = input()
array = map(int, raw_input().split())
e_list = [array[i] for i in range(0, n, 2)]
o_list = [array[i] for i in range(1, n+1, 2)]


def process(arr):
    arr.sort()
    num = arr[0]
    counter = 0
    amt_arr = []
    arr.append(0)
    max = 0
    max_amt_num = []
    for i in arr:
        if i == num:
            counter += 1
        else:
            if counter > max:
                max_amt_num = [num]
                max = counter
            elif counter == max:
                max_amt_num.append(num)
                max = counter
            num = i
            amt_arr.append(counter)
            counter = 1
    if len(amt_arr) == 1:
        amt_arr.append(0)
    if len(max_amt_num) > 1:
        max_amt_num = "haha"
    amt_arr.sort()

    return amt_arr[-1], amt_arr[-2], max_amt_num
v1, v2, a1 = process(e_list)
v3, v4, a2 = process(o_list)
if a1 != a2 and a1 != "haha":
    result = len(array) - v1 - v3
else:
    result = len(array) - max(v1+v4, v2+v3)
print result
Buggy python submission (verdict: Runtime Error):
 n= int(input())
 if n == 1:
        print("Hello World")
 else:
        a = int(input())+int(input())
        print(a)

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

Buggy python submission (verdict: Runtime Error):
n = int(input())
b = int(input())
c = int(input())
if n == 1:
    ("Hello World")
else:
    a = b + c
    print(a)

Fixed submission:
n = int(input())
if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a+b)
Buggy python submission (verdict: Runtime Error):
s = int(input())
print(s.count(1))

Fixed submission:
s = input()
print(s.count("1"))
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [list(map(int,input().split()))]
j = 0
new = []
while True:
    for m,i in enumerate(l):
        if i % 2 == 0:
            l[i] = i/2
            if m == n:
                j +=1
        else:
            print(j)
            exit()
        

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

j = 0
new = []
while True:
    for m,i in enumerate(l):
        if i % 2 == 0:
            l[m] = i/2
            
            if m+1 == n:
                j +=1
        else:
            print(j)
            break
    else:
        continue
    break
Buggy python submission (verdict: Runtime Error):
x,y = map(str,input().split())

x = int(x,16)
y = int(y,16)

if x<y:
    print("<")
elif x == y:
    print("=")
else:
    ptiny(">")


Fixed submission:
x,y = map(str,input().split())

x = int(x,16)
y = int(y,16)

if x<y:
    print("<")
elif x == y:
    print("=")
else:
    print(">")

Buggy python submission (verdict: Runtime Error):
x,y = map(str,input().split())

x = int(x,16)
y = int(y,16)

if x<y:
    print("<")
elif x == y:
    print("=")
eldr:
    ptiny(">")

Fixed submission:
x,y = map(str,input().split())

x = int(x,16)
y = int(y,16)

if x<y:
    print("<")
elif x == y:
    print("=")
else:
    print(">")
Buggy python submission (verdict: Runtime Error):
n = input()
if n[2]n[1]n[0] == n:
    print("Yes")
else:
    print("No")


Fixed submission:
n = input()
if n[2]+n[1]+n[0] == n:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n = input()
if n[2][1][0] == n:
    print("Yes")
else:
    print("No")

Fixed submission:
n = input()
if n[2]+n[1]+n[0] == n:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
q = input()
x=100000
for i in range(len(q) - 2):
	y = abs(int(q[i:i+3]) - 753)
	if x > y :
		x = y
		
print(y)

Fixed submission:
q = input()

if q == '7' or  q == '5' or q == '3':
	print('YES')
else:
	print('NO')

Buggy python submission (verdict: Runtime Error):
q = input()
x=100000
for i in range(len(q) - 2):
	y = abs(int(q[i:i+3]) - 753)
	if x > y :
		x = y
		
print(y)

Fixed submission:
q = input()

if q == '7' or  q == '5' or q == '3':
	print('YES')
else:
	print('NO')
Buggy python submission (verdict: Runtime Error):

s = input()
slen = len(s)

minRes = 10**6

for idx in range(2, slen):
	b = idx-2
	
	n = int(s[b:idx+1])
	
	tempRes = abs(n-753)
	
	minRes = min(tempRes, minRes)

print(minRes)
	


Fixed submission:
s = input()
slen = len(s)

minRes = 10**6

for idx in range(2, slen):
	b = idx-2
	
	n = int(s[b:idx+1])
	
	tempRes = abs(n-753)
	
	minRes = min(tempRes, minRes)

print(minRes)
Buggy python submission (verdict: Runtime Error):
# coding: utf8

if __name__ == "__main__":
    x = int(input())
    if x == 3 or x == 5 or == 7:
        print("YES")
    else:
        print("NO")

Fixed submission:
# coding: utf8

if __name__ == "__main__":
    x = int(input())
    if x == 3 or x == 5 or x == 7:
        print("YES")
    else:
        print("NO")
Buggy python submission (verdict: Runtime Error):
cnt = 0
n = int(input())
cnt = 0

def rec(int pref):
	if pref <= n:
		cnt += 1
		for d in {3, 5, 7}:
			rec(pref * 10 + d)


rec(0)
print(cnt - 1)


Fixed submission:
n = int(input())
cnt = 0

def rec(pref):
	global cnt
	if pref <= n:
		s = str(pref)
		if '3' in s and '5' in s and '7' in s:
			#print(pref)
			cnt += 1
		for d in {3, 5, 7}:
			rec(pref * 10 + d)


rec(0)
print(cnt)
Buggy python submission (verdict: Runtime Error):
import sys

i = 0
for l in sys.stdin():
  print(l[i], end='')
  i += 1
  

Fixed submission:
import sys

i = 0
for l in sys.stdin:
    print(l[i], end='')
    i += 1

print('')
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
dem = [[0, 0] for i in range(M)]
for i in range(M):
    dem[i][0], dem[i][1] = map(int, input().split())
dem.sort(key=lambda x: (x[1]))
br_flag = [False for i in range(N-1)]
count = 0
for i in range(M):
    for j in range(dem[i][1]-dem[i][0]):
        if br_flag[dem[i][0] - 1 + j]:
            break
        elif j == dem[i][1] - dem[i][0] - 1:
            br_flag[dem[i][1]-2] = True
            count += 1
print(count)


Fixed submission:
N, M = map(int, input().split())
dem = [[0, 0] for i in range(M)]
for i in range(M):
    dem[i][0], dem[i][1] = map(int, input().split())
dem.sort(key=lambda x: (x[1]))
br_flag = [False for i in range(N-1)]
count = 0
a = 0
for i in range(M):
    if a < dem[i][0]:
        br_flag[dem[i][1]-2] = True
        a = dem[i][1] - 1
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
s = [0 for i in range(N)]
for i in range(N):
    s[i] = input()

s.sort()
output = ""
for i in range(L):
    output += s[i]
print(output)


Fixed submission:
N, L = map(int, input().split())
s = [0 for i in range(N)]
for i in range(N):
    s[i] = input()

s.sort()
output = ""
for i in range(N):
    output += s[i]
print(output)
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")

Fixed submission:
a, b = input().split()
if int(a)*int(b) % 2 == 0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Time Limit Exceeded):
a, b = input().split()
ab = int(a)*10**(len(b)) + int(b)

judge = 0
i = int(a) * int(b)

while judge == 0:
    if i**2 == ab:
        judge = 1
        break
    i += 1

if judge == 1:
    print("Yes")
else:
    print("No")

Fixed submission:
a, b = input().split()
ab = int(a)*10**(len(b)) + int(b)

judge = 0
i = min(int(a), int(b))

while judge == 0:
    if i**2 == ab:
        judge = 1
        break
    i += 1
    if i**2 > ab:
        break

if judge == 1:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
a, b = input().split()
ab = int(a)*10**(len(b)) + int(b)

judge = 0
i = 1

while judge == 0:
    if i**2 == ab:
        judge = 1
        break
    i += 1

if judge == 1:
    print("Yes")
else:
    print("No")

Fixed submission:
a, b = input().split()
ab = int(a)*10**(len(b)) + int(b)

judge = 0
i = min(int(a), int(b))

while judge == 0:
    if i**2 == ab:
        judge = 1
        break
    i += 1
    if i**2 > ab:
        break

if judge == 1:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
D = input().split()
M = int(input())
T = input().split()
judge = 0

for t in T:
    if t in D:
        D.remove(t)
    else:
        judge = 1
        break

if judge == 0:
    print("YES")
else:
    print("NO")

Fixed submission:
N = int(input())
Di = input().split()
D = {}
for d in Di:
    if d in D:
        D[d] += 1
    else:
        D[d] = 1
M = int(input())
T = input().split()
judge = 0

for t in T:
    if (t in D) and (D[t] != 0):
        D[t] -= 1
    else:
        judge = 1
        break

if judge == 0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
x, a, b = map(int, input().split())
 
if abs(x-a) > abs(x-b):
  print(A)
else:
  print(B)

Fixed submission:
x, a, b = map(int, input().split())
 
if abs(x-a) > abs(x-b):
  print("B")
else:
  print("A")

Buggy python submission (verdict: Runtime Error):
x, a, b = input().split()
 
if abs(x-a) > abs(x-b):
  print(B)
else:
  print(A)

Fixed submission:
x, a, b = map(int, input().split())
 
if abs(x-a) > abs(x-b):
  print("B")
else:
  print("A")

Buggy python submission (verdict: Runtime Error):
x, a, b = input().split()

if abs(x-a) > abs(x-b):
  print(A)
else:
  print(B)

Fixed submission:
x, a, b = map(int, input().split())
 
if abs(x-a) > abs(x-b):
  print("B")
else:
  print("A")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = input().split()
b = [0]*8
c = 0

for a in A:
    a = int(a)
    if 1<=a<=399:
        b[0] += 1
    elif 400<=a<=799:
        b[1] += 1
    elif 800<=a<=1199:
        b[2] += 1
    elif 1200<=a<=1599:
        b[3] += 1
    elif 1600<=a<=1999:
        b[4] += 1
    elif 2000<=a<=2399:
        b[5] += 1
    elif 2400<=a<=2799:
        b[6] += 1
    elif 2800<=a<=3199:
        b[7] += 1
    elif 3200<=a:
        c += 1

if c == 0:
    print(8-b.count(0), end=" ")
else:
    print(max(8-b.count(0),1), end=" ")

print(min(8-b.count(0)+c, 9))

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

if (100*a+10*b+c)%4==0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
A, B = input().split()

if (A+B) >= 10:
    print("error")
else:
    print(A+B)

Fixed submission:
A, B = map(int, input().split())
 
if (A+B) >= 10:
    print("error")
else:
    print(A+B)
Buggy python submission (verdict: Runtime Error):
 = int(input())
s = input()
x = 0
l = [0]
for a in s:
    if a == "I":
        x = x + 1
        l.append(x)
    else:
        x = x - 1
        l.append(x)

print(max(l))


Fixed submission:
n = int(input())
s = input()
x = 0
l = [0]
for a in s:
    if a == "I":
        x = x + 1
        l.append(x)
    else:
        x = x - 1
        l.append(x)

print(max(l))
Buggy python submission (verdict: Runtime Error):

a, b = input().split()
if a == "A":
    a1 = 10
if a == "B":
    a1 = 11
if a == "C":
    a1 = 12
if a == "D":
    a1 = 13
if a == "E":
    a1 = 14
if a == "F":
    a1 = 15
if b == "A":
    b1==10
if b == "B":
    b1 = 11
if b == "C":
    b1 = 12
if b == "D":
    b1 = 13
if b == "E":
    b1 = 14
if b == "F":
    b1 = 15
if a1 > b1:
    print(">")
elif a1 == b1:
    print("=")
else :
    print("<")

Fixed submission:

a, b = input().split()
if a == "A":
    a1 = 10
if a == "B":
    a1 = 11
if a == "C":
    a1 = 12
if a == "D":
    a1 = 13
if a == "E":
    a1 = 14
if a == "F":
    a1 = 15
if b == "A":
    b1 =10
if b == "B":
    b1 = 11
if b == "C":
    b1 = 12
if b == "D":
    b1 = 13
if b == "E":
    b1 = 14
if b == "F":
    b1 = 15
if a1 > b1:
    print(">")
elif a1 == b1:
    print("=")
else :
    print("<")

Buggy python submission (verdict: Runtime Error):

a, b = input().split()
if a == "A":
    a1 = 10
if a == "B":
    a1 = 11
if a == "C":
    a1 = 12
if a == "D":
    a1 = 13
if a == "E":
    a1 = 14
if a == "F":
    a1 = 15
if b == "A":
    b== 10
if b == "B":
    b1 = 11
if b == "C":
    b1 = 12
if b == "D":
    b1 = 13
if b == "E":
    b1 = 14
if b == "F":
    b1 = 15
if a1 > b1:
    print(">")
elif a1 == b1:
    print("=")
else :
    print("<")

Fixed submission:

a, b = input().split()
if a == "A":
    a1 = 10
if a == "B":
    a1 = 11
if a == "C":
    a1 = 12
if a == "D":
    a1 = 13
if a == "E":
    a1 = 14
if a == "F":
    a1 = 15
if b == "A":
    b1 =10
if b == "B":
    b1 = 11
if b == "C":
    b1 = 12
if b == "D":
    b1 = 13
if b == "E":
    b1 = 14
if b == "F":
    b1 = 15
if a1 > b1:
    print(">")
elif a1 == b1:
    print("=")
else :
    print("<")
Buggy python submission (verdict: Runtime Error):
package main

import (
    "fmt"
    "math/rand"
    "time"
)

func swap(data []float64, i,

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

num = b - a
h = 0
for i in range(num):
    h += i

print(h-a)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = str(input())

cnt = []
count = 0

for i in range(len(S)):
    count = 0
    for j in range(len(S)):
        if i > j and S[j] == "W":
            count += 1
        if i < j and S[j] == "E":
            count += 1
    cnt.append(count)
print(min(cnt))

Fixed submission:
N = int(input())
S = str(input())
cnt = []
count = 0

for i in range(1,len(S)):
    if S[i] == "E":
        count += 1
cnt = [count]*N

for i in range(1, len(S)):
    cnt[i] = cnt[i-1]
    if S[i-1] == "W":
        cnt[i] += 1
    if S[i] == "E":
        cnt[i] -= 1
print(min(cnt))
Buggy python submission (verdict: Runtime Error):
def abc(a,b,k):
    for i in range(k):
        print(a)
        a += 1
    for i in range(k):
        print(b-k+1)
        b += 1
a, b, k = map(int, input().split())

abc(a,b,k)


Fixed submission:
def abc(s):
    word = list(s)
    if word[0] != word[1] and word[0] != word[2] and word[1] != word[2]:
        print("Yes")
    else:
        print("No")

S = input()
abc(S)
Buggy python submission (verdict: Time Limit Exceeded):
N, Y = map(int, input().split())

answer = [-1, -1, -1]

for i in range(N+1):
    for j in range(N+1):
        if i+j+(N-i-j) == N and i*10000 + j*5000 + (N-i-j)*1000 == Y and N-i-j>=0:
            answer[0] = i
            answer[1] = j
            answer[2] = N-i-j

print("{} {} {}".format((answer[0]),(answer[1]),(answer[2])))



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

answer = [-1, -1, -1]

for i in range(N+1):
    for j in range(N+1):
        k = N-i-j
        if k < 0:
            continue
        if i+j+k == N and i*10000 + j*5000 + k*1000 == Y:
            answer[0] = i
            answer[1] = j
            answer[2] = N-i-j

print("{} {} {}".format((answer[0]),(answer[1]),(answer[2])))
Buggy python submission (verdict: Time Limit Exceeded):
import collections

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

cnt_list = []

for i in range(N):
    if A[i] not in cnt_list:
        cnt_list.append(A[i])

c = collections.Counter(A)
values, counts = zip(*c.most_common())
counts = list(counts)
counts.reverse()

answer=0

if len(cnt_list) > K:
    for i in range(len(cnt_list)-K):
        answer += counts[i]
        
        
print(answer)


Fixed submission:
import collections

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

cnt_list = []

c = collections.Counter(A)
values, counts = zip(*c.most_common())
counts = list(counts)
counts.reverse()

answer=0

if len(counts) > K:
    for i in range(len(counts)-K):
        answer += counts[i]
        
print(answer)