Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):

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

count = 0
while True:
  x = 0
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    for i in A:
      i /= 2
    count += 1

print(count)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
A = np.array(A)
count = 0
while True:
  x = 0
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A = A / 2
    count += 1

print(count)

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

count = 0
while True:
  x = 0
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A = A / 2
    count += 1

print(count)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
A = np.array(A)
count = 0
while True:
  x = 0
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A = A / 2
    count += 1

print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
x = 0
count = 0
while True:
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A = A / 2
    count += 1

print(count)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
A = np.array(A)
count = 0
while True:
  x = 0
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A = A / 2
    count += 1

print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
x = 0
count = 0
while True:
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A /= 2
    count += 1

print(count)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
A = np.array(A)
count = 0
while True:
  x = 0
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A = A / 2
    count += 1

print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
x = 0
count = 0
while True:
  for i in A:
    if i % 2 == 1:
      x == 1
  if x == 1:
    break
  else:
    A /= 2
    count += 1

print(count)

Fixed submission:
import numpy as np
N = int(input())
A = list(map(int,input().split()))
A = np.array(A)
count = 0
while True:
  x = 0
  for i in A:
    if i % 2 == 1:
      x = 1
  if x == 1:
    break
  else:
    A = A / 2
    count += 1

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

a = []
for i in range(1,N + 1):
  count = 0
  while True:
    if i % 2 == 0:
      i /= 2
    count += 1
    else:
      break
  a.append(count)
print(a.index(max(a)) + 1)


Fixed submission:
N = int(input())

a = []
for i in range(1,N + 1):
  count = 0
  while True:
    if i % 2 == 1:
      break
    else:
      i /= 2
      count += 1
  a.append(count)
print(a.index(max(a)) + 1)

Buggy python submission (verdict: Runtime Error):
N = int(input())

a = []
for i in range(1,N + 1):
  count = 0
  while True:
    if i % 2 == 0:
      i /= 2
    count += 1
    else:
      break
  a.append(count)
print(a.index(max(X)) + 1)

Fixed submission:
N = int(input())

a = []
for i in range(1,N + 1):
  count = 0
  while True:
    if i % 2 == 1:
      break
    else:
      i /= 2
      count += 1
  a.append(count)
print(a.index(max(a)) + 1)

Buggy python submission (verdict: Runtime Error):
N = int(input())

a = []
for i in range(1,N + 1):
  count = 0
  while True:
    if i % 2 == 0:
      i /= 2
    count += 1
    else:
      break
  a.append(count)
print(a.index(max(X) + 1))

Fixed submission:
N = int(input())

a = []
for i in range(1,N + 1):
  count = 0
  while True:
    if i % 2 == 1:
      break
    else:
      i /= 2
      count += 1
  a.append(count)
print(a.index(max(a)) + 1)

Buggy python submission (verdict: Runtime Error):
N = int(input())

a = []
for i in range(1,N + 1):
  count = 0
  while True:
    if i % 2 == 0:
      i /= 2
    count += 1
    else:
      break
  a.append(count)
print(a.index(max(X) + 1)

Fixed submission:
N = int(input())

a = []
for i in range(1,N + 1):
  count = 0
  while True:
    if i % 2 == 1:
      break
    else:
      i /= 2
      count += 1
  a.append(count)
print(a.index(max(a)) + 1)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse = True)
total = 0
for i in li[:K]
  total += i
  
print(total)

Fixed submission:
N,K = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse = True)
total = 0
for i in li[:K]:
  total += i
  
print(total)

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse = True)
total = 0
for i in li[:k-1]:
  total += i
  
print(total)

Fixed submission:
N,K = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse = True)
total = 0
for i in li[:K]:
  total += i
  
print(total)
Buggy python submission (verdict: Runtime Error):
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 and z <= k:
      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 and z <= K:
      count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
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 and z <= k:
        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 and z <= K:
      count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
