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

from collections import defaultdict

S = input()

d = defaultdict(int)

d[0] += 1

mod = 0
for i in range(len(S))[::-1]:
    mod = (mod + int(S[i]) * 10 ** (len(S) - i - 1)) % 2019
    # mod = int(S[i:]) % 2019
    d[mod] += 1

ans = 0
for i in d.values():
    if i > 1:
        ans += i * (i - 1) / 2

print(int(ans))


### FIXED CODE ###

from collections import defaultdict

S = input()

d = defaultdict(int)

d[0] += 1

mod = 0
R = 1
for i in range(len(S)):
    mod = (mod + R * int(S[len(S) - i - 1])) % 2019
    R = R * 10 % 2019
    d[mod] += 1
ans = 0
for i in d.values():
    if i > 1:
        ans += i * (i - 1) / 2

print(int(ans))
### BUGGY CODE ###

from collections import deque
sl = list(input())
q = int(input())
dl = deque(sl)
for _ in range(q):
    query = list(map(str, input().split()))
    if len(query) == 1:
        dl.reverse()
    else:
        if query[1] == "1":
            dl.appendleft(query[2])
        else:
            dl.append(query[2])
print("".join(dl))

### FIXED CODE ###

from collections import deque
sl = list(input())
q = int(input())
dl = deque(sl)
r = 0
for _ in range(q):
    query = list(map(str, input().split()))
    if len(query) == 1:
        r += 1
    else:
        if r % 2 == 0:
            if query[1] == "1":
                dl.appendleft(query[2])
            else:
                dl.append(query[2])
        else:
            if query[1] == "1":
                dl.append(query[2])
            else:
                dl.appendleft(query[2])
if r % 2 == 1:
    dl.reverse()
print("".join(dl))
### BUGGY CODE ###

import sys
input=sys.stdin.readline
n,t=map(int,input().split())
dp=[[[0,0] for i in range(t)] for j in range(n+1)]
food=[list(map(int,input().split())) for i in range(n)]
foodmax=[0]*n
food.sort(key=lambda x:x[1],reverse=True)
food.sort(key=lambda x:x[0])
foodmax[-1]=food[-1][1]
for i in range(n-1)[::-1]:
  foodmax[i]=max(foodmax[i+1],food[i][1])
foodmax+=[0]
for i in range(n):
  for j in range(t):
    if j<food[i][0]:
      dp[i+1][j]=dp[i][j]
    else:
      dp[i+1][j][0]=max(dp[i][j][0],dp[i][j-food[i][0]][0]+food[i][1])
      if dp[i][j][0]>=dp[i][j-food[i][0]][0]+food[i][1]:
        dp[i+1][j][1]=dp[i][j][1]
      else:
        dp[i+1][j][1]=i
ans=0
for i in range(n+1):
  if ans<dp[i][t-1][0]+foodmax[dp[i][t-1][1]+1]:
    ans=dp[i][t-1][0]+foodmax[dp[i][t-1][1]+1]
print(ans)

### FIXED CODE ###

import sys
input=sys.stdin.readline
n,t=map(int,input().split())
dp=[[0 for i in range(t)] for j in range(n+1)]
food=[list(map(int,input().split())) for i in range(n)]
foodmax=[0]*n
food.sort(key=lambda x:x[1],reverse=True)
food.sort(key=lambda x:x[0])
foodmax[-1]=food[-1][1]
for i in range(n-1)[::-1]:
  foodmax[i]=max(foodmax[i+1],food[i][1])
foodmax+=[0]
for i in range(n):
  for j in range(t):
    if j<food[i][0]:
      dp[i+1][j]=dp[i][j]
    else:
      dp[i+1][j]=max(dp[i][j],dp[i][j-food[i][0]]+food[i][1])
      
ans=0
for i in range(n):
  if ans<dp[i+1][t-1]+foodmax[i+1]:
    ans=dp[i+1][t-1]+foodmax[i+1]
print(ans)
### BUGGY CODE ###

from sys import stdin

N = int(stdin.readline().rstrip())
L = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0
L.sort()

