Harryxun/stf_run huggingface dataset:
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

cnt = 0
i = 0
j = 0
while k >= 0:
    if i >= len(a) and j >= len(b):
        break

    if i >= len(a):
        if k >= b[i]:
            k -= b[i]
            j += 1
            cnt += 1
        else:
            break
        continue
    if j >= len(b):
        if k >= a[i]:
            k -= a[i]
            i += 1
            cnt += 1
        else:
            break
        continue

    if a[i] >= b[j]:
        if k >= a[i]:
            k -= a[i]
            i += 1
            cnt += 1
        else:
            break
    else:
        if k >= b[i]:
            k -= b[i]
            j += 1
            cnt += 1
        else:
            break

print(cnt)

### FIXED CODE ###

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

ans = 0
ia = -1
ib = -1

nowtime = 0
cnt = 0
for i in range(n):
    if nowtime + a[i] <= k:
        nowtime += a[i]
        cnt += 1
        ia = i
    else:
        break

ans = cnt
# print(ans, nowtime)
for i in range(m):
    while nowtime + b[i] > k and ia >= 0:
        nowtime -= a[ia]
        cnt -= 1
        ia -= 1
    if nowtime + b[i] > k:
        break
    nowtime += b[i]
    cnt += 1
    ans = max(ans, cnt)

print(ans)
N = int(input())
p = [int(x) for x in input().split()]

l = []

for i in range(len(p)):
    if p[i] == i + 1:
        l.append(p[i])
    else:
        l.append(0)

count = 0
for i in renge(len(l)):
    if l[i] > 0:
        l[i] = 0
        l[i + 1] = 0
        count += 1
print(count)



### FIXED CODE ###

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

l = []

for i in range(len(p)):
    if p[i] == i + 1:
        l.append(p[i])
    else:
        l.append(0)

count = 0

for i in range(len(l) - 1):
    if l[i] > 0:
        l[i] = 0
        l[i + 1] = 0
        count += 1
if l[len(l) - 1] != 0:
    count += 1

print(count)
n = int(input())
if 7 in n:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = input()
if "7" in n:
  print("Yes")
else:
  print("No")
S = str(input())
T = str(input())
n = 0

for i in len(S):
  if S[i] != T[i]:
    n += 1

print(n)

### FIXED CODE ###

S = str(input())
T = str(input())
n = 0

for i in range(len(S)):
  if S[i] != T[i]:
    n += 1
    
print(n)
import numpy as np
N,D = map(int,input().split())
X = []
for i in range(N):
    Xi = np.array(list(map(int,input().split())))
    X.append(Xi)
ans = 0
for i in range(N):
    for j in range(i,N):
        if i==j:
            continue
        d = np.linalg.norm(X[i]-X[j])
        if abs(d-int(d)) < 10**(-6):
            ans += 1
print(ans)

### FIXED CODE ###


N,D = map(int,input().split())
X = []
for i in range(N):
    Xi = list(map(int,input().split()))
    X.append(Xi)
ans = 0
def norm(Xi,Xj):
    return sum([(Xi[i]-Xj[i])**2 for i in range(len(Xi))])
for i in range(N):
    for j in range(i,N):
        if i==j:
            continue
        d = norm(X[i],X[j])
        if int(d**0.5)**2==d:
            ans += 1
print(ans)
s=input()
print('Yes' if len(set(s))==2 and s.count(s[0]==2) else 'No')

### FIXED CODE ###

s = input()
s_l = list(s)
s_ll = sorted(s_l)
if s_ll[0] == s_ll[1] and s_ll[2] == s_ll[3] and s_ll[1] != s_ll[2]:
    print('Yes')
else:
    print('No')
import math
r = int(input())
print("{0} {1}".format(r * r * math.pi, 2 * r * math.pi))

### FIXED CODE ###

import math
r = float(input())
areaOfCircle = format(r * r * math.pi, '.6f')
circumference = format(2 * r * math.pi,'.6f')
print("{0} {1}".format(areaOfCircle, circumference))
def dfs(i, c):
    C[i] = True
    P[i] = c
    for t in G[i]:
        if (C[t[0]] == True):
            continue
        dfs(t[0], c+t[1])
    return


