Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
a = LIST()
count = 0
flag = 0
while flag == 0:	
	for i in range(N):
		if a[i] % 1024 == 0:
			a[i] /= 1024
			count += 10
			break
	else:
		flag = 1
flag = 0
while flag == 0:	
	for i in range(N):
		if a[i] % 2 == 0:
			a[i] /= 2
			count += 1
			break
	else:
		flag = 1
print(count)

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
a = LIST()
count = 0
flag = 0
"""
while flag == 0:
	print(a)
	for i in range(N):
		if a[i] % 2 == 0:
			a[i] = int(a[i]/2)
			count += 1
			break
	else:
		flag = 1
"""
for i in a:
    while i % 2 == 0:
        count += 1
        i /= 2
print(count)
### BUGGY CODE ###

import queue
import sys

input = sys.stdin.readline


class Solution:
    def main(self):
        H, W = map(int, input().split())
        S = [list(input().rstrip()) for _ in range(H)]

        for i in range(H):
            S[i] = ["#"] + S[i] + ["#"]
        S = [["#"] * (W + 2)] + S + [["#"] * (W + 2)]

        already = set()
        ans = 0
        for i in range(1, H + 1):
            for j in range(1, W + 1):
                if S[i][j] == "#":
                    continue
                for n in range(1, H + 1):
                    for m in range(1, W + 1):
                        if S[n][m] == "#" or (i, j) == (n, m) or (i, j, n, m) in already:
                            continue
                        v = self.min_move(S, (i, j), (n, m))
                        already.add((i, j, n, m))
                        already.add((n, m, i, j))
                        ans = max(ans, v)
        print(ans)

    def min_move(self, map, start, goal):
        moving_range = ((1, 0), (-1, 0), (0, 1), (0, -1))

        q = queue.Queue()
        q.put((start, 0))

        while not q.empty():
            pos, cnt = q.get()
            for move in moving_range:
                i, j = pos[0] + move[0], pos[1] + move[1]
                if (i, j) == goal:
                    return cnt + 1
                if map[i][j] == ".":
                    q.put(((i, j), cnt + 1))


# Run main
if __name__ == '__main__':
    Solution().main()


### FIXED CODE ###

import queue
import sys

input = sys.stdin.readline


class Solution:
    def main(self):
        H, W = map(int, input().split())
        S = [list(input().rstrip()) for _ in range(H)]

        for i in range(H):
            S[i] = ["#"] + S[i] + ["#"]
        S = [["#"] * (W + 2)] + S + [["#"] * (W + 2)]

        ans = 0
        for i in range(1, H + 1):
            for j in range(1, W + 1):
                if S[i][j] == "#":
                    continue
                v = self.min_move(S, (i, j))
                ans = max(ans, v)
        print(ans)

    def min_move(self, map, start):
        moving_range = ((1, 0), (-1, 0), (0, 1), (0, -1))

        q = queue.Queue()
        q.put((start, 0))

        already = {start}
        ret = 0
        while not q.empty():
            pos, cnt = q.get()
            ret = max(ret, cnt)
            for move in moving_range:
                i, j = pos[0] + move[0], pos[1] + move[1]
                if (i, j) not in already and map[i][j] == ".":
                    q.put(((i, j), cnt + 1))
                    already.add((i, j))

        return ret


# Run main
if __name__ == '__main__':
    Solution().main()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**5) #再帰回数を増やさないとREになる


N, M, K = map(int, input().split())
friend = [[] for _ in range(N)]
block = [[] for _ in range(N)]
for _ in range(M):
  a, b = map(int, input().split())
  friend[a-1].append(b-1)
  friend[b-1].append(a-1)
for _ in range(K):
  c, d = map(int, input().split())
  block[c-1].append(d-1)
  block[d-1].append(c-1)


friendnetwork = []
sgn = [0 for _ in range(N)] #groupnumを書いていく
groupnum = 0

def makenetwork(n, groupnum):
  for item in friend[n]:
    if sgn[item] > 0:
      continue
    else:
      sgn[item] = groupnum
      makenetwork(item, groupnum)

for k in range(N):
  if sgn[k] == 0:
    groupnum += 1
    sgn[k] = groupnum
    makenetwork(k, groupnum)