for i in range(2, N):
    for j in range(1, i):
        for k in range(j):
            if L[j] + L[k] > L[i]:
                ans += 1

print(ans)


### FIXED CODE ###

from sys import stdin
import bisect

N = int(stdin.readline().rstrip())
L = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0
L.sort()
for i in range(1, N):
    for j in range(i):
        ans += max(bisect.bisect_left(L, L[i] + L[j]) - i - 1, 0)

print(ans)
### BUGGY CODE ###

#dp[n][k][i][c]:色c(0:赤 1:青)で終わり、全ボールn個・赤ボールk個でi回操作をする必要がある
#
#for any n: dp[n][0][0][1]=1
#
#...rR = ...r
#...bR = ...b + 1
# dp[n][k][i][0] = dp[n-1][k-1][i][0]+dp[n-1][k-1][i-1][1]
#
#...rB = ...r
#...bB = ...b
# dp[n][k][i][1] = dp[n-1][k][i][0]+dp[n-1][k][i][1]
N, K = [int(_) for _ in input().split()]
mod = 10**9 + 7
dp = [[[[0, 0] for _ in range(K + 1)] for _ in range(K + 1)]
      for _ in range(N + 1)]
dp[0][0][0][1] = 1
for n in range(1, N + 1):
    dp[n][0][0][1] = 1
    for k in range(1,K + 1):
        for i in range(1, K + 1):
            dp[n][k][i][0] = dp[n - 1][k - 1][i][0] + dp[n - 1][k - 1][i -
                                                                       1][1]
            dp[n][k][i][1] = dp[n - 1][k][i][0] + dp[n - 1][k][i][1]
            dp[n][k][i][0] %= mod
            dp[n][k][i][1] %= mod
dpNK = dp[N][K]
for i in range(1, K + 1):
    print(sum(dpNK[i]) % mod)


### FIXED CODE ###

'''
C[n-k+1,i]*C[k-1,i-1](=F(i)とおく)
F(1)=n-k+1
また
C[n,r+1]/C[n,r]=(n-r)/(r+1)
より
F(i+1)/F(i)=(k-i)*(n-k+1-i)/i(i+1)
'''
N, K = [int(_) for _ in input().split()]
mod = 10**9 + 7
a = N - K + 1
print(a % mod)
for i in range(1, K):
    a = a * (K - i) * (N - K + 1 - i) // i // (i + 1)
    print(a % mod)
### BUGGY CODE ###

import math
#xCy=x!/y!(x-y)!
def com(x,y):
    bunb = ((math.factorial(y)%mod) * (math.factorial(x-y)%mod))%mod
    buns = math.factorial(x)%mod
    bunb_inv = pow(bunb,mod-2,mod)
    d = (buns * bunb_inv) % mod
    return d
    
n,a,b = map(int,input().split())
mod = 10**9 + 7

ans = (2**n - 1) % mod
ans -= com(n,a) + com(n,b)

print(ans)

### FIXED CODE ###

#xCy=x!/y!(x-y)!
def com(x,y):
    bunb = 1
    buns = 1
    for i in range(y):
        buns = buns * (x-i) % mod
        bunb = bunb * (i+1) % mod

    bunb_inv = pow(bunb,mod-2,mod)
    d = (buns * bunb_inv) % mod
    return buns*pow(bunb,mod-2,mod)
    
n,a,b = map(int,input().split())
mod = 10**9 + 7

ans = pow(2,n,mod) - 1
ans -= com(n,a) + com(n,b)

print(ans%mod)
### BUGGY CODE ###

n = int(input())
a_list = list(map(int, input().split()))
ans = [0]*n
for i in range(n):
    for j,a in enumerate(a_list):
        if j != i:
            ans[i]=ans[i]^a
ans = " ".join([str(i) for i in ans])
print(ans)

### FIXED CODE ###

n = int(input())
a_list = list(map(int, input().split()))
base_xor = 0
for i in a_list:
    base_xor = base_xor^i
ans = [0]*n
for i in range(n):
    ans[i] = a_list[i]^base_xor
