Harryxun/stf_run huggingface dataset:
N, M = map(int, input().split())

l = []

for i in range(N):
    l.append(list(map(int, input().split())))

lis = [[] for i in range(N)]

for i in range(N):
    lis[l[i][0] - 1].append(l[i][1])
    lis[l[i][1] - 1].append(l[i][0])

print(lis)

# 隣接行列
# list = [[0 for c in range(M)] for r in range(N)]
#
# for i in range(M):
#     tmp_n, tmp_m = map(int, input().split())
#     list[tmp_n - 1][tmp_m - 1] = 1
#
#
# def dot(index1, index2):
#     results = [[0 for c in range(M)] for r in range(N)]
#     for (i, j) in zip(index1, zip(*index2)):
#         print(i,j)
#     return results



# 再起関数
# def travel(now, nextnodes, visited):
#     ends.append(visited)
#     visited.append(now + 1)
#     for node in nextnodes:
#         if node in visited:
#             continue
#         travel(node - 1, lis[node - 1], visited[:])
#
#
# travel(0, lis[0], [])

que = [[0, lis[0], []]]
ends = []
while que:
    now, nextnodes, visited = que.pop()
    ends.append(visited)
    visited.append(now + 1)
    for node in nextnodes:
        if node in visited:
            continue
        que.append([node - 1, lis[node - 1], visited[:]])

print(len(list(filter(lambda i: len(i) is 3, ends))))


### FIXED CODE ###

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

l = []

for i in range(M):
    l.append(list(map(lambda x: int(x) - 1, input().split())))

lis = [[] for i in range(N)]

for i in range(M):
    lis[l[i][0]].append(l[i][1])
    lis[l[i][1]].append(l[i][0])


# 隣接行列
# list = [[0 for c in range(M)] for r in range(N)]
#
# for i in range(M):
#     tmp_n, tmp_m = map(int, input().split())
#     list[tmp_n - 1][tmp_m - 1] = 1
#
#
# def dot(index1, index2):
#     results = [[0 for c in range(M)] for r in range(N)]
#     for (i, j) in zip(index1, zip(*index2)):
#         print(i,j)
#     return results



# 再起関数
# def travel(now, nextnodes, visited):
#     ends.append(visited)
#     visited.append(now + 1)
#     for node in nextnodes:
#         if node in visited:
#             continue
#         travel(node - 1, lis[node - 1], visited[:])
#
#
# travel(0, lis[0], [])

que = [[0, lis[0], []]]
ends = []

while que:
    now, nextnodes, visited = que.pop()
    ends.append(visited)
    visited.append(now)
    for node in nextnodes:
        if node in visited:
            continue
        que.append([node, lis[node], visited[:]])

print(len(list(filter(lambda ii: len(ii) is N, ends))))
n = int(input())
x = str(input())

def ppc(k): #k:2進数 bin
  cnt1 = sum( list(k) )
  k_10 = int(k, 2) #１０進数
  return format( k_10 % cnt1, 'b') #2adic

for i in range(n):
  ly = list(x)
  if ly[i] == '0':
    ly[i] = '1'
    y = ''.join(ly)
  else:
    ly[i] = '0'
    y = ''.join(ly)
  cnt = 0
  
  while True:
    if y == '0':
      break
    y = ppc(y)
    cnt += 1
  print(cnt)

### FIXED CODE ###

n = int(input())
x = input()
cnt1 = x.count('1')
x10 = int(x,2)

if cnt1 > 1:
  x10mod_m = x10 % (cnt1-1)
  x10mod_p = x10 % (cnt1+1)
else:
  x10mod_m = 0
  x10mod_p = 0