K,S = map(int,input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    if 0 <= S - x - y <= k:
        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 and z <= K:
      count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    for z in range(K + 1):
      total = x + y + z
      if total == 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 and z <= K:
      count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
K,S = map(int,input().split())
count = 0
for x in range(K + 1):
  for y in range(K + 1):
    for z in range(K + 1):
      total = x + y + z
      if total = 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 and z <= K:
      count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import decimal
n = int(input())
v = list(map(int, input().split()))
v = sorted(v)

temp = 0

for i in range(1,n):
    if i == 1:
        temp += decimal.Decimal((v[0] + v[1])/2)
    else:
        sum_ = decimal.Decimal((temp + v[i])/2)

print(sum_)


Fixed submission:
import decimal
n = int(input())
v = list(map(int, input().split()))
v = sorted(v)

temp = 0
sum_ = 0

for i in range(1,n):
    if i == 1:
        temp += decimal.Decimal((v[0] + v[1])/2)
    else:
        temp = decimal.Decimal((temp + v[i])/2)

print(temp)

Buggy python submission (verdict: Runtime Error):
import decimal
n = int(input())
v = list(map(int, input().split()))
v = sorted(v)

temp = 0

for i in range(1,n):
    if i == 1:
        temp += decimal.Decimal((v[0] + v[1])/2)
    else:
        print(temp, v[i])
        sum_ = decimal.Decimal((temp + v[i])/2)

print(sum_)

Fixed submission:
import decimal
n = int(input())
v = list(map(int, input().split()))
v = sorted(v)

temp = 0
sum_ = 0

for i in range(1,n):
    if i == 1:
        temp += decimal.Decimal((v[0] + v[1])/2)
    else:
        temp = decimal.Decimal((temp + v[i])/2)

print(temp)
Buggy python submission (verdict: Runtime Error):
if len(str(n)) == 6:
    print(90909)
elif len(str(n)) == 4:
    print(909)
elif len(str(n)) == 2:
    print(9)
elif len(str(n)) == 1:
    print(n)
elif len(str(n)) == 3:
    print(9 + (n - 100) + 1)
elif len(str(n)) == 5:
    print(9 + 900 + (n - 10000) + 1)


Fixed submission:
n = int(input())

if len(str(n)) == 6:
    print(90909)
elif len(str(n)) == 4:
    print(909)
elif len(str(n)) == 2:
    print(9)
elif len(str(n)) == 1:
    print(n)
elif len(str(n)) == 3:
    print(9 + (n - 100) + 1)
elif len(str(n)) == 5:
    print(9 + 900 + (n - 10000) + 1)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(input())
S_ = ''

S[K+1] = S[K+1].lower()
for i in range(N):
    S_ += S[i]

print(S_)


Fixed submission:
N, K = map(int, input().split())
S = list(input())
S_ = ''

S[K-1] = S[K-1].lower()
for i in range(N):
    S_ += S[i]

print(S_)
Buggy python submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
a = []
for i in range(N+1):
    a.append(list(map(int, input().split())))

count = 0
sum = 0
for i in range(1, N+1):
    for j in range(M):
        sum += int(a[0][j]) * int(a[i][j])
    if sum + int(C) > 0:
        count += 1
        sum = 0
    else:
        sum = 0

print(count)


Fixed submission:
s = [input().split() for i in range(2)]

a, b, c, d = int(s[0][0]), int(s[0][1]), int(s[1][0]), int(s[1][1])

sum_cells_count = a * b
row_cells_count = b * c
col_cells_count = (a - c) * d

filled_cells_count = row_cells_count + col_cells_count

blank_cells_count = sum_cells_count - filled_cells_count
print(blank_cells_count)

Buggy python submission (verdict: Runtime Error):
s = [input().split() for i in range(2)]
print(s)

sum_cells_count = s[0][0] * s[0][1]
row_cells_count = s[0][1] * s[1][0]
col_cells_count = s[0][0] - s[1][0]

filled_cells_count = row_cells_count + col_cells_count

return sum_cells_count - filled_cells_count


Fixed submission:
s = [input().split() for i in range(2)]

a, b, c, d = int(s[0][0]), int(s[0][1]), int(s[1][0]), int(s[1][1])

sum_cells_count = a * b
row_cells_count = b * c
col_cells_count = (a - c) * d

filled_cells_count = row_cells_count + col_cells_count

blank_cells_count = sum_cells_count - filled_cells_count
print(blank_cells_count)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys

def part_sum(a,A):
  N=len(a)
  dp=[[0 for i in range(A+1)] for j in range(N+1)]
  dp[0][0]=1

  for i in range(N):
    for j in range(A+1):
      if a[i]<=j: 
        dp[i+1][j]=dp[i][j-a[i]] or dp[i][j]
      else: 
        dp[i+1][j]=dp[i][j]
  return dp[N][A]

n,k=list(map(int,input().split()))
a=list(map(int,input().split()))

s=sum(a)
s_factors=[]

l=int(math.sqrt(s))

for i in range(1,l+1):
    if s%i==0:
        s_factors.append(i)
        s_factors.append(s//i)

s_factors.sort()

for f in s_factors[::-1]:
    b=[a[i]%f for i in range(n)]
    c=[f-a[i]%f for i in range(n)]
    
    b.sort()
    c.sort()
    c=c[::-1]

    for i in range(n):
        if sum(b[:i+1])==sum(c[i+1:]):
            if sum(b[:i+1])<=k:
                print(f)
                sys.exit()

Fixed submission:
import math
import sys

n,k=list(map(int,input().split()))
a=list(map(int,input().split()))

s=sum(a)
s_factors=[]

l=int(math.sqrt(s))

for i in range(1,l+1):
    if s%i==0:
        s_factors.append(i)
        s_factors.append(s//i)

s_factors.sort()

for f in s_factors[::-1]:
    b=[a[i]%f for i in range(n)]
    c=[f-a[i]%f for i in range(n)]
    
    b.sort()
    c.sort()
    c=c[::-1]

    sb=[0 for i in range(n)]
    sc=[0 for i in range(n)]
    
    sb[0]=b[0]
    sc[0]=c[0]

    for i in range(1,n):
        sb[i]=sb[i-1]+b[i]

    for i in range(1,n):
        sc[i]=sc[i-1]+c[i]

    for i in range(n):
        if sb[i]==sc[n-1]-sc[i]:
            if sb[i]<=k:
                print(f)
                sys.exit()
Buggy python submission (verdict: Runtime Error):
s=input()

target="keyence"
j=0

for i in range(len(s)):
    if s[i]==target[j]:
        j+=1

if j==len(target):
    print('YES')
else:
    print('NO')


Fixed submission:
import sys

s=input()

target="keyence"
j=0
mismatch=0

for i in range(len(target)):
    if target[:i]==s[:i] and target[i:]==s[-7+i:]:
        print('YES')
        sys.exit()
print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
n=len(s)

ans=0

a=[]
for i in range(n):
    if s[i]=="B":
        a.append(0)
    else:
        a.append(1)

count=0
pre=-1
while True:
    if count==pre:
        break
    pre=count
    for i in range(n):
        if i+1<n and a[i]==0 and a[i+1]==1:
            a[i]=1
            a[i+1]=0
            count+=1
    
print(count)

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

ans=0
j=0
for i in range(n):
    if s[i]=="W":
        ans+=(i-j)
        j+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=list(map(int,input().split())

if a%2==1 and b%2==1:
    print('Yes')
else:
    print('No')



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

if a*b%2==0:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
import sys

s=input()
k=int(input())


i=0
while i<=k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        sys.exit()
print("1")

Fixed submission:
import sys

s=input()
k=int(input())


i=0
while i<len(s) and i<k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        sys.exit()
print("1")

Buggy python submission (verdict: Runtime Error):
import sys

s=input()
k=int(input())


i=0
while i<k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        sys.exit()
print(s[i])

Fixed submission:
import sys

s=input()
k=int(input())


i=0
while i<len(s) and i<k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        sys.exit()
print("1")

Buggy python submission (verdict: Runtime Error):
s=input()
k=int(input())

if s[0]=="1":
    print(s[1])
else:
    print(s[0])

Fixed submission:
import sys

s=input()
k=int(input())


i=0
while i<len(s) and i<k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        sys.exit()
print("1")
Buggy python submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))

if n==1:
    print(0)
    sys.exit()

def abs(a):
    if a<0:
        return -a
    else:
        return a

for i in range(n):
    a[i]=a[i]-i-1

ans=10**12
a.sort()
if n<20:
    for b in a:
        S=0
        for j in range(n):
            S+=abs(a[j]-b)
        ans=min(ans,S)
    if ans==10**12:
        ans=0
    print(ans)
    sys.exit()

mid=n//2
if a[mid]<0:
    b_choice=a[mid-20:mid]
else:
    b_choice=a[mid:mid+20]
for b in b_choice:
    S=0
    for j in range(n):
        S+=abs(a[j]-b)
    ans=min(ans,S)
if ans==10**12:
    ans=0
print(ans)

Fixed submission:
n=int(input())

if n%2==0:
    print(n)
else:
    print(2*n)

Buggy python submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))