ans = " ".join([str(i) for i in ans])
print(ans)
### BUGGY CODE ###

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

from math import ceil

D, G = [int(t) for t in input().split()]
p = []
c = []
for i in range(D):
    p_, c_ = [int(t) for t in input().split()]
    p.append(p_)
    c.append(c_)

cache = {}

def minsolve(G, p, c, i):
    """100i点以下の問題だけでGを達成する最小問題数"""
    global cache
    if i <= 0:
        return float('inf')
    if (G, i) in cache:
        return cache[(G, i)]
    m = float('inf')
    for n in range(min(ceil(G / (100 * i)), p[i-1]) + 1):
        s = 100 * i * n
        if n == p[i-1]:
            s += c[i-1]
        if s >= G:
            m = min(m, n)
        else:
            m = min(m, n + minsolve(G - s, p, c, i-1))
    cache[(G, i)] = m
    return m

print(minsolve(G, p, c, D))

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
 
from math import ceil
 
D, G = [int(t) for t in input().split()]
p = []
c = []
for i in range(D):
    p_, c_ = [int(t) for t in input().split()]
    p.append(p_)
    c.append(c_)
 
def minsolve(G, p, c, i):
    """100i点以下の問題だけでGを達成する最小問題数"""
    if i <= 0:
        return float('inf')
    n = min(ceil(G / (100 * i)), p[i-1])
    s = 100 * i * n
    if n == p[i-1]:
        s += c[i-1]
    if s >= G:
        return min(n, minsolve(G, p, c, i-1))
    else:
        return min(n + minsolve(G - s, p, c, i-1), minsolve(G, p, c, i-1))
 
m = min(minsolve(G, p, c, i) for i in range(1, D+1))
print(m)
### BUGGY CODE ###

a = input() + 'K'
ans = 'K'

for i,j in enumerate(a):
    if j == '?':
        if ans[-1] == 'P':
            ans+='D'
        elif  (ans[-1] == 'D' and a[i+1] == '?') or a[i+1] == 'D':
            ans+='P'
        else:
            ans+='D'
    else:
        ans+=j

print(ans[1:-1])

### FIXED CODE ###

a = input()

print(a.replace('P?', 'PD').replace('?D', 'PD').replace('??', 'PD').replace('?', 'D'))
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
ans=0
for  i in range(N-1):
  for j in range(i+1,N):
    if abs(i-j)==A[i]+A[j]:
      ans+=1
print(ans)

### FIXED CODE ###

import bisect
N=int(input())
A=list(map(int,input().split()))
A1=[]
A2=[]
for i in range(N):
  A1.append(i+1+A[i])
  A2.append(i+1-A[i])
A1.sort()
#A2.sort()
ans=0
for i in range(N):
  ai=A[i]
  i+=1
  ans+=bisect.bisect_right(A1,i-ai)-bisect.bisect_left(A1,i-ai)
  #ans+=bisect.bisect_right(A2,i+ai)-bisect.bisect_left(A2,i+ai)
print(ans)
### BUGGY CODE ###

N, M = map(int, input().split())
V = []
INF = float("inf")
dp = [INF]*(1<<N)
dp[0] = 0
for i in range(M):
  a,b = map(int, input().split())
  c = list(map(int, input().split()))
  k = 0
  for j in range(b):
    k |= 1<<(c[j]-1)
  V.append((a,k))
  dp[k] = min(dp[k],a)

for i in range(1<<N):
  for a,k in V:
    dp[i|k] = min(dp[i|k],dp[i]+dp[k])  
print(dp[-1] if dp[-1] != INF else -1)

### FIXED CODE ###

N, M = map(int, input().split())
INF = float("inf")
V = [INF] * (1<<N)
V[0] = 0
for i in range(M):
  v,_ = map(int, input().split())
  b = 0
  s = list(map(int, input().split()))
  for a in s:
    b |= (1<<(a-1))
  V[b] = min(V[b], v) #宝箱の集合bを開けるための最小コスト