ans = []
for i in range(n):
  if x[i] == '1':
    if cnt1 == 1:
      print(0)
      continue
    cntx = cnt1-1
    mod = ( x10mod_m - pow(2,n-1-i,cntx) ) % cntx
  else:
    cntx = cnt1+1
    mod = ( x10mod_p + pow(2,n-1-i,cntx) ) % cntx
    
  cnt = 1
  mod = format(mod, 'b')
  
  while True:
    if mod == '0':
      break
    mod = format( int(mod,2) % mod.count('1'), 'b')
    cnt += 1
  print(cnt)
S = input()

if S == "AAA" or S = "BBB":
    print("No")
else:
    print("Yes")


### FIXED CODE ###

S = input()

if S == "AAA" or S == "BBB":
    print("No")
else:
    print("Yes")
#入力した整数が５、７、５であるならばTrueを返す
# int,int,int -> True 

def check7(x,y,z):
    if x == 7:
        if y == z :
            print("YES")
        else:
            print("NO")
    elif y == 7:
        if x == z :
            print("YES")
        else:
          print("NO")
    elif z == 7:
        if x == y:
          print("YES")
        else:
          print("NO")
    else:
      print("NO")

if __name__ == __main__:
    check7()

### FIXED CODE ###

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

input_list = input().split()

cnt7 = 0
cnt5 = 0

for n in input_list:
    if int(n) == 7:
        cnt7 += 1
    elif int(n) == 5:
        cnt5 += 1
    else:
        continue
if cnt7 == 1 and cnt5 == 2:
    print("YES")
else:
    print("NO")
import collections

#文字列を一文字ずつ取得したいとき
def inputStrOnebyOne():
    s = list(input())
    return s

#整数を一つずつリストに入れる
def inputOnebyOne_Int():
    a = list(int(x) for x in input().split())
    return a

def main():
    s = inputStrOnebyOne()
    ret = []
    for i in range(len(s)):
        if s[i] == "0":
            ret.append(s[i])
        elif s[i] == "1":
            ret.append(s[i])
        else:
            ret.pop()
    print(''.join(ret))

if __name__=='__main__':
    main()

### FIXED CODE ###

import collections

#文字列を一文字ずつ取得したいとき
def inputStrOnebyOne():
    s = list(input())
    return s

#整数を一つずつリストに入れる
def inputOnebyOne_Int():
    a = list(int(x) for x in input().split())
    return a

def main():
    s = inputStrOnebyOne()
    ret = []
    for i in range(len(s)):
        if s[i] == "0":
            ret.append(s[i])
        elif s[i] == "1":
            ret.append(s[i])
        else:
            if 1<=len(ret):
                ret.pop()
    print(''.join(ret))

if __name__=='__main__':
    main()
#!/usr/bin/env python3
import sys


def create_graph(N, a, b):
    g = {}
    for i in range(N-1):
        if a[i] in g:
            g[a[i]][b[i]] = 0
        else:
            g[a[i]] = {b[i]: 0}
        if b[i] in g:
            g[b[i]][a[i]] = 0
        else:
            g[b[i]] = {a[i]: 0}
    return g


def find_color(used, m):
    for i in range(1, m+1):
        if i not in used:
            return i
    return m+1


def dfs(g, p):
    for q in g[p].keys():
        # print(f"p:{p} q:{q} g:{g[p][q]}")
        if not g[p][q]:
            c = find_color(set([v for k, v in g[p].items() if v > 0]), len(g[p]))
            g[p][q] = c
            g[q][p] = c
            dfs(g, q)


def solve(N: int, a, b):
    g = create_graph(N, a, b)
    dfs(g, a[0])
    # print(g)
    m = 1
    for i in range(N-1):
        m = max(m, g[a[i]][b[i]])
    print(m)
    for i in range(N-1):
        print(g[a[i]][b[i]])


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int()] * (N - 1)  # type: "List[int]"
    b = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, a, b)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import queue

def create_graph(N, a, b):
    g = {}
    for i in range(N-1):
        if a[i] in g:
            g[a[i]][b[i]] = 0
        else:
            g[a[i]] = {b[i]: 0}
        if b[i] in g:
            g[b[i]][a[i]] = 0
        else:
            g[b[i]] = {a[i]: 0}
    return g