if n==1:
    print(0)
    sys.exit()

def abs(a):
    if a<0:
        return -a
    else:
        return a

for i in range(n):
    a[i]=a[i]-i-1

ans=10**12
a.sort()
if n<50:
    for b in a:
        S=0
        for j in range(n):
            S+=abs(a[j]-b)
        ans=min(ans,S)
    if ans==10**12:
        ans=0
    print(ans)
    sys.exit()

mid=n//2
if a[mid]<0:
    b_choice=a[mid-20:mid]
else:
    b_choice=a[mid:mid+20]
for b in range(b_choice):
    S=0
    for j in range(n):
        S+=abs(a[j]-b)
    ans=min(ans,S)
if ans==10**12:
    ans=0
print(ans)

Fixed submission:
n=int(input())

if n%2==0:
    print(n)
else:
    print(2*n)
Buggy python submission (verdict: Runtime Error):
n=input()
s=0
for i in range(len(n)):
    s+=int(n[i])

if int(n)%s==0:
    print('Yes')
else:
    print('No')
tanakashunshounoMacBook-P

Fixed submission:
n=input()
s=0
for i in range(len(n)):
    s+=int(n[i])

if int(n)%s==0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
a,b=list(map(int, input().split()))
if a<=8 and b<=8:
    print(‘Yay!’)