vbs = [] #（最小コスト、宝箱の集合b）のリスト、ただしコストINFのものを除く
for b,v in enumerate(V):
  if v == INF:
    continue
  vbs.append((v,b))

for v,b in vbs:
  for c in range(1<<N):
    if V[c] == INF:
      continue
    V[b|c] = min(V[b|c], V[b]+V[c])

print(V[-1] if V[-1] < INF else -1)
### BUGGY CODE ###

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


for i in range(1, N + 1):
    print(A.count(i))

### FIXED CODE ###

from collections import Counter

N = int(input())
A = [int(x) for x in input().split()]
a = Counter(A)

for i in range(1, N + 1):
    print(a[i])
### BUGGY CODE ###

k,s = map(int, input().rstrip().split())
count = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                count += 1

print(count)


### FIXED CODE ###

k,s = map(int, input().rstrip().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)
### BUGGY CODE ###

t=c=0
for _ in[0]*input():i=input();c+=(i+t)/2;t=(i+t)%2&(i>0)
print c

### FIXED CODE ###

t=c=0
for _ in[0]*input():i=input();c+=(i+t)/2;t=(i+t)%2&(i>0)
print c
### BUGGY CODE ###

import numpy as np
import sys
# import copy
# def input(): return sys.stdin.readline().rstrip()
# input = sys.stdin.readline
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10 ** 7)

N, K = map(int, input().split())
# A = np.array(list(map(int, (input().split()))))
A = list(map(int, (input().split())))
# nd = np.zeros((N,N), dtype=bool)
# print(*A)
for i in range(K):
    cnt = [0]*N
    for j in range(N):
        # nd[j, max(j-A[j],0):min(j+A[j]+1,N)] = True
        l = max(j-A[j],0)
        r = min(j+A[j]+1,N)
        cnt[l] += 1
        if r<N:
            cnt[r] -= 1
        # for k in range(max(j-A[j],0), min(j+A[j]+1,N)):
        #     cnt[k] += 1
    # print(nd)
    # A = np.count_nonzero(nd, axis=0)
    # print(cnt)
    A = np.cumsum(cnt)
    if A[0] == A[N-1] == N:
        break
    # print(*A)

print(*A)

### FIXED CODE ###

import numpy as np
from numba import njit
import sys
# import copy
# def input(): return sys.stdin.readline().rstrip()
# input = sys.stdin.readline
input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10 ** 7)

N, K = map(int, input().split())
# A = np.array(list(map(int, (input().split()))))
A = np.array(input().split(), dtype=np.int64)
# A = list(map(int, (input().split())))
# nd = np.zeros((N,N), dtype=bool)
# print(*A)

# @njit('(i8[::1],)', cache=True)
@njit(cache=True)
def loop(A):
    for i in range(K):
        # cnt = [0]*N
        cnt = np.zeros_like(A)
        for j, x in enumerate(A):
            # nd[j, max(j-A[j],0):min(j+A[j]+1,N)] = True
            l = max(j-x,0)
            r = min(j+x+1,N)
            cnt[l] += 1
            if r<N:
                cnt[r] -= 1
            # for k in range(max(j-A[j],0), min(j+A[j]+1,N)):
            #     cnt[k] += 1
        # print(nd)
        # A = np.count_nonzero(nd, axis=0)
        # print(cnt)
        A = np.cumsum(cnt)
        if A[0] == A[N-1] == N:
            break
        # print(*A)
    return A

A = loop(A)
print(*A)
### BUGGY CODE ###

def resolve():
    n = int(input())
    a = tuple(map(int,input().split()))
    for i in range(n):
        print(a.count(i+1))
resolve()

### FIXED CODE ###

def resolve():
    n = int(input())
    ans = [0]*n
    a = list(map(int,input().split()))
    for i in a:
        ans[i-1] += 1
    for i in ans:
        print(i)
resolve()
### BUGGY CODE ###

N,K=map(int,input().split())
List = list(map(int, input().split()))
strength = [1]*N
for k in range (K):
  for i in range(N):
    for j in range(N):
      if i==j:
        pass
      else:
        if j-List[j]-0.5 < i < List[j]+j+0.5:
          strength[i] += 1
        else:
          pass
      #print(List,strength)
  List = strength
  strength = [1]*N
