Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

S = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']

for j in range (0, 1000000):
	for i in range (0, 26):
		S.append(S[j]+chr(96+i))

print(S[N])

Fixed submission:
N = int(input())
Alphabet = str('abcdefghijklmnopqrstuvwxyz')
import bisect

List = [0, 26, 702, 18278, 475254, 12356630, 321272406, 8353082582, 217180147158, 5646683826134, 146813779479510, 3817158266467286, 99246114928149462, 2580398988131886038, 67090373691429037014, 1744349715977154962390, 45353092615406029022166, 1179180408000556754576342, 30658690608014475618984918]
V = []

if List.count(N) == 1:
	for i in range (0, List.index(N)):
		V.append('z')
	print(*V, sep = '')
	exit()

k = 26
A = [0]
for i in range (2, 20):
	A.append(k)
	k = k+26**i
    
S = []

B = bisect.bisect_right(A, N)

N = N-A[B-1]-1
for i in range (0, B):
	S.append(Alphabet[N%26])
	N = N//26
    
S = reversed(S)
print(*S, sep = '')

Buggy python submission (verdict: Runtime Error):

N = int(input())

S = str()

import math

K = [26, 702, 18278, 475254, 12356630, 321272406, 8353082582, 217180147158, 5646683826134, 146813779479510]

if K.count(N) > 0:
	for i in range (0, K.index(N)+1):
		S=S+'z'
	print(S)
	exit()

import bisect
P = bisect.bisect_right(K, N)
Mel = N- K[P-1]

for i in range (0, P):
	K = Mel//(26**(P-i))
	Mel = Mel-K*(26**(P-i))
	S=S+chr(97+K)

S=S+chr(96+Mel)

print(S)

Fixed submission:
N = int(input())
Alphabet = str('abcdefghijklmnopqrstuvwxyz')
import bisect

List = [0, 26, 702, 18278, 475254, 12356630, 321272406, 8353082582, 217180147158, 5646683826134, 146813779479510, 3817158266467286, 99246114928149462, 2580398988131886038, 67090373691429037014, 1744349715977154962390, 45353092615406029022166, 1179180408000556754576342, 30658690608014475618984918]
V = []

if List.count(N) == 1:
	for i in range (0, List.index(N)):
		V.append('z')
	print(*V, sep = '')
	exit()

k = 26
A = [0]
for i in range (2, 20):
	A.append(k)
	k = k+26**i
    
S = []

B = bisect.bisect_right(A, N)

N = N-A[B-1]-1
for i in range (0, B):
	S.append(Alphabet[N%26])
	N = N//26
    
S = reversed(S)
print(*S, sep = '')
Buggy python submission (verdict: Runtime Error):
X = int(input())

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

xfactor = prime_factors(X)

for i in (0, len(xfactor)-1):
	for j in range (-1000000, 1000000):
		if xfactor[i]*(5*j^4-10*j^3*xfactor[i]^1+10*j^2*xfactor[i]^2-5*j^1*xfactor[i]^3-xfactor[i]^4) == X:
			print(j, j-xfactor[i])
			exit()

Fixed submission:
X = int(input())

for i in range (-1000, 1000):
	for j in range (-1000,1000):
		if i**5-j**5 == X:
			print(i, j)
			exit()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))

SL = sorted(L)
count = 0

for i in range (0, max(L)):
	p=len([j for j in SL[count::] if j == i+1]) 
	count+=p
	print(p)

for i in range (max(L), N):
	print(0)

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

K = [0]*N

for i in range (0, N-1):
	K[L[i]-1]+=1

print(*K, sep = "\n")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))

SL = sorted(L)
count = 0

for i in range (0, max(L)):
	p=len([j for j in SL[count::] if j == i+1]) 
	count+=p
	print(p)

for i in range (max(L), N):
	print(0)

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

K = [0]*N

for i in range (0, N-1):
	K[L[i]-1]+=1

print(*K, sep = "\n")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))

SL = sorted(L)

for i in range (0, max(L)):
	print(len([j for j in SL if j == i+1]))

for i in range (max(L), N):
	print(0)

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

K = [0]*N

for i in range (0, N-1):
	K[L[i]-1]+=1

print(*K, sep = "\n")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A= list(map(int, input().split()))

for i in range (0, max(A)):
	print(A.count(i+1))

