Harryxun/stf_run huggingface dataset:
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
# 全探索
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            tmp = i*500 + j*100 + k*50
            if tmp == x:
                ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
A = []
for _ in range(2):
    A.append(list(map(int, input().split())))
cand = []
for i in range(n):
    cand.append(sum(A[0][:i+1])+sum(A[1][i:]))
print(max(cand))
def list_add(li1, li2):
    return list(map(sum,zip(li1,li2)))
N, M, X = map(int, input().split(" "))
list = []
for i in range(N):
    list.append([int(i) for i in input().split(" ")])
list.sort()
price = 0
knowledge = []
priceList = []
for i in range(N):
    price = price + list[i][0]
    if i == 0:
        knowledge = list[0][1: M + 1]
    else:
        tmp2 = [x + y for (x, y) in zip(knowledge, list[i][1:M+1])]
        knowledge = tmp2
    # 全部足しても足りないとき
    if i == N - 1 and min(knowledge) < X:
        print(-1)
        exit()
    # 目標を超えたとき
    if min(knowledge) >= X:
        for j in range(i, -1, -1):
            searchList = [x - y for (x, y) in zip(knowledge, list[j][1: M + 1])]
            if min(searchList) >= X:
                knowledge = searchList
                price = price - list[j][0]
        break
for i in range(N):
    if min(list[i][1: M + 1]) >= X and min(priceList) > list[i][0]:
        print(list[i][0])
        exit()
print(price)


### FIXED CODE ###

def list_add(li1, li2):
    return list(map(sum, zip(li1, li2)))


def dfs(price, knowledge, depth):
    if (min(knowledge) >= X):
        ansList.append(price)
    if depth == N:
        return
    dfs(price, knowledge, depth + 1)
    dfs(price+priceList[depth], list_add(KnowList[depth], knowledge), depth+1)


N, M, X = map(int, input().split(" "))
KnowList = [[] for i in range(N)]
priceList = [0] * N
for i in range(N):
    tmp = [int(i) for i in input().split(" ")]
    priceList[i] = tmp[0]
    KnowList[i] = tmp[1:]
price = 0
ansList = []
knowledge = [0] * M
dfs(price, knowledge, 0)
if (len(ansList) == 0):
    ansList.append(-1)
print(min(ansList))
n,k = [int(x) for x in input().split()]

if n/(k-1) > 2 :
    print("YES")
else:
    print("NO")

### FIXED CODE ###

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

if k==1 or n/(k-1) > 2 :
    print("YES")
else:
    print("NO")
a,b,c=input().split()
l=[]
l.append(len(a))
l.append(len(b))
l.append(len(c))
if l==[5,5,7] or l=[5,7,5] or l=[7,5,5]:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

a,b,c=map(int,input().split())
l=[]
l.append(a)
l.append(b)
l.append(c)
if l==[5,5,7] or l==[5,7,5] or l==[7,5,5]:
    print("YES")
else:
    print("NO")
A, B, C, D = map(int, input().split())

import math
CD = C * D // math.gcd(C, D)

# C, D, C*Dで割り切れるものの個数
div_C = B//C - (A//C + (-1 if A%C==0 else 0))  # 40//6 - 10//6 -> 6 - 1 = 5
div_D = B//D - (A//D + (-1 if A%D==0 else 0))  # 40//8 - 10//8 -> 5 - 1 = 4
div_CD = B//(CD) - max(0, (A//(CD) + (-1 if A%(CD)==0 else 0)))
print(B-A+1 - div_C - div_D + div_CD)

### FIXED CODE ###

A, B, C, D = map(int, input().split())

import fractions
CD = C * D // fractions.gcd(C, D)