friends = [[] for _ in range(groupnum)]
for k in range(N):
  friends[sgn[k]-1].append(k)

ans = ''
for k in range(N):
  num = len(friends[sgn[k]-1])-1  - len(friend[k])
  for item in block[k]:
    if sgn[item] == sgn[k]:
      num -= 1
  ans += str(num) + ' '

ans.rstrip()
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)


N, M, K = map(int, input().split())
friend = [[] for _ in range(N)]
block = [[] for _ in range(N)]
for _ in range(M):
  a, b = map(int, input().split())
  friend[a-1].append(b-1)
  friend[b-1].append(a-1)
for _ in range(K):
  c, d = map(int, input().split())
  block[c-1].append(d-1)
  block[d-1].append(c-1)


friendnetwork = []
sgn = [0 for _ in range(N)]
groupnum = 0

def makenetwork(n, groupnum):
  for item in friend[n]:
    if sgn[item] > 0:
      continue
    else:
      sgn[item] = groupnum
      makenetwork(item, groupnum)

for k in range(N):
  if sgn[k] == 0:
    groupnum += 1
    sgn[k] = groupnum
    makenetwork(k, groupnum)


friends = [[] for _ in range(groupnum)]
for k in range(N):
  friends[sgn[k]-1].append(k)

ans = []
for k in range(N):
  num = len(friends[sgn[k]-1])-1  - len(friend[k])
  for item in block[k]:
    if sgn[item] == sgn[k]:
      num -= 1
  ans.append(num)

a = str(ans[0])
for j in range(1, len(ans)):
  a += ' '+ str(ans[j])
print(a)
### BUGGY CODE ###

import fractions
 
n = int(input())
a = list(map(int, input().split()))
 
num = a[0]
for i in range(1, n):
	num = num // fractions.gcd(num, a[i])*a[i]
 
