Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=str(input())
result = float('inf')
for i in range(N):
  S_1 = S[:i].count('W')
  S_2 = S[i+1:].count('E')
  result = min(result,S_1+S_2)
print(result)

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

E=[0]*N
W=[0]*N
c=0
for i in range(N):
  W[i] =c
  if S[i]=='W':
    c +=1
c=0
for j in range(N):
  E[-1-j]=c
  if S[-1-j]=='E':
    c +=1
E=[E[0]]+E+[0]
W=[0]+W+[W[-1]]
answer=float('inf')
for i in range(N+2):
  answer=min(answer,E[i]+W[i])
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=str(input())
result = float('inf')
for i in range(N):
  S_1=S[:i]
  S_2=S[i+1:]
  result = min(result,S_1.count('W')+S_2.count('E'))
print(result)

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

E=[0]*N
W=[0]*N
c=0
for i in range(N):
  W[i] =c
  if S[i]=='W':
    c +=1
c=0
for j in range(N):
  E[-1-j]=c
  if S[-1-j]=='E':
    c +=1
E=[E[0]]+E+[0]
W=[0]+W+[W[-1]]
answer=float('inf')
for i in range(N+2):
  answer=min(answer,E[i]+W[i])
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=str(input())
result = N
for i in range(N):
  S_1=S[:i]
  S_2=S[i+1:]
  result = min(result,S_1.count('W')+S_2.count('E'))
print(result)

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

E=[0]*N
W=[0]*N
c=0
for i in range(N):
  W[i] =c
  if S[i]=='W':
    c +=1
c=0
for j in range(N):
  E[-1-j]=c
  if S[-1-j]=='E':
    c +=1
E=[E[0]]+E+[0]
W=[0]+W+[W[-1]]
answer=float('inf')
for i in range(N+2):
  answer=min(answer,E[i]+W[i])
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=str(input())
result = float('inf')
for i in range(N):
  S_1=S[:i]
  S_2=S[i+1:]
  result = min(result,S_1.count('W')+S_2.count('E'))
print(result)

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

E=[0]*N
W=[0]*N
c=0
for i in range(N):
  W[i] =c
  if S[i]=='W':
    c +=1
c=0
for j in range(N):
  E[-1-j]=c
  if S[-1-j]=='E':
    c +=1
E=[E[0]]+E+[0]
W=[0]+W+[W[-1]]
answer=float('inf')
for i in range(N+2):
  answer=min(answer,E[i]+W[i])
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
S=str(input())
K=int(input())
S_list=list(S)
J=[]
for i in range(len(S)):
  for j in range(i+1,len(S)+1):
    J += [''.join(S[i:j])]
J=sorted(list(set(J)))
print(J[K-1])

Fixed submission:
S=str(input())
K=int(input())
S_list=list(S)
J=[]
for i in range(len(S)):
  for j in range(i+1,min(i+6,len(S)+1)):
    J += [''.join(S[i:j])]
J=sorted(list(set(J)))
print(J[K-1])
Buggy python submission (verdict: Time Limit Exceeded):
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n
 
    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]
 
    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
 
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
 
    return result
N=int(input())
A=[int(x) for x in input().split()]
A=sorted(A,reverse = True)
answer=0
p=0
q=0
for i in range(N-1):
  for j in range(i+1,N):
    answer=max(answer,cmb(A[i],A[j]))
    if cmb(A[i],A[j])==answer:
      p=A[i]
      q=A[j]
print(p,q)

Fixed submission:

N=int(input())
A=[int(x) for x in input().split()]
A=sorted(A,reverse = True)
b=float('inf')
for i in range(1,N):
  b=min(b,abs(A[0]/2-A[i]))
  if b ==abs(A[0]/2-A[i]):
    q=A[i]
  
print(A[0],q)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input().split()
print('Three' if len(set(S))==3 else 'Four')

