Harryxun/stf_run huggingface dataset:
import math
import itertools

N,M,Q = map(int,input().split())
a =[0] * Q
b =[0] * Q
c =[0] * Q
d =[0] * Q
for i in range(Q):
    a[i] , b[i] , c[i] , d[i] = map(int,input().split())





def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))



All =[0] * M
for i in range(M):
    All[i] = i+1

#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。



#M個のうちからN個取り出す順列
ans = 0
for A in itertools.product(All, N):
    #点数計算
    print(A)
    wa = 0
    for i in range(Q):
        print(wa) 
        kari = A[b[i]-1] - A[a[i]-1]
        if kari == c[i]:
            wa = wa + d[i] 
    if ans < wa:
        ans = wa
    #print(ans) 
    #print(wa) 


print(ans)



























### FIXED CODE ###

import math
import itertools

N,M,Q = map(int,input().split())
a =[0] * Q
b =[0] * Q
c =[0] * Q
d =[0] * Q
for i in range(Q):
    a[i] , b[i] , c[i] , d[i] = map(int,input().split())




Al =[0] * M
for i in range(M):
    Al[i] = i+1


#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
All = list(itertools.combinations_with_replacement(Al, N))


#M個のうちからN個取り出す順列
ans = 0
#for A in itertools.combinations(All, N):
for A in All:
    #点数計算
    #print(A)
    wa = 0
    for i in range(Q):
        #print(wa) 
        kari = A[b[i]-1] - A[a[i]-1]
        if kari == c[i]:
            wa = wa + d[i] 
    if ans < wa:
        ans = wa
    #print(ans) 
    #print(wa) 


print(ans)
from collections import deque
H, W = map(int, input().split()) 
S = [list(input()) for i in range(H)]

Kuro = 0
Shiro = 0
for j in range(H):
    for i in range(W):
        if S[j][i]=='.':
            Shiro += 1
        else:
            Kuro += 1

Dis =[[0]*W for i in range(H)]
X =[-1, 0, 1, 0]
Y =[0, -1, 0, 1]
q = deque()
q.append((0,0))
while True:
    y,x = q.popleft()
    if (y==H-1) and (x==W-1):
        break
    for i in range(4):
        nx = x + X[i]
        ny = y + Y[i]
        if (0<= nx < W) and(0 <= ny < H) and (S[ny][nx]=='.') and(Dis[ny][nx] ==0):
            q.append((ny,nx))
            Dis[ny][nx] = Dis[y][x] +1

print(Shiro-Dis[H-1][W-1]-1)    

### FIXED CODE ###

import sys
from collections import deque
sys.setrecursionlimit(10**8)

H, W = map(int, input().split()) 
S = [list(input()) for i in range(H)]

Kuro = 0
Shiro = 0
for j in range(H):
    for i in range(W):
        if S[j][i]=='.':
            Shiro += 1
Dis =[[-1]*W for i in range(H)]
X =[-1, 0, 1, 0]
Y =[0, -1, 0, 1]
q = deque()
q.append((0,0))
Dis[0][0] = 0
a=deque()
while (q != a):
    y,x = q.popleft()
    if (y==H-1) and (x==W-1):
        break
    for i in range(4):
        nx = x + X[i]
        ny = y + Y[i]
        if (0<= nx < W) and(0 <= ny < H) and (S[ny][nx]=='.') and (Dis[ny][nx] ==-1):
            q.append((ny,nx))
            Dis[ny][nx] = Dis[y][x] +1

if (Dis[H-1][W-1]==-1):
    print(-1)
else:
    print(Shiro-Dis[H-1][W-1]-1)
a, b = [int(x) for x in input().split()]
if a <= b:
  return str(a) * b
else:
  return str(b) * a

### FIXED CODE ###

a, b = [int(x) for x in input().split()]
if a <= b:
  print(str(a) * b)
else:
  print(str(b) * a)