else:
    print(‘:(’)


Fixed submission:
a,b=list(map(int, input().split()))
if a<=8 and b<=8:
    print('Yay!')
else:
    print(':(')
Buggy python submission (verdict: Runtime Error):
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(1000)]
cand[0]=1
for i in range(2,log_x+1):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x+1]))

Fixed submission:
def abs(a):
  if a<0:
    return a*(-1)
  else:
    return a

a,b,c,d=list(map(int,input().split()))
if abs(a-b)<=d and abs(b-c)<=d:
  print('Yes')
elif abs(a-c)<=d:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(x)]
cand[0]=1
for i in range(2,x):
    cand[i]=int(pow(x,1.0/i))**i
print(max(cand))


Fixed submission:
def abs(a):
  if a<0:
    return a*(-1)
  else:
    return a

a,b,c,d=list(map(int,input().split()))
if abs(a-b)<=d and abs(b-c)<=d:
  print('Yes')
elif abs(a-c)<=d:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(x)]
cand[0]=1
for i in range(2,log_x+1):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x]))

Fixed submission:
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(1001)]
cand[0]=1
for i in range(2,1000):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x+1]))

Buggy python submission (verdict: Runtime Error):
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(x)]
cand[0]=1
for i in range(2,log_x+1):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x+1]))

Fixed submission:
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(1001)]
cand[0]=1
for i in range(2,1000):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x+1]))
Buggy python submission (verdict: Runtime Error):
s=input()
o=s.count('o')

print o*800+(len(s)-o)*700

Fixed submission:
s=input()
o=s.count('o')
print(700+100*o)
Buggy python submission (verdict: Runtime Error):
n,x=list(map(int,input()))
m=[]
sum=0
for i in range(n):
  mi=int(input())
  m.append(mi)
  sum+=mi

ans=n+(x-sum)/min(m)
print(ans)



Fixed submission:
n,x=list(map(int,input().split()))
m=[]
sum=0
for i in range(n):
  mi=int(input())
  m.append(mi)
  sum+=mi

ans=n+int((x-sum)/min(m))
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=raw_input().split()
n=int(a+b)
if(sqrt(n)**2==n):
  print "Yes"
else:
  print "No"

Fixed submission:
import math
a,b=raw_input().split()
n=int(a+b)
if(int(math.sqrt(n))**2==n):
  print "Yes"
else:
  print "No"
Buggy python submission (verdict: Runtime Error):
s=input()
s="2018"+s[4:]
print s

Fixed submission:
s=input()
s="2018"+s[4:]
print(s)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=input().split()
dict={}
for i in a:
  if i not in dict:
    dict[i]=1
  else:
    dict[i]+=1