def bfs(g, s):
    Q = queue.Queue()
    Q.put(s)
    while not Q.empty():
        p = Q.get()
        cs = set(range(len(g[p])+2)) - set([v for k, v in g[p].items()])
        for q in g[p].keys():
            # print(f"p:{p} q:{q} g:{g[p][q]}")
            if not g[p][q]:
                c = cs.pop()
                g[p][q] = c
                g[q][p] = c
                Q.put(q)


def solve(N: int, a, b):
    g = create_graph(N, a, b)
    bfs(g, a[0])
    # print(g)
    m = 1
    for i in range(N-1):
        m = max(m, g[a[i]][b[i]])
    print(m)
    for i in range(N-1):
        print(g[a[i]][b[i]])


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int()] * (N - 1)  # type: "List[int]"
    b = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, a, b)

if __name__ == '__main__':
    main()
N = int(input())

s = map(int,input().split())

s.sort(reverse=True)

sum = 0

for i in range(N):
  sum = sum + s[2*i]

print(sum)

### FIXED CODE ###

N = int(input())

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

s.sort()

sum = 0

for i in range(N):
  sum = sum + s[2*i]

print(sum)
#!/usr/bin/env python3
N = int(input())
a = list(map(int, input().split()))

print(sum([a[a[i] - 1] - 1 == i for i in range(N)]) // 2)


### FIXED CODE ###

#!/usr/bin/env python3
s = input()
print(s[:4], s[4:])
def main():
    input_data = [int(input()) for i in range(5)]
    k = int(input())
    count = 0

    input_data = input_data.sort()

    temp = input_data[0] - input_data[4]
    if temp > k :
        print(":(")
    else:
        print('Yay!')

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    input_data = [int(input()) for i in range(5)]
    k = int(input())

    input_data.sort()
    input_data.reverse()

    temp = input_data[0] - input_data[4]
    if temp > k :
        print(":(")
    else:
        print('Yay!')

if __name__ == '__main__':
    main()
input1 = input()
result = 1000 - int(input1) % 1000
if result == 1000:
    print 0
else:
    result

### FIXED CODE ###

input1 = input()
result = 1000 - int(input1) % 1000
if result == 1000:
    print(0)
else:
    print(result)
3 5

### FIXED CODE ###

x, a = list(map(int, input().split(' ')))

if x  >= a :
    print(10)
else:
    print(0)
N,K = int(input('N = ')), int(input('K = '))
S = input('S = ')

komoji = S[K-1:K].lower()

Out = S[:K-1] + komoji + S[K:N+1]

print(Out)

### FIXED CODE ###

N,K = (int(x) for x in input().split())
S = input()
if 1 <= N <= 50 and 1 <=K <= N and len(S) == N :
    komoji = S[K-1:K].lower()

    Out = S[:K-1] + komoji + S[K:]

    print(Out)
from collections import defaultdict

N, M = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(M)]

g = defaultdict(list)
done = [0] * (N+1)
memo = [0] * (N+1)

for x, y in xy:
    g[x].append(y)

def dp(v):
    max_len = 0
    if done[v] == 1:
        return memo[v]
    else:
        for to in g[v]:
            max_len = max(max_len, dp(to)+1)
        done[v] = 1
        memo[v] = max_len
    return max_len

ans = 0
for v in range(1, N+1):
    ans = max(ans, dp(v))
print(ans)

### FIXED CODE ###

from collections import defaultdict, deque

def topological_sort(vertex:list, edge:list):
    graph = {i: [] for i in vertex}
    for i, j in edge:
        graph[i].append(j)
        
    inp_cnt = defaultdict(int)
    outs = defaultdict(list)
    for inp, out in edge:
        inp_cnt[out] += 1
        outs[inp].append(out)

    result = []
    queue = deque([i for i in vertex if inp_cnt[i]==0])
    while queue:
        v = queue.popleft()
        result.append(v)
        for v2 in outs[v]:
            inp_cnt[v2] -= 1
            if inp_cnt[v2] == 0:
                queue.append(v2)
    return result