import copy
n=int(input())
num_list=[int(input()) for i in range(n)]

buf = []

for i in range(n):
  buf = copy.copy(num_list)
  buf.pop(i)
  print(max(buf))


### FIXED CODE ###

r = int(input())

print(3 * r * r)
n = input()
       
S = range(1, 14)
H = range(1, 14)
C = range(1, 14)
D = range(1, 14)
       
for i in range(0, n):
   mk, num = raw_input()split()
      if mk == 'S':
         S[int(num)-1] = 0
      elif mk == 'H':
         H[int(num)-1] = 0
      elif mk == 'C':
         C[int(num)-1] = 0
      elif mk == 'D':
         D[int(num)-1] = 0
       
for i in range(1, 13):
   if S[i] != 0:
      print 'S '+ str(S[i])
      
for i in range(0, 13):
   if S[i] != 0:
      print 'H '+ str(H[i])
      
for i in range(0, 13):
   if S[i] != 0:
      print 'C '+ str(C[i])
      
for i in range(0,13):
   if S[i] != 0:
      print 'D '+ str(D[i])

### FIXED CODE ###

n=input()
  
s=range(1,14)
h=range(1,14)
c=range(1,14)
d=range(1,14)
   
for i in range(n):
   m, k=raw_input().split()
   if m == 'S':
      s[int(k)-1] = 0
   elif m == 'H':
      h[int(k)-1] = 0
   elif m == 'C':
      c[int(k)-1] = 0
   elif m == 'D':
      d[int(k)-1] = 0
  
for i in range(0, 13):
   if s[i] != 0:
      print 'S '+str(s[i])
  
for i in range(0, 13):
   if h[i] != 0:
      print 'H '+str(h[i])
  
for i in range(0, 13):
   if c[i] != 0:
      print 'C '+str(c[i])
  
for i in range(0, 13):
   if d[i] != 0:
      print 'D '+str(d[i])
import sys


def dfs(idx):
    for x in arr[idx]:
        if not vis[x]:
            vis[x] = True
            dfs(x)


n, m = map(int, input().split())

arr = [[] * (n + 1) for _ in range(n + 1)]
vis = [False] * (n + 1)

for _ in range(m):
    a, b = map(int, sys.stdin.readline().split())
    arr[a].append(b)
    arr[b].append(a)

ans = 0

dfs(1)
for i in range(2, n + 1):
    if not vis[i]:
        vis[i] = True
        dfs(i)
        ans += 1
for i in range(1, n + 1):
    if not vis[i]:
        ans += 1
print(ans)


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)


def dfs(idx):
    for x in arr[idx]:
        if not vis[x]:
            vis[x] = True
            dfs(x)


n, m = map(int, input().split())

arr = [[] * (n + 1) for _ in range(n + 1)]
vis = [False] * (n + 1)

for _ in range(m):
    a, b = map(int, sys.stdin.readline().split())
    arr[a].append(b)
    arr[b].append(a)

ans = 0

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

dfs(1)
for i in range(2, n + 1):
    if not vis[i]:
        vis[i] = True
        dfs(i)
        ans += 1

print(ans)
# -*- coding: utf-8 -*-

n = int(input())
k = int(input())
x = list(map(int, input().split())) #x[0->(n-1)]

sum = 0

for i in x:
    if i < k - i:
        sum = sum + i
    else:
        sum = sum + k - i

print(sum)

### FIXED CODE ###

# -*- coding: utf-8 -*-

n = int(input())
a = int(input())

print(n*n - a)
def gcd(a, b):
    if a == 0:
        return b
    return gcd(b%a, a)

def lcm(a,b):
    return a*b/gcd(a,b)

if __name__ == '__main__':
    n = input()
    a = list(map(int, input().split()))
    l = 1
    for e in a:
        l = lcm(l,e)
    s = 0
    for e in a:
        s += l/e
    mod = 1000000007
    print(int(s % mod))