N, M = list(map(int, input().split()))
G = [[] for _ in range(N+1)]
P = [None for _ in range(N+1)]
C = [False for _ in range(N+1)]

for i in range(M):
    l, r, d = list(map(int, input().split()))
    G[l].append((r,d))
    G[r].append((l,-d))

for i in range(1, N+1):
    if (C[i] == False):
        dfs(i,0)

f = False
for i in range(N):
    for t in G[i]:
        if (P[t[0]] - P[i] != t[1]):
            f = True
if (f):
    print('No')
else:
    print('Yes')


### FIXED CODE ###

import sys
sys.setrecursionlimit(200002)


def dfs(i, c):
    C[i] = True
    P[i] = c
    for t in G[i]:
        if (C[t[0]] == True):
            continue
        dfs(t[0], c+t[1])
    return


N, M = list(map(int, input().split()))
G = [[] for _ in range(N+1)]
P = [None for _ in range(N+1)]
C = [False for _ in range(N+1)]

for i in range(M):
    l, r, d = list(map(int, input().split()))
    G[l].append((r,d))
    G[r].append((l,-d))

for i in range(1, N+1):
    if (C[i] == False):
        dfs(i,0)

f = False
for i in range(1, N+1):
    for t in G[i]:
        if ((P[t[0]] - P[i]) != t[1]):
            f = True
if (f):
    print('No')
else:
    print('Yes')
from sklearn.datasets import load_digits
input, ground_truth = load_digits(return_X_y=True)

l = input().split()
 
a = int(l[0],16)
b = int(l[1],16)
 
if a == b:
	print("=")
elif a < b:
	print("<")
else:
	print(">")

### FIXED CODE ###

l = input().split()

a = int(l[0],16)
b = int(l[1],16)

if a == b:
	print("=")
elif a < b:
	print("<")
else:
	print(">")
import math
import string
import collections
from collections import Counter


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
h, w = map(int, input().split())
tmp = [None]*h
for i in range(w):
    tmp[i] = input()
# print(tmp)
for i in range(h):
    for j in range(w):
        if tmp[i][j] == '#':
            if (i != 0 and tmp[i-1][j] == '#')or(i+1 < h and tmp[i+1][j] == '#') or(j != 0 and tmp[i][j-1] == '#')or(j+1 < w and tmp[i][j+1] == '#'):
                continue
            else:
                print('No')
                exit()
print('Yes')


### FIXED CODE ###

import math
import string
import collections
from collections import Counter
from collections import deque


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

H, W = map(int, input().split())
s = [None]*H
for i in range(H):
    s[i] = input()
    # print(s[i])
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            #print(i, j)
            if (i != 0 and s[i-1][j] == '#') or(i != H-1 and s[i+1][j] == '#')or(j != 0 and s[i][j-1] == '#') or(j != W-1 and s[i][j+1] == '#'):
                continue
            else:
                print('No')
                exit()
print('Yes')
from collections import Counter
from scipy.misc import comb
N = int(input())
An = list(map(int, input().split()))
counter = Counter(An)
cnt = 0
for c in counter.values():
    cnt += comb(c, 2)
for a in An:
    if counter[a] < 3:
        print(0)
    else:
        print(int(cnt - comb(counter[a], 2) + comb(counter[a]-1, 2)))


### FIXED CODE ###

from collections import Counter
N = int(input())
An = list(map(int, input().split()))
counter = Counter(An)
cnt = 0
for c in counter.values():
    cnt += c * (c-1) // 2
for a in An:
    print(cnt - (counter[a] - 1))
if int(input())%1000==0:
    print(0)
else:
    print(1000-((int(input()))%1000))

### FIXED CODE ###

n = int(input())
if n%1000==0:
    print(0)
else:
    print(1000-(n%1000))
a,b,c = map(int, input().split())
if a >= c:
  a -= c
  print(a,b)