N, M = map(int, input().split())
vertex = list(range(1, N+1))
edge = [list(map(int, input().split())) for _ in range(M)]
graph = {i: [] for i in vertex}
for i, j in edge:
    graph[i].append(j)

sorted_vertecies = topological_sort(vertex, edge)
dp = [0] * (N+1)
for i in sorted_vertecies:
    ends = graph[i]
    for j in ends:
        dp[j] = max(dp[j], dp[i] + 1)
print(max(dp))
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x):
        self.setdefault(x,0)
        self[x] += 1

N,P = ilint()
ans = 0

def swap(i):
    P[i],P[i+1] = P[i+1],P[i]
    ans += 1

for i in range(N-1):
    if P[i]==i+1:
        swap(i)
if P[-1]==N:
    swap(N-1)
print(ans)

### FIXED CODE ###

import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x):
        self.setdefault(x,0)
        self[x] += 1

N,P = ilint()
ans = 0

def swap(i):
    global ans
    P[i],P[i+1] = P[i+1],P[i]
    ans += 1

for i in range(N-1):
    if P[i]==i+1:
        swap(i)
if P[-1]==N:
    swap(N-2)
print(ans)
#include <bits/stdc++.h>
using namespace std;
long long a,b,x,s,e;
int main()
{
    cin>>a>>b>>x;
    if(a%x==0)
	{
		s=a/x;
	}
    else
	{
		s=a/x+1;
	}
    e=b/x;
    cout<<e-s+1;
    return 0;//求过！！！！！！！！！！！ 
}

### FIXED CODE ###

