Harryxun/stf_run huggingface dataset:
import itertools

N = int(input())
P=tuple(map(int,input().split()))
Q=tuple(map(int,input().split()))

for v_idx,v in enumerate(itertools.permutations(range(1,N+1))):
    if v==P:
        a=v_idx
    elif v==Q:
        b=v_idx
        
print(abs(a-b))

### FIXED CODE ###

import itertools
 
N = int(input())
P=tuple(map(int,input().split()))
Q=tuple(map(int,input().split()))
 
for v_idx,v in enumerate(itertools.permutations(range(1,N+1))):
    if v==P:
        a=v_idx
    if v==Q:
        b=v_idx
        
print(abs(a-b))
from sys import stdin

s = stdin.readline().rstrip()

ans = "Yes"
for i in range(0, 11, 2):
    if s[i] + s[i+1] != "hi":
        ans = "No"
        break

print(ans)


### FIXED CODE ###

from sys import stdin

s = stdin.readline().rstrip()

ans = "Yes"
if len(s)%2 != 0:
    ans = "No"
else:
    for i in range(0, len(s), 2):
        if s[i] + s[i+1] != "hi":
            ans = "No"
print(ans)
a = map(int, input().split())
print(n*(n-1)//2 + m(m-1)//2)

### FIXED CODE ###

n, m = map(int, input().split())
print(n*(n-1)//2 + m*(m-1)//2)
import numpy as np
A = np.array([])
for i in range(3):
    A.append(list(map(int, input().split())))

N = int(input())

for n in range(N):
    called_num = int(input())
    called_row = [called_num in A[i] for i in range(3)].index(True)
    
    A[called_row] = [0 if x==called_num else x for x in A[called_row]]
    
sum_row = np.sum(A, axis=1)
sum_col = np.sum(A, axis=0)
sum_diag1 = np.diag(A).sum()
sum_diag2 = A[0][2] + A[1][1] + A[2][0] #良い実装が思いつかなかった

if 0 in sum_row or 0 in sum_col or 0 in [sum_diag1, sum_diag2]: #書き方イマイチ
    print('Yes')
else:
    print('No')

### FIXED CODE ###

import numpy as np
A = []
for i in range(3):
    A.append(list(map(int, input().split())))
A = np.array(A)

N = int(input())

for n in range(N):
    called_num = int(input())
    exist_list = [called_num in A[i] for i in range(3)]
    if True in exist_list:
        called_row = exist_list.index(True)
        A[called_row] = [0 if x==called_num else x for x in A[called_row]]
        
sum_row = np.sum(A, axis=1)
sum_col = np.sum(A, axis=0)
sum_diag1 = np.diag(A).sum()
sum_diag2 = A[0][2] + A[1][1] + A[2][0] #良い実装が思いつかなかった

if 0 in sum_row or 0 in sum_col or 0 in [sum_diag1, sum_diag2]: #書き方イマイチ
    print('Yes')
else:
    print('No')
n,m=[int(s) for s in input().split()]
key_ls=[]
for i in range(m):
  a,b=[int(s) for s in input().split()]
  op=[int(s) for s in input().split()]
  key_ls.append([a,op])
key_ls.sort()
#print(key_ls)
door=[0 for _ in range(n)]
door2=[1 for _ in range(n)]
cost=0
#####一番安い鍵から順にかっていく
while True:
  if door==door2 : break
  key=key_ls.pop(0)
  flag=0
  #まだ開いていない箱を開けられるか？
  for x in key[1]:
    if door[x-1]==0:
      flag=1
      break
  #開けられるなら購入
  if flag==1:
    cost+=key[0]
  for x in key[1]:
    door[x-1]=1
    
print(cost)
    
      

### FIXED CODE ###

n,m=[int(s) for s in input().split()]
key=[]
for i in range(m):
  cost,b=[int(s) for s in input().split()]
  op=0
  for i in input().split():
    op+=1<<(int(i)-1)
  key.append([cost,op])
N=2**n
dp=[[10**7 for _ in range(N)] for _ in range(m)]
dp[0][key[0][1]]=key[0][0]
dp[0][0]=0
for i in range(1,m):
  for j in range(N):
    dp[i][j]=min([dp[i-1][j],dp[i][j]])
    x=j|key[i][1]
    dp[i][x]=min([dp[i][x],dp[i-1][j]+key[i][0]])
if dp[m-1][N-1]==10**7:
  print(-1)
else:
  print(dp[m-1][N-1])
N=int(input())
L=list(map(int,input().split())
M=list[]
m=list[]
for i in range(N):
  for x in range(N):
    if L[x]<i:
      L[x].append(M)
    else:
      L[x].append(m)
  if len(M)=len(m):
    ans+=1

print(ans)

### FIXED CODE ###

N=int(input())
L=list(map(int,input().split()))
l=sorted(L)
if N%2==0:
  n=int(N/2)
  a=l[n-1]
  b=l[n]
  if a==b:
    print('0')
  else:
    print(b-a)
    
else:
  print('0')
n = input()
a = list(map(int, input().split()))
q = input()

aset = set()
for i in range(1, len(a) + 1):
    aset |= set(sum(combi) for combi in itertools.combinations(a, i))

for m in map(int, input().split()):
    print('yes' if m in aset else 'no')

### FIXED CODE ###

import itertools

n = input()
a = list(map(int, input().split()))
q = input()
 
aset = set()
for i in range(1, len(a) + 1):
    aset |= set(sum(combi) for combi in itertools.combinations(a, i))
 
for m in map(int, input().split()):
    print('yes' if m in aset else 'no')
import math
n, x = map(int, input().split())
print(3 * (n - gcd(n, x)))


### FIXED CODE ###

import math
n, x = map(int, input().split())
print(3 * (n - math.gcd(n, x)))
H, N = map(int, input().split())
D = list(map(int, input().split()))
flag = 0

def f(h, d):
  if h == 0:
    return 1
  if len(d) == 0:
    return 0
  a = f(h-d[0], [d[i] for i in range(1, len(d))])
  if a == 1:
    return 1
  a = f(h, [d[i] for i in range(1, len(d))])
  return a

if f(H, D) == 1:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

H, N = map(int, input().split())
A = list(map(int, input().split()))
if sum(A) >= H:
  print("Yes")
else:
  print("No")
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
    B.append(A.index(i)+1)
print(' '.join(map(int,B)))

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
B = [0] * N
for i in range(N):
    B[A[i]-1] = i+1
print(' '.join(map(str,B)))
from functools import lru_cache
MOD=10**9+7
n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
if n==1:
  print(1)
  exit()
if 1 in a and 2 in a:
  print(0)
  exit()
elif 1 in a:
  ans=[0,0,1]
elif 2 in a:
  ans=[0,1,0]
else:
  ans=[0,1,2]

@lru_cache(maxsize=None)
def cnt(x):
  if x<3:
    return ans[x]
  if x in a:
    return 0
  else:
    return (cnt(x-1)+cnt(x-2))%MOD

print(cnt(n))

### FIXED CODE ###

N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
a.sort(reverse=True)

if 1 in a:
  a.pop()
  fibs = [1,0]
else:
  fibs = [1,1]

for i in range(2,N+1):
  if len(a) > 0 and i == a[-1]:
    a.pop()
    fibs[0] = fibs[1]
    fibs[1] = 0
  else:
    next = fibs[1] + fibs[0]
    if next > 1000000007:
      next -= 1000000007
    fibs[0] = fibs[1]
    fibs[1] = next

print(fibs[-1])
n,m = map(int,input().split())
f = [False for _ in range(n)]
a = [[] for _ in range(n+1)]
for _ in range(m):
    x,y,z = map(int,input().split())
    a[x-1].append(y-1)
    a[y-1].append(x-1)

def dfs(i):
    global f
    global a
    f[i] = True
    for g in a[i]:
        if not f[g]:
            dfs(g)
res = 0
for i in range(n):
    if not f[i]:
        res += 1
        dfs(i)

print(res)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
n,m = map(int,input().split())
f = [False for _ in range(n)]
a = [[] for _ in range(n)]
res = 0

def dfs(k):
    f[k] = True
    for g in a[k]:
        if not f[g]:
            dfs(g)

for _ in range(m):
    x,y,z = map(int,input().split())
    a[x-1].append(y-1)
    a[y-1].append(x-1)

for i in range(n):
    if not f[i]:
        res += 1
        dfs(i)
print(res)
a,b,c=map(int,input().split())
d,e,f=map(abs,a-b,a-c,b-c)
print(d+e+f-min(d,e,f))

### FIXED CODE ###

a,b,c=map(int,input().split())
d,e,f=abs(a-b),abs(a-c),abs(b-c)
print(d+e+f-max(d,e,f))
n = int(input())
a = input()
if str(a[:n/2+1])==str(a[n/2+1:]):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())
a = input()
if a[:n//2]==a[n//2:]:
  print("Yes")
else:
  print("No")
# -*- coding: utf-8 -*-

def qui(l):
    num = len(l)
    if num == 0: return []
    if num == 1: return l
    piv = l[0]
    mini = []
    maxi = []
    for i in range(1,len(l)):
        (mini if l[i]< piv else maxi).append(l[i])
    return qui(mini) + [piv] + qui(maxi)

input()
list1 = list(map(lambda x: int(x), input().split(" ")))
result = qui(list1)

print(' '.join(map(str, result)))

### FIXED CODE ###

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

import random
def qui(l):
    num = len(l)
    if num <= 1:
        return l
    piv = random.randrange(0,len(l))
    piv2 = random.randrange(0,len(l))
    piv3 = random.randrange(0,len(l))
    if (l[piv] > l[piv2]) and (l[piv2] > l[piv3]):
        piv = piv2
    elif (l[piv] > l[piv3]) and (l[piv3] > l[piv2]):
        piv = piv3
    elif (l[piv] < l[piv2]) and (l[piv2] < l[piv3]):
        piv = piv2
    elif (l[piv] < l[piv3]) and (l[piv3] < l[piv2]):
        piv = piv3
    else:
        pass
    mini = []
    middlei = []
    maxi = []

    for i in range(0,len(l)):
        if l[i] == l[piv]:
            middlei.append(l[i])
        elif l[piv] > l[i]:
            mini.append(l[i])
        elif l[piv] <= l[i]:
            maxi.append(l[i])
    mini = qui(mini)
    maxi = qui(maxi)
    return mini+ middlei+maxi
input()
list1 = input().split(" ")
for i in range(0, len(list1)):
    list1[i] = int(list1[i])

result = qui(list1)

print(' '.join(map(str, result)))
from math import gcd
# from fractions import gcd
from functools import reduce

def lcm_list(numbers):
    return reduce(lambda x, y: (x * y) // gcd(x, y), numbers, 1)

def main():
    n = int(input())
    # a = [int(x) for x in input().split()]
    a = tuple(map(int, input().split()))
    lcm = lcm_list(a)
    aa = []
    for i in range(len(a)):
        aa.append(lcm // a[i])
    ans = sum(aa) % 1000000007
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

# from math import gcd
from fractions import gcd
from functools import reduce

def lcm_list(numbers):
    return reduce(lambda x, y: (x * y) // gcd(x, y), numbers, 1)

def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    lcm = lcm_list(a)
    aa = []
    for i in range(len(a)):
        aa.append(lcm // a[i])
    ans = sum(aa) % 1000000007
    print(ans)

if __name__ == '__main__':
    main()
def main():
  n=int(input())
  s=input()
  dp=[[0]*(n+1) for i in range(n+1)]
  for i in range(n-1,-1,-1):
    for j in range(n-1,-1,-1):
      if s[i]==s[j]:
        dp[i][j]=dp[i+1][j+1]+1
  for i in dp:
    print(i)
  
  ans=0
  for i in range(n-1):
    for j in range(i+1,n):
      ans=max(ans,min(j-i,dp[i][j]))
  print(ans)      
        

if __name__=='__main__':
  main()

### FIXED CODE ###

def main():
  n=int(input())
  s=input()
  dp=[[0]*(n+1) for i in range(n+1)]
  for i in range(n-1,-1,-1):
    for j in range(n-1,i,-1):
      if s[i]==s[j]:
        dp[i][j]=dp[i+1][j+1]+1
  #for i in dp:
  #  print(i)
  
  ans=0
  for i in range(n-1):
    for j in range(i+1,n):
      ans=max(ans,min(j-i,dp[i][j]))
  print(ans)      
        

if __name__=='__main__':
  main()
dp1, dp2, dp3 = 0, abs(h_list[1]-h_list[0]), 0
for i in range(2, n):
    if abs(h_list[i]-h_list[i-1]) + dp2 >= abs(h_list[i]-h_list[i-2]) + dp1:
        dp3 = abs(h_list[i]-h_list[i-2]) + dp1
    else:
        dp3 = abs(h_list[i]-h_list[i-1]) + dp2
    dp1 = dp2
    dp2 = dp3
print(dp2)

### FIXED CODE ###

n = int(input())
h_list = list(map(int, input().split()))
if n == 1:
    print(h_list[0])
elif n == 2:
    print(abs(h_list[1]-h_list[0]))
else:
    dp1 = 0
    dp2 = abs(h_list[1]-h_list[0])
    dp3 = 0
    for i in range(2, n):
        if abs(h_list[i]-h_list[i-1]) + dp2 >= abs(h_list[i]-h_list[i-2]) + dp1:
            dp3 = abs(h_list[i]-h_list[i-2]) + dp1
        else:
            dp3 = abs(h_list[i]-h_list[i-1]) + dp2
        dp1 = dp2
        dp2 = dp3
    print(dp2)
N=int(input())
A=list(map(int, input().split()))
m=[]
m.append([A[0]])
j=0
f=True
if A[0] > A[1]:
  f=False
for i in range(1,N):
  if A[i-1] <= A[i] and f:
    m[j].append(A[i])
  elif A[i-1] >= A[i] and not f:
    m[j].append(A[i])
  else:
    j+=1
    m.append([])
    m[j].append(A[i])
    if i != N-1:
      f=True if A[i] < A[i+1] else False
print(len(m))


### FIXED CODE ###

N=int(input())
A=list(map(int, input().split()))
ans=1
for i, a in enumerate(A):
  if i==0:
    flag=0
  elif flag==0 and a==A[i-1]:
    pass
  elif a>=A[i-1] and flag>=0:
    flag=1
  elif a<=A[i-1] and flag<=0:
    flag=-1
  else:
    flag=0
    ans+=1
print(ans)
n = ir()
a = lr()
total = 0
for i,num in enumerate(a):
    a[i]=(num-(i+1))
mean = sum(a)//n-1
ans = [0,0,0]
for i in range(mean, mean+3):
    tmp = i%3
    for num in a:
        ans[tmp]+=abs(num-i)
print(min(ans))

### FIXED CODE ###

# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""
def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# a^n
def power(a,n,mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod

# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n-1
    while(tmp >= l):
        a = a*tmp%mod
        tmp -= 1
    return a

inf = 10**18
mod = 10**9+7

n = ir()
a = lr()
total = 0
for i,num in enumerate(a):
    a[i]=(num-(i+1))
a.sort()
if n%2 == 0:
    mean = (a[n//2-1]+a[n//2])//2
else:
    mean = a[n//2]
ans = [0,0]
for i in range(mean, mean+2):
    tmp = i%2
    for num in a:
        ans[tmp]+=abs(num-i)
print(min(ans))
def main(a,b,c,k):
    res = 0
    if k < a:
        res = k
    elif a <= k < a+b:
        res = a
    elif a+b <= k:
        res = a - (k - (a + b))
    return res

a,b,c,k = mi()
print(main(a,b,c,k))

### FIXED CODE ###

ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(a,b,c,k):
    res = 0
    if k < a:
        res = k
    elif a <= k < a+b:
        res = a
    elif a+b <= k:
        res = a - (k - (a + b))
    return res

a,b,c,k = mi()
print(main(a,b,c,k))
N = int(input())
S = [input() for i in range(N)]
 
from collections import defaultdict
def decode(s):
  d = defaultdict(int)
  for c in sorted(list(s)):
    d[c] += 1
  return d
 
decodes = [decode(s) for s in S]
 
hash_table = defaultdict(int)
for decode in decodes:
  hash_table[tuple(decode.items())] += 1
#print(hash_table)
import math
c_list = [int(math.factorial(v)/math.factorial(2)) for v in hash_table.values()]
#print(c_list)
count = sum(c_list)
 
print(count)

### FIXED CODE ###

N = int(input())
S = [input() for i in range(N)]
d = {}
S_trans = [''.join(sorted(list(s))) for s in S]
count = 0
for s in S_trans:
  if s in d:
    count += d[s]
    d[s] += 1
  else:
    d[s] = 1
print(count)
x=list(map(int,input().split()))
a,b= x[0],x[1]
print(str(a//b)+" "+str(a%b)+" {0:.6f}.format(a/b)"

### FIXED CODE ###

x=list(map(int,input().split()))
a,b= x[0],x[1]
print(str(a//b)+" "+str(a%b)+" {0:06f}".format(a/b))
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
#print(a)
asum=[]
bsum=[]
cnt=0
for i in range(n):
    cnt+=a[i]
    asum.append(cnt)
    if cnt>k:
        amx=i
        break
    amx=i
#print("amx=",amx)

cnt=0
for i in range(m):
    cnt+=b[i]
    bsum.append(cnt)
    if cnt>k:
        bmx=i
        break
    bmx=i
#print("bmx=",bmx)

ans=0
for i in range(amx+1):
    c=k-asum[i]
#    print("i=",i)
#    print("c=",c)
    if c<0:
        continue
    elif i==0:
#        for j in range(bmx,0,-1):
        for j in reversed(range(0,bmx+1)):
#            print(j)
#            print(bsum[j])
            if c>=bsum[j]:
                tmp=i+j+2
                l=j
#                print("l=",l)
                break
    else:
        while(c<bsum[l]):
            l-=1
        tmp=i+l+2
    ans=max(ans,tmp)
#    print("ans=",ans)
print(ans)


### FIXED CODE ###

n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
#print(a)
asum=[0]
bsum=[0]
cnt=0
for i in range(n):
    cnt+=a[i]
    asum.append(cnt)
#    if cnt>k:
#        amx=i
#        break
#    amx=i
#print("amx=",amx)

cnt=0
for i in range(m):
    cnt+=b[i]
    bsum.append(cnt)
#    if cnt>k:
#        bmx=i
#        break
#    bmx=i
#print("bmx=",bmx)

ans=0
j=m
for i in range(n+1):
    c=k-asum[i]
#    print("i=",i)
#    print("c=",c)
    if c<0:
        continue
    while c<bsum[j] and j>0:
        j-=1
    ans=max(ans,i+j)
#    print("ans=",ans)
print(ans)
N = int(input())
A = []
flag=0
ans=0
anslist=[]
se=0
for i in range(N):
    A.append(int(input()))
A.sort()
if N%2==0:
    anslist.append(A[-1])
    del A[-1]
else:
    anslist.append(A[0])
    del A[0]
    se=1
try:
    if se==0:
        while True:
            if flag==0:
                for i in range(2):
                    anslist.append(A[0])
                    anslist.reverse()
                    del A[0]
                flag=1
            else:
                for i in range(2):
                    anslist.append(A[-1])
                    anslist.reverse()
                    del A[-1]
                flag=0
    else:
        while True:
            if flag!=0:
                for i in range(2):
                    anslist.append(A[0])
                    anslist.reverse()
                    del A[0]
                flag=1
            else:
                for i in range(2):
                    anslist.append(A[-1])
                    anslist.reverse()
                    del A[-1]
                flag=0
 
 
except Exception as e:
    #print (anslist)
    flag=0
    while N-1>flag:
        ans=abs(anslist[flag]-anslist[flag+1])+ans
        flag=flag+1
    
    print(ans)

### FIXED CODE ###

N= input()
nlen=len(N)
if nlen==3:
    CN=N[2]+N[1]+N[0]
    print (CN)
else:
    print (N)
#!/usr/bin/env pypy3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")
import math,sys

n = int(sys.stdin.readline())
a = tuple(map(int,sys.stdin.readline().split()))
#n = int(input())
#a = list(map(int,input().split()))
g = math.gcd(a[0],a[1])
for i in range(2,n):
    g = math.gcd(g,a[i])
M = max(a)
acc = a[0]
for i in range(n):
    acc = math.gcd(acc,a[i])
if acc != 1:
    print("not coprime")
    exit()

LIMIT=max(a)
minPrime = [0]*(LIMIT+1)
minPrime[1] = 1
def make():
    for i in range(2,LIMIT+1):
        if minPrime[i] == 0:
            minPrime[i] = i
            #print(i)
            for j in range(i+i,LIMIT+1,i):
                #print(i,j)
                if minPrime[j] == 0:
                    minPrime[j] = i
make()
def factrial(N):
     ret = []
     while minPrime[N] != N:
         ret.append(minPrime[N])
         N = N//minPrime[N]
     if N != 1:
         ret.append(N)
     return ret

judge = set([])

for e in a:
    asf = set(factrial(e))
    if judge & asf != set():
        print("setwise coprime")
        exit()
    #judge |= asf
    judge = judge | asf #too slow
print("pairwise coprime")

### FIXED CODE ###

#!/usr/bin/env python3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")
import sys,collections

D,T,S = map(int,sys.stdin.readline().split())

if D <= T * S:
    print("Yes")
    exit()
print("No")
s=input()
a=0
m={}
for i in range(len(s)):
  b=int(s[len(s)-1-i])*10**i+a
  b=b%2019
  a=b
  if b in m:
    m[b]+=1
  else:
    m[b]=1
sum=m[0]
for i in m:
  sum+=m[i]*(m[i]-1)/2
print(int(sum))



### FIXED CODE ###

s=input()
a=0
m={}
d=1
for i in range(len(s)):
  b=int(s[len(s)-1-i])*d+a
  b=b%2019
  a=b
  d=d*10%2019
  if b in m:
    m[b]+=1
  else:
    m[b]=1
if 0 in m:
  sum=m[0]
else:
  sum=0
for i in m:
  sum+=m[i]*(m[i]-1)/2
print(int(sum))
a,b,c,d=map(int,input().split())
s=max(b,d)-min(a,c)
s_i=(c-a)+(d-b)
if b<c:
    print(0)
else:
    print(s-s_i)

### FIXED CODE ###

n=list(map(int,input()))
re=n[::-1]
for i in range(len(n)):
    if n[i]==re[i]:
        print("Yes")
        break
    else:
        print("No")
        break
import sys
input = sys.stdin.readline()
input = input.strip()
input = input.split(" ")
result = ""
for i in input:
    result += i[0].upper()
return result

### FIXED CODE ###

strs = raw_input()
strs = strs.split()
print strs[0][0].upper() + strs[1][0].upper() + strs[2][0].upper()
n=int(input())
s=[None]*n
for i in range(n):
  s[i]=sorted(input())
import collections
c=collections.Counter(s)
ans=0
for v in c.valeus():
  ans+=(v*(v-1))//2
print(ans)
  

### FIXED CODE ###

n=int(input())
s=[None]*n
for i in range(n):
  s[i]="".join(sorted(input()))

s=sorted(s)

total=0
count=1
for j in range(1,n):
  if s[j]==s[j-1]:
    count = count+1
  else:
    if count>1:
      total = total+(count*(count-1))//2
    count=1

if count>1:
  total = total+(count*(count-1))//2

print(total)
b = int(input())

if b == 'A':
    print('T')
elif b == 'T':
    print('A')
elif b == 'G':
    print('C')
elif b == 'C':
    print('G')

### FIXED CODE ###

b = input()

if b == 'A':
    print('T')
elif b == 'T':
    print('A')
elif b == 'G':
    print('C')
elif b == 'C':
    print('G')
import math

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

lis = list(map(int,input().split()))
diffs = []
for i in range(n):
    diff = abs(lis[i]-x)
    diffs.append(diff)


if len(diffs) > 1:
    com = math.gcd(diffs[0],diffs[1])
    for i in range(len(diffs)-2):
        com = math.gcd(com, diffs[i+2])
else:
    com = diffs[0]

print(com)

### FIXED CODE ###

import fractions

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

lis = list(map(int,input().split()))
diffs = []
for i in range(n):
    diff = abs(lis[i]-x)
    diffs.append(diff)


if len(diffs) > 1:
    com = fractions.gcd(diffs[0],diffs[1])
    for i in range(len(diffs)-2):
        com = fractions.gcd(com, diffs[i+2])
else:
    com = diffs[0]

print(com)
s = input()
k = int(input())

for _s in s:
    if _s == "1":
        if k == 1:
            print(1)
            break
        else:
            k -= 1
    else:
        print(i)
        break


### FIXED CODE ###

s = input()
k = int(input())

for _s in s:
    if _s == "1":
        if k == 1:
            print(1)
            break
        else:
            k -= 1
    else:
        print(_s)
        break
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
s_set = list(set(s))
t_set = list(set(t))
check_list = []
for i in s_set:
    check_list.append(s.count(i) - t.count(i))
print(max(max(check_list), 0)

### FIXED CODE ###

N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
s_set = list(set(s))
t_set = list(set(t))
check_list = []
for i in s_set:
    check_list.append(s.count(i) - t.count(i))
print(max(max(check_list), 0))