elif a < c:
  b -= (c-a)
  a = 0
  print(a,b)
else:
  print(0,0)

### FIXED CODE ###

a,b = input().split()
print(b+a)
S=input()
q=int(input())
s=[]
for i in S:
    s.append(i)
t=1
for i in range(q):
    qv=list(input().split())
    if qv[0]=='1':
        t^=1
    else:
        if (qv[1]=='1' and t==1) or (qv[1]=='2' and t==0):
            s.insert(0,qv[2])
        else:
            s.append(qv[2])
            
if t==0:
    for j in range(len(s)):
        ss.append(s[-1-j])
ans=''.join(s)
print(ans)

### FIXED CODE ###

S=input()
q=int(input())
s=[]
r=[]
for i in S:
    s.append(i)
t=1
for i in range(q):
    qv=list(input().split())
    if qv[0]=='1':
        t^=1
    else:
        if int(qv[1])^t==0 or int(qv[1])^t==2:
            r.append(qv[2])
        else:
            s.append(qv[2])
            
if t==0:
    ss=s.copy()
    s=[]
    for j in range(len(ss)):
        s.append(ss[-1-j])
    ans=s
    ans.extend(r)
else:
    rr=r.copy()
    r=[]
    for j in range(len(rr)):
        r.append(rr[-1-j])
    ans=r
    ans.extend(s)
answer=''.join(ans)
print(answer)
N, M = map(int, input().split())
A = list(map(int, input().split()))
matchlist = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
numberlist = []
for i in range(M):
    numberlist.append([matchlist[A[i]], A[i]])
numberlist.sort(key = lambda x: (x[0], -x[1]))

ans = []
while N > 0:
    print(N)
    ans.append(numberlist[0])
    N -= ans[-1][0]
    if N < 0:
        N += ans.pop()[0]
        N += ans.pop()[0]
        numberlist.pop(0)

ans = [i[1] for i in ans]
ans.sort(reverse = True)
print("".join(map(str, ans)))


### FIXED CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
matchlist = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
numberlist = []
for i in range(m):
    numberlist.append(matchlist[a[i]])
numberlist = set(numberlist)
#dp[i]:i本でのmax桁
dp = [-10000000]*(n+1)
dp[0] = 0
for i in range(n):
    for j in numberlist:
        if i+j <= n:
            dp[i+j] = max(dp[i+j], dp[i]+1)


ans = []
d = dp[n]
a.sort(reverse = True)
for i in range(d):
    for j in a:
        if n - matchlist[j] >= 0:
            if dp[n] == dp[n-matchlist[j]] + 1:
                n -= matchlist[j]
                ans.append(j)
                break
print("".join(map(str,ans)))
L = []
for i in range(input()):
    L.append(map(int, raw_input().split()))
print "%d %d" % sorted(L, key=lambda a:(-a[1], a[0]))[0]

### FIXED CODE ###

L = []
for i in range(input()):
    L.append(map(int, raw_input().split()))
print ' '.join(map(str, sorted(L, key=lambda a:(-a[1], a[0]))[0]))
n, k = map(int, input().split())
As = list(map(int, input().split()))
maps = {}

for i, a in enumerate(As):
    maps[i] = a - 1

probs = [0] * n
p = 0  # 現在位置
target = 0  # はじめて2回出現する場所
h = 0  # ターゲットの初回出現時のワープ回数
t = 0  # ターゲットの2回目の出現時のワープ回数

# はじめて2回出現する場所(target)と、その時点でのワープ回数を取得
for i in range(n):
    if (p == maps[p]):
        target = p
        t = i
        break
    probs[p] += 1
    if (probs[p] == 2):
        target = p
        t = i
        break
    p = maps[p]

# 初回出現位置を取得(めんどうくさいのでもう一回回した。)
p = 0
for i in range(n):
    if (p == target):
        h = i
        break
    p = maps[p]

s = t - h  # 周期
d = (k - h) % s  # targetに到着後にワープすべき回数