print(*List)

### FIXED CODE ###

N,K=map(int,input().split())
List = list(map(int, input().split()))
 
def imosu(x,k):
  data = [0]*k
  for i in range(k):
    first = i-x[i]
    last = i+x[i]
    if first < 0:
      first = 0
    data[first] += 1
    if last+1 < k:
      data[last+1] +=-1
  ruiseki = [0]*k
  ruiseki[0] = data[0]
  for i in range(k-1):
    ruiseki[i+1] = ruiseki[i] + data[i+1]
  return ruiseki
 
for i in range(K):
  List = imosu(List,N)
  if List.count(N) == N:
    break
print(*List)
### BUGGY CODE ###

import itertools


N, M = map(int, input().split())
lst = [list(map(int, input().rstrip().split())) for n in range(N)]
num = [i for i in range(N)]
maximum = -float("inf")
for p in itertools.combinations(num, M):
    m = sum(abs(sum(lst[n][i] for n in p)) for i in range(3))
    maximum = max(maximum, m)

print(maximum)


### FIXED CODE ###

N, M = map(int, input().split())
lst = [list(map(int, input().rstrip().split())) for n in range(N)]
maximum = -float("inf")
for i in [-1, 1]:
    for j in [-1, 1]:
        for k in [-1, 1]:
            sum_lst = []
            for n in range(N):
                num = lst[n][0] * i + lst[n][1] * j + lst[n][2] * k
                sum_lst.append(num)
            maximum = max(abs(sum(sorted(sum_lst)[:M])), maximum)
            
print(maximum)
### BUGGY CODE ###

N,M=map(int,input().split())
keys=[]
for i in range(M):
    a,b=map(int,input().split())
    c=list(map(int,input().split()))
    cans=0
    for i in c:
        cans+=1<<(i-1)
    keys.append((a,cans))

#print(keys)

dp=[12*(10**5)+1 for j in range(2**N)]
dp[0]=0

for key in keys:
    for j in range(2**N):
        dp[j|key[1]]=min(dp[j|key[1]],dp[j]+key[0])
#    print(dp)

print(dp[2**N-1] if dp[2**N-1]!=12*(10**5)+1 else -1)

### FIXED CODE ###

N,M=map(int,input().split())
inf=12*(10**5)+1

dp=[inf for j in range(2**N)]
dp[0]=0

for i in range(M):
    a,b=map(int,input().split())
    c=sum([1<<(i-1) for i in list(map(int,input().split()))])
#    print(a,b,c)
    for j in range(2**N):
        dp[j|c]=min(dp[j|c],dp[j]+a)
#    print(dp)

print(dp[2**N-1] if dp[2**N-1]!=inf else -1)
### BUGGY CODE ###

def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


N = int(input())
A = list(map(int, input().split()))
setA = set(A)
dup = set([x for x in setA if A.count(x) > 1])

count = 0
for i in range(len(A)):
    flag = False
    if A[i] in dup:
        continue
    for div in make_divisors(A[i]):
        if div == A[i]:
            continue
        elif div in setA:
            flag = True
            break
    if not flag:
        count += 1

print(count)


### FIXED CODE ###

# エラトステネスの篩

N = int(input())
A = sorted(map(int, input().split()))
maxA = A[N - 1]
dp = [0] * (maxA + 1)

for i in range(len(A)):
    cursor = A[i]
    while cursor <= maxA:
        dp[cursor] += 1
        cursor += A[i]

ans = 0
for a in A:
    if dp[a] == 1:
        ans += 1

print(ans)
### BUGGY CODE ###

#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！

d=defaultdict(list)
n,m,p=map(int,input().split())

for s in range(m):
    a,b,c=map(int,input().split())
    d[a].append([b,c])
#print(d)