### FIXED CODE ###

def gcd(a, b):
    if a == 0:
        return b
    return gcd(b%a, a)

def lcm(a,b):
    return a*b//gcd(a,b)

if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    l = int(1)
    for e in a:
        l = lcm(l,e)
    s = int(0)
    for e in a:
        s += l//e
    mod = int(1000000007)
    print(int(s % mod))
from functools import reduce
import fractions


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())
a = list(map(int, input().split()))
l = lcm_list(a)
ans = sum([l // x for x in a]) %
int(1e9+7)
print(ans)
# print(l)
# print(a)


### FIXED CODE ###

from functools import reduce
import fractions


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())
a = list(map(int, input().split()))
l = lcm_list(a)
ans = sum([l // x for x in a]) % int(1e9+7)
print(ans)
# print(l)
# print(a)
#handshake
from scipy.fft import rfft, irfft
import numpy as np
N, M = map(int, input().split())
A = np.array(input().split(), dtype=np.int32)

x = np.bincount(A)
fft_size = 1 << (2 * x.size + 10).bit_length()

fx = rfft(x, fft_size)
conv = irfft(fx * fx, fft_size)
conv = (conv + 0.5).astype(int)

tmp = np.arange(conv.size, dtype=int)
happy = tmp[np.nonzero(conv)].tolist()
cnt = conv[np.nonzero(conv)].tolist()


ans = 0
while M > 0:
h = happy.pop()
num = cnt.pop()
num = min(M, num)

M -= num
ans += num * h

print(ans)


### FIXED CODE ###

import bisect

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
B = [0] * N
B[-1] = A[-1]
for i in range(N - 2, -1, -1):
    B[i] = B[i+1]+A[i]


def C(mid):
    tmp = 0
    for a in A:
        pos = bisect.bisect_right(A, mid - a)
        tmp += N-pos
    return tmp > M


lb = 0
rb = 10**6
while rb - lb > 1:
    happy = (lb + rb) // 2
    if C(happy):
        lb = happy
    else:
        rb = happy

ans = 0
cnt = 0
for a in A:
    pos = bisect.bisect_right(A, rb - a)
    if pos == N:
        continue
    ans += B[pos]+(N-pos)*a
    cnt += N - pos
ans += (M-cnt)*rb
print(ans)
import math
a,b,c,d = map(int, input().split())

x = c*d/math.gcd(c,d)
A = (a-1) - (a-1)//c - (a-1)//d +x
B = b - (b-1)//c - (b-1)//d +x
print(int(B-A))

### FIXED CODE ###

import fractions
a,b,c,d = map(int, input().split())

x = (c*d)//fractions.gcd(c,d)
A = (a-1) - (a-1)//c - (a-1)//d + (a-1)//x
B = b - b//c - b//d + b//x
print(int(B-A))
k = input().split()
a = k[0]
b = k[1]
c = k[2]
Sum = 0
h = max(k)

Buf = 1
del k[k.index[h]]

for i in k:
    buf = Buf*i

print(int(buf/2))

### FIXED CODE ###

k = input().split()
a = k[0]
b = k[1]
c = k[2]
for i in range(len(k)):
    k[i] = int(k[i])
h = max(k)

Buf = 1
del k[k.index(h)]

for i in k:
    Buf = Buf * int(i)
r = Buf/2
print(int(r))
#-*- coding:utf-8 -*-
N = int(input())
a1 = []
a2 = []
s,t = 0,0

a1 = [int(input()) for i in range(N)]
a2 = [int(input()) for i in range(N)]


for i in range(N-1):
	for j in range(i):
		t += a1[j]
	for k in range(N-1-i):
		t += a2[i+k]
	if t > s:
	    s = t
	t = 0
print(s)

### FIXED CODE ###

#-*- coding:utf-8 -*-
N = int(input())
a1 = []
a2 = []
s,t = 0,0

a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))



for i in range(N):
	for j in range(i+1):
		t += a1[j]
	for k in range(N-i):
		t += a2[i+k]
	if t > s:
	    s = t
	t = 0
print(s)
N,K = map(int,input().split())
int tmp = 0
 
while();
	tmp = N
	if(abs(tmp - K) < tmp);
      	tmp = abs(tmp - K)
   	else;
      	break
 	
print(tmp)

### FIXED CODE ###

import math

N,K = map(int,input().split())
tmp = N%K

while True:
  if abs(tmp - K) < tmp:
    tmp = abs(tmp - K)
  else:
    break
 	
print(tmp)
str1= input().split()
str2= input().split()

for a,b in zip(str1, str2):
    str3 = str3 + a + b

print (str3)

### FIXED CODE ###

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

if (a-b==b-c):
    print("YES")
else:
    print("NO")
#c
n,k = map(int,input().split())
a = list(map(int,input().split()))

for i in range(n-k):
    if a[i]<s[i+1]:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

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

for i in range(n-k):
    if a[i]<a[i+k]:
        print("Yes")
    else:
        print("No")
N,M = map(int,input().split())
a = [0]*N
b = [None]*N
for i in range(M):
  s,c = map(int,input().split())
  if b[s-1] == c:
    continue
  else:
    a[s-1] +=1
    b[s-1] =c
    
count = 0
for i in range(N):
  if a[i]>=2:
    count=-1
  elif b[0]==0 and N>1:
    count =-1
  elif i==0:
    if i is None:
      if N==1:
        b[i] =0
      else:
        b[i]=1
  elif i>0:
    if b[i] is None:
      b[i]=0
b.reverse()
if count == 0:
  for i in range(N):
    count+=b[i]*10**i
print(count)

### FIXED CODE ###

N,M = map(int,input().split())
a = [0]*N
b = [None]*N
for i in range(M):
  s,c = map(int,input().split())
  if b[s-1] == c:
    continue
  else:
    a[s-1] +=1
    b[s-1] =c
    
count = 0
for i in range(N):
  if a[i]>=2:
    count=-1
  elif b[0]==0 and N>1:
    count =-1
  elif i==0:
    if b[i] is None:
      if N==1:
        b[i] =0
      else:
        b[i]=1
  elif i>0:
    if b[i] is None:
      b[i]=0
b.reverse()
if count == 0:
  for i in range(N):
    count+=b[i]*10**i
print(count)
N=int(input())
A=list(int,input())
sum=0
i=0
while i<=N-1:
  sum+=1/A[i]
  i+=1
rev=1/sum
print(rev)


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
sum=0
i=0
while i<=N-1:
  sum+=1/A[i]
  i+=1
rev=1/sum
print(rev)
a=int(input())
if a%2==0:
    print(a/2/a)
else:
    print((a//2+1)a)

### FIXED CODE ###

a=int(input())
if a%2==0:
    print(a/2/a)
else:
    print((a//2+1)/a)
A,B=map(int,input().split())
C = list(map(int,input().split()))
C.sort()
D = C[0]+C[1]+C[2]
print(D)


### FIXED CODE ###

A,B=map(int,input().split())
C = list(map(int,input().split()))
C.sort()
D = 0
for i in range(0,B):
    D = D + C[i]
print(D)
a, b = map(int, input().split())
print((a+b)//2+(a+b) % 2))


### FIXED CODE ###

a, b = map(int, input().split())
print((a+b)//2+(a+b) % 2)
a,b = map(int,input())
print(max([a+a -1, b+b-1, a+b])

### FIXED CODE ###

a,b = map(int,input().split())
print(max([a+a-1,b+b-1,a+b]))
x,y = map(int,input().split())
p = list(map(int,input().split()))

bigNumber = 0

for i in range(x-y+1):
    if sum(p[i:i+y]) > bigNumber:
        bigNumber = number

print((bigNumber + y) / 2)


### FIXED CODE ###

def main():
    x,y = map(int,input().split())
    p = list(map(int,input().split()))

    number = sum(p[0:y])
    bigNumber = number

    for i in range(x-y):

        number = number - p[i] + p[i+y]

        if number > bigNumber:
            bigNumber = number

    print((bigNumber + y) / 2)

main()
x = map(int, input().split())

if x < 1200:
  print('ABC')
else:
  print('ARC')

### FIXED CODE ###

x = int(input())

if x < 1200:
  print('ABC')
else:
  print('ARC')
i1 = list(map(int, f.input().split()))

o1 = ((i1[0]) // (i1[1]*2 + 1))
o2 = ((i1[0]) % (i1[1]*2 + 1))
if o2 == 0:
    print(o1)
else:
    print(o1 + 1)

### FIXED CODE ###

i1 = list(map(int, input().split()))

o1 = ((i1[0]) // (i1[1]*2 + 1))
o2 = ((i1[0]) % (i1[1]*2 + 1))
if o2 == 0:
    print(o1)
else:
    print(o1 + 1)
import math
a, b = map(int, input().split())
print(a * b // math.gcd(a, b))


### FIXED CODE ###

def gcd(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x
a, b = map(int, input().split())
print(a * b // gcd(a, b))
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K, C = map(int, readline().split())
S = list(map(int, readline().split()))
ans = []

def solve(index, K):
    i = 0
    cnt = 0
    while i < N:
        if S[i] == 'o' and i != index:
            cnt += 1
            i += C + 1
        else:
            i += 1
    return cnt < K

if not (solve(-1, K+1)):
    pass
else:
    index = 0
    while index < N:
        if S[index] == 'x':
            index += 1
        elif solve(index, K):
            ans.append(index + 1)
            index += C + 1
        else:
            index += 1

    for i in ans:
        print(i)

### FIXED CODE ###

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

def solve(List):
    ans = []
    i = 0
    while i < N:
        if List[i] == 'o':
            ans.append(i+1)
            i += C
        i += 1
    return ans

n = solve(S)

if len(n) > K:
    pass
else:
    r = solve(S[::-1])
    r = list(map(lambda x: N+1-x, r[::-1]))
    ans = list(set(n) & set(r))
    ans.sort()
    for i in ans:
        print(i)
a=int(input())
b=int(input())
if a % 2 == 0 or b % 2 == 0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

hoge=input()
hoge=hoge.split()
a=int(hoge[0])
b=int(hoge[1])
if a % 2 == 0 or b % 2 == 0:
  print("Even")
else:
  print("Odd")
n = int(input())
a = int(input())
b = int(input())


if n == 1:
    print("Hello World")
else:
    print(a+b)

### FIXED CODE ###

n = int(input())
if n == 2:
    a = int(input())
    b = int(input())


if n == 1:
    print("Hello World")
else:
    print(a+b)
a,b,k=map(int,input().split())
l=range(a,b+1)
for i in range(k):
  print(l[i])

### FIXED CODE ###

A, B, K = map(int,input().split())
ans = []
for i in range(A, B+1)[:K]:
  ans.append(i)
for i in range(A, B+1)[-K:]:
  ans.append(i)
for a in sorted(list(set(ans))):
  print(a)
#copy page
import sys
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

if N == M:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

import sys
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N, M = rl()

if N == M:
    print('Yes')
else:
    print('No')
!/usr/bin/python3
from itertools import product

def solve():
	N = int(input())
	S = [0 if i == 'o' else 1 for i in input()]

	for i, j in product(range(2), repeat=2):
		pattern = [i, j] + [0] * (N - 2) 
		for k in range(2, N):
			pattern[k] = (pattern[k - 1] + pattern[k - 2] + S[k] ) % 2
		if S[-1] != (pattern[-2] + pattern[-1] + pattern[0]) % 2 : 
			continue
		if S[0] != (pattern[-1] + pattern[0] + pattern[1]) % 2 :
			continue 	
		answer = [ 'S' if pattern[k] == 0 else 'W' for k in range(N)]
		print(''.join(answer))
		return None;
	print(-1);

if __name__ == '__main__':
	solve()

### FIXED CODE ###

from itertools import product

def solve():
    N = int(input())
    S = [0 if i == 'o' else 1 for i in input()]
    
    for i, j in product(range(2), repeat=2):
        pat = [i, j] + [0]*(N - 2)
        for k in range(2, N):
            pat[k] = (S[k - 1] - (pat[k - 1] + pat[k - 2])) % 2

        if S[-1] != (pat[0] + pat[-1] + pat[-2]) % 2:
            continue
        if S[0] != (pat[1] + pat[0] + pat[-1]) % 2:
            continue

        ans = ['S' if pat[k] == 0 else 'W' for k in range(N)]
        print(''.join(ans))
        return None

    print(-1)

if __name__ == '__main__':
    solve()
a, b = map(int, input().split())

def kansu_return_flag(a,b):
    
    flag = 0

    for i in range(10**9):
        a_ans = abs(a-i)
        b_ans = abs(b-i)
        if a_ans == b_ans:
            ans = i
            flag = 1
            break
    return flag

flag = kansu_return_flag(a,b)

if flag == 1:
    print(ans)
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

a, b = map(int, input().split())
def kansu_return_flag(a,b):
    ans = 0
    flag = 0

    if abs(a-b)%2 != 0:
        flag = 0
    else:
        ans = (a+b)/2
        flag = 1
    return flag,ans

flag,ans = kansu_return_flag(a,b)

if flag == 1:
    print(int(ans))
else:
    print('IMPOSSIBLE')
A ,B = int(input())
if (A+B)%2==0:
    print((A+B)/2)
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

A= list(map(int,input().split()))
if (A[0]+A[1])%2 == 0:
    print(int((A[0]+A[1])/2))
else:
    print('IMPOSSIBLE')
h,w=map(int,input().split())
a=[]
for i range(h):
  a.append=list(map(list,input().split()))
  a.append=list(map(list,input().split()))
print(a)


### FIXED CODE ###

h,w=map(int,input().split())

a=[]
for i in range(h):
  b=input()
  a.append(b)
  a.append(b)
for i in range(2*h):
  print(a[i])
H = int(input())
ls = [-1]*(H+1)
ls[0] = 0
ls[1] = 1
def battle(h):
  if ls[h] != -1:
    return ls[h]
  else:
    tmp = 2*battle(h//2)
    ls[h] = tmp
    return ls[h]
print(battle(H))

### FIXED CODE ###

H = int(input())

def battle(h):
  if h == 1:
    return 1
  else:
    return 2*battle(h//2)+1
print(battle(H))
N = int(input())
A = list(map(int, input().split()))
B = [0] * 200000
ans = 0
for i in range(N):
	if A[i] < 200000:
		B[A[i]] += 1
	else:
		ans += 1
for i in range(200000):
	ans += min(B[i], abs(i – B[i]))
print(ans)
	


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = [0] * 100001
ans = 0
for i in range(N):
	if A[i] <= 100000:
		B[A[i]] += 1
	else:
		ans += 1
for i in range(100001):
	if B[i] < i:
		ans += B[i]
	else:
		ans += B[i] - i
print(ans)
from collections import Counter, defaultdict, deque
import bisect
from sys import stdin, stdout
from itertools import repeat
import math
import random

# sys.stdin = open('input')

def inp():
    re = map(int, raw_input().split())
    if len(re) == 1:
        return re[0]
    return re

def inst():
    return raw_input().strip()

def gcd(x, y):
   while(y):
       x, y = y, x % y
   return x

def my_main():
        n, k, c = inp()
        st = inst()
        front, end = [], []
        def get(now, ans):
            if len(ans) == k:
                return
            for i in range(now, n):
                if st[i]=='o':
                    ans.append(i+1)
                    return get(i+1+c, ans)
        get(0, front)
        st = st[::-1]
        get(0, end)
        for i in range(len(end)):
            end[i] = n-end[i]+1
        end.sort()
        if len(front)!=k or len(end)!=k:
            return
        ans = []
        # print front, end
        for i in range(k):
            if front[i] == end[i]:
                ans.append(front[i])
        print '\n'.join(map(str, ans))

my_main()


### FIXED CODE ###

from collections import Counter, defaultdict, deque
import bisect
from sys import stdin, stdout
from itertools import repeat
import math
import random

# sys.stdin = open('input')

def inp():
    re = map(int, raw_input().split())
    if len(re) == 1:
        return re[0]
    return re

def inst():
    return raw_input().strip()

def gcd(x, y):
   while(y):
       x, y = y, x % y
   return x

def my_main():
        n, k, c = inp()
        st = inst()
        front, end = [], []
        def get(now, ans):
            while now < n:
                if len(ans) == k:
                    return
                for i in range(now, n):
                    if st[i]=='o':
                        ans.append(i+1)
                        now = i+c+1
                        break
                else:
                    break
        get(0, front)
        st = st[::-1]
        get(0, end)
        for i in range(len(end)):
            end[i] = n-end[i]+1
        end.sort()
        if len(front)!=k or len(end)!=k:
            return
        ans = []
        # print front, end
        for i in range(k):
            if front[i] == end[i]:
                ans.append(front[i])
        if ans:
            print '\n'.join(map(str, ans))

my_main()
N, M = (int(i) for i in input().split())
P = [None for i in range(N+1)]
Tree = [list() for i in range(N+1)]
for index in range(M):
	L, R, D = (int(i) for i in input().split())
	Tree[L].append((R, D))
	Tree[R].append((L,-D))

def process(i):
	global P, Tree
	obj = Tree[i]
	if P[i] is None:
		P[i] = 0
	if len(obj) != 0:
		for j, d in obj:
			if P[j] is None:
				P[j] = P[i] + d
				process(j)
			else:
				if P[j] - P[i] != d:
					print("No")
					exit(0)

for i in range(1,N+1):
	process(i)

print("Yes")

### FIXED CODE ###

import sys

N, M = (int(i) for i in input().split())
P = [None for i in range(N+1)]
Graph = [list() for i in range(N+1)]
for index in range(M):
	L, R, D = (int(i) for i in input().split())
	Graph[L].append((R, D))
	Graph[R].append((L,-D))

def determine(i):
	if P[i] is not None:
		return
	P[i] = 0
	stack = [i]
	while len(stack) != 0:
		I = stack.pop()
		for j, d in Graph[I]:
			if P[j] is None:
				P[j] = P[I] + d
				stack.append(j)

def check(i):
	for j, d in Graph[i]:
		if P[j] - P[i] != d:
			print("No")
			exit(0)

for i in range(1,N+1):
	determine(i)

for i in range(1,N+1):
	check(i)

print("Yes")
N, M = map(int, input().split())
data = [[] for i in range(M)]
ans = [""] * M
num = [0] * M
for i in range(M):
    ken, year = map(int, input().split())
    data[i] = [ken, year, i]
    
data.sort(key=lambda x:x[1])

for p, y, i in data:
    num[p] += 1
    ans[i] = (str(p).zfill(6) + str(num[p]).zfill(6))

for i in ans:
    print(i)

### FIXED CODE ###

N, M = map(int, input().split())
cnt = [0 for i in range(N + 1)] 
check = []
ans = []

for i in range(M):
    p, y = map(int, input().split())
    check.append((y, p, i))

check.sort()

for y, p, i in check:
    cnt[p] += 1
    ans.append((i,str(p).zfill(6)+str(cnt[p]).zfill(6)))

ans.sort()

for aa, bb in ans:
    print(bb)