# 実際に必要な回数だけワープ
p = 0
for i in range(h + d):
    p = maps[p]

print(p + 1)

### FIXED CODE ###

n, k = map(int, input().split())
As = list(map(int, input().split()))
maps = {}

for i, a in enumerate(As):
    maps[i] = a - 1

probs = [0] * n
p = 0  # 現在位置
target = 0  # はじめて2回出現する場所
h = 0  # ターゲットの初回出現時のワープ回数
t = 0  # ターゲットの2回目の出現時のワープ回数

# はじめて2回出現する場所(target)と、その時点でのワープ回数を取得
for i in range(n + 1):
    probs[p] += 1
    if (probs[p] == 2):
        target = p
        t = i
        break
    p = maps[p]

# 初回出現位置を取得(めんどうくさいのでもう一回回した。)
p = 0
for i in range(n):
    if (p == target):
        h = i
        break
    p = maps[p]

s = t - h  # 周期
if (k <= h):
    p = 0
    for i in range(k):
        p = maps[p]
    print(p + 1)
    exit()

d = (k - h) % s  # targetに到着後にワープすべき回数

# 実際に必要な回数だけワープ
p = 0
for i in range(h + d):
    p = maps[p]

print(p + 1)
from math import ceil


n = int(input())
print(111 * ceil(n / 111)
      

### FIXED CODE ###

import math


n = int(input())
print(111 * math.ceil(n / 111))
n=input()
n=int(n)
input_h=input().split()# 2 4 5のような入力
input_h=[int(num) for num in input_h]#intへ変換

for idx in range(n-1):

    if input_h[idx]<=input_h[idx+1]:
        continue
    elif input_h[idx]-1==input_h[idx+1]:
        continue
    else:
        print("No")
        break
else:
    print("Yes")
    

### FIXED CODE ###

input_num=input().split()# 2 4 5のような入力
input_num=[int(num) for num in input_num]#intへ変換

A,B,C=input_num

cup_1=B
cup_2=C

cup_1=B+cup_2
cup_2=0

if cup_1>=A:
    cup_1=A
    cup_2=B+C-cup_1
    print(cup_2)
else:
    print(0)
A,B,C,K = map(int, input().split())
L=[1]*A + [0]*B + [-1]*C

J = sum(L[:K])

print(J)

### FIXED CODE ###

A,B,C,K = map(int, input().split())
ans =0
for c,i in enumerate([A,B, C]):
  K -= i
  if K>=0:
    if c ==0:
    	ans += i
    elif c == 2:
      	ans -= i
      
  else:
    if c ==0:
    	ans += K +i
    elif c == 2:
      	ans -= K+i
    break
    
  

print(ans)
n=int(input().split())
arr=list(map(int,input().split()))
ans=1
least=arr[0]
for i in range(1,n):
  if arr[i]<=least:
    ans+=1
  least=min(least,arr[i])
print(ans)

### FIXED CODE ###

n=int(input())
arr=list(map(int,input().split()))
ans=1
least=arr[0]
for i in range(1,n):
  if arr[i]<=least:
    ans+=1
  least=min(least,arr[i])
print(ans)
s=sorted;print(['No','Yes'][s(input())<s(input())[::-1]])

### FIXED CODE ###

import math;a,b=map(int,input().split());print(math.ceil((a+b)/2))
s=str(input())
s1=str[:5]
s2=str[6:13]
s3=str[14:]
print('{} {} {}'.format(s1,s2,s3))

### FIXED CODE ###

s=str(input())
s1=s[:5]
s2=s[6:13]
s3=s[14:]
print('{} {} {}'.format(s1,s2,s3))
a,b,c=map(int,input().split())
print("YES" if ((b-a)==(c-d)) else "NO")

### FIXED CODE ###

a,b,c=map(int,input().split())
print("YES" if ((b-a)==(c-b)) else "NO")
s=input()
ans='No'
for i in range(len(s)):
  if s[i]=='C':
    for j in s[i+1:]:
      if s[j]=='F':
        ans='Yes'
print(ans)

### FIXED CODE ###

s=input()
ans='No'
for i in range(len(s)):
  if s[i]=='C':
    for j in s[i+1:]:
      if j=='F':
        ans='Yes'
print(ans)
def judge(t,x,y,t0,x0,y0):
  minT=abs(x-x0)+abs(y-y0)
  return (t-t0-minT)>=0 and (t-t0-minT)%2==0
n=int(input())
lst=[tuple(int(i) for i in input().split()) for i in range(n)]
t0=0;x0=0;y0=0
num=0;bool=False
while num<=n:
  t,x,y=lst[num]
  if judge(t,x,y,t0,x0,y0):
    t0=t;x0=x;y0=y
    num+=1
    bool=True
  else:
    bool=False
    break
if bool:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

def judge(t,x,y,t0,x0,y0):
  minT=abs(x-x0)+abs(y-y0)
  if (t-t0-minT)>=0 and (t-t0-minT)%2==0:
    return True
  else:
    return False
n=int(input())
lst=[tuple(int(i) for i in input().split()) for i in range(n)]
t0=0;x0=0;y0=0
for i in range(n):
  t,x,y=lst[i]
  if judge(t,x,y,t0,x0,y0):
    t0=t;x0=x;y0=y
    ans=True
  else:
    ans=False
    break
if ans:
  print('Yes')
else:
  print('No')
N, X = map(int, input().split())
city_lst = list(map(int, input().split()))
city_lst.sort()
# print(city_lst)

if X < city_lst[0]:
	maximum_D = city_lst[0] - X
else:
	for i in range(N - 1):
		if city_lst[i] < X:
			maximum_D = min(abs(X - city_lst[i]), abs(city_lst[i + 1] - X))
			break

# print(maximum_D)
for D in reversed(range(1, maximum_D + 1)):
	fail = 0
	# print("D = {}".format(D))
	for i in range(1, N):
		if (city_lst[i] - city_lst[i - 1]) % D != 0:
			# print(city_lst[i], city_lst[i - 1])
			fail = 1
			# print("fail = 1")
			break
	if not fail:
		print(D)
		break

### FIXED CODE ###

from fractions import gcd

N, X = (int(i) for i in input().split())

x = [abs(int(i) - X) for i in input().split()]  
for i in range(1,N):
	x[i] = gcd(x[i-1], x[i])

print(x[-1])
a,s = map (int,input().split())
a = int(input())
s = input()

if a >= 3200 :
    print(s)
else:
    print('red')

### FIXED CODE ###

  
# 整数 a と、英小文字からなる文字列s が入力されます。
# a が3200 以上ならs と出力し、a が3200 未満なら red と出力するプログラムを書いてください。


a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print("red")
import sys
sys.setrecursionlimit(10000)

N,M = map(int, input().split())
a = [int(input()) for i in range(M)]

flag = 0
for i in range(M-1):
    if a[i+1] - a[i] == 1:
        flag += 1

if flag >= 1:
    print(0)

else:
    def fib(n):
        a, b = 0, 1
        for i in range(n):
            a, b = b, a + b
        return b

    ans = fib(a[0]-1)
    for i in range(M-1):
        ans = (ans * fib(a[i+1]-a[i]-2))%(10**9+7)

    ans = (ans * fib(N-a[-1]-1))%(10**9+7)

    print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10000)