for i in range (max(A), N):
	print(0)

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

K = [0]*N

for i in range (0, N-1):
	K[L[i]-1]+=1

print(*K, sep = "\n")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A= list(map(int, input().split()))

for i in range (0, N):
  print(A.count(i+1))

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

K = [0]*N

for i in range (0, N-1):
	K[L[i]-1]+=1

print(*K, sep = "\n")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = str(input())

count = 0

for i in range (0, N-2):
  colour1 = S[i]
  for j in range (i+1, N-1):
    colour2 = S[j]
    if colour1 == colour2:
      continue
    else:
      for k in range(j+1, N):
        colour3 = S[k]
        if j-i == k-j:
          continue
        elif colour1 != colour3 and colour2 != colour3:
          count+=1
        else:
          continue

print(count)

Fixed submission:
N = int(input())
S = str(input())

count = S.count('R')*S.count('G')*S.count('B')

for i in range (0, N-2):
  colour1 = S[i]
  for j in range (i+1, N-1):
    colour2 = S[j]
    if colour1 == colour2:
      continue
    else:
      if 2*j-i > N-1:
        continue
      elif colour1 != S[2*j-i] and colour2 != S[2*j-i]:
          count-=1
      else:
          continue

print(count)

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

count = 0

for i in range (0, N-2):
  colour1 = S[i]
  for j in range (i+1, N-1):
    colour2 = S[j]
    if colour1 == colour2:
      continue
    else:
      for k in range(j+1, N):
        colour3 = S[k]
        if j-i == k-j:
          continue
        elif colour1 != colour3 and colour2 != colour3:
          count+=1
        else:
          continue

print(count)

Fixed submission:
N = int(input())
S = str(input())

count = S.count('R')*S.count('G')*S.count('B')

for i in range (0, N-2):
  colour1 = S[i]
  for j in range (i+1, N-1):
    colour2 = S[j]
    if colour1 == colour2:
      continue
    else:
      if 2*j-i > N-1:
        continue
      elif colour1 != S[2*j-i] and colour2 != S[2*j-i]:
          count-=1
      else:
          continue

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

S = []

import collections

for i in range (0, N):
	S.append(str(input()))

S = sorted(S)
cnt = collections.Counter()

for word in S:
	cnt[word] += 1
    
V = cnt.most_common(1)

D = V[0][1]

String = [V[0][0]]

for i in range (1, len(set(S))):
	if cnt.most_common()[i][1] == D:
		String.append(cnt.most_common()[i][0])

for i in range (0, len(String)):
	print(String[i])

Fixed submission:
N = int(input())

S = []

import collections

for i in range (0, N):
	S.append(str(input()))

S = sorted(S)
cnt = collections.Counter()

for word in S:
	cnt[word] += 1
    
mostCommon = cnt.most_common()

D = mostCommon[0][1]
print(mostCommon[0][0])
for i in range(1, len(set(S))):
	if mostCommon[i][1] == D:
		print(mostCommon[i][0])
	else:
		exit()
Buggy python submission (verdict: Time Limit Exceeded):
b = input()
l = list(map(int, input().split()))
plus = 0
for i in range (len(l)-1):
	v = l[0]
	l.pop(0)
	if l.count(v)>0:
		plus += 1
        
if plus > 0:
  	print('NO')
else:
	print('YES')

Fixed submission:
b = input()
l = list(map(int, input().split()))
ldistinct = set(l)

if len(ldistinct) < len(l):
	print('NO')
else:
	print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
b = input()
l = list(map(int, input().split()))
plus = 0
for i in range (len(l)-1):
	if l.count(l[i])>1:
		plus += 1
        
if plus > 0:
  	print('NO')
else:
	print('YES')

Fixed submission:
b = input()
l = list(map(int, input().split()))
ldistinct = set(l)

if len(ldistinct) < len(l):
	print('NO')
else:
	print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
b = input()
l = list(map(int, input().split()))
plus = 0
a = len(l)-1
for i in range (a):
	if l.count(l[i])>1:
		plus += 1
        
if plus > 0:
  	print('NO')
else:
	print('YES')

Fixed submission:
b = input()
l = list(map(int, input().split()))
ldistinct = set(l)

if len(ldistinct) < len(l):
	print('NO')
else:
	print('YES')
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
l = list(map(int, input().split()))
c = a-b+1
vector = [0]*c