ans=0
for i in dict.keys():
  count=dict[i]
  if count>i:
    ans+=count-i
  elif count<i:
    ans+=count

print(ans)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
dict={}
for i in a:
  if i not in dict:
    dict[i]=1
  else:
    dict[i]+=1

ans=0
for i in dict.keys():
  count=dict[i]
  if count>i:
    ans+=count-i
  elif count<i:
    ans+=count

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
a.sort()
a_uniq=set(a)

ans=0
for i in a_uniq:
  count=a.count(i)
  if count>i:
    ans+=count-i
  elif count<i:
    ans+=count

print(ans)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
dict={}
for i in a:
  if i not in dict:
    dict[i]=1
  else:
    dict[i]+=1

ans=0
for i in dict.keys():
  count=dict[i]
  if count>i:
    ans+=count-i
  elif count<i:
    ans+=count

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
a.sort()
a_uniq=set(a)

ans=0
for i in a_uniq:
  if a.count(i)>i:
    ans+=a.count(i)-i
  elif a.count(i)<i:
    ans+=a.count(i)

print(ans)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
dict={}
for i in a:
  if i not in dict:
    dict[i]=1
  else:
    dict[i]+=1

ans=0
for i in dict.keys():
  count=dict[i]
  if count>i:
    ans+=count-i
  elif count<i:
    ans+=count

print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=map(int,input().split())

ans=0
for i in range(n):
  if a.count(i)>i:
    ans+=a.count(i)-i
  elif a.count(i)<i:
    ans+=a.count(i)

print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
dict={}
for i in a:
  if i not in dict:
    dict[i]=1
  else:
    dict[i]+=1

ans=0
for i in dict.keys():
  count=dict[i]
  if count>i:
    ans+=count-i
  elif count<i:
    ans+=count

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

a.sort()
b.sort()
c.sort()

def binary_search(x,i):
	low = 0
	high = len(x)-1
	t = (low + high) // 2 	
	while (low<=high):
		if (i==x[t]):
			break
		elif (i > x[t]):
			low = t + 1
		elif (i < x[t]):
			high = t - 1
		t = (low + high) // 2
	return t

ans=0
for i in range(n):
  b_l=binary_search(b,a[i])
  for j in range(b_l+1,n):
    c_l=binary_search(c,b[j])
    ans+=n-c_l-1

print(ans)   

Fixed submission:
import bisect

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

a.sort()
b.sort()
c.sort()
ans=0
for i in range(n):
	a_l=bisect.bisect_left(a,b[i])
	c_l=bisect.bisect(c,b[i])
	ans+=a_l*(n-c_l)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

a.sort()
b.sort()
c.sort()

def binary_search(x,i):
	low = 0
	high = len(x)-1
	t = (low + high) // 2 	
	while (low<=high):
		if (i==x[t]):
			break
		elif (i > x[t]):
			low = t + 1
		elif (i < x[t]):
			high = t - 1
		t = (low + high) // 2
	return t

ans=0
for i in range(n):
  b_l=binary_search(b,a[i])
  for j in range(b_l+1,n):
    c_l=binary_search(c,b[j])
    ans+=n-c_l-1

print(ans)   

Fixed submission:
import bisect

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

a.sort()
b.sort()
c.sort()
ans=0
for i in range(n):
	a_l=bisect.bisect_left(a,b[i])
	c_l=bisect.bisect(c,b[i])
	ans+=a_l*(n-c_l)

print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

a.sort()
b.sort()
c.sort()

def binary_search(x,i):
	low = 0
	high = len(x)
	t = (low + high) // 2 
	while (low<=high):
		if (i==x[t]):
			break
		elif (i > x[t]):
			low = t + 1
		elif (i < x[t]):
			high = t - 1
		t = (low + high) // 2
	return t

ans=0
for i in range(n):
  b_l=binary_search(b,a[i])
  for j in range(b_l+1,n):
    c_l=binary_search(c,b[j])
    ans+=n-c_l-1

print(ans)    


Fixed submission:
import bisect

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

a.sort()
b.sort()
c.sort()
ans=0
for i in range(n):
	a_l=bisect.bisect_left(a,b[i])
	c_l=bisect.bisect(c,b[i])
	ans+=a_l*(n-c_l)

print(ans)