N,M = map(int, input().split())
a = [int(input()) for i in range(M)]

def fib(n):
        a, b = 0, 1
        for i in range(n):
            a, b = b, a + b
        return b if n >= 0 else 0

if M == 0:
    ans = fib(N) % (10**9+7)


elif M == 1:
    ans = fib(a[0]-1) * fib(N-a[0]-1)
    ans %= (10**9+7)

else:
    ans = fib(a[0]-1)
    for i in range(M-1):
        ans = (ans * fib(a[i+1]-a[i]-2))%(10**9+7)

    ans = (ans * fib(N-a[-1]-1))%(10**9+7)

print(ans)
hoge = input().split()
N = int(hoge[0])
M = int(hoge[1])
broken = []
for i in range(M):
  broken.append(int(input()))

anss = []
safes = []
fibo = [1,2]
safes.append(broken[0]-1)
for i in range(M-1):
  safes.append(broken[i+1] - broken[i] - 1)

safes.append(N-broken[M-1] - 1)

for i in range(len(safes)):
  if safes[i] == 0:
    anss.append(1) # 間が0
  elif safes[i] == 1:
    anss.append(1) # 間が1つ
  elif safes[i] == 2:
    anss.append(2) # 間が2つ
  else:
    for i in range(safes[i] - 2): # 間が3つ以上
      fibo.append(fibo[i] + fibo[i+1])
    anss.append(fibo.pop())
    fibo = [1, 2]