# C, D, C*Dで割り切れるものの個数
div_C = B//C - (A//C + (-1 if A%C==0 else 0))  # 40//6 - 10//6 -> 6 - 1 = 5
div_D = B//D - (A//D + (-1 if A%D==0 else 0))  # 40//8 - 10//8 -> 5 - 1 = 4
div_CD = B//(CD) - max(0, (A//(CD) + (-1 if A%(CD)==0 else 0)))
print(B-A+1 - div_C - div_D + div_CD)
s = int(input())
count = 0
for i in range(1000000):
  if s%2 == 0:
    s /=2
  else:
    s = 3*x+1
  
  if s==4:
    print(count+4)
  count +=1

### FIXED CODE ###

s = int(input())
ptn = []
count = 1
while True:
  ptn.append(s)
  if s%2 == 0:
    s /=2
  else:
    s = 3*s+1
  if s in ptn:
    print(count+1)
    exit()
  count +=1
N=int(input())
A=[int(input()) for i in range(N)]
amax = max(A)
B = A.copy()
B.sort()
print(B)

for i in range(N):
	k = A.pop(0)
	if k == B[N]:
		print(B[N])
	else:
		print(amax)


### FIXED CODE ###

N=int(input())
A=[int(input()) for i in range(N)]
#print(A)
B = A.copy()
#print(B)
B.sort()


for i in range(N):
	k = A[i]
	#print(k)
	if k != B[N-1]:
		print(B[N-1])
	else:
		print(B[N-2])
while(True) :
    instr=input()
    if(instr=='?') : break;
    a,op,b=input().split()
    a=int(a)
    b=int(b)
    if op=='+' :
        print("{}".format(a+b))
    elif op=='-' :
        print("{}".format(a-b))
    elif op=='*' :
        print("{}".format(a*b))
    else :
        print("{}".format(int(a/b)))


### FIXED CODE ###

while(True) :
    a,op,b=input().split()
    a=int(a)
    b=int(b)
    if op=='+' :
        print("{}".format(a+b))
    elif op=='-' :
        print("{}".format(a-b))
    elif op=='*' :
        print("{}".format(a*b))
    elif op=='/' :
        print("{}".format(int(a/b)))
    else :
        break
n, ma, mb = [int(i) for i in input().split()]
lst = [[int(i) for i in input().split()] for _ in range(n)]
lst.sort(key=lambda x: x[2])

def push(k,v):
    if k in dic:
        dic[k] = min(dic[k],v)
    else:
        dic[k] = v


for i in lst:
    k, v = i[0] * mb - i[1] * ma, i[2]
    l = [[j, dic[j]] for j in dic]
    for item in l:
        push(item[0] + k, item[1] + v)
    push(k, v)

print(dic[0] if 0 in dic else '-1')

### FIXED CODE ###

n, ma, mb = [int(i) for i in input().split()]
lst = [[int(i) for i in input().split()] for _ in range(n)]
lst.sort(key=lambda x: x[2])
dic = {}
def push(k,v):
    if k in dic:
        dic[k] = min(dic[k],v)
    else:
        dic[k] = v


for i in lst:
    k, v = i[0] * mb - i[1] * ma, i[2]
    l = [[j, dic[j]] for j in dic]
    for item in l:
        push(item[0] + k, item[1] + v)
    push(k, v)

print(dic[0] if 0 in dic else '-1')
N = int(input())
a = list(range(N))
for i in range(N):
    a[i] = int(input())
a = a.sort()
p = 1
for i in range(N - 1):
    if a[i + 1] - a[i] != 0:
        p += 1
print(p)

### FIXED CODE ###

N = int(input())
a = list(range(N))
for i in range(N):
    a[i] = int(input())
a.sort()
p = 1
for i in range(N - 1):
    if a[i + 1] - a[i] != 0:
        p += 1