Fixed submission:
n = int(input())
print(n//3)
Buggy python submission (verdict: Runtime Error):
N,A = map(int,input().split())
if N%500<=A:
    print('YES')
else:
    print('NO')

Fixed submission:
N,A=int(input()),int(input())
print('Yes' if N%500<=A else 'No')

Buggy python submission (verdict: Runtime Error):
N,A = map(int,input().split())
if N%500 <= A:
    print('YES')
else:
    print('NO')

Fixed submission:
N,A=int(input()),int(input())
print('Yes' if N%500<=A else 'No')

Buggy python submission (verdict: Runtime Error):
N,A = map(int,input().split())
a = N%500
if a<=A:
    print('YES')
else:
    print('NO')

Fixed submission:
N,A=int(input()),int(input())
print('Yes' if N%500<=A else 'No')

Buggy python submission (verdict: Runtime Error):
N,A = map(int,input().split())
a = N%500
if a<=A:
    print('YES')
else:
    print('no')

Fixed submission:
N,A=int(input()),int(input())
print('Yes' if N%500<=A else 'No')
Buggy python submission (verdict: Runtime Error):
S =str(input())
print('2018/01/' + s[-2:])

Fixed submission:
s =str(input())
print('2018/01/' + s[-2:])
Buggy python submission (verdict: Time Limit Exceeded):
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
S=[]
for i in range(1,10**5):
  if is_prime(i) and is_prime((i+1)//2):
    S+=[i]

N=int(input())
for i in range(N):
  l,r = map(int,input().split())
  count=0
  for j in range(l,r+1):
    if j in S:
      count +=1
  print(count)

Fixed submission:
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
S=[]
for i in range(1,10**5):
  if is_prime(i) and is_prime((i+1)//2):
    S+=[i]
Count=[0]
count=0
for i in range(1,10**5):
  if i in S:
    count+=1
  Count +=[count]

N=int(input())
for i in range(N):
  l,r=map(int,input().split())
  print(Count[r]-Count[l-1])
Buggy python submission (verdict: Runtime Error):
import numpy as np
S=str(input())
X=[]
c=1
for i in range(1,len(S)):
  if S[i]==S[i-1]:
    c +=1
  elif S[i]!=S[i-1]:
    X +=[c]
    c=1
  if i==len(S)-1:
    X +=[c]
if len(X)>=3:
  X=np.cumsum(X)
  t=float('inf')
  for i in range(len(X)-1):
    u=max(X[i],len(S)-X[i])
    t=min(u,t)
  answer=t
elif len(X)==1:
  answer=X[0]
elif len(X)==2:
  answer=max(X)
print(answer)

Fixed submission:
import numpy as np
S=str(input())
X=[]
c=1
for i in range(1,len(S)):
  if S[i]==S[i-1]:
    c +=1
  elif S[i]!=S[i-1]:
    X +=[c]
    c=1
  if i==len(S)-1:
    X +=[c]
if len(S)==1:
  X=[1]
if len(X)>=3:
  X=np.cumsum(X)
  t=float('inf')
  for i in range(len(X)-1):
    u=max(X[i],len(S)-X[i])
    t=min(u,t)
  answer=t
elif len(X)==1:
  answer=X[0]
elif len(X)==2:
  answer=max(X)
print(answer)

Buggy python submission (verdict: Runtime Error):
S=str(input())
X=[]
c=1
for i in range(1,len(S)):
  if S[i]==S[i-1]:
    c +=1
  elif S[i]!=S[i-1]:
    X +=[c]
    c=1
  if i==len(S)-1:
    X +=[c]
if len(X)>=3:
  if S[0]=='0':
    X.pop(0)
  if S[-1]=='0':
    X.pop(-1)
  P=(len(X)-1)//2
  
  answer= min(X[P-1]+X[P],X[P]+X[P+1])
elif len(X)==1:
  answer=X[0]
elif len(X)==2:
  answer=max(X)
print(answer)

Fixed submission:
import numpy as np
S=str(input())
X=[]
c=1
for i in range(1,len(S)):
  if S[i]==S[i-1]:
    c +=1
  elif S[i]!=S[i-1]:
    X +=[c]
    c=1
  if i==len(S)-1:
    X +=[c]
if len(S)==1:
  X=[1]
if len(X)>=3:
  X=np.cumsum(X)
  t=float('inf')
  for i in range(len(X)-1):
    u=max(X[i],len(S)-X[i])
    t=min(u,t)
  answer=t
elif len(X)==1:
  answer=X[0]
elif len(X)==2:
  answer=max(X)
print(answer)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(a+b+c)

Fixed submission:
s = input()
print(s.count('1'))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
input()
x=np.array(input().split(),dtype=np.int32)

ans=0
while (x%2==0).all():
  x//2
  ans +=1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
result = float('inf') 
for i in a:
    result = min(result,len(bin(i))-bin(i).rfind('1')-1)
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
input()
x=np.array(input().split(),dtype=np.int32)
ans=0
while (x%2==0).all():
  x//2
  ans +=1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
result = float('inf') 
for i in a:
    result = min(result,len(bin(i))-bin(i).rfind('1')-1)
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
input()
x=np.array(input().split(),dtype=np.int32)
ans=0
while (x%2==0).all():
  x//2
  ans +=1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
result = float('inf') 
for i in a:
    result = min(result,len(bin(i))-bin(i).rfind('1')-1)
print(result)

Buggy python submission (verdict: Runtime Error):
import numpy as np
input()
x=np.array(input().split(),dttype=np.int32)
ans=0
while (x%2==0).all():
    x//2
    ans +=1
print(answer)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
result = float('inf') 
for i in a:
    result = min(result,len(bin(i))-bin(i).rfind('1')-1)
print(result)
Buggy python submission (verdict: Runtime Error):
N,Z,W=map(int,input().split())
A=[int(x) for x in input().split()]
if N==1:
  answer=abs(A[1]-W)
else:
  answer=max(abs(W-A[-1]),abs(A[-1]-A[-2]))
print(answer)

Fixed submission:
N,Z,W=map(int,input().split())
A=[int(x) for x in input().split()]
if N==1:
  answer=abs(A[0]-W)
else:
  answer=max(abs(W-A[-1]),abs(A[-1]-A[-2]))
print(answer)

Buggy python submission (verdict: Runtime Error):
N,Z,W=map(int,input().split())
A=[int(x) for x in input().split()]
answer=max(abs(W-A[-1]),abs(A[-1]-A[-2]))
print(answer)

Fixed submission:
N,Z,W=map(int,input().split())
A=[int(x) for x in input().split()]
if N==1:
  answer=abs(A[0]-W)
else:
  answer=max(abs(W-A[-1]),abs(A[-1]-A[-2]))
print(answer)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(x) for x in input().split()]
X = [0]*N
answer = 0
for i in range(N):
  if A[i]==i+1:
    X[i]=1
for i in range(N):
  if X[i]==1:
    answer +=1
    X[i+1]=0
print(answer)

Fixed submission:
N = int(input())
A = [int(x) for x in input().split()]
X = [0]*N
answer = 0
for i in range(N):
  if A[i]==i+1:
    X[i]=1
for i in range(N-1):
  if X[i]==1:
    answer +=1
    X[i+1]=0
if X[N-1]==1:
  answer +=1
print(answer)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
result = float('inf') 
for i in a:
    result = min(result,len(bin(i))-bin(i).rfind('1')-1)
print(result)

Fixed submission:
N = int(input())
print(2**(len(bin(N))-3))
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
K=[]
A=[]
B=[]
answer='IMPOSSIBLE'
for i in range(M):
  a,b=map(int,input().split())
  if a==1:
    A +=[b]
  if b==N:
    B += [a]
for x in B:
  if x in A:
    answer='POSSIBLE'
print(answer)

Fixed submission:
N,M = map(int,input().split())
K=[0]*(N+1)
for i in range(M):
  a,b=map(int,input().split())
  if a==1:
    K[b] +=1
  if b == N:
    K[a] +=1
print('POSSIBLE' if 2 in K else 'IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
K=[]
A=[]
B=[]
answer='IMPOSSIBLE'
for i in range(M):
  a,b=map(int,input().split())
  A +=[a]
  B += [b]
  if a==1 and b==N:
    answer='POSSIBLE'
  if a==1:
    K +=[b]
for i in range(M):
  if A[i] in K and B[i]==N:
    answer='POSSIBLE'
print(answer)

Fixed submission:
N,M = map(int,input().split())
K=[0]*(N+1)
for i in range(M):
  a,b=map(int,input().split())
  if a==1:
    K[b] +=1
  if b == N:
    K[a] +=1
print('POSSIBLE' if 2 in K else 'IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
N,A=int(input()),int(input())
print('Yes' if N%500<=A else 'No')

Fixed submission:
r,g,b=map(int,input().split())
result = (r*100+g*10+b)%4
if result==0:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[int(x) for x in input().split()]
B=[0]*9
for i in range(N):
  R=A[i]//400
  if R>8:
    R=8
  B[R] +=1
answer_min=0
for i in range(8):
  if not B[i]==0:
    answer_min +=1
answer_max=answer_min+B[8]
if answer_max>8:
  answer_max=8
if answer_min=0:
  answer_min=1
print(answer_min,answer_max)

Fixed submission:
N=int(input())
A=[int(x) for x in input().split()]
B=[0]*9
for i in range(N):
  R=A[i]//400
  if R>8:
    R=8
  B[R] +=1
answer_min=0
for i in range(8):
  if not B[i]==0:
    answer_min +=1
answer_max=answer_min+B[8]
if answer_min==0:
  answer_min=1
print(answer_min,answer_max)
Buggy python submission (verdict: Time Limit Exceeded):
N,K =map(int,input().split())
result = []
for i in range(N):
  a,b = map(int,input().split())
  result +=[a]*b
result.sort()
print(result[K-1])

Fixed submission:
N,K =map(int,input().split())
result = [0]*(10**5+1)
for i in range(N):
  a,b = map(int,input().split())
  result[a] += b
count = 0
for j in range(len(result)):
  count += result[j]
  if count >= K:
    print(j)
    break
Buggy python submission (verdict: Runtime Error):
W,A,B = map(int,input().split())
if A <= B:
  a=A
  b=b
else:
  a=B
  b=A
print(b-a-W if a+W<b else int(0))

Fixed submission:
W,A,B = map(int,input().split())
if A <= B:
  a=A
  b=B
else:
  a=B
  b=A
print(b-a-W if a+W<b else int(0))
Buggy python submission (verdict: Time Limit Exceeded):
N= int(input())
p=1
for i in range(N):
  p *= (i+1)
print(p%(10**9+7))

Fixed submission:
import math
n = int(input())
print(math.factorial(n)%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
count =0
for i in range(K+1):
  for j in range(K+1):
    for k in range(K+1):
      if i+j+k==S:
        count +=1
print(count)

Fixed submission:
k, s = map(int, input().split())
count = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if 0 <= z <= k:
            count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,x = map(int,input().split())
count=0
for i in range(a,b+1):
  if i%x == 0:
    count +=1
print(count)

Fixed submission:
a,b,x = map(int,input().split())
print(b//x-(a-1)//x)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,T = map(int,input().split())
A=np.array(input().split(),dtype=np.int32)
s=[]
count=0
for i in range(1,N):
  s += [A[i]-min(A[0:i])]
for j in range(len(s)):
  if s[j]==max(s):
    count +=1
print(count)

Fixed submission:
import numpy as np
N,T = map(int,input().split())
A=np.array(input().split(),dtype=np.int32)
s=A-np.minimum.accumulate(A)
print((s==max(s)).sum())

Buggy python submission (verdict: Time Limit Exceeded):
N,T = map(int,input().split())
A=[int(x) for x in input().split()]
s=[]
count=0
for i in range(1,N):
  s += [A[i]-min(A[0:i])]
for j in range(len(s)):
  if s[j]==max(s):
    count +=1
print(count)

Fixed submission:
import numpy as np
N,T = map(int,input().split())
A=np.array(input().split(),dtype=np.int32)
s=A-np.minimum.accumulate(A)
print((s==max(s)).sum())
Buggy python submission (verdict: Runtime Error):
S , T =  [str(x) for x in input().split()]

A , B =  [int(x) for x in input().split()]

U = input()
    
if S ==  U:
    A = A - 1
else:
    B = B - 1
    
print(A,B)
S = input()
print('x'*len(S))

Fixed submission:
S , T =  [str(x) for x in input().split()]

A , B =  [int(x) for x in input().split()]

U = input()
# S = input()   
if S ==  U:
    A = A - 1
elif T==U:
    B = B - 1   
print(A,B)
Buggy python submission (verdict: Runtime Error):
def areDistinct(arr) : 
  
    n = len(arr) 
  
    s = set() 
    for i in range(0, n):  
        s.add(arr[i]) 
      

    return (len(s) == len(arr)) 
  

N = int(input())
S =  [int(x) for x in input().split()]
  
if (areDistinct(S)):  
    print("YES") 
  
else :  
    print("NO")

Fixed submission:
S = input()
print('x'*len(S))
Buggy python submission (verdict: Runtime Error):
n = int(input())
listV =  list(map(int,input().split()))
sortedListV = sorted(listV)
result = (sortedListV[0] + sortedListV[1]) / 2

for i range (2, n):
    result += (result + sortedListV[i]) / 2
print(result)

Fixed submission:
n = int(input())
listV =  list(map(int,input().split()))
sortedListV = sorted(listV)

for i in range(0 , n-1):
    if (i != 0):
        result = (result + sortedListV[i+1]) / 2
    else:
        result = (sortedListV[i] + sortedListV[i+1]) / 2
print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
listV =  list(map(int,input().split()))
sortedListV = sorted(listV)
result = (sortedListV[0] + sortedListV[1]) / 2

for i range (2, n-1):
    result += (result + sortedListV[i]) / 2
print(result)

Fixed submission:
n = int(input())
listV =  list(map(int,input().split()))
sortedListV = sorted(listV)

for i in range(0 , n-1):
    if (i != 0):
        result = (result + sortedListV[i+1]) / 2
    else:
        result = (sortedListV[i] + sortedListV[i+1]) / 2
print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
listV =  list(map(int,input().split()))
sortedListV = sorted(listV)
result = (sortedListV[0] + sortedListV[1]) / 2

for i range (2, n-1):
    result += (sortedListV[i] + sortedListV[i+1]) / 2
print(result)

Fixed submission:
n = int(input())
listV =  list(map(int,input().split()))
sortedListV = sorted(listV)

for i in range(0 , n-1):
    if (i != 0):
        result = (result + sortedListV[i+1]) / 2
    else:
        result = (sortedListV[i] + sortedListV[i+1]) / 2
print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
listV =  list(map(int,input().split()))
sortedListV = sorted(listV)
result = (sortedListV[0] + sortedListV[1]) / 2

for i range (2, n-1):
    result = (sortedListV[i] + sortedListV[i+1]) / 2
print(result)

Fixed submission:
n = int(input())
listV =  list(map(int,input().split()))
sortedListV = sorted(listV)

for i in range(0 , n-1):
    if (i != 0):
        result = (result + sortedListV[i+1]) / 2
    else:
        result = (sortedListV[i] + sortedListV[i+1]) / 2
print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
listV =  list(map(int,input().split()))
sortedListV = sorted(listV)
result = (sortedListV[0] + sortedListV[1]) / 2

for i range (0,3):
    result = (sortedListV[i] + sortedListV[i+1]) / 2
print(result)

Fixed submission:
n = int(input())
listV =  list(map(int,input().split()))
sortedListV = sorted(listV)

for i in range(0 , n-1):
    if (i != 0):
        result = (result + sortedListV[i+1]) / 2
    else:
        result = (sortedListV[i] + sortedListV[i+1]) / 2
print(result)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ListH = list(map(int,input().split()))
result = 1
for i in range(N):
    out = False
    for k in range(i):
        if k >= 0:
            if ListH[k] > ListH[i]:
                out = True
    if not out :
        result += 1
print(result)

Fixed submission:
a, b = map(int,input().split())
if a > b:
  c = a
  a-=1
else:
  c = b
  b-=1
if a > b:
  c += a
else:
  c += b
print(c)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ListH = list(map(int,input().split()))
result = 1
for i in range(N):
    for k in range(i):
        out = False
        if k >= 0:
            if ListH[k] > ListH[i]:
                out = True
    if not out :
        result += 1
print(result)

Fixed submission:
a, b = map(int,input().split())
if a > b:
  c = a
  a-=1
else:
  c = b
  b-=1
if a > b:
  c += a
else:
  c += b
print(c)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ListH = list(map(int,input().split()))
result = 1
for i in range(N):
    for k in range(i):
        out = False
        if k >= 0:
            if ListH[k] < ListH[i]:
                out = True
    if not out :
        result += 1
print(result)

Fixed submission:
a, b = map(int,input().split())
if a > b:
  c = a
  a-=1
else:
  c = b
  b-=1
if a > b:
  c += a
else:
  c += b
print(c)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ListH = list(map(int,input().split()))
result = 1
for i in range(N):
    for k in range(i):
        out = False
        if k >= 0:
            print(ListH[k],ListH[i])
            if ListH[k] < ListH[i]:
                out = True
    if not out :
        result += 1
print(result)

Fixed submission:
N = int(input())
ListH = list(map(int,input().split()))
result = 0
for i in range(N):
    out = False
    for k in range(i):
        if k >= 0:
            if ListH[k] > ListH[i]:
                out = True
    if not out :
        result += 1
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = {}
for i in range(n):
  x = input()
  if x not in s.keys():
    s[x] = 1
  else:
    s[x] += 1
x = max(list(s.values()))
keys = sorted([k for k, v in s.items() if v == x])
for i in keys:
  print(i)

Fixed submission:
n = int(input())
s = {}
for i in range(n):
  x = input()
  if x not in s.keys():
    s[x] = 1
  else:
    s[x] += 1
x = max(list(s.values()))
keys = sorted([k for k, v in s.items() if v == x])
for i in keys:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = []
for i in range(n):
  s.append(input())
dic = {}
for i in set(s):
  if s.count(i) not in dic.keys():
    dic[s.count(i)] = [i]
  else:
    dic[s.count(i)].append(i)
a = max(list(dic.keys()))
dic[a] = sorted(dic[a])
for i in dic[a]:
  print(i)

Fixed submission:
n = int(input())
s = {}
for i in range(n):
  x = input()
  if x not in s.keys():
    s[x] = 1
  else:
    s[x] += 1
x = max(list(s.values()))
keys = sorted([k for k, v in s.items() if v == x])
for i in keys:
  print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p  = list(map(int,input().split()))
x = 1
for i in range(1,len(p)):
  if p[i] == min(p[:i+1]):
    x += 1
print(x)

Fixed submission:
n = int(input())
p  = list(map(int,input().split()))
x = 1
mn = p[0]
for i in range(1,len(p)):
  if p[i] <= mn:
    x += 1
    mn = p[i]
print(x)
Buggy python submission (verdict: Runtime Error):
import numpy as np
l,r = map(int, input().split())
if ((l-1//2019)<(r//2019))|(((l-1//673)<(r//673))&((l-1//3)<(r//3))):
  print(0)
else:
  arr1 = np.array(range(l,r+1))
  arr2 = np.array(range(l,r+1)).reshape(r-l+1,1)
  arr = arr1*arr2%2019 + (np.identity(r-l+1)*2019)
  print(int(np.min(arr)))

Fixed submission:
import numpy as np
l,r = map(int, input().split())
if ((l//2019)<(r//2019)):
  print(0)
else:
  arr1 = np.array(range(l,r+1))
  arr2 = np.array(range(l,r+1)).reshape(r-l+1,1)
  arr = arr1*arr2%2019 + (np.identity(r-l+1)*2019)
  print(int(np.min(arr)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
l,r = map(int, input().split())
if ((l-1//2019)<(r//2019))|(((l-1//673)<(r//673))&((l-1//3)<(r//3))):
  print(0)
else:
  arr1 = np.array(range(l,r+1))
  arr2 = np.array(range(l,r+1)).reshape(r-l+1,1)
  arr = arr1*arr2%2019
  for i in range(r-l+1):
    arr[i][i] = 2019
  print(np.min(arr))

Fixed submission:
import numpy as np
l,r = map(int, input().split())
if ((l//2019)<(r//2019)):
  print(0)
else:
  arr1 = np.array(range(l,r+1))
  arr2 = np.array(range(l,r+1)).reshape(r-l+1,1)
  arr = arr1*arr2%2019 + (np.identity(r-l+1)*2019)
  print(int(np.min(arr)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
l,r = map(int, input().split())
if (l-1//2019)<(r//2019):
  print(0)
else:
  arr1 = np.array(range(l,r+1))
  arr2 = np.array(range(l,r+1)).reshape(r-l+1,1)
  arr = arr1*arr2%2019
  for i in range(r-l+1):
    arr[i][i] = 2019
  print(np.min(arr))

Fixed submission:
import numpy as np
l,r = map(int, input().split())
if ((l//2019)<(r//2019)):
  print(0)
else:
  arr1 = np.array(range(l,r+1))
  arr2 = np.array(range(l,r+1)).reshape(r-l+1,1)
  arr = arr1*arr2%2019 + (np.identity(r-l+1)*2019)
  print(int(np.min(arr)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
l,r = map(int, input().split())
arr1 = np.array(range(l,r+1))
arr2 = np.array(range(l,r+1)).reshape(r-l+1,1)
arr = arr1*arr2%2019
for i in range(r-l+1):
  arr[i][i] = 2019
print(np.min(arr))

Fixed submission:
import numpy as np
l,r = map(int, input().split())
if ((l//2019)<(r//2019)):
  print(0)
else:
  arr1 = np.array(range(l,r+1))
  arr2 = np.array(range(l,r+1)).reshape(r-l+1,1)
  arr = arr1*arr2%2019 + (np.identity(r-l+1)*2019)
  print(int(np.min(arr)))