answer = 1
#print(safes)
#print(anss)
for i in range(len(anss)):
  answer = answer * anss[i]
# print(safes)
  
flag = 0
for i in range(M-1):
  if broken[i+1] - broken[i] == 1:
    flag = 1

if flag == 0:
  print(answer%1000000007)
else:
  print(0)

### FIXED CODE ###

N, M = list(map(int,input().split()))
     
b = [0]*(N+2)
b[0] = 1
     
for i in range(M):
  b[int(input())] = -1
     
for i in range(N):
  if b[i] != -1:
    if b[i+1] != -1:
      b[i+1] += b[i]
    if b[i+2] != -1:
      b[i+2] += b[i]

print(b[N]%1000000007)
T,X = map(input().split())
print(T/X)

### FIXED CODE ###

T,X = map(int, input().split())
print(T/X)
x,n = map(int,input().split())
p = list(map(int,input().split()))
if n==0:
    print(x)
    exit()
elif x==1:
    print(0)
    exit()
res = []
for num in range(1,101):
    if x!=num and num not in p:
        res.append(abs(x-num))
if x-min(res) not in p:
    print(x-min(res))
else:
    print(x+min(res))

### FIXED CODE ###

x,n = map(int,input().split())
p = list(map(int,input().split()))
if x not in p:
    print(x)
    exit()
a,b = x,x
while True:
    a+=1
    b-=1
    if b not in p:
        print(b)
        break
    elif a not in p:
        print(a)
        break
if (n == len(s) and (s == t)):
    print(n)
else:
    ind = [0]
    for i in range(1, len(s)):
        if s[-i:] == t[:i]:
            ind.append(i)

    ind.reverse()
    for i in ind:
        if i == 0:
            print(2*n)
        else:
            res = s[0:-i] + t
            if len(res) >= n:
                print(len(res))
                break

### FIXED CODE ###

n = int(input())
s = input()
t = input()

if (n == len(s) and (s == t)):
    print(n)
else:
    ind = [0]
    for i in range(1, len(s)):
        if s[-i:] == t[:i]:
            ind.append(i)

    ind.reverse()
    for i in ind:
        if i == 0:
            print(2*n)
        else:
            res = s[0:-i] + t
            if len(res) >= n:
                print(len(res))
                break
import sys
input = sys.stdin.readline
import math

sys.setrecursionlimit(1000000)

def main(): 

    N = int(input())
    A = list(map(int,input().split()))
    A_gcd_for=[]
    A_gcd_for.append(A[0])
    A_gcd_af=[]
    A_gcd_af.append(A[-1])
    for i in range(1,N):
        A_gcd_for.append(math.gcd(A_gcd_for[-1], A[i]))
        A_gcd_af.append(math.gcd(A_gcd_af[-1], A[N-i-1]))
    ans=0
    for i in range(N):
        if i==0: a = A_gcd_af[N-i-2]
        elif i==N-1: a = A_gcd_for[i-1]
        else: a = math.gcd(A_gcd_for[i-1], A_gcd_af[N-i-2])
        if a > ans:
            ans=a
    print(ans)

if __name__ == "__main__":
    main()
    

### FIXED CODE ###

import sys
input = sys.stdin.readline
#import math
import fractions #fractions.gcd()
sys.setrecursionlimit(1000000)