a,b,c=map(int,input().split())
if a%c==0:
 print((b-a)//c+1)
else:
 print((b-(a//c+1)*c)//c+1)
S = input()
lis = list(S)
lis_rev = list(S)
lis_rev.reverse()
cnt = 0

lgh = 

for i in range(len(lis) // 2):
    if lis[i] != lis_rev[i]:
        cnt += 1
print(cnt)

### FIXED CODE ###

S = input()
lis = list(S)
lis_rev = list(S)
lis_rev.reverse()
cnt = 0

for i in range(len(lis) // 2):
    if lis[i] != lis_rev[i]:
        cnt += 1
print(cnt)
import math
x1, y1, x2, y2 = [int(i) for i in input().split()]
print(math.hypot(x1 - x2, y1 - y2))

### FIXED CODE ###

from math import *
x1, y1, x2, y2 = map(float, input().split())
print(hypot(x1 - x2, y1 - y2))
s=list(input())
c = 0
if s[0] == 'A':
    c += 1
if s[2:len(s)-1:].count('C') == 1:
    c += 1
    s.remove('A')
    s.remove('C')
a = 'a'
for i in range(len(s)):
    a += s[i]
if a.islower():
    c += 1

if c == 3:
    print('AC')
else:
    print('WA')

### FIXED CODE ###

# cook your dish here
s=list(input())
c = 0
if s[0] == 'A':
    c += 1
if s[2:len(s)-1:].count('C') == 1:
    c += 1

    s.remove('C')
if 'A' in s:
    s.remove('A')
a = 'a'
for i in range(len(s)):
    a += s[i]
if a.islower():
    c += 1
 
if c == 3:
    print('AC')
else:
    print('WA')
N,Q=map(int,input().split())
S=input()
for i in range(Q):
  l,r=list(map(int,input().split()))
for j in range(Q):
  print(str.count("AC",l[j].r[j]+1))

### FIXED CODE ###

N,Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
  t[i+1]=t[i]+(1 if S[i:i+2]=="AC" else 0)
for i in range(Q):
  l,r=map(int,input().split())
  print(t[r-1]-t[l-1])
n = int(input())
def move(max_num,before):
  return min(max_num,before)

people = [n,0,0,0,0,0]
max_nums = []
for i in range(5):
  max_nums.append(int(input()))

time = 0
while True:
  time += 1
  move_p = [0] * 6
  for i in range(5):
    move_p[i] -= min(max_num[i],people[i])
    move_p[i+1] += min(max_num[i],people[i])
  people += move_p
  if people[-1] == n:
    break



### FIXED CODE ###

n = int(input())

max_nums = []
for i in range(5):
  max_nums.append(int(input()))
max_nums.append(n)
a = n/min(max_nums)
print(int(a) +4+ (0 if a == int(a) else 1))
a,b,c = map(int,raw_input().split())
ans = []
for i in range(a,b+1):
	if c%i == 0:
		ans.append(i)
reuturn ans

### FIXED CODE ###

a,b,c = map(int,raw_input().split())
lst = []
for i in range(a,b+1):
	if c%i == 0:
		lst.append(i)
print len(lst)
import math
A,B,C,D=map(int,input().split())


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


#print(len([x for x in range(A,B) if x%2!=0 and x%3!=0]))

size=B-A+1
#C
C2=A%C
if C2 is 0:
    Csize=size
else:
    C2=C-C2
    Csize=size-C2

#D
D2=A%D
if D2 is 0:
    Dsize=size
else:
    D2=D-D2
    Dsize=size-D2

cd =lcm(C,D)

#c,dの最小公倍数
cd2=A%cd
if cd2 is 0:
    CDsize=size
else:
    cd2=cd-cd2
    CDsize=size-cd2

#Cの個数
Cq=(Csize-1)//C

#Dの個数
Dq=(Dsize-1)//D

#CDの個数
CDq=(CDsize-1)//cd


Q=(Cq+1)+(Dq+1)-(CDq+1)
Q=size-Q
print(Q)












"""
listsize=B-A-1
Q=0
for i in range(listsize+1):
    number=i+A
    if number % C is not 0 and number % D is not 0:
        Q+=1
print(Q)
"""




### FIXED CODE ###

from fractions import gcd
A,B,C,D=map(int,input().split())


def lcm(x, y):
    return (x * y) // gcd(x, y)

size=B

cd=lcm(C,D)
allC=size//C
allD=size//D
allcd=size//cd
ALL=size-(allC+allD-allcd)

size=A-1
cd=lcm(C,D)
pC=size//C
pD=size//D
pcd=size//cd
P=size-(pC+pD-pcd)

print(ALL-P)
from math import gcd
from functools import reduce
import sys

lcm = lambda x, y : x*y // gcd(x, y)
N, *T = map(int, sys.stdin.read().split())
ans = reduce(lcm, T)
print(ans)


### FIXED CODE ###

from fractions import gcd
from functools import reduce
import sys

lcm = lambda x, y : x*y // gcd(x, y)
N, *T = map(int, sys.stdin.read().split())
ans = reduce(lcm, T)
print(ans)
N=input()

nl=[ [] for i in range(N+1) ]

q=deque()
for i in range(N-1):
	u,v,w=map(int, raw_input().split())
	nl[u].append( (v,w) )
	nl[v].append( (u,w) )

	if i==0:
		Visit[u]=0
		q.append(1)

Visit=[ None for i in range(N+1) ] 


while q:
	x=q.popleft()
	for to,kyori in nl[x]:
		if Visit[to] is None:
			if kyori%2==0:
				Visit[to]=Visit[x]
			else:
				Visit[to]=(Visit[x]+1)%2
			q.append(to)
			

for i in Visit[1:]:
	print i
	


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

N,M=map(int, raw_input().split())
par=[ i for i in range(N+1)  ]

def root(x):
	if par[x]==x:
		return x
	else:
		par[x]=root( par[x] )
		return par[x]

def same(x,y):
	return root(x)==root(y)

def unite(x,y):
	x=root(x)
	y=root(y)
	if x==y: return
	par[x]=y


for i in range(M):
	x,y,z=map(int, raw_input().split())
	unite(x,y)


S=set()
for i in range(1,N+1):
	S.add(root(i))

print len(S)
if input() == "Sunny":
  print("Cloudy")
elif input() == "Cloudy":
  print("Rainy")
else:
  print("Sunny")

### FIXED CODE ###

s = input()
if s == "Sunny":
  print("Cloudy")
elif s == "Cloudy":
  print("Rainy")
else:
  print("Sunny")
n = int(input())
c = 1
s = 26
while True:
    if n <= s:
        break
    c += 1
    s += 26 ** c
a = ""
al = 'abcdefghijklmnopqrstuvwxyz'
for i in range(c-1,-1,-1):
    b = n // 26 ** i
    n %= 26 ** i
    a += al[b-1]
print(a)

### FIXED CODE ###

n = int(input())
c = 1
s = 26
while True:
    if n <= s:
        break
    c += 1
    s += 26 ** c
a = ""
al = 'abcdefghijklmnopqrstuvwxyz'
for i in range(1,c+1):
    a += al[(n - 1) % 26]
    n = (n - 1) // 26
print(a[::-1])
from math import gcd
N=int(input())
T=[int(input()) for i in range(N)]
def lcm(a,b):
    return a*b//gcd(a,b)
ans=1
for i in T:
    ans=lcm(ans,i)
print(ans)

### FIXED CODE ###

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
N=int(input())
T=[int(input()) for i in range(N)]
def lcm(a,b):
    return a*b//gcd(a,b)
ans=1
for i in T:
    ans=lcm(ans,i)
print(ans)
l = input().split()

a=l[1]
b=l[2]

X=abs(a-b)
print(X)


### FIXED CODE ###

L = input().split()

w=int(L[0])
a=int(L[1])
b=int(L[2])

if a<b:
    if a+w<b:
        move=abs(a+w-b)
        print(move)
    else:
        print(int(0))

elif a>b:
    if b+w<a:
        m=abs(b+w-a)
        print(m)
    else:
        print(int(0))

else:
    print(int(0))
import math
import sys
import collections
n,k = map(int, input().split())
A = list(map(int, input().split()))
count=len(A)
Adel=list(set(A))
ans=len(Adel)-k
#print(Adel)
if ans<0:
    ans=0
    print(ans)
    sys.exit()
newA=collections.Counter(A)
ans=len(Adel)
Aans=n
for i in range(k+1):
    count=newA.most_common()[i][i]
    #print(count)
    ans=ans-1
    Aans=Aans-count
    if ans==k:
        print(n-Aans)
        sys.exit()
    #print(count)
#print(newA)
#print(A)

### FIXED CODE ###

import math
import sys
import collections
n,k = map(int, input().split())
A = list(map(int, input().split()))
count=len(A)
Adel=list(set(A))
ans=len(Adel)-k
#print(Adel)
if ans<0:
    ans=0
    print(ans)
    sys.exit()
newA=collections.Counter(A)
count=list(newA.values())
count.sort()
#print(count)
ans=sum(count[:-k])
print(ans)
import math
A, B, C, D = map(int, input().split())

def lcm(x, y):
    return x * y // math.gcd(x, y)

def F(a, c, d):
    x = a - a//c - a//d + a//lcm(c, d)
    return x

ans = int(F(B, C, D) - F(A-1, C, D))
print(ans)

### FIXED CODE ###

from fractions import gcd
A, B, C, D = map(int, input().split())

def lcm(x, y):
    return x * y // gcd(x, y)

def F(a, c, d):
    x = a - a//c - a//d + a//lcm(c, d)
    return x

ans = int(F(B, C, D) - F(A-1, C, D))
print(ans)
strS = input()
S = int(strS)
lenS = len(strS)
 
ans = 0
for i in range(lenS - 3):
    for j in range(i+3, lenS):
#        print(i,j)
        if int(strS[i:j+1])%2019 == 0:
#            print(int(str(S)[i:j]), i, j)
            ans += 1
print(ans)

### FIXED CODE ###

S, W = map(int, input().split())
if W >= S:
    print('unsafe')
else:
    print('safe')
n = int(input())
z = list(map(int,input().split()))

def half(n,z):
	existodd = 0
	count = 0
	while True: 
		for i in z:
			if i % 2 != 0:
				existodd = 1

		if existodd:
			print(count)
			break
		
		for i in range(n):		
			z[i] /= 2
		
		count += 1
	
half(n,z)


### FIXED CODE ###

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

def judge(a,b):
	c = a*b
	if a*b % 2 == 0:
		print('Even')
	else:
		print('Odd')

judge(a,b)
S = input()
W = input()
S *= 3

T = [-1] * len(W)

ii = 2
jj = 0

T[0] = -1
T[1] = 0

while ii < len(W):
    if W[ii - 1] == W[jj]:
        T[ii] = jj + 1
        ii += 1
        jj += 1
    elif jj > 0:
        jj = T[jj]
    else:
        T[ii] = 0
        ii += 1

def KMP(i0):
    ret = -1
    
    m = 0
    i = 0

    while m + i < len(S) - i0:
        if W[i] == S[m + i + i0]:
            i += 1
            if i == len(W):
                return m
        else:
            m = m + i - T[i]
            if i > 0:
                i = T[i]
    return len(S) - i0

i = 0
c = 0
cmax = 0
while i < len(S):
    k = KMP(i)
    if k == len(S):
        break
    elif k == 0:
        c += 1
    else:
        c = 1
    cmax = max(cmax, c)
    i += k + len(W)
if cmax * len(W) * 2 > len(S) * 3:
    print(-1)
else:
    print(cmax)

### FIXED CODE ###

S = input()
W = input()
M = len(S)
S *= 3 * (len(W)//len(S)+1)


N = len(W)
def primeFactor(N):
    i, n, ret, d, sq = 2, N, {}, 2, 99
    while i <= sq:
        k = 0
        while n % i == 0: n, k, ret[i] = n//i, k+1, k+1
        if k > 0 or i == 97: sq = int(n**(1/2)+0.5)
        if i < 4: i = i * 2 - 1
        else: i, d = i+d, d^6
    if n > 1: ret[n] = 1
    return ret

def divisors(N):
    pf = primeFactor(N)
    ret = [1]
    for p in pf:
        ret_prev = ret
        ret = []
        for i in range(pf[p]+1):
            for r in ret_prev:
                ret.append(r * (p ** i))
    return sorted(ret)

D = divisors(N)
p = 1
for d in D:
    if W[:-d] == W[d:]:
        W = W[:d]
        p = N//d
        N = d
        break

W = W[:d]

T = [-1] * (len(W)+1)

ii = 2
jj = 0

T[0] = -1
T[1] = 0

while ii < len(W) + 1:
    if W[ii - 1] == W[jj]:
        T[ii] = jj + 1
        ii += 1
        jj += 1
    elif jj > 0:
        jj = T[jj]
    else:
        T[ii] = 0
        ii += 1
m = 0
def KMP(i0):
    global m, i
    ret = -1

    while m + i < len(S):
        if W[i] == S[m + i]:
            i += 1
            if i == len(W):
                t = m
                m = m + i - T[i]
                if i > 0:
                    i = T[i]
                return t
        else:
            m = m + i - T[i]
            if i > 0:
                i = T[i]
    return len(S)

i = 0
j = -10**9
c = 0
cmax = 0
f = 0
while m < len(S)-N:
    k = KMP(0)
    if k == len(S):
        break
    elif k == N + j:
        c += 1
    else:
        c = 1
        f += 1
    cmax = max(cmax, c)
    j = k
if f == 1:
    print(-1)
else:
    print(cmax//p)