def BELLMANFORD(point,d,p):
    cost       = {node:-float("inf")for node in range(1,n+1)}
    preference = {node:None         for node in range(1,n+1)}      #最適路のこと
    cost[point]= 0
    for i in range(n-1):                                  #経路の長さは最大n-1であるため
        for now,lis in d.copy().items():
            for nex,c in lis:
                if cost[nex]<cost[now]+c-p:
                    cost[nex]=cost[now]+c-p
                    preference[nex]=now
 
    negative=[0]*n                                        #負閉路の長さは最大nであるため
    
    for i in range(n):                  #閉路判定 negativeの1は閉路に入っている部分を表す
        for now,lis in d.copy().items():
            for nex,c in lis:
                if negative[now-1]==1:
                    negative[nex-1]=1
                if cost[nex]<cost[now]+c-p:
                    cost[nex]=cost[now]+c-p
                    preference[nex]=now
                    negative[now-1]=1
 
    return cost,negative








def main():
    x,y=(BELLMANFORD(1,d,p))
#    print(x,y)
    if y[n-1]==1:
        print(-1)
    else:
        print(max(x[n],0))

    
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input=sys.stdin.readline  #危険！基本オフにしろ！


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

d={}
for s in range(m):
    a,b,c=map(int,input().split())
    if a in d:
        d[a].append((b,c))
    else:
        d[a]=[(b,c)]

#print(d)


def BELLMANFORD(point,d,p):
    cost       = [-float("inf") for node in range(n+1)]  #infじゃないと閉路検出がうまくいかない
    cost[point]= 0
    for i in range(n-1):                                  #経路の長さは最大n-1であるため
        for now,lis in d.items():
            for nex,c in lis:
                if cost[nex]<cost[now]+c-p:
                    cost[nex]=cost[now]+c-p

    negative=[0]*n                                        #負閉路の長さは最大nであるため
    
    for i in range(n):                  #閉路判定 negativeの1は閉路に入っている部分を表す
        for now,lis in d.items():
            for nex,c in lis:
                if negative[now-1]==1:
                    negative[nex-1]=1
                if cost[nex]<cost[now]+c-p:
                    cost[nex]=cost[now]+c-p
                    negative[now-1]=1
 
    return cost,negative

def main():
    x,y=(BELLMANFORD(1,d,p))
    
    if y[n-1]==1:
        print(-1)
    else:
        print(max(x[n],0))

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

n = int(input())
v = list(map(int, input().split()))
v1 = []
v2 = []
ans = 0

for i in range(n):
    if i % 2 == 0:
        v1.append(v[i])
    else:
        v2.append(v[i])

mostCount1 = 0
mostChar1 = 0