ans = 0
for i in range(n):
	ans += (num//a[i])
print(ans%1000000007)

### FIXED CODE ###

import fractions
 
n = int(input())
a = list(map(int, input().split()))
 
l = 1
for i in range(n):
	l = l // fractions.gcd(l, a[i])*a[i]
 
ans = 0
for i in range(n):
	ans += l//a[i]
print(ans%(10**9+7))
### BUGGY CODE ###

s = input()
dp = [1] + [0] * 12
for c in s:
    newdp = [0] * 13
    for d in range(10) if c == '?' else [int(c)]:
        for m in range(13):
            m2 = (m * 10 + d) % 13
            newdp[m2] = (newdp[m2] + dp[m]) % 1000000007
    dp = newdp
print(dp[5])

### FIXED CODE ###

s = input()
dp = [1] + [0] * 12
for c in s:
    newdp = [0] * 13
    for d in range(10) if c == '?' else [int(c)]:
        for m in range(13):
            m2 = (m * 10 + d) % 13
            newdp[m2] = (newdp[m2] + dp[m]) % 1000000007
    dp = newdp
print(dp[5])
### BUGGY CODE ###

N = int(input())

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

V = []
for i in range(N):
    volume = 0
    for j in range(N):
        k = i + j
        if k >= N:
            k -= N
        if j % 2 == 0:
            volume += A[k]
        else:
            volume -= A[k]
    print(volume ,end=' ')

print()

### FIXED CODE ###

N = int(input())

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


volume = 0
for j in range(N):
    if j % 2 == 0:
        volume += A[j]
    else:
        volume -= A[j]
print(volume ,end=' ')

for i in range(1, N):
    volume = 2 * A[i - 1] - volume
    print(volume ,end=' ')

print()
### BUGGY CODE ###

s = input()
t = input()
count = 0
sList = list(s)
tList = list(t)

for i in range(len(sList)):
    if sList == tList:
        break
    if sList[i] != tList[i]:
        sList[i] = tList[i]
        count = count + 1

print(count)

### FIXED CODE ###

s = input()
t = input()
count = 0
sList = list(s)
tList = list(t)

for i in range(len(s)):
    if s[i] != t[i]:
        count = count + 1

print(count)
### BUGGY CODE ###

import numpy as np

N, M = map(int, input().split())

keys = [True] * N

for i in range(M):
    l, r = map(int, input().split())
    newKeys = [False] * N
    for j in range(l - 1, r):
        newKeys[j] = True
    keys = np.logical_and(keys, newKeys)

print(np.sum(keys == True))


### FIXED CODE ###

N, M = map(int, input().split())

keys = [True] * N

l1 = 1
r1 = N

for i in range(M):
    l, r = map(int, input().split())
    if (l1 < l):
        l1 = l
    if (r < r1):
        r1 = r

if (r1 - l1 + 1 > 0):
    print(r1 - l1 + 1)
else:
    print(0)
### BUGGY CODE ###

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

def parent(i):
    return i // 2


def left(i):
    return 2 * i


def right(i):
    return 2 * i + 1

class MaxHeap(list):
    def __init__(self, H=0):
        list.__init__(self)
        self.H = H
        self[:] = [None]

    def insert(self, key):
        self.H += 1
        self.append(-float("inf"))
        self.heapIncreaseKey(self.H, key)

    def heapIncreaseKey(self, i, key):
        if key < self[i]:
            return
        self[i] = key
        while i > 1 and self[parent(i)] < self[i]:
            self[i], self[parent(i)] = self[parent(i)], self[i]
            i = parent(i)

    def heapExtract(self):
        if self.H < 1:
            raise "underflow"
        maximum = self[1]
        self[1] = A[self.H]
        self.pop()
        self.H -= 1
        self.maxHeapify(1)

        return maximum

    def maxHeapify(self, i):
        l = left(i)
        r = right(i)
        if l <= self.H and self[l] > self[i]:
            largest = l
        else:
            largest = i
        if r <= self.H and self[r] > self[largest]:
            largest = r

        if largest != i:
            self[i], self[largest] = self[largest], self[i]
            self.maxHeapify(largest)

    def print(self):
        print(" ".join(map(str, self)))


if __name__ == '__main__':

    A = MaxHeap()
    while True:
        #A.print()
        c = input().split(" ")
        if c[0] == "insert":
            A.insert(int(c[1]))
        elif c[0] == "extract":
            print(A.heapExtract())
        else:
            break




### FIXED CODE ###

# -*- coding: utf-8 -*-
from heapq import heappush, heappop

if __name__ == '__main__':

    q = []
    while True:
        c = input().split(" ")
        if c[0]=='end':
            break
        if c[0]=='insert':
            heappush(q, -int(c[1]))
        else:
            print(-heappop(q))
### BUGGY CODE ###

import math

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

under = int(b/a + 1)
top = min(n, b)
ans = 0
for i in range(under, top+1):
    ans = max(math.floor(a*i/b)-a*math.floor(i/b), ans)

print(ans)

### FIXED CODE ###

import math

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

top = min(n, b-1)
ans = math.floor(a*top/b)
print(ans)
### BUGGY CODE ###

def m():
    s = list(input())
    s.reverse()
    MOD = 2019
    tot = 0
    ans = 0
    d = [0 for _ in range(MOD)]
    for i in range(len(s)):
        d[tot] += 1
        x = (10 ** i) % MOD
        p = int(s[i]) * x
        p %= MOD
        tot = (tot + p) % MOD
        ans += d[tot]
    return ans


print(m())


### FIXED CODE ###

def main():
    s = list(input())
    s.reverse()
    MOD = 2019
    tot = 0
    ans = 0
    d = [0 for _ in range(MOD)]
    for i in range(len(s)):
        d[tot] += 1
        x = pow(10, i, MOD)
        p = int(s[i]) * x
        p %= MOD
        tot = (tot + p) % MOD
        ans += d[tot]
    return ans


if __name__ == '__main__':
    print(main())
### BUGGY CODE ###

list = input()
i=0
while True:
  if i>2:
    break
    print(list[0][0:1],end='')

### FIXED CODE ###

list = input().split()
i = 0
while True:
	if i>2:
		break
	print(list[i][0:1],end='')
	i += 1
### BUGGY CODE ###

n = int(input())
ar = [[-1 for i in range(n)] for j in range(n)]
ar2 = [[] for i in range(n)]
for i in range(n-1):
    ipt = list(map(int,input().split()))
    ar[ipt[0]-1][ipt[1]-1] = ipt[2]%2
    ar[ipt[1]-1][ipt[0]-1] = ipt[2]%2
    ar2[ipt[0]-1].append(ipt[1]-1)
    ar2[ipt[1]-1].append(ipt[0]-1)

ans = [[] for i in range(n)]
ans[0] = 0

def draw(u,k):
    for v in ar2[u]:
        if v!=k:
            ans[v] = (ans[u] + ar[u][v])%2
            draw(v,u)

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

### FIXED CODE ###

n = int(input())
ar = [[] for i in range(n)]
for i in range(n-1):
    ipt = list(map(int,input().split()))
    ar[ipt[0]-1].append((ipt[1]-1,ipt[2]))
    ar[ipt[1]-1].append((ipt[0]-1,ipt[2]))

ans = [-1 for i in range(n)]
u = 0
ans[u] = 0
queue = [u] #キュー
l = 1
while True:
    if l == 0:
        break
    u = queue.pop(0)
    l -= 1
    for v in ar[u]:
        if ans[v[0]] < 0:
            ans[v[0]] = ans[u] + v[1]
            queue.append(v[0])
            l+=1

for i in range(n):
    print(ans[i]%2)
### BUGGY CODE ###

n,m,k=map(int,input().split())
fr=[input() for i in range(m)]
bl=[input() for i in range(k)]
relfr={i:set() for i in range(n)}
relbl={i:set() for i in range(n)}
for l in fr:
  a,b=map(int,l.split())
  relfr[a-1].add(b-1)
  relfr[b-1].add(a-1)
frsiz={i:len(relfr[i]) for i in range(n)}
for l in bl:
  a,b=map(int,l.split())
  relbl[a-1].add(b-1)
  relbl[b-1].add(a-1)
cand={0}
searched=set()
gr=set()
all_gr={i for i in range(n)}
ans=[0]*n
c=0
while True:
  siz=0
  while True:
    now=cand.pop()
    gr.add(now)
    c+=1
    siz+=1
    for point in relfr[now].difference(gr,cand):
      cand.add(point)
    if len(cand)==0:
      break
  for i in gr:
    ans[i]=siz-frsiz[i]-len(relbl[i].intersection(gr))-1
    searched.add(i)
  all_gr=all_gr.difference(searched)
  gr.clear()
  if c!=n:
    cand.add(list(all_gr)[0])
  else:
    break
print(' '.join(map(str,ans)))

### FIXED CODE ###

n,m,k=map(int,input().split())
relfr={i:set() for i in range(n)}
relbl={i:set() for i in range(n)}
for i in range(m):
  a,b=map(int,input().split())
  relfr[a-1].add(b-1)
  relfr[b-1].add(a-1)
for i in range(k):
  a,b=map(int,input().split())
  relbl[a-1].add(b-1)
  relbl[b-1].add(a-1)
blsiz=[0 for i in range(n)]
ans=[0]*n
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    def Unite(self, x, y):
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        if(x == y):
            return
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)
    def Count(self, x):
        return -self.root[self.Find_Root(x)]