for i in range(c):
	for j in range (b):
		vector[i]=vector[i]+l[i+j]
    
print((max(vector)+b)/2)

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

for i in range (0, N):
	A[i] = (A[i]+1)/2

sumK = sum(A[0:K])

L = [sumK]

for i in range (0, N-K):
	sumK = sumK + A[K+i] - A[i]
	L.append(sumK)

print(max(L))
Buggy python submission (verdict: Runtime Error):
H, N = map(int, input().split())
L= list(map(int, input().split())

if sum(L) >= H:
	print('Yes')
else:
	print('No')

Fixed submission:
H, N = map(int, input().split())
L= list(map(int, input().split()))
 
if sum(L) >= H:
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a == b:
	Print('Yes')
else:
	Print('No')

Fixed submission:
a, b = map(int, input().split())
if a == b:
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Runtime Error):
# simply use double ifs
s = input()
print(chr(ord(s))+1)


Fixed submission:
# simply use double ifs
s = input()
print(chr(ord(s)+1))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)

count = 0

max = A[-1]
import math
V = [0]*(math.floor(math.log(max, 2))+1)

for i in range (0, N):
	B = A[i]
	vount = 0
	while B > 0:
		if B%2 == 0:
			B = B//2
			vount+=1			
		else:
			B = (B-1)//2
			V[vount]+=1
			vount+=1

for i in range (0, len(V)):
	count+=((V[i]*(N-V[i]))*(2**i))

print(count%(10**9+7))

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

count = 0

max = A[-1]
if max == 0:
	print(0)
	exit()

import math
V = [0]*(math.floor(math.log(max, 2))+1)

for i in range (0, N):
	B = A[i]
	vount = 0
	while B > 0:
		if B%2 == 0:
			B = B//2
			vount+=1			
		else:
			B = (B-1)//2
			V[vount]+=1
			vount+=1

for i in range (0, len(V)):
	count+=((V[i]*(N-V[i]))*(2**i))

print(count%(10**9+7))
Buggy python submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())

