Harryxun/stf_run huggingface dataset:
import sys
lines = sys.stdin.readlines()

S = str(lines[0])

#10**nのmod計算
A = []
p =1
for i in range(len(S)):
  A.append(p)
  p = p*10%2019

#左からi文字以降の数字列のmod計算
X = []
a = 0
for i in range(len(S)):
  a = (a + int(S[len(S)-i-1])*A[i]) %2019
  X.append(a)

X.sort()
flag =1
n = 0

#modが同じになる組み合わせ、またはもともとmodが0になる数字列の個数の総和計算
for i in range(len(X)-1):
  if X[i]==0:
    n +=1
  if X[i]==X[i+1]:
    flag += 1
  else:
    n += flag*(flag-1)//2
    flag = 1
print(n)

### FIXED CODE ###

S = str(input())

#10**nのmod計算
A = []
p =1
for i in range(len(S)):
  A.append(p)
  p = p*10%2019

#左からi文字以降の数字列のmod計算
X = []
a = 0
for i in range(len(S)):
  a = (a + int(S[len(S)-i-1])*A[i]) %2019
  X.append(a)
X.sort()
flag =1
n = 0

#modが同じになる組み合わせ、またはもともとmodが0になる数字列の個数の総和計算
for i in range(len(X)-1):
  if X[i]==0:
    n +=1
  if X[i]==X[i+1]:
    flag += 1
  else:
    n += int(flag*(flag-1)/2)
    flag = 1
n += int(flag*(flag-1)/2)
if X[len(X)-1]==0:
  n +=1
print(n)
def main():
    N = int(input())
    A = list(map(int, input().split()))
    mod_v = 10**9 + 7
    ans = [0] * (N + 1)
    for i in range(0, N - 1):
        ai = A[0]
        aj = A[i + 1]
        ans[0] += ai * aj
    for j in range(1, N - 1):
        ans[j] = (ans[j - 1] - A[j - 1] * A[j]) // A[j - 1] * A[j]
    ret = 0
    for k in range(0, N):
        ret += ans[k]
    if ret > mod_v:
        ret = ret % mod_v
    print(ret)


if __name__ == '__main__':
    main()

### FIXED CODE ###

def calc(A, N, i):
    ans = 0
    ai = A[i]
    for i in range(i, N - 1):
        aj = A[i + 1]
        ans += ai * aj
    return (ans)


def main():
    N = int(input())
    A = list(map(int, input().split()))
    mod_v = 10**9 + 7
    ans = [0] * (N + 1)
    for i in range(0, N - 1):
        if A[i] != 0:
            ans[i] = calc(A, N, i)
            break
    for j in range(i + 1, N - 1):
        if A[j] != 0:
            ans[j] = (ans[j - 1] - A[j - 1] * A[j]) // A[j - 1] * A[j]
        else:
            ans[j] = 0
    ret = 0
    for k in range(0, N):
        ret += ans[k]
    ret = ret % mod_v
    print(ret)


if __name__ == '__main__':
    main()