print(p)
print("Yes" if input() == reversed((input()) else "No")

### FIXED CODE ###

a = input()
print("Yes" if a == a[::-1] else "No")
x = import()
print(x ** 3)


### FIXED CODE ###

x = int(input())
print(x**3)
def divisor(n):
    i = 1
    res = []
    for i in range(1, n**.5 + 1)
        if n%i == 0:
            res.append(i)
            if n//i not in res:
                res.append(n//i)
    res.sort(reverse=True)
    return res

def main():
    n, m = map(int, input().split())
    md = divisor(m)
    for i in md:
        if i*n <= m:
            print(i)
            exit()

if __name__ == '__main__':
    main()

### FIXED CODE ###

def divisor(n):
    i = 1
    res = []
    while i*i <= n:
        if n%i == 0:
            res.append(i)
            if n//i not in res:
                res.append(n//i)
        i += 1
    res.sort()
    return res

def main():
    n, m = map(int, input().split())
    md = divisor(m)
    ans = 0
    for i in md:
        if (m - n*i)%i == 0 and (m - n*i) >= 0:
            ans = i
        else:
            break
    print(ans)

if __name__ == '__main__':
    main()
import numpy as np
from numba import jit

@njit
def solve(s):
    n = len(s)
    ans = 0
    now = 0
    mp = np.zeros(2019, np.int)
    mp[0] += 1
    tmp = np.zeros(2019, np.int)

    id = np.zeros(2019, np.int)
    for i in range(2019):
        id[i] = i * 10 % 2019

    for c in s:
        now *= 10;
        now += ord(c) - ord("0")
        now %= 2019

        ans += mp[now]
        mp[now] += 1
        for i in range(2019):
            tmp[id[i]] = mp[i]
        for i in range(2019):
            mp[i] = tmp[i]

    print(ans)

s = input()
solve(s)


### FIXED CODE ###

s = input()
n = len(s)
ans = 0
now = 0
mp = [0 for i in range(2019)]
mp[0] += 1
tmp = [0 for i in range(2019)]

id = [0 for i in range(2019)]
for i in range(2019):
    id[i] = i * 10 % 2019

for c in s:
    now *= 10;
    now += ord(c) - ord("0")
    now %= 2019

    ans += mp[now]
    mp[now] += 1
    for i in range(2019):
        tmp[id[i]] = mp[i]
    for i in range(2019):
        mp[i] = tmp[i]

print(ans)
ef is_prime(n):
  t = 2
  while n > t:
    if n % t == 0: return 0
    t += 1
  return 1

c = 0
for _ in range(int(input())):
  c += is_prime(int(input()))
print(c)


### FIXED CODE ###

def is_prime(x):
  if x == 2: return 1
  if x % 2 == 0: return 0
  for i in range(3, int(x ** 0.5) + 1, 2):
    if x % i == 0: return 0
  return 1

c = 0
for _ in range(int(input())):
  c += is_prime(int(input()))
print(c)
x,y,z = map(int,input().split)
print(z,x,y)


### FIXED CODE ###

x,y,z = input().split(" ")
print(z,x,y)
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限x
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


X, Y = map(int, input().strip().split())

min_num = min(X,Y)
z = min_num//3

tX = z * 3
tY = z * 3
cA = z
cB = z

rx = X - tX
ry = Y - tY
if rx == 0 and ry == 0:
    print(cmb(cA+cB, cA, mod))
    exit(0)
if rx * 2 == ry:
    cA += rx
elif ry * 2 == rx:
    cB += ry
else:
    raise Exception
    print(0)
    exit(0)
print(cmb(cA+cB, cA, mod))


### FIXED CODE ###

r = int(input().strip())

print(r**2)
from sys import stdin
input = stdin.readline

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

ls = [0] * 10 ** 5

for a in A:
    ls[a] += 1

s = sum(A)

for _ in range(Q):
    B, C = map(int, input().split())
    s += ls[B] * (C - B)
    ls[B], ls[C] = 0, ls[B] + ls[C]
    print(s)


### FIXED CODE ###

from sys import stdin
input = stdin.readline

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

ls = [0] * 10 ** 6

for a in A:
    ls[a] += 1

s = sum(A)

for _ in range(Q):
    B, C = map(int, input().split())
    s += ls[B] * (C - B)
    ls[C] += ls[B]
    ls[B] = 0
    print(s)
n, k, s = map(int, input().split())
A = [0]*n
for i in range(1, n+1):
    if i <= k:
        A[i] = s
    else:
        if s == 10**9:
          A[i] = 1
        else:
          A[i] = 10**9
print(*A)


### FIXED CODE ###

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

for i in range(1, n+1):
    if i <= k:
        print(s)
    else:
        if s == 10**9:
            print(1)
        else:
            print(10**9)
import math
a,b,c,d = map(int,input().split())
def calc(n,x,y):
    cnt = n // x
    cnt += n//y
    lcm = x*y//math.gcd(x,y)
    cnt -= int(n//lcm)
    return n - cnt

print(calc(b,c,d)-calc(a-1,c,d))


### FIXED CODE ###

import fractions
a,b,c,d = map(int,input().split())
def calc(n,x,y):
    cnt = n // x
    cnt += n//y
    lcm = x*y//fractions.gcd(x,y)
    cnt -= n//lcm
    return n - cnt

print(calc(b,c,d)-calc(a-1,c,d))
N = int(input())
s = [list(input()) for i in range(N)]
 
from itertools import combinations
 
a = 0
for i,j in combinations(s,2):
  if set(i) == set(j):
    a+=1
print(a)

### FIXED CODE ###

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

a1 = A+B
a2 = A-B
a3 = A*B

am = max([a1,a2,a3])

print(am)
n = int(input())

lis = [1, 6, 36, 216, 1296, 7776, 46656,
     9, 81, 729, 6561, 59049]
m = len(c)

dp = [float('inf') for _ in range(n+1)]
dp[0] = 0

for j in range(1,n+1):
    temp = []
    for i in range(m):
        if j < lis[i]:
            continue
        else:
            temp.append(dp[j-lis[i]]+1)
    dp[j] = min(temp)

print(dp[n])


### FIXED CODE ###

n = int(input())

lis = [1, 6, 36, 216, 1296, 7776, 46656,
     9, 81, 729, 6561, 59049]
m = len(lis)

dp = [float('inf') for _ in range(n+1)]
dp[0] = 0

for j in range(1,n+1):
    temp = []
    for i in range(m):
        if j < lis[i]:
            continue
        else:
            temp.append(dp[j-lis[i]]+1)
    dp[j] = min(temp)

print(dp[n])
N = int(input())
A = list(map(int, input()))

idx = 0
ans = 0
while 1:
  if idx >= len(A):
    exit()
  elif A[idx] == idx+1:
    idx += 1
  else:
    A.pop(idx)
    ans += 1

if len(A) == 0:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

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

k = 1
ans = 0

if 1 not in A:
  print(-1)
  exit()

for a in A:
  if a == k:
    k += 1
  else:
    ans += 1

print(ans)
def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

q = int(input())
n = 100000
ass = primes(n)
lkn = []
for p in ass:
    l = (p + 1) // 2
    if l in ass:
        lkn.append(p)
cnt = 0
pre = 1
ans = {}
for p in lkn:
    for i in range(pre,p,2):
        ans[i] = cnt
    cnt += 1
    pre = p
for i in range(q):
    l,r = map(int,input().split())
    l = max(l-2,1)
    print(ans[r] - ans[l])
    #print(ans[r],ans[l])
#print(lkn)

### FIXED CODE ###

def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass

q = int(input())
n = 100000
ass = primes(n)
lkn = []
for p in ass:
    l = (p + 1) // 2
    if l in ass:
        lkn.append(p)
cnt = 0
pre = 1
ans = {}
lkn.append(100001)
for p in lkn:
    for i in range(pre,p,2):
        ans[i] = cnt
    cnt += 1
    pre = p
for i in range(q):
    l,r = map(int,input().split())
    l = max(l-2,1)
    print(ans[r] - ans[l])
    #print(ans[r],ans[l])
#print(lkn)
import numpy as np

x, y, z = map(int, input().split(' '))
row = np.array([x,y,z])

for times in range(int(input()):
    row[row.argmax()] = row.max() * 2
print(np.sum(row))

### FIXED CODE ###

import numpy as np

x, y, z = map(int, input().split(' '))
row = np.array([x, y, z])

for times in range(int(input())):
    row[row.argmax()] = row.max() * 2
    
print(np.sum(row))
#!/usr/bin/env python3

if __name__ == '__main__':
    N, x = (int(_) for _ in input().split(' '))
    As = [int(_) for _ in input().split(' ')]
    each = sum(As)
    change = (N - 1) * x + N
    print(min(each, change))


### FIXED CODE ###

if __name__ == '__main__':
    x, y, z = (int(_) for _ in input().split(' '))
    a = max((x, y, z))
    if a == x:
        b, c = y, z
    elif a == y:
        b, c = x, z
    elif a == z:
        b, c = x, y
    print(abs(a // 2 * b * c - (a - a // 2) * b * c))
N,K=map(int, input().split())
h=list(map(int,input().split()))
dp=[float('inf') for i in range(N)]
dp[0]=0
for i in range(1,N):
  for j in range(1,K+1):
    dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[N-1])

### FIXED CODE ###

N=int(input())
h=list(map(int,input().split()))
dp=[float('inf') for i in range(N)]
dp[0]=0
for i in range(1,N):
  dp[i]=min(dp[i],dp[i-1]+abs(h[i]-h[i-1]))
  if(i>1):
    dp[i]=min(dp[i],dp[i-2]+abs(h[i]-h[i-2]))
print(dp[N-1])
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def comb(N):
    if N<0:
        return 0
    if N==0 or N==1:
        return 1

    dp=[[0 for _ in range(N+1)] for _ in range(3)]

    for j in range(1,N+1):
        for i in [1,2]:
            if j == i:
                dp[i][j] = 1
            else:
                dp[i][j] = dp[1][j-i] + dp[2][j-i]
    return dp[1][N]+dp[2][N]

def main():
    N, M = map(int, input().split())
    a_list = [int(input()) for _ in range(M)]

    divider = 1000000007
    p = 0
    ans = 1

    for a in a_list:
        r = comb(a-1-p)%divider
        ans = ans%divider 
        ans = (ans*r)%divider 
        p = a + 1
    else:
        if a < N:
            r = comb(N-p)%divider
            ans = ans%divider
            ans = (ans*r)%divider

    print(ans)
        

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc129","c",main)

### FIXED CODE ###

#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    N, M = map(int, input().split())
    a_list = [int(input()) for _ in range(M)]

    p = 0
    steps=[]
    m = 0
    for a in a_list:
        if a != 1:
            steps.append((p, a-1))
            m = max(m, a-p)
        p = a + 1
    else:
        steps.append((p, N))
        m = max(m, N-p+1)

    dp=[0 for _ in range(m+1)]

    divider = 1000000007
    dp[0], dp[1] = 1, 1
    for i in range(2,m+1):
        dp[i]=(dp[i-1]+dp[i-2])%divider

    ans = 1
    for p, n in steps:
        if n < p:
            ans = 0
            break
        else:
            r = dp[n-p]
        ans = (ans*r)%divider 

    print(ans)
        

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc129","c",main)
i = 0 //????????????

while True:
	n = input()
	if n == 0:
		break
	i += 1//?????????????????????
	print('Case {} : {}'.format(i,n))

### FIXED CODE ###


i = 0 #????????????

while True:
	n = input()
	if n == '0':
		break
	i += 1#?????????????????????
	print('Case {}: {}'.format(i,n))
a,b=map(in,input().split())
if a>b:
	print(a*2-1)
elif a<b:
	print(b*2-1)
else:
		print(a+b)

### FIXED CODE ###

a,b=map(int,input().split())
if a>b:
	print(a*2-1)
elif a<b:
	print(b*2-1)
else:
		print(a+b)
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
X_distance = [0]*(M-1)
for i in range(M-1):
    X_distance[i] = abs(X[i]-X[i+1])
X_distance.sort(reverse=True)

if N == M:
    print(0)
elif M == 1:
    print(0)
else :
    for i in range(N-1):
        X_distance[i] = 0
    print(sum(X_distance))

### FIXED CODE ###

N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
X_distance = [0]*(M-1)
for i in range(M-1):
    X_distance[i] = abs(X[i]-X[i+1])
X_distance.sort(reverse=True)

if N >= M:
    print(0)
elif M == 1:
    print(0)
else :
    for i in range(N-1):
        X_distance[i] = 0
    print(sum(X_distance))
a

### FIXED CODE ###

def wf(this_graf):
    s = len(graf)
    for k in range(s):
        for i in range(s):
            for j in range(s):
                this_graf[i][j] = min(this_graf[i][j], this_graf[i][k] + this_graf[k][j])
    return this_graf

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
graf = [[10 ** 10 for i in range(n)] for j in range(n)]

for i, j in ab:
    graf[i - 1][j - 1] = 1
    graf[j - 1][i - 1] = 1

import copy
cnt = 0

for i, j in ab:
    this_graf = copy.deepcopy(graf)
    tmp = 0
    this_graf[i - 1][j - 1] = 10 ** 10
    this_graf[j - 1][i - 1] = 10 ** 10
    this_graf = wf(this_graf)
    for i in range(n):
        for j in range(n):
            if this_graf[i][j] == 10 ** 10:
                tmp = 1
                break
        if tmp:
            break
    cnt += tmp

print(cnt)
a,b,c = map(int,input().split())
if a==b==c or a!=b!=c!=:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

a,b,c = map(int,input().split())
if a==b and b!=c:
    print('Yes')
elif a==c and a!=b:
    print('Yes')
elif b==c and b!=a:print('Yes')
else:print('No')
S = input()
if ("RRR" in S):
  return 3
elif ("RR" in S):
  return 2
elif ("R" in S):
  return 1
else:
  return 0


### FIXED CODE ###

S = input()
if ("RRR" in S):
  print(3)
elif ("RR" in S):
  print(2)
elif ("R" in S):
  print(1)
else:
  print(0)
import itertools
n,m = map(int, input().split())
p = list(map(int, input().split()))
x_y = [list(map(int, input().split())) for i in range(m)]
key = [i for i in range(m)]
sum = 0
for i in range(n):
    if i+1==p[i]:
        sum += 1
if sum == n:
    print(sum)
    quit()
update = True
while update:
    update = False
    i = 1
    while i < len(x_y):
        for j in range(len(x_y[i])):
            if x_y[i][j] in x_y[i-1]:
                update = True
                key[i] = key[i-1]
                x_y[i-1] += x_y[i]
                x_y[i-1] = list(set(x_y[i-1]))
                if len(x_y) == 1:
                    break
                del x_y[i]
                i -= 1
        i += 1
lis = []
for i in x_y:
    if len(i) != 0:
        lis += list(itertools.permutations(i))

for i in lis:
    i = list(i)
    v = [i+1 for i in range(n)]
    for j in i:
        v.remove(j)
    for j in v:
        i.insert(j-1,j)
    count = 0
    for j in range(len(i)):
        if j+1 == p[i[j]-1]:
            count += 1
    sum = max(sum, count)
print(sum)

### FIXED CODE ###

a,b,c,d = map(int, input().split())
if abs(a-b) <= d and abs(b-c) <= d:
    print("Yes")
    quit()
if abs(a-c) <= d:
    print("Yes")
    quit()
print("No")
def acinput():
    return list(map(int,input().split(" ")))


N,M=acinput()
a=[0]*(N+100)
for i in range(M):
    a[int(input())]=1


Mod=1000000007

def solve(x):
    global dp,M
    if dp[x]>=0:
        return dp[x]

    if x<0:
        return 0

    res=0
    zeroflg=True
    if  a[x-1]!=1:
        res+=solve(x-1)%Mod
        zeroflg=False
    if a[x-2]!=1:
        res+=solve(x-2)%Mod
        zeroflg=False
    
    if zeroflg:
        return 0
    dp[x]=res
    return res

dp=[-1]*(N+10)
dp[0]=1
dp[1]=1

print(solve(N)%Mod)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

def acinput():
    return list(map(int, input().split(" ")))


N, M = acinput()
a = [0]*(N+1)
for i in range(M):
    a[int(input())] = 1


Mod = 1000000007


def solve(x):
    global dp, Mod
    if dp[x] >= 0:
        return dp[x]

    if x < 0:
        return 0

    res = 0
    zeroflg = True

    if  a[x-2] != 1:
        res += solve(x-2) 
        zeroflg = False

    if a[x-1] != 1:
        res += solve(x-1)
        zeroflg = False

    if zeroflg:
        return 0
    dp[x] = res% Mod
    return res


dp = [-1]*(N+1)
dp[0] = 1
dp[1] = 1

print(solve(N) % Mod)


'''
5 1
1
'''
n,m = map(int,input().split( ))
ans = ""
ls_a = []
ls_b = [[] for i in range(n)]
for i in range(m):
    p,y = map(int,input().split( ))
    ls_a.append([p,y])
    ls_b[p-1].append(y)
for i in range(n):
    if len(b[i]) !=0:
        ls_b[i].sort()
for i in range(m):
    ans += str(ls_a[i][0]).zfill(6) + str(ls_b[ls_a[i][0]-1].index(ls_a[i][1])+1).zfill(6)+"\n"
print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
PY=[list(map(int,input().split()))+[i] for i in range(M)] #定義終了
 
PY.sort(key= lambda x:x[1])
num=[0]*N
w=[""]*M
 
for p,y,i in PY:
	num[p-1]+=1
	w[i]=str(p).zfill(6)+str(num[p-1]).zfill(6)

for i in range(M):
  	print(w[i])
N,X = map(int,input().split())

def f(a,b) :
    if a < b :
        return 2*a + f(a,b-a)
    elif a > b :
        a,b = b,a
        return 2*a + f(a,b-a)
    else :
        return a

ans = N + f(X,N-X)

print(ans)


### FIXED CODE ###

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

def f(a,b) :
    if a > b :
        a,b = b,a
    if b % a == 0 :
        return 2*(b//a-1)*a + a
    else :
        return 2*(b//a)*a + f(a,b%a)
        
ans = N + f(X,N-X)

print(ans)
999999 999999x, y = map(int, input().split())
if (x + y) % 3 != 0:
    print(0)
    exit()
a = (x + y) // 3
x -= a
y -= a
mod = 10 ** 9 + 7
def combination(n, r):
    x = 1
    y = 1
    for i in range(r):
        x = x * (n - i) % mod
        y = y * (r - i) % mod
    return (x * pow(y, mod-2, mod)) % mod
print(combination(x+y, min(x, y)))

### FIXED CODE ###

x, y = map(int, input().split())
if (x + y) % 3 != 0:
    print(0)
    exit()
a = (x + y) // 3
x -= a
y -= a
if x < 0 or y < 0:
    print(0)
    exit()
mod = 10 ** 9 + 7
def combination(n, r):
    x = 1
    y = 1
    for i in range(r):
        x = x * (n - i) % mod
        y = y * (r - i) % mod
    return (x * pow(y, mod-2, mod)) % mod
print(combination(x+y, min(x, y)))
from collections import defaultdict

N = int(input())
Ts = list(set([int(input()) for _ in range(N)]))

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    g = gcd(a, b)
    return a / g * b

res = Ts[0]
for T in Ts:
    res = lcm(res, T)
print(int(res))


### FIXED CODE ###

from collections import defaultdict

N = int(input())
Ts = list(set([int(input()) for _ in range(N)]))

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    g = gcd(a, b)
    return a // g * b

res = Ts[0]
for T in Ts:
    res = lcm(res, T)
print(int(res))