Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[0]*N
B=list(map(int,input().split()))
A[0]=B[0]
A[N-1]=B[N-2]
for i in range(1,N-1):
  A[i]=min(B[i],B[i+1])
  
print(sum(A))

Fixed submission:
N=int(input())
B=list(map(int,input().split()))
A=[0]*N
A[0]=B[0]
A[N-1]=B[N-2]
for i in range(1,N-1):
  A[i]=min(B[i-1],B[i])
  
print(sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans=0

for i in range(N):
  ans+=i
  
print(ans)

Fixed submission:
N = int(input())
ans=(N*(N-1))//2
  
print(int(ans))
Buggy python submission (verdict: Runtime Error):
a,b = int(input.split())

x=a+b
y=a-b
z=a*b
print(max(x,y,z))

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

c=a+b
d=a-b
e=a*b
print(max(c,d,e))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a=[]
cnt=0
for i in range(N):
  a.append(input())
for j in range(N):
  a[j]=list(sorted(a[j]))
for k in range(N):
  cnt += (a.count(a[k])-1)
  
print(int(cnt/2))

Fixed submission:
# coding: utf-8

N = int(input())
alp = [chr(i) for i in range(97, 97+26)]
L = []
for i in range(N):
    s = list(input())
    L.append(s)
for i in range(N):
    L[i].sort()
L.sort()

ans = 0
cnt = 1
for i in range(N-1):
    if L[i]==L[i+1]:
        cnt += 1
    else:
        ans += cnt*(cnt-1)//2
        cnt = 1
if cnt > 1:
    ans += cnt*(cnt-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
#解答２
N = int(input())
H = list(map(int,input().split()))
stp = 0
for i in range(N-1):
    if H[i] == H[i+1]+1:#そのままforループ。次が１だけ低ければ１足して、
        H[i+1] += 1　　　
    elif H[i+1] >= H[i]:#同じ高さ以上なら無問題、
         pass
    else:#２以上低ければアウト
        stp += 1
        print("No")
        break
if stp == 0:
    print("Yes")

Fixed submission:
N = int(input())
H = list(map(int,input().split()))
stp=0
for i in range(N-1,0,-1):
    if H[i]+1 == H[i-1]:
        H[i-1]-=1
    elif H[i] >= H[i-1]:
        pass
    elif H[i] < H[i-1]+1:
        print("No")
        stp = 1
        break
if stp != 1:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
N.d = map(int,input().split())

if N%(2*d+1)==0:
  print(N/(2*d+1))
else:
  print((N/(2*d+1))+1)

Fixed submission:
N,d = map(int,input().split())
 
if N%(2*d+1)==0:
  print(int(N/(2*d+1)))
else:
  print(int((N/(2*d+1))+1))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a=[]
for i in range(N):
  a.append(input())
  
for j in range(N):
  modori=a.pop(j)
  print(max(a))
  a.insert(j,modori)
  


Fixed submission:
N = int(input())
a=[]
for i in range(N):
  a.append(int(input()))

a1=max(a)
b=sorted(a)
a2=b[N-2]

for j in range(N):
  if a[j] != a1:
    print(a1)
  else:
    print(a2)
Buggy python submission (verdict: Runtime Error):
#解答
w, h, x, y = list(map(int, input().split()))
ans = 0
 
if ((x, y) == (w / 2, h / 2)):
    print("{s} {mul}".format(s=(w * h / 2), mul=1))
else:
    print("{s} {mul}".format(s=(w * h / 2), mul=0))
w, h, x, y = list(map(int, input().split()))
ans = 0

if ((x, y) == (w / 2, h / 2)):
    print("{s} {mul}".format(s=(w * h / 2), mul=1))
else:
    print("{s} {mul}".format(s=(w * h / 2), mul=0))

Fixed submission:
#解答
w, h, x, y = list(map(int, input().split()))
ans = 0
 
if ((x, y) == (w / 2, h / 2)):
    print("{s} {mul}".format(s=(w * h / 2), mul=1))
else:
    print("{s} {mul}".format(s=(w * h / 2), mul=0))
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
import sys
input = sys.stdin.readline
N,M=map(int,input().split())
A=[0]*M
for i in range(M):
    A[i]=int(input())
#print(A)
def dp(n):
    dp=[0]*(N+1)
    dp[0]=1
    dp[1]=0 if 1 in A else 1
    for i in range(N-1):
        if (i+2) in A:
            dp[i+2]=0
        else:
            dp[i+2]=dp[i+1]+dp[i]
    return dp[n]
print(dp(N)%(10**9+7))

Fixed submission:
# coding: utf-8
import sys
input = sys.stdin.readline
N,M=map(int,input().split())
A=[0]*M
dp=[-1]*(N+1)
for i in range(M):
    tmp=int(input())
    dp[tmp]=0
#print(dp)
dp[0]=1
dp[1]=0 if dp[1]==0 else 1

for i in range(2,N+1):
    if dp[i]!=0:
        dp[i]=dp[i-1]+dp[i-2]
        
print(dp[N]%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
N,M=map(int,input().split())
A=[0]*M
for i in range(M):
    A[i]=int(input())
#print(A)
def dp(n):
    dp=[0]*(N+1)
    dp[0]=1
    dp[1]=0 if 1 in A else 1
    for i in range(N-1):
        if (i+2) in A:
            dp[i+2]=0
        else:
            dp[i+2]=dp[i+1]+dp[i]
    return dp[n]
print(dp(N)%(10**9+7))

Fixed submission:
# coding: utf-8
import sys
input = sys.stdin.readline
N,M=map(int,input().split())
A=[0]*M
dp=[-1]*(N+1)
for i in range(M):
    tmp=int(input())
    dp[tmp]=0
#print(dp)
dp[0]=1
dp[1]=0 if dp[1]==0 else 1

for i in range(2,N+1):
    if dp[i]!=0:
        dp[i]=dp[i-1]+dp[i-2]
        
print(dp[N]%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
N,M=map(int,input().split())
A=[0]*M
for i in range(M):
    A[i]=int(input())
#print(A)
def dp(n):
    dp=[0]*(N+1)
    dp[0]=1
    dp[1]=0 if 1 in A else 1
    for i in range(N-1):
        if (i+2) in A:
            dp[i+2]=0
        else:
            dp[i+2]=dp[i+1]+dp[i]
    return dp[n]
print(dp(N)%(10**9+7))

Fixed submission:
# coding: utf-8
import sys
input = sys.stdin.readline
N,M=map(int,input().split())
A=[0]*M
dp=[-1]*(N+1)
for i in range(M):
    tmp=int(input())
    dp[tmp]=0
#print(dp)
dp[0]=1
dp[1]=0 if dp[1]==0 else 1

for i in range(2,N+1):
    if dp[i]!=0:
        dp[i]=dp[i-1]+dp[i-2]
        
print(dp[N]%(10**9+7))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input(),split())
n=int((a*3+b)/2)

print(n)

Fixed submission:
a,b=map(int,input().split())
n=int((a*3+b)/2)
 
print(n)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
l=[]
r=[]
for i in range(N):
  a,b=map(int,input().split())
  l.append(a)
  r.append(b)
  
  
ans=min(r)-max(l)+1
print(ans)

Fixed submission:
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
L=[]
R=[]
for i in range(m):
  L.append(l[i][0])
  R.append(l[i][1])
print(max(min(R)-max(L)+1,0))

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
l=[]
r=[]
for i in range(M):
  a,b=map(int,input().split())
  l.append(a)
  r.append(b)
  
  
ans=min(b)-max(a)+1
print(ans)

Fixed submission:
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
L=[]
R=[]
for i in range(m):
  L.append(l[i][0])
  R.append(l[i][1])
print(max(min(R)-max(L)+1,0))

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
l=[]
r=[]
for i in range(N):
  a,b=map(int,input().split())
  l.append(a)
  r.append(b)
  
  
ans=min(b)-max(a)+1
print(ans)

Fixed submission:
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
L=[]
R=[]
for i in range(m):
  L.append(l[i][0])
  R.append(l[i][1])
print(max(min(R)-max(L)+1,0))

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
a,b=map(int,input().split())
 
l_=[int(n) for n in range(a,b+1)]
 
for i in range(M-1):
  c,d=map(int,input().split())
  if max(c,d)<= a or min(c,d) => b:
    pass
  else:
    l__=[n for n in range(c,d+1)]
    l_=list(set(l_)&set(l__))
  
  
print(len(l_))

Fixed submission:
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
L=[]
R=[]
for i in range(m):
  L.append(l[i][0])
  R.append(l[i][1])
print(max(min(R)-max(L)+1,0))

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

l_=[int(n) for n in range(a,b+1)]

for i in range(M-1):
  c,d=map(int,input().split())
  l__=[n for n in range(c,d+1)]
  l_=list(set(l_)&set(l__))
  
print(len(l_))

Fixed submission:
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
L=[]
R=[]
for i in range(m):
  L.append(l[i][0])
  R.append(l[i][1])
print(max(min(R)-max(L)+1,0))
Buggy python submission (verdict: Runtime Error):
N,k=map(int,input().split())
ans=0
for i in range(1,N+1):
  cnt=0
  while i < k:
    frag*(1/2)
    cnt+=1
    i*=2
  ans += (1/N)*i*((1/2)**cnt)
print(ans)

Fixed submission:
N, K = map(int, input().split())
cnt = 0
for i in range(1, N+1):
	tmp = i
	x = 0
	while tmp < K:
		tmp *= 2
		x += 1
	cnt += (1 / N) * (0.5 ** x)
print(cnt)

Buggy python submission (verdict: Runtime Error):
N,k=map(int,input().split())
ans=0
for i in range(1,N+1):
  cnt=0
  while i < k:
    frag*(1/2)
    cnt+=1
    i*=2
  ans += (1/N)*i*(1/2)**cnt
print(ans)

Fixed submission:
N, K = map(int, input().split())
cnt = 0
for i in range(1, N+1):
	tmp = i
	x = 0
	while tmp < K:
		tmp *= 2
		x += 1
	cnt += (1 / N) * (0.5 ** x)
print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
k = int(input())

t = s.replace(s[k],"*")
    
print(t)

Fixed submission:
n = int(input())
s = input()
t = [i for i in s]
k = int(input())
moji = " "
for j in range(len(t)):
  if t[j] != t[k-1]:
    t[j]="*"

for k in t:
  moji+=k
print(moji)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input())

ans = 0
a = max(a,b)
b = min(a,b)
ans += a
a -= 1
a = max(a,b)
b = min(a,b)
ans += a

print(ans)

Fixed submission:
a,b = map(int,input().split())
 
ans = 0
c = max(a,b)
d = min(a,b)
ans += c
c -= 1
e = max(c,d)
f = min(a,b)
ans += e
 
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b c = map(int,input().split())

if a == b == c:
  print("Yes")
else:
  print("No")

Fixed submission:
a,b,c = map(int,input().split())
 
if a == b == c:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N,Q = map(int,input().split())
s = input()
a = []
b = 0
for i in range(Q+1):
  a.append(map(int,input().split())
for j in range(Q+1):
           for k in range(2):
               if "AC" in a[j,k]:
                   b[j] = a[j,k].count("AC")
               else:
                   b[j] = 0
for l in range(len(b)):
           print(b[i])

Fixed submission:
# coding: utf-8
N,Q=map(int,input().split())
S=list(input())
W=[0]*N
W[0]=0

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

for i in range(Q):
    l,r=map(int,input().split())
    print(W[r-1]-W[l-1])
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
n = 0
for i in range(min(a,b)):
  if a%i == 0 and b%i == 0:
    n += 1
    if n ==c:
      print(i)
      break
    else:
      pass

Fixed submission:
import fractions
a,b,K = map(int,input().split())
g = fractions.gcd(a,b)
cnt = 0
ans = 0
for i in range(g,0,-1):
    if g % i == 0:
        cnt += 1
        if cnt == K:
            ans = i
            break
    else:
        pass
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
n = 0
for i in range(min(a,b)):
  if a%i = 0 and b%i =0:
    n += 1
    if n ==c:
      print(i)
      break
    else:
      pass

Fixed submission:
import fractions
a,b,K = map(int,input().split())
g = fractions.gcd(a,b)
cnt = 0
ans = 0
for i in range(g,0,-1):
    if g % i == 0:
        cnt += 1
        if cnt == K:
            ans = i
            break
    else:
        pass
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
total = 0
for i in range(N):
  a,b = map(int(input()))
  if b = "JPY":
    total += a
  else:
    total += a * 380000
print(total)

Fixed submission:
N = int(input())
total = 0
for i in range(N):
  a,b = map(str,input().split())
  if b == "JPY":
    total += float(a)
  else:
    total += float(a) * 380000
print(total)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

ans = input().split()

for i in range(N):
  b = input().split()
  c = set(ans) & set(b)
  ans = list(c)
  
print(len(ans))

Fixed submission:
N,M = map(int,input().split())
L = [0]*N
for i in range(N):
    L[i] = list(map(int,input().split()))
for i in range(N):
    del L[i][0]
L.sort() #第一要素でソート

ans = 0
for i in range(1,M+1):
    cnt = 0
    for j in range(N):
        if i in L[j]:
            cnt += 1
    if cnt == N:
        ans += 1
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = sorted(list(map(int,input().split())))
m = A[0]
for i in range(m-1):
    for j in range(1,len(A)):
        A[j] = A[j] % A[0]
    A = [k for k in A if k != 0]
    A.sort()

print(A[0])

Fixed submission:
N = int(input())
A = sorted(list(map(int,input().split())))
while len(A) > 1:
    for j in range(1,len(A)):
        A[j] = A[j] % A[0]
    A = [k for k in A if k != 0]
    A.sort()

print(A[0])
Buggy python submission (verdict: Runtime Error):
x = int(input())
if x == 3,5,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,5,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):
# coding: utf-8
import math
N,M=map(int,input().split())
A=[]
for i in range(1,int(math.sqrt(M))):
    if M%i==0:
        if M//i>=N:
            A.append(i)
            if i>=N and M//i>i:
                A.append(M//i)

A.sort()

print(A[-1])

Fixed submission:
# coding: utf-8
import math
N,M=map(int,input().split())
A=[]
for i in range(1,int(math.sqrt(M))+1):
    if M%i==0:
        if M//i>=N:
            A.append(i)
            if i>=N and M//i>i:
                A.append(M//i)

A.sort()

ans=A[-1]

print(ans)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import math
N,M=map(int,input().split())

for i in range(1,int(math.sqrt(M))):
    if M%i==0:
        if M//i>=N:
            ans=i
            
print(ans)

Fixed submission:
# coding: utf-8
import math
N,M=map(int,input().split())
A=[]
for i in range(1,int(math.sqrt(M))+1):
    if M%i==0:
        if M//i>=N:
            A.append(i)
            if i>=N and M//i>i:
                A.append(M//i)

A.sort()

ans=A[-1]

print(ans)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

h, w = map(int,input().split())
A = []

for i in range(h):
    l = list(input())
    if list(set(l)) == ['.']:
        h -= 1
    else:
        A.append(l)
#for a in A:
    #print(a)
Ans = []
for i in range(w):
    cnt = 0
    for j in range(h):
        if A[j][i] == '.':
            cnt += 1
    if cnt == h:
        Ans.append(i)

for i in Ans:
    for j in range(h):
        del A[j][i]

for a in A:
    print(''.join(a))

Fixed submission:
# coding: utf-8
import fractions
#N = int(input())

h, w = map(int,input().split())
h_list = []
w_list = []
F = []
for i in range(h):
    l = list(input())
    F.append(l)
    if list(set(l)) == ['.']:
        w_list.append(i)
        
for i in range(w):
    cnt = 0
    for j in range(h):
        if F[j][i] == '.':
            cnt += 1
        else:
            break
    if cnt == h:
        h_list.append(i)
A = []
#print(h_list,w_list)#ここまでOK
for i in range(h):
    if i not in w_list:
        l = []
        for j in range(w):
            if j not in h_list:
                #print(F[i][j])
                l.append(F[i][j])
        
        A.append(l)

for i in range(len(A)):
    print(''.join(A[i]))
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
import math
n = int(input())
#x, y = map(int,input().split())
A = list(map(int,input().split()))
ans = 0
B=  []
for i in range(n):
    B.append(A[i]-(i+1))
B.sort()
m = B[n//2]
m2=B[n//2+1]
tmp1=0
tmp2=0
#print(m,m2)
for i in range(n):
    tmp1 += abs(A[i]-(i+1)-m)
    tmp2 += abs(A[i]-(i+1)-m2)
print(min(tmp1, tmp2))

Fixed submission:
# coding: utf-8
import math
n = int(input())
#x, y = map(int,input().split())
A = list(map(int,input().split()))
ans = 0
B=  []
for i in range(n):
    B.append(A[i]-(i+1))
B.sort()
if n==1:
    m=B[0]
    m2=B[0]
else:
    m = B[n//2]
    m2=B[n//2+1]
tmp1=0
tmp2=0
#print(m,m2)
for i in range(n):
    tmp1 += abs(A[i]-(i+1)-m)
    tmp2 += abs(A[i]-(i+1)-m2)
print(min(tmp1, tmp2))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=[i for i in input()]
ans=float('inf')
for i in range(N):
    l=S[:i]
    r=S[i+1:]
    E_change=l.count('W')
    W_change=r.count('E')
    ans=min(E_change+W_change,ans)
print(ans)

Fixed submission:
# coding: utf-8
#累積和
N=int(input())
S=[i for i in input()]

pls_E=[0]*N
pls_W=[0]*N

#初期値
if S[N-1]=='E':
    pls_E[N-1]=1
else:
    pls_E[N-1]=0
    
if S[0]=='W':
    pls_W[0]=1
else:
    pls_W[0]=0

#Wの累積和(左から)
for i in range(1,N):
    if S[i]=='W':
        pls_W[i]=pls_W[i-1]+1
        
    else:
        pls_W[i]=pls_W[i-1]

#Eの累積和（右から）
for i in range(N-2,-1,-1):
    if S[i]=='E':
        pls_E[i]=pls_E[i+1]+1
    else:
        pls_E[i]=pls_E[i+1]

#print(pls_W,pls_E)
ans=float('inf')
for i in range(1,N-1):
    ans=min(ans,pls_W[i-1]+pls_E[i+1])
    
print(min(ans,pls_E[1],pls_W[N-2]))
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
N=int(input())
ans=0
n=0
sn=str(N)
w=[int(i) for i in sn]
wa=sum(w)

for i in range(N):
    if 10**i>N:
        n=i
        break
n0=int(str(N)[0])
n1=int(str(N)[1])
if n==1 or n==0:
    print(N)
elif n==2:
    ans=max(wa,9+n0)
    print(ans)
else:
    ans=9*(n-1)
    #print(n0,n1)
    if n1==0:
        ans=ans+n0-1
        print(ans)
    else:
        ans=max(ans,ans-9+n1-1+n0,ans+n0-1)
        print(ans)

Fixed submission:
N = int(input())

if len(str(N)) == 1:
    ans = N
else:
    s = list(str(N))
    S = s[1:]
    #print(S)
    #print(['9']*((len(str(N)))-1))
    if S == ['9']*((len(str(N)))-1):
        ans = int(str(N)[0]) + 9 * (len(str(N))-1)
        #print('YYY')
    else:
        ans = int(str(N)[0]) + 9 * (len(str(N))-1) - 1

print(ans)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
N=int(input())
ans=0
for i in range(N):
    if 10**i>N:
        n=i
        break
#print(n)
if n==1:
    print(N)
else:
    ans=9*(n-1)
    n0=int(str(N)[0])
    n1=int(str(N)[1])
    #print(n0,n1)
    if n1==0:
        print(ans)
    else:
        ans=max(ans,ans-9+n1-1+n0,ans+n0-1)
        print(ans)

Fixed submission:
N = int(input())

if len(str(N)) == 1:
    ans = N
else:
    s = list(str(N))
    S = s[1:]
    #print(S)
    #print(['9']*((len(str(N)))-1))
    if S == ['9']*((len(str(N)))-1):
        ans = int(str(N)[0]) + 9 * (len(str(N))-1)
        #print('YYY')
    else:
        ans = int(str(N)[0]) + 9 * (len(str(N))-1) - 1

print(ans)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
a=int(input())
b=int(input())
c=int(input())
X=int(input())
l1=X//a
l2=X//b
l3=X//c
ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            #p=a*i+b*j+c*k
            #print(p)
            if 500*i+100*j+50*k==X:
                ans+=1
                
print(ans)

Fixed submission:
# coding: utf-8
# Your code here!
l = []

for i in range(4):
    l.append(int(input()))

x = l[3]
ans = 0
for i in range(l[0]+1):
    for j in range(l[1]+1):
        for k in range(l[2]+1):
            if 500 * i + 100 * j + 50 * k == x:
                ans += 1
                
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
import collections
N=int(input())
A=list(map(int,input().split()))
c = collections.Counter(A)
ans=0
n=len(set(A))
for i in range(n):
    a=int(c.most_common()[i][0])
    b=c.most_common()[i][1]
    if a <= b:
        ans+=b-a
    else:
        ans+=b
print(ans)

Fixed submission:
import collections
N=int(input())
A=list(map(int,input().split()))
c = collections.Counter(A)
ans=0
n=len(set(A))
c_=c.most_common()
for i in range(n):
    a=int(c_[i][0])
    b=c_[i][1]
    if a <= b:
        ans+=b-a
    else:
        ans+=b
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(input().split())
b = [int(i) for i in a]
c=0
print(a)
ans=0
def cal2(k):
    return k /2

while True:
    for i in range(len(a)):
        c+=int(a[i][-1])
        if  c% 2 == 0:
            b = list(map(cal2,b))
            ans+=1
        else:
            print(ans)
print(ans)

Fixed submission:
import numpy as np
N=int(input())
A=list(map(int,input().split()))
A=np.array(A)
ans=2**9
for i in A:
  cnt=0
  while i%2==0:
    i=i/2
    cnt+=1
  if ans > cnt:
    ans=cnt
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(input().split())
b = [int(i) for i in a]
ans=0
def cal2(k):
    return k /2

while True:
    if  sum(b)% 2 == 0:
        b = list(map(cal2,b))
        ans+=1
else:
    print(ans)
print(ans)

Fixed submission:
import numpy as np
N=int(input())
A=list(map(int,input().split()))
A=np.array(A)
ans=2**9
for i in A:
  cnt=0
  while i%2==0:
    i=i/2
    cnt+=1
  if ans > cnt:
    ans=cnt
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
import collections
N,K=map(int,input().split())
A=list(map(int,input().split()))
m=len(set(A))
#print(m,K)
ans=0
if K>=m:
    print(0)
else:
    c = collections.Counter(A)
    for i in range(m-K):
        ans+=c.most_common()[m-1-i][1]
    print(ans)

Fixed submission:
import sys
input = sys.stdin.readline
import collections
N,K=map(int,input().split())
A=list(map(int,input().split()))
m=len(set(A))
ans=0
if K>=m:
    print(0)
else:
    c = collections.Counter(A)
    c_=c.most_common()
    for i in range(m-K):
        ans+=c_[m-1-i][1]
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
N,K=map(int,input().split())
A=list(map(int,input().split()))
m=len(set(A))
#print(m,K)
ans=0
if K>=m:
    print(0)
else:
    c = collections.Counter(A)
    for i in range(m-K):
        ans+=c.most_common()[m-1-i][1]
    print(ans)

Fixed submission:
import sys
input = sys.stdin.readline
import collections
N,K=map(int,input().split())
A=list(map(int,input().split()))
m=len(set(A))
ans=0
if K>=m:
    print(0)
else:
    c = collections.Counter(A)
    c_=c.most_common()
    for i in range(m-K):
        ans+=c_[m-1-i][1]
    print(ans)
Buggy python submission (verdict: Runtime Error):
N =int(input())
a=N[0]
b=N[1]
c=N[2]
d=N[3]
if a==b==c:
  print('Yes')
elif b==c==d:
  print('Yes')
else:
  print('No')

Fixed submission:
N =input()
a=int(N[0])
b=int(N[1])
c=int(N[2])
d=int(N[3])
if a==b==c:
  print('Yes')
elif b==c==d:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N= int(input())
L=[0]*(N+1)
a=2
b=1
​
for i in range(1,N+1):
    L[0]=2
    L[1]=1
    L[i]=L[i-1]+L[i-2]
    
print(L[N])

Fixed submission:
N= int(input())
L=[0]*(N+1)
L[0]=2
L[1]=1
for i in range(2,N+1):
    
    L[i]=L[i-1]+L[i-2]
    
print(L[N])
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())

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

if X>Y:
  print(">")
elif X<Y:
  print("<")
else:
  print("=")

Fixed submission:
x,y = 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,z= map(int,input().split())
 
rem=x-y
 
print(int(rem/(y+z)+1)

Fixed submission:
# coding: utf-8
# Your code here!
x,y,z=map(int,input().split())
n=1#最初は一人
while True:
    l=y*n+(n+1)*z
    if l>x:
        break
    else:
        n+=1
        ans=n
ans-=1
print(ans)

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

rem=x-y

print(int(rem/(y+z))

Fixed submission:
# coding: utf-8
# Your code here!
x,y,z=map(int,input().split())
n=1#最初は一人
while True:
    l=y*n+(n+1)*z
    if l>x:
        break
    else:
        n+=1
        ans=n
ans-=1
print(ans)