a = int(input())
if a % 2 = 0:
  print(str(int(a//2)))
else:
  print(str(int(a//2)+1.0))

### FIXED CODE ###

a = int(input())
if a % 2 == 0:
  print(str(int(a//2)))
else:
  print(str(int(a//2)+1))
S = input()

count = 0
C = []
for i in list(S):
  if i == "A" or i == "C" or i == "G" or i == "T":
    count += 1
  else:
    C.append(count)
    count = 0

print(max(C))

### FIXED CODE ###

S = input()

count = 0
C = []
for i in range(len(S)):
  C.append(count)
  count = 0
  if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
    count += 1
    if(i == len(S)-1):
      C.append(count)
      break
    for j in range(i+1,len(S)):
      if S[j] == "A" or S[j] == "C" or S[j] == "G" or S[j] == "T":
        count += 1
      else: break

print(max(C))
A, B, C, K = map(int, input().split())
cards = [1]*A + [0]*B + [-1]*C

print(sum(cards[:K]))

### FIXED CODE ###

A, B, C, K = map(int, input().split())
max_score = 0

if A >= K:
  print(K)
elif A+B >= K:
  print(A)
else:
  print(2*A+B-K)
A, B, C = map(input().split())

if int(A) == int(B) == int(C):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a = input().split()
if(len(set(a))==2):
   print("Yes")
else:
   print("No")
n = int(input())
a = list(map(int, input().split()))
                                                                                              M = max(a)
biggest_prime = [0] * (M+10)
for i in range(2, M+10):
    if biggest_prime[i] == 0:
        biggest_prime[i] = i
        for j in range(i*i, M+1, i):
            biggest_prime[j] = i

from collections import defaultdict
cntd=defaultdict(int)
for i in range(len(a)):
    num = a[i]
    while num>1:
        p=biggest_prime[num]
        cntd[p]+=1
        while num % p == 0:
            num//=p

flg=False
for c in cntd.values():
    if c==n:
        print("not coprime")
        exit()
    if c>1:
        flg=True
if flg:
    print("setwise coprime")
else:
    print("pairwise coprime")

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
M=max(a)
biggest_prime = [0] * (M+10)
for i in range(2, M+10):
    if biggest_prime[i] == 0:
        biggest_prime[i] = i
        for j in range(i*i, M+1, i):
            biggest_prime[j] = i

from collections import defaultdict
cntd=defaultdict(int)
for i in range(len(a)):
    num = a[i]
    while num>1:
        p=biggest_prime[num]
        cntd[p]+=1
        while num % p == 0:
            num//=p

flg=False
for c in cntd.values():
    if c==n:
        print("not coprime")
        exit()
    if c>1:
        flg=True
if flg:
    print("setwise coprime")
else:
    print("pairwise coprime")
import itertools

N = int(input())
params = []
for i in range(N):
    xyh = [int(n) for n in input().split()]
    params.append(xyh)

for cxi, cyi in itertools.product(range(101), range(101)):
    for k in range(N):
        if params[k][2] > 0:
            hight = params[k][2] + abs(params[k][0] - cxi) + abs(params[k][1] - cyi)

    for k in range(N):
        if params[k][2] != max((hight - abs(params[k][0] - cxi) - abs(params[k][1] - cyi)), 0)
            break
    
    else:
        print(cxi, cyi, hight)

### FIXED CODE ###

N = int(input())
params = []
for i in range(N):
    xyh = [int(n) for n in input().split()]
    params.append(xyh)

for cxi in range(101):
    for cyi in range(101):
        for k in range(N):
            if params[k][2] > 0:
                hight = params[k][2] + abs(params[k][0] - cxi) + abs(params[k][1] - cyi)

        for k in range(N):
            if params[k][2] != max((hight - abs(params[k][0] - cxi) - abs(params[k][1] - cyi)), 0):
                break
        
        else:
            print(cxi, cyi, hight)
#import numpy as np

n,k=[int(i) for i in input().split()]
h=[int(i) for i in input().split()]



a=np.array(h)
b=[[0 for i in range(n)] for j in range(n)]
b=np.array(b)

for j in range(n):
    for i in range(n):
        if j>i:
            b[j][i]=abs(a[j]-a[i])
#print(b)

dp=[int(0) for i in range(n)]
dp0=[[1000000000000000 for i in range(n)] for j in range(n)]

dp0[0]=0
dp[0]=0

dp0[1]=b[1][0]
dp[1]=dp0[1]

if k==1:
    for i in range(2,n):
        dp[i]=dp[i-1]+b[i][i-1]
    
if k > 1:
    for j in range(2,n):
        if j <=k:
            for i in range(j):
                dp0[j][i]=dp[i]+b[j][i]
            dp[j]=min(dp0[j])
        else:
            for i in range(k):
                dp0[j][i+j-k]=dp[i+j-k]+b[j][i+j-k]
            dp[j]=min(dp0[j])

#print(dp0)
print(dp[n-1])

### FIXED CODE ###

n,k=[int(i) for i in input().split()]
h=[int(i) for i in input().split()]
#print(n,k,h)
dp=[float('inf') for i in range(n)]
dp[0]=0
dp[1]=abs(h[1]-h[0])

if k > 1 and n > 2:
  for y in range(2,k):
    dp[y]=abs(h[y]-h[0])
    x=1
    while x < k:
      tmp=dp[x]+abs(h[y]-h[x])
      if tmp < dp[y]:
        dp[y]=tmp
      x+=1
  for y in range(k,n):    
    dp[y]=dp[y-1]+abs(h[y]-h[y-1])
    for x in range(2,k+1):
      tmp=dp[y-x]+abs(h[y]-h[y-x])
      if tmp < dp[y]:
        dp[y]=tmp
        
if k == 1 and n > 2:
  for y in range(2,n):
    dp[y]=dp[y-1]+abs(h[y]-h[y-1])

print(dp[-1])
n = int(input())
for i in range(2):
    if n[i] == n[i+1] and n[i+1] == n[i+2]:
        print("Yes")
        exit()
print("No")

### FIXED CODE ###

n = input()
for i in range(2):
    if n[i] == n[i+1] and n[i+1] == n[i+2]:
        print("Yes")
        exit()
print("No")
# coding: utf-8
import math
a, b, x = map(int, input().split())
h = x / a ** 2
l = 2 * a * h / b
if l <= a:
    print(math.degrees(math.atan2(b, l)))
else:
    k = 2 * h - b
    m = a * b / (k - b)
    print(90 + math.degrees(math.atan2(m, b)))

### FIXED CODE ###

# coding: utf-8
import math
a, b, x = map(int, input().split())
h = x / a ** 2
l = 2 * a * h / b
if l <= a:
    print(math.degrees(math.atan2(b, l)))
elif x == a ** 2 * b:
    print(0)
else:
    k = 2 * h - b
    m = a * b / (k - b)
    print(90 + math.degrees(math.atan2(m, b)))
n=int(input())
l=list(map(int, input().split()))
cnt=0
ans=[]
for i in range(n-1):
  if l[i] >= l[i+1]:
    cnt += 1
    ans.append(cnt)
  else:
    cnt = 0
print(max(ans))


### FIXED CODE ###

n=int(input())
l=list(map(int, input().split()))
cnt=0
ans=[0]
for i in range(n-1):
  if l[i] >= l[i+1]:
    cnt += 1
    ans.append(cnt)
  else:
    cnt = 0
print(max(ans))
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

maxn=0
for i in range(n):
  maxn=max(maxn,sum(a[:i+1],b[i:]))
print(maxn)

### FIXED CODE ###

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

ans=0
for i in range(N):
    sumn=sum(A[:i+1])+sum(B[i:])
    ans=max(sumn,ans)
print(ans)
from sympy import divisors

n = int(input())

a = len(divisors(n-1)[1:])

d = divisors(n)
for dd in d[1:]:
    nn = n
    while nn % dd == 0:
        nn = nn // dd
    if nn % dd == 1:
        a += 1

print(a)


### FIXED CODE ###

from math import sqrt, ceil


def divisors(n):
    out = []
    nn = ceil(sqrt(n))
    for i in range(1, nn):
        if n % i == 0:
            out.append(i)
            out.append(n//i)

    if nn ** 2 == n:
        out.append(nn)

    out.sort()
    return out


n = int(input())
a = len(divisors(n-1)[1:])

d = divisors(n)
for dd in d[1:]:
    nn = n
    while nn % dd == 0:
        nn = nn // dd
    if nn % dd == 1:
        a += 1

print(a)
#入力部
n,k = map(int,input().split())
h = list(map(int,input().split()))

#攻撃:hを1減らす　必殺技:hをすべて減らす制限　k回
#hを降順にソート
h.sort(reverse = True)
#nがkより小さい時全部に必殺技が使えるから0
if n <= k:
    print(0)
#体力が多い順に必殺技を使用して残った体力の合計を出力
else:
    for i in range(k):
        s[i] = 0
print(sum(s))

### FIXED CODE ###

#入力部
n,k = map(int,input().split())
h = list(map(int,input().split()))

#攻撃:hを1減らす　必殺技:hをすべて減らす制限　k回
#hを降順にソート
h.sort(reverse = True)
#nがkより小さい時全部に必殺技が使えるから0
if n <= k:
    print(0)
#体力が多い順に必殺技を使用して残った体力の合計を出力
else:
    for i in range(k):
        h[i] = 0
    print(sum(h))
if p and m:
    p=z+p
    for i in p[:-1]:
        print(m[0],i)
        m[0]-=i
    for i in m:
        print(p[-1],i)
        p[-1]-=i
elif p:
    p=z+p
    for i in p[:-2]:
        print(p[0],i)
        p[0]-=i
    print(p[-2],p[0])    
elif m:
    m=m+z
    for i in p[:-1]:
        print(p[-1],i)
        p[-1]-=i

### FIXED CODE ###

n,*a=map(int,open(0).read().split())
a.sort()
print(sum(abs(i)for i in a)-2*min(abs(a[-1]),abs(a[0]))*(a[0]*a[-1]>0))
if a[0]>0:
    print(a[0],a[-1])
    a[0]-=a[-1]
    for i in a[1:-2]:
        print(a[0],i)
        a[0]-=i
    print(a[-2],a[0])
elif a[-1]<0:
    for i in a[:-1]:
        print(a[-1],i)
        a[-1]-=i
else:
    for i in a[1:-1]:
        if i<0:
            print(a[-1],i)
            a[-1]-=i
        else:
            print(a[0],i)
            a[0]-=i
    print(a[-1],a[0])
import collections

N = int(input())
V = list(int(i) for i in input().split())
even = V[0::2]
odd =  V[1::2]
half_count = len(even)
even = collections.Counter(even).most_common(1)
even_elem = even[0][0]
even_count = even[0][1]
odd = collections.Counter(odd).most_common(1)
odd_elem = odd[0][0]
odd_count = odd[0][1]

if (even_count > odd_count):
    print((half_count - even_count) + (half_count + len(odd.count(even_elem))))
elif (even_count < odd_count):
    print((half_count - odd_count) + (half_count + len(even.count(odd_elem))))
else:
    print(0)

### FIXED CODE ###

import collections

N = int(input())
V = list(int(i) for i in input().split())
even = V[0::2]
odd =  V[1::2]
all_length = len(V)
even = collections.Counter(even).most_common(2)
odd = collections.Counter(odd).most_common(2)
if (even[0][0] != odd[0][0]):
    print(all_length - even[0][1] - odd[0][1])
else:
    if(len(even) == 1 and len(odd) == 1):
        print(all_length // 2)
    elif(len(even)==1):
        print(all_length // 2 - odd[1][1])
    elif(len(odd)==1):
        print(all_length // 2 - even[1][1])    
    else:
        print(min(all_length - even[0][1] - odd[1][1], all_length - even[1][1] - odd[0][1]))
N = int(input())
A = set(map(int,input().split()))

while len(A) > 1:
  min_A = min(A)
  next_A = set([min_A])
  for i in A:
    B = i % min_A
    if B != 0:
      next_A.add(B)
  A = list(next_A)
print(A[0])

### FIXED CODE ###

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

while len(A) > 1:
  min_A = min(A)
  next_A = set([min_A])
  for i in A:
    B = i % min_A
    if B != 0:
      next_A.add(B)
  A = list(next_A)
print(list(A)[0])
# -*- coding: utf-8 -*-
print(3*int(input)**2)


### FIXED CODE ###

# -*- coding: utf-8 -*-
print(3*int(input())**2)
import Math

h, a = map(int, input().split())
print(math.ceil(h/a))


### FIXED CODE ###

import math

h, a = map(int, input().split())
print(math.ceil(h/a))
-*- coding: utf-8 -*-

s = input()
print(s.rfind('Z') - s.find('A') + 1)

### FIXED CODE ###

s = input()
     
a = s.find("A")
b = s.rfind("Z")
     
print(b-a+1)
def main():
  s = input()
  n = len(s)
  x, y = map(int, input().split())
  
  x_max = 0
  y_max = 0
  dpx = [[False, False] for _ in range(n+2)]
  dpy = [[False, False] for _ in range(n+2)]

  dpx[0][0] = True
  dpy[0][0] = True
  x_turn = False
  y_turn = False
  judge = True
  turn = False
  xcount = 0
  count = 0
  for i in range(n):
    if judge and s[i] == "F":
      xcount += 1
      continue
    if judge:
      judge = False
      turn = False if turn else True
      continue
    if s[i] == "F":
      count += 1
      if i != n-1:
        continue
    if turn:
      y_turn = False if y_turn else True
      if y_turn:
        p, q = 0, 1
      else:
        p, q = 1, 0
      for i in range(n+1):
        
        dpy[i][q] = False
      for i in range(n+1):
        if dpy[i][p]:
          dpy[abs(i-count)][q] = True
          dpy[i+count][q] = True
        if i == y_max:
          y_max = i+count
          break
    else:
      x_turn = False if x_turn else True
      if x_turn:
        p, q = 0, 1
      else:
        p, q = 1, 0
      for i in range(n+1):
        dpx[i][q] = False
      for i in range(n+1):
        if dpx[i][p]:
          dpx[abs(i-count)][q] = True
          dpx[i+count][q] = True
        if i == x_max:
          x_max = i+count
          break
    turn = False if turn else True
    count = 0
  
  p = 1 if x_turn else 0
  q = 1 if y_turn else 0
  x -= xcount
  if dpx[abs(x)][p] and dpy[abs(y)][q]:
    print("Yes")
  else:
    print("No")
  
if __name__ == "__main__":
  main()

### FIXED CODE ###

def main():
  s = input()
  n = len(s)
  x, y = map(int, input().split())

  dpx = [[False, False] for _ in range(n+2)]
  dpy = [[False, False] for _ in range(n+2)]

  dpx[0][0] = True
  dpy[0][0] = True
  x_turn = False
  y_turn = False
  judge = True
  turn = False
  xcount = 0
  count = 0
  for i in range(n):
    if judge and s[i] == "F":
      xcount += 1
      continue
    if judge:
      judge = False
      turn = False if turn else True
      continue
    if s[i] == "F":
      count += 1
      if i != n-1:
        continue
    if turn:
      y_turn = False if y_turn else True
      if y_turn:
        p, q = 0, 1
      else:
        p, q = 1, 0
      for i in range(n+1):
        
        dpy[i][q] = False
      for i in range(n+1):
        if dpy[i][p]:
          dpy[abs(i-count)][q] = True
          dpy[i+count][q] = True
    else:
      x_turn = False if x_turn else True
      if x_turn:
        p, q = 0, 1
      else:
        p, q = 1, 0
      for i in range(n+1):
        dpx[i][q] = False
      for i in range(n+1):
        if dpx[i][p]:
          dpx[abs(i-count)][q] = True
          dpx[i+count][q] = True
    turn = False if turn else True
    count = 0
  
  p = 1 if x_turn else 0
  q = 1 if y_turn else 0
  x -= xcount
  if abs(x) > n:
    print("No")
  elif dpx[abs(x)][p] and dpy[abs(y)][q]:
    print("Yes")
  else:
    print("No")
  
if __name__ == "__main__":
  main()
n,m=map(int,input().split())
for i in range(m):
  l,r=list(map(int,input().split()))
ans=0
dif=max(l)-min(r)
if(diff>=0):
  ans=diff+1
else:
  ans=0
print(ans)

### FIXED CODE ###

minlist=[]
maxlist=[]
 
n,m=map(int,input().split())
for i in range(m):
  l,r=list(map(int,input().split()))
  minlist.append(l)
  if r>0:
    maxlist.append(r)
ans=0
dif=min(maxlist)-max(minlist)
if(dif>=0):
  ans=dif+1
else:
  ans=0
print(ans)
s = input()
s = int(s)

x = s / 1.08

rx = round(x)
tashikame = rx * 1.08
tashikames = math.floor(tashikame)
tashikames = int(tashikames)
if s != tashikames:
  print(':(')
else:
  print(x)

### FIXED CODE ###

import math

s = int(input())

te = s % 1.08
if te < 0.1:
  print(':(')
else:
  x = s / 1.08
  print(math.ceil(x))
n, m = map(int, input().split()) 
card = list(map(int, input().split()))
card.sort()
#command = [list(map(int, input().split())) for i in range(m)]
#command.sort(key=lambda x: x[1], reverse=True)

command = []

for i in range(m):
    b, c = map(int, input().split())
    command.append([b,c])
command.sort(key=lambda x: x[1], reverse=True)

ind = 0
for i in command:
    for j in range(i[0]):
        if card[ind] > i[1]:
            break
        card[ind] = i[1]
        ind += 1
    else:
        continue
    break
print(sum(card))

### FIXED CODE ###

n, m = map(int, input().split()) 
card = list(map(int, input().split()))
card.sort()
command = [list(map(int, input().split())) for i in range(m)]
command.sort(key=lambda x: x[1], reverse=True)

ind = 0
maxNum = len(card)
for i in command:
    for j in range(i[0]):
        if maxNum < ind+1:
            break
        if card[ind] >= i[1]:
            break
        card[ind] = i[1]
        ind += 1
    else:
        continue
    break
print(sum(card))
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(1,n-1):
    if a[i-1]<a[i] and a[i]<a[i+1]:
        cnt+=1
    elif a[i-1]>a[i] and a[i]>a[i+1]:
        cnt+=1py
print(cnt)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(1,n-1):
    if a[i-1]<a[i] and a[i]<a[i+1]:
        cnt+=1
    elif a[i-1]>a[i] and a[i]>a[i+1]:
        cnt+=1
print(cnt)
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B, C, D = il()
    E = B - A + 1
    cnt = 0

    cnt += B // C
    cnt += B // D
    cnt -= A // C
    cnt -= A // D

    cnt -= B // lcm(C, D)
    cnt += A // lcm(C, D)
    print(E - int(cnt))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import os
import fractions

MOD = 10 ** 9 + 7


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


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B, C, D = list(map(int, sys.stdin.readline().split()))
    E = B - A + 1

    ret = 0
    ret += B // C
    ret += B // D
    ret -= (A - 1) // C
    ret -= (A - 1) // D
    ret -= B // lcm(C, D)
    ret += (A-1) // lcm(C, D)
    print(E - ret)


if __name__ == '__main__':
    main()
K = int(input())
S = input()
if (len(S) == K):
  print(S)
else: print( S[0:K].join('...')

### FIXED CODE ###

K = int(input())
S = input()
if (len(S) <= K):
  print(S)
else: print(S[0:K] + '...')
2 line = input()
  3 line = line.split()
  6
  7 A = int(line[0])
  8 B = int(line[1])
  9 print(max(A + B, A - B, A * B))
~
~
~
~

### FIXED CODE ###

line = input()
line = line.split()

A = int(line[0])
B = int(line[1])
print(max(A + B, A - B, A * B))
n=int(input())

def dfs(s):
  if n<int(s) : return 0
  res = if all(s.count(c) for c in "753") : 1 else 0
  for i in "753":
    res += dfs(s+i)
  return res

print(dfs("0"))

### FIXED CODE ###

n=int(input())

def dfs(s):
  if n<int(s) : return 0
  res = 1 if all(s.count(c)>0 for c in "753") else 0
  for i in "753":
    res += dfs(s+i)
  return res

print(dfs("0"))
def make_label(x, y, a, b, label, m):
    h = False
    g = []
    for i in range(m):
        if a[i] == x and label[b[i] - 1] == 0:
            label[b[i] - 1] = y
            g.append(b[i])
            h = True
        elif b[i] == x and label[a[i] - 1] == 0:
            label[a[i] - 1] = y
            h = True
            g.append(a[i])
        
    if h:
        for i in range(len(g)):
            return make_label(g[i], y, a, b, label, m)
    else:
        return label  
        


n, m, k = map(int, input().split())
a = [0] * m
b = [0] * m
c = [0] * k
d = [0] * k

label = [0] * n
kosu_label = 1

friend = [0] * n
block = [0] * n

ans = [0] * n

for i in range(m):
    a[i], b[i] = map(int, input().split())
    
for i in range(k):
    c[i], d[i] = map(int, input().split())
    
for i in range(n):
    if label[i] == 0:
        label[i] = kosu_label
        label = make_label(i + 1, kosu_label, a, b, label, m)
        kosu_label = kosu_label + 1

label_s = [0] * kosu_label

for i in range(n):
    label_s[label[i]] = label_s[label[i]] + 1
    
for i in range(n):
    for j in range(m):
        if a[j] == i + 1 or b[j] == i + 1:
            friend[i] = friend[i] + 1
    for w in range(k):
        if (c[w] == i + 1 or d[w] == i + 1) and label[c[w] - 1] == label[d[w] - 1]:
            block[i] = block[i] + 1
    ans[i] = label_s[label[i]] - friend[i] - block[i] - 1

for i in range(n):
    print(ans[i], end = '')

### FIXED CODE ###

N = int(input())

if N % 2 == 0:
  print(N // 2)
else:
  print(N // 2 + 1)
s = input()
t = input()

a = []

for i in range(len(s)-len(t)):
    count = 0
    for j in range(len(t)):
        if t[j] == s[i + j]:
            count += 1
    a.append(count)
print(len(t)-max(a))

        


### FIXED CODE ###

s = input()
t = input()

a = []

for i in range(len(s)-len(t)+1):
    count = 0
    for j in range(len(t)):
        if t[j] == s[i + j]:
            count += 1
    a.append(count)
print(len(t)-max(a))
import fractions
n,m=map(int,input().split())
s=input()
t=input()
p=fractions.gcd(n,m)
ans=n*m//p
tt=[""]*ans
for i in range(n):
	tt[i*(ans//n)]=s[i]
for i in range(m):
	if tt[i*(ans//m)]!=t[i] and tt[i*(ans//m)]!="":
		print(-1)
		exit()
print(ans)


### FIXED CODE ###

from fractions import gcd
n,m=map(int,input().split())
s=input()
t=input()
p=gcd(n,m)
ans=n*m//p 
for i in range(n):
	if abs((i*(ans//n)/(ans//m))-int(i*(ans//n)/(ans//m)))<=10**(-7):
		if s[i]==t[(i*(ans//n)//(ans//m))]:
			continue
		else:
			print(-1)
			exit()
print(ans)
K = int(input("Enter K: "))
X = int(input("Enter X: "))
if K*500 >= X:
  print("yes")
else:
  print("no")

### FIXED CODE ###

k, x = input().split()
if int(k)*500 >= int(x):
	print("Yes")
else:
	print("No")
# coding: utf-8
n=int(input())
D=list(map(int,input().split()))
m=int(input())
T=list(map(int,input().split()))
d={}
t={}
for d_ in D:
    if str(d_) in d:
        d[str(d_)]+=1
    else:
        d[str(d_)] = 1
for t_ in T:
    if str(t_) in t:
        t[str(t_)]+=1
    else:
        t[str(t_)] = 1

D_=list(set(D))
T_=list(set(T))
flg=True
#print(T_,D_)
if len(T) > len(D) or len(T_) > len(D_):
    flg=False
if flg:
    for t_ in T_:
        #print(t_)
        #print(t[str(t_)], d[str(t_)])
        if t[str(t_)] <= d[str(t_)]:
            pass
        else:
            flg=False
if flg:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

# coding: utf-8
import collections
n=int(input())
D=list(map(int,input().split()))
m=int(input())
T=list(map(int,input().split()))
T_=list(set(T))
c = collections.Counter(D)
c2 = collections.Counter(T)
flg=True
for t in T_:
    #print(c[t], c2[t])
    if c[t] < c2[t]:
        flg=False
if flg:
    print("YES")
else:
    print("NO")
n = [int(input()) for i in range(int(input()))]
m = [int(input()) for i in range(int(input()))]
print(max(len(set(n))-len(set(m)),0))


### FIXED CODE ###

n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))