uf=UnionFind(n)
for i in range(n):
  for j in relfr[i]:
    uf.Unite(i,j)
for i in range(n):
  for j in relbl[i]:
    if uf.isSameGroup(i,j):
      blsiz[i]+=1
for i in range(n):
  ans[i]=uf.Count(i)-len(relfr[i])-blsiz[i]-1

print(' '.join(map(str,ans)))
### BUGGY CODE ###

import math
import collections

def combinations_count(n, r):
	if n < 2:
		return 0
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

_ = int(input())
ns = input().split(" ")
cs = collections.Counter(ns)

c = 0
for n in ns:
	for k, v in cs.items():
		if v==1:
			c += 0
		elif n==k:
			c += combinations_count(v-1, 2)
		else:
			c += combinations_count(v, 2)
	print(c)
	c = 0

### FIXED CODE ###

N = int(input())
A = [int(a)-1 for a in input().split()]
X = [0] * N
for a in A:
	X[a] += 1
s = 0
for x in X:
	s += x * (x-1) // 2
for a in A:
	print(s - (X[a] - 1))
### BUGGY CODE ###


def solve():
#    dp = [1]*(N)
    dp = [0] * N
    for i in range(M):
#        for j in range(0, LR[i][0]-1):
#            dp[j] = 0
#        for j in range(LR[i][1], N):
#            dp[j] = 0
        for j in range(LR[i][0]-1,LR[i][1]):
            dp[j] += 1