if B> A:
	print(math.ceil((B-1)//(A-1))
  
else:
	print(1)

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

print(math.ceil((B-1)/(A-1)))
Buggy python submission (verdict: Time Limit Exceeded):
import math
N = int(input())

Psama = []

for i in range (0, N):
	Psama.append("". join(sorted(input())))

Achamo = list(set(Psama))

Wakashamo = [0]*len(Achamo)

for i in range (0, len(Psama)):
	for j in range (0, len(Achamo)):
		if Psama[i] == Achamo[j]:
			Wakashamo[j]+=1

counter =0

for i in range (0, len(Achamo)):
	if Wakashamo[i]!=1:
		counter+=math.factorial(Wakashamo[i])/(2*math.factorial(Wakashamo[i]-2))

print(int(counter))


Fixed submission:
import math 
import collections

N = int(input())
String = []
for i in range (0, N):
	S = str(input())
	S = sorted(S)
	V = str(S[0])
	for j in range (1, 10):
		V = V+str(S[j])
	String.append(V)
    
cnt = collections.Counter()
for word in String:
	cnt[word] += 1

V = cnt.most_common()

count = 0

for i in range (0, len(V)):
	count+=math.comb(V[i][1], 2)
    
print(count)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = [int(input()) for _ in range(W)]
    
floor = list(range(0,H+1))

if S.count(1) >0:
	floor[1]=0
	floor[2]=1
if S.count(2) >0:
    floor[2]=0

for i in range (3, H+1):
		floor[i]=floor[i-2]*(1-S.count(i-2))+floor[i-1]*(1-S.count(i-1))
print(floor[H]%(10**9+7))

Fixed submission:
a, b, c = map(int, input().split())
print(a+b+c-max(a,b,c))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
P = [input().split() for i in range(M)]

A=[int(P[0][0]), int(P[0][1])]

for i in range (1, M):
	if int(P[i][0]) <= A[1]:
		A[0] = max(A[0], int(P[i][0]))
		A[1] = min(A[1], int(P[i][1]))
	else:
		A=[]

if len(A) >0:
	choniki = list(range(A[0], A[1]+1))           
	print(len(choniki))
else:
	print(0)   

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

P = [0]*(N+1)

for i in range (0, M):
	A, B = map(int, input().split())
	P[A-1]+=1
	P[B]-=1
    
for i in range (1, N+1):
	P[i]+=P[i-1]
    
P = sorted(P, reverse = True)

count = 0

for i in range (0, N+1):
	if P[i] == M:
		count+=1
	else:
		print(count)
		exit()

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
P = [input().split() for i in range(M)]

A=[int(P[0][0]), int(P[0][1])]

for i in range (1, M):
	if int(P[i][0]) <= A[1]:
		A[0] = max(A[0], int(P[i][0]))
		A[1] = min(A[1], int(P[i][1]))
	else:
		A=[]

if len(A) >0:
	choniki = list(range(A[0], A[1]+1))           
	print(len(choniki))
else:
	print(0)

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

P = [0]*(N+1)

for i in range (0, M):
	A, B = map(int, input().split())
	P[A-1]+=1
	P[B]-=1
    
for i in range (1, N+1):
	P[i]+=P[i-1]
    
P = sorted(P, reverse = True)

count = 0

for i in range (0, N+1):
	if P[i] == M:
		count+=1
	else:
		print(count)
		exit()

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
P = [input().split() for i in range(M)]

A=set(list(range(int(P[0][0]), int(P[0][1])+1)))

for i in range (1, M):
	B = set(list(range(int(P[i][0]), int(P[i][1])+1)))
	A = A.intersection(B)

print(len(A))

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

P = [0]*(N+1)

for i in range (0, M):
	A, B = map(int, input().split())
	P[A-1]+=1
	P[B]-=1
    
for i in range (1, N+1):
	P[i]+=P[i-1]
    
P = sorted(P, reverse = True)

count = 0

for i in range (0, N+1):
	if P[i] == M:
		count+=1
	else:
		print(count)
		exit()
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int, input().split())
S = str(input())

P = [list(map(int,input().split())) for i in range(Q)]

for i in range (0, Q):
	s = S[(P[i][0]-1):(P[i][1])]
	print(s.count('AC'))

Fixed submission:
N, Q = map(int, input().split())
S = str(input())

l = [0]*N
count = 0

for i in range (1, N):
	if S[i-1] == 'A' and S[i] == 'C':
		count+=1
		l[i] = count
	else:
		l[i] = count

for i in range(0, Q):
	O, P = map(int, input().split())
	print(l[P-1] - l[O-1])

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

P = [list(map(int,input().split())) for i in range(Q)]

for i in range (0, Q):
	s = S[(P[i][0]-1):(P[i][1])]
	print(s.count('AC'))

Fixed submission:
N, Q = map(int, input().split())
S = str(input())

l = [0]*N
count = 0

for i in range (1, N):
	if S[i-1] == 'A' and S[i] == 'C':
		count+=1
		l[i] = count
	else:
		l[i] = count

for i in range(0, Q):
	O, P = map(int, input().split())
	print(l[P-1] - l[O-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = str(input())
V = 'abcdefghijklmnopqrstuvwzyz'
Lavida = [1]*26
for i in range (0, N):
	Lavida[V.index(S[i])]+=1

count = 1
for i in range (0, 26):
	count*=Lavida[i]
	count=count%(10**9+7)

print((count-1)%(10**9+7))

Fixed submission:
N = int(input())
S = str(input())
V = 'abcdefghijklmnopqrstuvwxyz'
Lavida = [1]*26
for i in range (0, N):
	Lavida[V.index(S[i])]+=1

count = 1
for i in range (0, 26):
	count*=Lavida[i]
	count=count%(10**9+7)

print((count-1)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
S = str(input())
T = str(input())

if M > N:
	M, N = N, M
	S, T = T, S

import math
G = N*M//math.gcd(N, M)

A = []
B = []

for i in range (0, N):
	A.append(1+i*G//N) 
for i in range (0, M):
	B.append(1+i*G//M)

J = [0]*(G+1)

for i in range (0, N):
	J[A[i]]+= (i+1)

FA = []
FB = []

for i in range (0, M):
	if J[B[i]] != 0:
		FB.append(i)
		FA.append(J[B[i]]-1)
        
for i in range (0, len(FA)):
	if S[FA[i]] != T[FB[i]]:
		print(-1)
		exit()
print(G)

Fixed submission:
N, M = map(int, input().split())
S = str(input())
T = str(input())

if M > N:
	M, N = N, M
	S, T = T, S

import math
G = N*M//math.gcd(N, M)

A = []
B = []

C = N//math.gcd(N,M)
D = M//math.gcd(N,M)

for i in range (0, math.gcd(N,M)):
	if S[i*C] != T[i*D]:
		print(-1)
		exit()

print(G)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
S = str(input())
T = str(input())

if M > N:
	M, N = N, M
	S, T = T, S

import math
G = N*M//math.gcd(N, M)

A = []
B = []

for i in range (0, N):
	A.append(1+i*G//N) 
for i in range (0, M):
	B.append(1+i*G//M)

import bisect
FA = []
FB = []

for i in range (0, M):
	if A.count(B[i]) != 0:
		FA.append(A.index(B[i]))
		FB.append(i)
        
for i in range (0, len(FA)):
	if S[FA[i]] != T[FB[i]]:
		print(-1)
		exit()
print(G)

Fixed submission:
N, M = map(int, input().split())
S = str(input())
T = str(input())

if M > N:
	M, N = N, M
	S, T = T, S

import math
G = N*M//math.gcd(N, M)

A = []
B = []

C = N//math.gcd(N,M)
D = M//math.gcd(N,M)

for i in range (0, math.gcd(N,M)):
	if S[i*C] != T[i*D]:
		print(-1)
		exit()

print(G)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

if M%N == 0:
	print(M//N)
	exit()

A = []
for i in range (1, M//N+1):
	if M%i == 0:
		A.append(i)

print(A[-1])

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

if M%N == 0:
	print(M//N)
	exit()

A = []
for i in range (1, M//N+1):
	if M%i == 0:
		A.append(i)

print(A[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
L = list(map(int, input().split()))
 
if N == 1:
	if L[0]%M == 0:
		print(1)
		exit()
	else:
		print(0)
		exit()

for i in range (0, N):
	L[i] = L[i]%M

count = 0
 
for i in range (1, N):
	L[i]+= L[i-1]
    
for i in range (0, N):
	L[i] = L[i]%M

L = sorted(L)
 
alreadythere = []
 
for i in range (0, N):
	if alreadythere.count(L[i])>0 or L[i] == 0:
		continue
	else:
		alreadythere.append(L[i])
		V = L[i]
		D = L.count(L[i])
		count+= int(D*(D-1)/2)

V = L.count(0)
count+= V+int(V*(V-1)/2)
 
print(count)

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

if N == 1:
	if L[0]%M == 0:
		print(1)
		exit()
	else:
		print(0)
		exit()

for i in range (0, N):
	L[i] = L[i]%M

count = 0

for i in range (1, N):
	L[i]= (L[i-1]+L[i])%M

L = sorted(L)

alreadythere = []
import collections

cnt = collections.Counter()
for number in L:
	cnt[number] += 1

L = set(L)

for i in L:
	if i == 0:
		K = cnt[i]
		count+=(int(K*(K-1)/2)+K)
	else:
		K = cnt[i]
		count+=int(K*(K-1)/2)

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
L = list(map(int, input().split()))

if N == 1:
	if L[0]%M == 0:
		print(1)
		exit()
	else:
		print(0)
		exit()

for i in range (0, N):
	L[i] = L[i]%M

count = 0

for i in range (1, N):
	L[i]+= L[i-1]
    
for i in range (0, N):
	L[i] = L[i]%M

L = sorted(L)

alreadythere = []

for i in range (0, N):
	if alreadythere.count(L[i])>0 or L[i] == 0:
		continue
	else:
		alreadythere.append(L[i])
		V = L[i]
		D = L.count(L[i])
		count+= int(D*(D-1)/2)

V = L.count(0)
count+= V+int(V*(V-1)/2)

print(count)

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

if N == 1:
	if L[0]%M == 0:
		print(1)
		exit()
	else:
		print(0)
		exit()

for i in range (0, N):
	L[i] = L[i]%M

count = 0

for i in range (1, N):
	L[i]= (L[i-1]+L[i])%M

L = sorted(L)

alreadythere = []
import collections

cnt = collections.Counter()
for number in L:
	cnt[number] += 1

L = set(L)

for i in L:
	if i == 0:
		K = cnt[i]
		count+=(int(K*(K-1)/2)+K)
	else:
		K = cnt[i]
		count+=int(K*(K-1)/2)

print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = str(input())

count = S.count('E')

if S[0] == 'E':
	coun-=1

countmin = count

for i in range (1, N):
	if S[i] == 'E':
		count-=1
	if S[i-1] == 'W':
		count+=1
	if count < countmin:
		countmin = count

print(countmin) 

Fixed submission:
N = int(input())
S = str(input())

count = S.count('E')

if S[0] == 'E':
	count-=1

countmin = count

for i in range (1, N):
	if S[i] == 'E':
		count-=1
	if S[i-1] == 'W':
		count+=1
	if count < countmin:
		countmin = count

print(countmin)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))
L = sorted(L)

import math

maxcomb = 0
pair = 0

for i in range (0, N):
	z = math.comb(L[-1], L[i])
	if z > maxcomb:
		maxcomb = z
		pair = i

print(L[-1], L[pair])

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

import math
import bisect
max = L[-1]
maxdiv2 = max//2
posleft = bisect.bisect_left(L, maxdiv2)
posright = bisect.bisect_right(L, maxdiv2)

if len(L) == 2:
	print(L[1], L[0])
	exit()

if posleft!= posright:
	print(max, L[posleft])
	exit()

if abs(max/2 - L[posleft]) > abs(max/2 - L[posleft-1]):
	print(max, L[posleft-1])
else:
	print(max, L[posleft])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int, input().split()))

L = sorted(L)

import math

seikai = 0
Emu = L[-1]
calc = 0

for i in range (0, N-1):
	P = math.comb(Emu, L[i])
	if P > calc:
		calc = P
		seikai = L[i]

print(L[-1], seikai)

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

import math
import bisect
max = L[-1]
maxdiv2 = max//2
posleft = bisect.bisect_left(L, maxdiv2)
posright = bisect.bisect_right(L, maxdiv2)

if len(L) == 2:
	print(L[1], L[0])
	exit()

if posleft!= posright:
	print(max, L[posleft])
	exit()

if abs(max/2 - L[posleft]) > abs(max/2 - L[posleft-1]):
	print(max, L[posleft-1])
else:
	print(max, L[posleft])

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

L = sorted(L)

import math

def combination(n, r):
	value = 1
	smaller = min(n-r, r)
	for i in range (0, smaller):
		value = value*(n-i)
	value = value/math.factorial(smaller)
	return value

seikai = 0
Emu = L[-1]
calc = 0

for i in range (0, N-1):
	if combination(Emu, L[i]) > calc:
		calc = combination(Emu, L[i])
		seikai = L[i]

print(L[-1], seikai)

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

import math
import bisect
max = L[-1]
maxdiv2 = max//2
posleft = bisect.bisect_left(L, maxdiv2)
posright = bisect.bisect_right(L, maxdiv2)

if len(L) == 2:
	print(L[1], L[0])
	exit()

if posleft!= posright:
	print(max, L[posleft])
	exit()

if abs(max/2 - L[posleft]) > abs(max/2 - L[posleft-1]):
	print(max, L[posleft-1])
else:
	print(max, L[posleft])
Buggy python submission (verdict: Runtime Error):
s= str(input())
t= str(input())

S = ['a']*len(s)
T = ['a']*len(t)

for i in range (0, len(s)):
	S[i]=ord(s[i])

for i in range (0, len(t)):
	T[i]=ord(t[i])

S = sorted(S)
T = sorted(T, reverse=True)

check = 0

for i in range (0, len(s)):
	if S[i] < T[i]:
		print('Yes')
		exit()
	elif S[i] == T[i]:
		check+=1

if check == len(S) and len(T)>len(S):
	print('Yes')
else:
	print('No')

Fixed submission:
s= str(input())
t= str(input())

S = ['a']*len(s)
T = ['a']*len(t)

for i in range (0, len(s)):
	S[i]=ord(s[i])

for i in range (0, len(t)):
	T[i]=ord(t[i])

S = sorted(S)
T = sorted(T, reverse=True)

check = 0

for i in range (0, min(len(s), len(t))):
	if S[i] < T[i]:
		print('Yes')
		exit()
	elif S[i] == T[i]:
		check+=1

if check == min(len(S),len(t)) and len(T)>len(S):
	print('Yes')
else:
	print('No')