def main(): 

    N = int(input())
    A = list(map(int,input().split()))
    A_gcd_for=[]
    A_gcd_for.append(A[0])
    A_gcd_af=[]
    A_gcd_af.append(A[-1])
    for i in range(1,N):
        A_gcd_for.append(fractions.gcd(A_gcd_for[-1], A[i]))
        A_gcd_af.append(fractions.gcd(A_gcd_af[-1], A[N-i-1]))
    ans=0
    for i in range(N):
        if i==0: a = A_gcd_af[N-i-2]
        elif i==N-1: a = A_gcd_for[i-1]
        else: a = fractions.gcd(A_gcd_for[i-1], A_gcd_af[N-i-2])
        if a > ans:
            ans=a
    print(ans)

if __name__ == "__main__":
    main()
def com(_x):
    _flg = 1
    mx  = int(_x**0.5)
    for i in range(2, mx+1):
        if _x % i == 0:
            _flg = 0
            break
    return _flg


x = int(input())
flg = 0
  while flg == 0:
      #print("a")
      flg = com(x)
      if flg == 0:
          x+=1
print(x)

### FIXED CODE ###

def com(_x):
    _flg = 1
    mx  = int(_x**0.5)
    for i in range(2, mx+1):
        if _x % i == 0:
            _flg = 0
            break
    return _flg


def main():
    x = int(input())
    flg = 0
    while flg == 0:
        #print("a")
        flg = com(x)
        if flg == 0:
            x+=1
    print(x)



if __name__ == "__main__":
    main()
n,m = [int(x) for x in input().split()]
py = []
for i in range(m):
    p,y = [int(x) for x in input().split()]
    py.append([p,y,i+1])

def zero(num):
    return str(num).zfill(6)


if m == 1:
    print(zero(1)+zero(1))
else:
    year_py = sorted(py, key=lambda x: x[1])
    dic = {x: 1 for x in range(1,m+1)}

    for i in range(m):
        year_py[i].append(dic[year_py[i][0]+1])
        dic[year_py[i][0]+1] += 1

    yb_py = sorted(year_py, key=lambda x: x[2])

    for i in range(m):
        print(zero(yb_py[i][0]) + zero(yb_py[i][3]))

### FIXED CODE ###

n,m = [int(x) for x in input().split()]
py = []
for i in range(m):
    p,y = [int(x) for x in input().split()]
    py.append([p,y,i+1])

def zero(num):
    return str(num).zfill(6)


if m == 1:
    print(zero(py[0][0])+zero(1))
else:
    year_py = sorted(py, key=lambda x: x[1])
    dic = {str(x): 0 for x in range(1,n+1)}

    for i in range(m):
        dic[str(year_py[i][0])] += 1
        year_py[i].append(dic[str(year_py[i][0])])
    yb_py = sorted(year_py, key=lambda x: x[2])

    for i in range(m):
        print(zero(yb_py[i][0]) + zero(yb_py[i][3]))
n = int(input())
h = input().split()

mizuyari = 0
for i in range(int(sorted(h)[n-1])):
    maenohana = False
    mizuyari += thismizuyari
    thismizuyari = 0
    for j in range(n):
        if not maenohana and i+1<=int(h[j]):
            thismizuyari += 1
        maenohana = i+1<=int(h[j])
print(mizuyari)

### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
 
mizuyari = 0
for i in range(sorted(h)[n-1]):
    maenohana = False
    for j in range(n):
        if not maenohana and i+1<=h[j]:
            mizuyari += 1
        maenohana = i+1<=h[j]
print(mizuyari)
X, N = map(int,input().split())
p_list = list(map(int, input().split()))

p_list.sort()
r = 200
answer = 101

for i in range(0, 102):
    if i in p_list:
        continue
    else:
        if r > abs(i - X):
            r = abs(i - X)
            answer = i
        else:
            print(answer)
            break


### FIXED CODE ###

a = list(map(int,input().split()))
count = 1

for i in a:
    if i == 0:
        print(count)
        break
    count+=1