#    print(dp)
    print(dp.count(M))
#    print(sum(dp))


if __name__ == "__main__":
    N,M = list(map(int, input().split()))
    LR = [list(map(int, input().split())) for _ in range(M)]
    solve()  


### FIXED CODE ###


def solve():
    dp = [0] * N
    L = max(l)
    R = min(r)
    if L <= R:
        i = list(range(L,R+1))
        ans = len(i)
    else:
        ans = 0
    print(ans)

if __name__ == "__main__":
    N,M = list(map(int, input().split()))
#    LR = [list(map(int, input().split())) for _ in range(M)]
    l,r = [0]*M, [0]*M
    for c in range(M):
        tmp = list(map(int, input().split()))
        l[c] = tmp[0]
        r[c] = tmp[1]
    solve()
### BUGGY CODE ###

n,m = map(int,input().split())
l,r = [0] * m, [0] * m
for i in range(m):
    l[i], r[i] = map(int, input().split())

ans = 0
for i in range(n):
    for j in range(m):
        if not((i + 1) >= l[j] and (i + 1) <= r[j]):
            break
        if j == m - 1:
            ans += 1

print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
l,r = [0] * m, [0] * m
for i in range(m):
    l[i], r[i] = map(int, input().split())

lmax = 0
rmin = 10 ** 5
for i in range(m):
    lmax = max(lmax,l[i])
    rmin = min(rmin,r[i])

if lmax <= rmin:
    print(rmin - lmax + 1)
else:
    print("0")
### BUGGY CODE ###

def sigma(n):
    return n * (n + 1) // 2

s = input()
l = [s[0]]
for c in s[1:]:
    if c in l[-1]:
        l[-1] += c
    else:
        l.append(c)
ans = 0
now = 0
for c in l:
    if '>' in c:
        ans -= min(now, len(c))
    ans += sigma(len(c))
    now = len(c)
print(ans)

### FIXED CODE ###

def sigma(n):
    return n * (n + 1) // 2

s = list(map(lambda x : 1 if x == '<' else -1, input()))
l = [s[0]]
for c in s[1:]:
    if c * l[-1] > 0:
        l[-1] += c
    else:
        l.append(c)
ans = 0
now = 0
for c in l:
    if c < 0:
        ans -= min(now, abs(c))
    ans += sigma(abs(c))
    now = abs(c)
print(ans)
### BUGGY CODE ###

N,K = map(int,input().split())
S = input()
tmp = 1
tbl = []
cont = 0
for s in S:
    if int(s) == tmp:
        cont += 1
    else:
        tbl.append(cont)
        cont = 1
        tmp = abs(tmp-1)
tbl.append(cont)
if len(tbl) % 2 == 0:
    tbl.append(0)
max = 0
for i in range(0,len(tbl),2):
    if len(tbl) == 1:
        max = tbl[i]
        break
    if sum(tbl[i:i+K*2+1]) > max:
        max = sum(tbl[i:i+K*2+1])
print(max)

### FIXED CODE ###

N,K = map(int,input().split())
S = list(map(int,input()))
tmp = 1
nums = []
cont = 0
for s in S:
    if int(s) == tmp:
        cont += 1
    else:
        nums.append(cont)
        cont = 1
        tmp = 1 - tmp
if cont != 0:
    nums.append(cont)
if len(nums) % 2 == 0:
    nums.append(0)
cml = [0]
for n in nums:
    cml.append(cml[-1]+n)
ans = []
for i in range(0,len(cml),2):
    ans.append(cml[min(len(cml)-1,i+K*2+1)]-cml[i])
print(max(ans))
### BUGGY CODE ###

n,p = map(int,input().split())
s = input()
ans = 0
for i in range(n):
    for j in range(i+1,n+1):
        if s[i:j] and int(s[i:j])%p == 0:
            ans += 1
            
print(ans)