for i in range(n//2):
    count = v1.count(v1[i])
    if count > mostCount1:
        mostCount1 = count
        mostChar1 = v1[i]
        if mostCount1 > n//2:
            break

mostCount2 = 0
mostChar2 = 0

for i in range(n//2):
    count = v2.count(v2[i])
    if count > mostCount2:
        mostCount2 = count
        mostChar2 = v2[i]
        if mostCount2 > n//2:
            break

if mostChar1 == mostChar2:
    ans = n//2
else:
    ans = n - mostCount1 - mostCount2

print(ans)


### FIXED CODE ###

import collections

n = int(input())
v = list(map(int, input().split()))
v1 = []
v2 = []
ans = 0

for i in range(n):
    if i % 2 == 0:
        v1.append(v[i])
    else:
        v2.append(v[i])

c1 = collections.Counter(v1)
mostChar1, mostCount1 = c1.most_common()[0]
#ndChar1, ndCount1 = c1.most_common()[1]

c2 = collections.Counter(v2)
mostChar2, mostCount2 = c2.most_common()[0]
#ndChar2, ndCount2 = c2.most_common()[1]

if mostChar1 == mostChar2:
    if len(c1.most_common()) == 1 and len(c1.most_common()) == 1:
        ans = n // 2
    elif len(c1.most_common()) == 1:
        ndChar2, ndCount2 = c2.most_common()[1]
        ans = n - mostCount1 - ndCount2
    elif len(c2.most_common()) == 1:
        ndChar1, ndCount1 = c1.most_common()[1]
        ans = n - mostCount2 - ndCount1
    else:
        ndChar1, ndCount1 = c1.most_common()[1]
        ndChar2, ndCount2 = c2.most_common()[1]
        temp1 = n - mostCount1 - ndCount2
        temp2 = n - mostCount2 - ndCount1
        ans = min(temp1, temp2)
else:
    ans = n - mostCount1 - mostCount2

print(ans)
### BUGGY CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = [0]
b = [0]
p = 0
q = 0
for i in range(N):
  a.append(p+A[i])
  p += A[i]
for i in range(M):
  b.append(q+B[i])
  q += B[i]
ans = 0
for n, s in enumerate(a):
  if s > K:
    break
  for m, t in enumerate(b):
    if s + t <= K:
      ans = max(ans, n+m)
    else:
      break
print(ans)

### FIXED CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = [0]
b = [0]
p = 0
for i in range(N):
  p += A[i]
  a.append(p)
q = 0
for j in range(M):
  q += B[j]
  b.append(q)
ans = 0
j = M
for i in range(N+1):
  if a[i] > K:
    break
  while a[i] + b[j] > K:
    j -= 1
  ans = max(ans, i + j)
print(ans)
### BUGGY CODE ###

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

s = 0

result = 0
for s in range(n):
    for e in range(s+1, n+1):
        if sum(a[s: e]) == 0:
            result += 1
print(result)



### FIXED CODE ###

import numpy
from scipy.misc import comb
import math
import collections

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

cumulative_sum = numpy.cumsum(a)
cumulative_sum = numpy.append(cumulative_sum, 0)
count = collections.Counter(cumulative_sum)

ret = 0
for v in count.values():
    if v < 2:
        continue
    ret += math.factorial(v) // (math.factorial(v - 2) * math.factorial(2)) 
print(ret)
### BUGGY CODE ###

from sys import stdin 
n = int(stdin.readline().rstrip())
l = [int(x) for x in stdin.readline().rstrip().split()]
l.sort()
answer = 0
for i in range(len(l)):
    for j in range(i):
        if i != j:
            low = i+1
            high = n
            c = l[i] + l[j]
            while low < high:
                mid = (low + high) // 2
                if l[mid] < c:
                    low = mid + 1
                else:
                    high = mid
            answer += low - i - 1
print(answer)



### FIXED CODE ###

from sys import stdin 
from bisect import bisect_left
n = int(stdin.readline().rstrip())
l = [int(x) for x in stdin.readline().rstrip().split()]
l.sort()
answer = 0
for i in range(len(l)):
    for j in range(i):
        if i != j:
            k = bisect_left(l, l[i]+ l[j])
            answer += k - i - 1
print(answer)
### BUGGY CODE ###

import copy
import numpy as np
n=int(input())
xl=[list(map(int,input().split()))  for i in  range(n)]

cp=copy.deepcopy(xl)
cp=np.array(cp)
cp=cp.T
xSort = np.sort(cp[0])[::-1]
dict={k: v for v, k in enumerate(cp[0])}

xr=[x+cp[1][dict[x]] for x in xSort]
xl=[x-cp[1][dict[x]] for x in xSort]
#print(xr)
#print(xl)
xls=sorted(xl, reverse=True)
xrs=[xr[xl.index(x)] for x in xls]
#print("xrs", xrs)
#print("xls", xls)

ans=0
r=10**5+1
for i in range(len(xls)):
  if xrs[i]>r:
    continue
  if xls[i]<=r:
    r=xls[i]
    #print("r",r)
    ans+=1
    
print(ans)

### FIXED CODE ###

import copy
import numpy as np
n=int(input())
xl=[]
for i in range(n):
    x,l = map(int,input().split())
    xl.append([x-l,l+x])
#print(xl)
xl = sorted(xl, key=lambda x: x[0],reverse=True)
#print(xl)

ans=0
r=2*(10**9+1)
for i in range(n):
  if xl[i][1]>r:
    continue
  if xl[i][0]<=r:
    r=xl[i][0]
    #print("r",r)
    ans+=1
print(ans)