### FIXED CODE ###

def main():
    n,p = map(int,input().split())
    s = input()

    if p == 2 or p == 5:
        ans = 0
        for i in range(n-1,-1,-1):
            if int(s[i]) % p == 0:
                ans += i+1
        print(ans)
        exit()

    l = [0]*p
    l[0] += 1
    s1 = s[::-1]
    ten = 1
    mod = 0
    for i in range(n):
        mod += int(s1[i])*ten%p
        mod %= p
        ten = ten*10%p
        l[mod] += 1
    ans = 0

    for i in l:
        ans += (i-1)*i//2
    print(ans)
if __name__ == "__main__":
    main()
### BUGGY CODE ###

n=int(input())

c= float('inf')
for i in range(1,n+1):
      if n%i==0 and (i+n//i)<c:
            a=i
            b=n//i
            c=a+b

print(a+b-2)

### FIXED CODE ###

import math

n=int(input())
num=math.ceil(math.sqrt(n))

c=n+2
for i in range(1,num+1):
      if n%i==0 and (i+n//i)<c:
            a=i
            b=n//i
            c=a+b

print(a+b-2)
### BUGGY CODE ###

import itertools
n, m, x = map(int, input().split())
c = []
ans = []
for _ in range(n):
    l = list(map(int, input().split()))
    c.append(l)

for i in range(1, n+1):
    for vl in itertools.permutations(c, i):
        a = [0] * m
        p = 0
        for v in vl:
            p += v[0]
            for j in range(m):
                a[j] += v[1+j]
        flag = True
        for k in range(m):
            if a[k] < x:
                flag = False
        if flag:
            ans.append(p)
if len(ans) == 0:
    print(-1)
else:
    print(min(ans))

### FIXED CODE ###

import itertools
n, m, x = map(int, input().split())
c = []
ans = []
for _ in range(n):
    l = list(map(int, input().split()))
    c.append(l)

for i in range(1, n+1):
    for vl in itertools.combinations(c, i):
        a = [0] * m
        p = 0
        for v in vl:
            p += v[0]
            for j in range(m):
                a[j] += v[1+j]
        flag = True
        for k in range(m):
            if a[k] < x:
                flag = False
        if flag:
            ans.append(p)
if len(ans) == 0:
    print(-1)
else:
    print(min(ans))
### BUGGY CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

from bisect import bisect_left, bisect_right

def main():
    N,C,K = map(int, input().split())
    Ti = list(int(input()) for _ in range(N))
    Ti.sort()
    ret = 0
#    print(Ti)
    while len(Ti)>0:
        Tto = K + Ti[0]
        Ti = Ti[min(C,bisect_right(Ti, Tto)):]
        ret += 1
#        print(Ti)
    print(ret)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

from bisect import bisect_left, bisect_right

def main():
    N,C,K = map(int, input().split())
    Ti = list(int(input()) for _ in range(N))
    Ti.sort()
    i = 0
    ret = 0
    while i<N:
        ret += 1
        s = i
        Ts = Ti[i]
        while i<N and Ti[i]<=(Ts+K) and (i-s)<C:
            i += 1

    print(ret)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
from bisect import insort_left

def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    
    if sum(A) < sum(B):
        print(-1)
        exit()

    ok = []
    ng_cnt = 0
    ng_num = 0
    for i in range(N):
        if A[i] - B[i] >= 0:
            insort_left(ok, A[i] - B[i])
        else:
            ng_cnt += 1
            ng_num += B[i] - A[i]
    ans = ng_cnt

    while ng_num > 0:
        ans += 1
        ng_num -= ok.pop()

    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
from bisect import insort_left

def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    B = [int(i) for i in input().split()]
    
    if sum(A) < sum(B):
        print(-1)
        exit()

    ok = []
    ng_cnt = 0
    ng_num = 0
    for i in range(N):
        if A[i] - B[i] >= 0:
            ok.append(A[i] - B[i])
        else:
            ng_cnt += 1
            ng_num += B[i] - A[i]
    ok.sort()

    ans = ng_cnt

    while ng_num > 0:
        ans += 1
        ng_num -= ok.pop()

    print(ans)

if __name__ == "__main__":
    main()