Harryxun/stf_run huggingface dataset:
# coding: UTF-8
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,M=map(int,input().split())
    s,c=[0]*M,[0]*M
    d={}
    for i in range(M):
        s,c=map(int,input().split())
        if s in d:
            if c!=d[s]:
                print(-1)
                exit()
        else:
            d[s]=c
    if N!=1 and d[1]==0:
        print(-1)
        exit()
    ans=''
    for i in range(1,N+1):
        if i in d:
            ans+=str(d[i])
        else:
            if i==0:
                ans+='1'
            else:
                ans+='0'
    print(ans)

    

if __name__ == '__main__':
    main()


### FIXED CODE ###

# coding: UTF-8
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,M=map(int,input().split())
    s,c=[0]*M,[0]*M
    d={}
    for i in range(M):
        s,c=map(int,input().split())
        if s in d:
            if c!=d[s]:
                print(-1)
                exit()
        else:
            d[s]=c
    if N!=1 and 1 in d and d[1]==0:
        print(-1)
        exit()
    ans=''
    if N==1 and M==0:
        print(0)
        exit()
    for i in range(1,N+1):
        if i in d:
            ans+=str(d[i])
        else:
            if i==1:
                ans+='1'
            else:
                ans+='0'
    print(ans)

    

if __name__ == '__main__':
    main()
A,B = map(int,input().split())
if A = B:
	print(A+B)
elif A < B:
    print(B*2-1)
else:
    print(A*2-1)

### FIXED CODE ###

A,B = map(int,input().split())
if A == B:
	print(A+B)
elif A < B:
    print(B*2-1)
else:
    print(A*2-1)
n=input()
A=set()
for i in range(n):
     x,y=input().split()
     if x=='insert':
         A.add(y)
     else:
         if A in y:
            print('yes')
         else:
            print('no')


### FIXED CODE ###

n=int(input())
A=set()
for i in range(n):
     x,y=input().split()
     if x == 'insert':
         A.add(y)
     else:
         print('yes'*(y in A)or'no')
import math
a,b = map(int,input().split())
ans=a*b
print(math.floor(ans))

### FIXED CODE ###

from decimal import *
a,b = input().split()
ans = Decimal(a) * Decimal(b)
print(ans.quantize(Decimal("1"),rounding=ROUND_DOWN))
import numpy as np
H, N = map(int, input().split())
A = np.array([int(num) for num in input().split()])
if H <= A.sum():
    print('Yes')
else:
    print('No')

### FIXED CODE ###

import numpy as np
H, A = map(int, input().split())
num = int(np.ceil(H/A))
print(num)
from collections import Counter

N = int(input())
A=list(map(int,input().split()))
c=dict(Counter(A))
#print(c)
e=[]
f=[]

for i in c:
  if c[i]>1:
    e.append(i)
  if c[i]>=4:
    f.append(i)

e.sort(reverse=True)
f.sort(reverse=True)
if f[0]>=e[0]:
  print(f[0]**2)
else:
  if len(e)>=2:
    print(e[0]*e[1])
  else:
    print(0)

### FIXED CODE ###

from collections import Counter

N = int(input())
A=list(map(int,input().split()))
c=dict(Counter(A))
#print(c)
e=[]
f=[]

for i in c:
  if c[i]>1:
    e.append(i)
  if c[i]>=4:
    f.append(i)

e.sort(reverse=True)
f.sort(reverse=True)
if len(f)>=1:
  if f[0]>=e[0]:
    print(f[0]**2)
  else:
    if len(e)>=2:
      print(e[0]*e[1])
    else:
      print(0)
else:
  if len(e)>=2:
    print(e[0]*e[1])
  else:
    print(0)
n,k = map(int,input().split())
import math

def c(x,y):
  return math.fractorial(x)//math.fractorial(x-y)*math.fractorial(y)

for in in range(1,k-1):
  sol = c(n+k-1,i)*c(k-1,i-1)
  ans = sol%(10**9+7)
  print(ans)
  





### FIXED CODE ###

import math
 
def combination_count(n,k):
    if k > n or k < 0:
        return 0
    if n == 0 or k == 0:
        return 1
    
    s = math.factorial(n)
    t = math.factorial(k)
    u = math.factorial(n-k)
    
    return s//(t*u)
    
n,k = map(int,input().split())
 
mod = 10**9 + 7
 
for i in range(1,k+1):
    x = combination_count(n-k+1,i) * combination_count(k-1, i-1)
    print(x%mod)
import sys
input = sys.stdin.readline
N=int(input())
strings=list("".join(sorted(input())) for _ in range(N))
count = 0
for string in strings:
    tmp = strings.count(string)
    if tmp > 1:
        count += (tmp - 1) / 2

print(int(count))

### FIXED CODE ###

A,B = map(int,input().split())
print(max(A+B,A-B,A*B))
n = int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
count = 0
total = 0

for _ in range(n):
  total += 1
  if x[n] == y[n]:
    count += 1
    if count == 3:
      print("Yes")
      break
  else:
    count = 0
  if total == n and count < 3:
    print("No")

### FIXED CODE ###

n = int(input())
a = []

for _ in range(n):
  aa, b = map(int,input().split())
  if aa == b:
    a.append("1")
  else:
    a.append("0")
if "111" in "".join(a):
  print("Yes")
else:
  print("No")
N = int(input())
P = list(map(int, input().split()))

cnt = 1
after = [P[i-1] for i in range(1, N)]
for a in after:
    if a < P[i]:
        break
else:
    cnt += 1
print(cnt)

### FIXED CODE ###

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

cnt = 1
mini = P[0]
for i in range(1, N):
    if P[i] <= mini:
        mini = P[i]
        cnt += 1
print(cnt)
import sys
input = sys.stdin.readline

import math

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

if "1"*M in S:
  print(-1)
  exit()  

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

max_n = [0]
mask = (1<<M) -1
b = 0
for i in range(N):
  b = ((b<<1) + (1- S[i])) & mask
  max_n.append(math.floor(math.log(b)/math.log(2))+1)

now = N
deme = []
while now != 0:
  x = max_n[now]
  now -= x
  deme.append(x)
print(*deme[::-1])

### FIXED CODE ###

import sys
input = sys.stdin.readline

import math
import bisect

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

if "1"*M in S:
  print(-1)
  exit()  

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

L = [(1<<i) -1 for i in range(1,M+1)]

max_n = [0]
mask = (1<<M) -1
b = 0
for i in range(N):
  b = ((b<<1) + (1- S[i])) & mask
  max_n.append(bisect.bisect_left(L,b)+1)

now = N
deme = []
while now != 0:
  x = max_n[now]
  now -= x
  deme.append(x)
print(*deme[::-1])
N = int(input())

import math
a = list(map(int, input().split()))
#最大公約数
ans = a[0]
for i in range(1, N):
    ans = math.gcd(ans, a[i])

cnt = 0

while ans%2 == 0:
    ans /= 2
    cnt += 1

print(cnt)

### FIXED CODE ###

N = int(input())

import fractions
a = list(map(int, input().split()))
#最大公約数
ans = a[0]
for i in range(1, N):
    ans = fractions.gcd(ans, a[i])

cnt = 0

while ans%2 == 0:
    ans /= 2
    cnt += 1

print(cnt)
s = input()
word = ''
for i in range(len(s)//2+1):
	word += s[2*i]
print(word)

### FIXED CODE ###

s = input()
word = ''
for i in range((len(s)+1)//2):
	word += s[2*i]
print(word)
a,b = map(int,input().split())
x = (a+b)/2
if (a+b) % 2 = 0:
  print(int(x))
else:
  print(int(x)+1)

### FIXED CODE ###

a,b = map(int,input().split())
x = (a+b)/2
if (a+b)%2 == 0:
  print(int(x))
else:
  print(int(x)+1)
from decimal import Decimal
X= int(input())
B=1
while True:
    A=Decimal((X+B**5)**(1/5))
    if int(A)==A and A>B:
        print(A,B)
        break
    else:
        if B>=0:
            B=-1*B       
        else:
            B=-1*B+1

### FIXED CODE ###

#D
X=int(input())
for i in range(1000):
    for a in range(1000):
        if a**5-(a-i)**5==X:
            print(a,a-i)
            break
from numba import njit
import numpy as np

@njit
def resolve():
    N, K = map(int, input().split())
    A = np.array(list(map(int, input().split())), np.int64)
 
    for _ in range(K):
        imos_table = np.zeros(N + 1, np.int64)
        for i, a in enumerate(A):
            # 配列の個数を超えないように注意
            imos_table[max(i - a, 0)] += 1
            imos_table[min(i + a + 1, N)] -= 1
        A = np.cumsum(imos_table)[:-1]
        if np.all(A == N):
            print(*A)
            return
    else:
        print(*A)
        
if __name__ == "__main__":
    resolve()

### FIXED CODE ###


from itertools import accumulate
def resolve():

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

    for _ in range(K):
        imos_table = [0]*(N+1)
        for i, a in enumerate(A):
            # 配列の個数を超えないように注意
            imos_table[max(i - a, 0)] += 1
            imos_table[min(i + a + 1, N)] -= 1
        A = list(accumulate(imos_table))[:-1]
        if all([True if a == N else False for a in A]):
            print(*A)
            return
    else:
        print(*A)

if __name__ == "__main__":
    resolve()
import sys
H,W = map(int,sys.stdin.readline())
C = open(0)
for i in C:
    print(i)
    print(i)

### FIXED CODE ###

import sys

H, W = sys.stdin.readline().split()
C = map(str, sys.stdin)
for i in C:
    print(i)
    print(i)
a = int(input())
print(["No", "Yes"][a//10 == 9 or a%10 == 9]

### FIXED CODE ###

a = int(input())
print(["No", "Yes"][a//10 == 9 or a%10 == 9])
n = input()
max = -10**9
min = R[]

for i in range(n-1):
 if max <= R[i] - min:
  max = R[i] - min
 if R[i] <= min:
  min = R[i]

print max

### FIXED CODE ###

n = input()
n_max = -(10**9)
n_min = input() 

for i in range(0, n-1):
 R = input()
 if n_max < R - n_min:
  n_max = R - n_min
 if R < n_min:
  n_min = R
 
print n_max
n= int(input())
s = input()
ans = 0
for i in range(10):
  ii = s.find(str(i))
  if -1 == ii:
    continue
  for j in range(10):
    ij = s.find(str(j), ii+1)
    if -1 == ij:
      continue
    for k in range(10):
      ik = s.find(str(k), ij+1)
      if ik != -1:
        ans += 1
      
print(ans)

### FIXED CODE ###

m_1, d_1 = map(int, input().split())
m_2, d_2 = map(int, input().split())

if m_1 != m_2:
    print(1)
else:
    print(0)
import numpy as np
#s = "1234567"
s = input()
#print(len(s))

ss = []

for i in range(len(s)-2):
    print(s[i:i+3])
    ss.append(int(s[i:i+3]))

ss = np.array(ss)
print((ss - 753).max())

### FIXED CODE ###

s = int(input())
if s==3 or s==5 or s==7:
	print("YES")
else:
	print("NO")
A,B,C,D,E,F = list(map(int, input().split()))
#x is a list which represents for the volumn of water
x = set()

#y is a list which represents for the volumn of sugar
y = set()

for i in range(F//C+1):
    for j in range((F-C*i)//D+1):
        #if i + j == 0:
            continue
        y.add( i * C + j * D)

for i in range(F//(100 * A)+1):
    for j in range((F-100*A*i)//(100*B)+1):
        if i + j == 0:
            continue
        x.add(i * A * 100 + j * B * 100)
#print(x)
#print(y)
ans_sweetwater = 1
ans_sugar = -1
#ans_density = -1
#density = E/(100+E)
#print("density: ",density)
for m in x:
    for n in y:
        #tmp_density = n/(m+n)
        if m + n <= F and m*E/100 >= n and ans_sugar/ans_sweetwater <= n/(m+n):
            ans_sweetwater =  m + n
            ans_sugar = n
            #ans_density = tmp_density
print(ans_sweetwater,ans_sugar)


### FIXED CODE ###

A, B, C, D, E, F = map(int, input().split())
 
x = set()
y = set()
 
for i in range(F // (100 * A) + 1):
    for j in range((F - 100 * A * i) // (100 * B) + 1):
        if i + j == 0:
            continue
        x.add(A * i * 100 + B * j * 100)
 
for i in range(F // C + 1):
    for j in range((F - C * i) // D + 1):
        y.add(C * i + D * j)
 
ret_w = 1
ret_s = -1
 
for w in x:
    for s in y:
        if w + s <= F and w * E / 100 >= s and s / (w + s) >= ret_s / ret_w:
            ret_s = s
            ret_w = w + s
 
print(ret_w, ret_s)
import fractions
N, M = map(int, input().split())

k = M // N　+ 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    tmp =  max(M - (N-1)*i,1)
    ans = max(ans, fractions.gcd(i, tmp))

print(ans)


### FIXED CODE ###

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

k = M // N + 1
ans = 1
for i in reversed(range(1, k+1)):
    if ans > i:
        break
    tmp = max(M - (N-1)*i, 1)
    if tmp % i == 0:
        ans = max(ans, i)

print(ans)
friends=input()
friends.split('')
friends_all=friends[0]
cakes=input()
cakes.split('')
cakes_amount(sum(cakes))
person=friends+1
one_person=cakes_amount//person
if cakes_amount%person==0:
        pass
else:
        one_person+=1
preint(one_person)



### FIXED CODE ###

friends=input()
friends=friends.split()
friends_all=friends[0]
person=int(friends_all)+1
cakes=input()
cakes_amount=0
for a in cakes.split():
        cakes_amount+=int(a)
one_person=cakes_amount//person

if cakes_amount%person!=0:
        one_person+=1
else:
        pass
print(one_person)
# -*- coding: utf-8 -*-


def qui(l):
    num = len(l)
    if num == 0: return []
    piv = l[int(num/2)]
    mini = []
    maxi = []
    for i in l:
        if piv > i :
            mini.append(i)
        elif piv < i:
            maxi.append(i)
    print(piv)
    print("{0}".format(mini))
    print("{0}".format(maxi))
    return qui(mini) + [piv] + qui(maxi)

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

print(result)

### FIXED CODE ###

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


def qui(l):
    num = len(l)
    if num <= 1:
        return l
    piv = 0
    piv2 = len(l)-1
    piv3 = int(len(l)/2)
    if l[piv] > l[piv2] > l[piv3]:
        piv = piv2
    elif l[piv] > l[piv3] > l[piv2]:
        piv = piv3
    else:
        pass
    mini = []
    maxi = []

    for i in range(0,len(l)):
        if i == piv:
            continue
        if l[piv] > l[i]:
            mini.append(l[i])
        elif l[piv] <= l[i]:
            maxi.append(l[i])
    return qui(mini) + [l[piv]] + qui(maxi)

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

print(' '.join(map(str, result)))
print('A{}C'.format(input().split()[1][1]))


### FIXED CODE ###

print('A{}C'.format(input().split()[1][0]))
s = input()
x = []

for i in range(len(s) - 2):
    x.append(abs(s[i:i+3]-753))
    
print(min(x))

### FIXED CODE ###

s = list(str(input()))
m = []
for i in range(len(s)-2):
    x = s[i:i+3]
    a = 0
    a = int("".join(x))
    x = s
    m.append(abs(753-a))
print(min(m))
S=input()
char_list=list(S)
if char_list[0]=="A":
	j=0
	del char_list[0]
	for i in range(1,len(char_list)-2):
		if char_list[i]=="C":
			del char_list[i]
			j=j+1
		
	if j==1:
		
		k=0	
		for i in range(0,len(char_list)):	
			if char_list[i].islower():
				k=k+1
			
		if k==len(char_list):
			print("AC")
		else:
			print("WA")			
	else:
		print("WA")		
else:
	print("WA")				
								


### FIXED CODE ###

S=input()
if S[0]=="A" and S[2:-1].count("C")==1:
	index=S.index("C")
	S=S[1:index]+S[index+1:]
	if S.islower():
		print("AC")
	else:
		print("WA")	
else:
	print("WA")
t = int(input())
x = int(input())
answer = 0.0

if 1 <= t and t <= 100:
  if 1 <= x and x <= 100:
    answer = t / x
    print(answer)


### FIXED CODE ###

i = list(map(int, input().split()))
ans = 0.0

if 1 <= i[0] and i[0] <= 100:
  if 1 <= i[1] and i[1] <= 100:
    ans = i[0] / i[1]
    print(ans)
a = input()
b = input()
c = input()
x = input()

# a = 2
# b = 2
# c = 2
# x = 100

cnt = 0
for i1 in range(0,a+1):
    for i2 in range(0,b+1):
        for i3 in range(0,c+1):
            s = 500*i1+100*i2+50*i3
            if(s==x):
                cnt = cnt + 1
print(cnt)


### FIXED CODE ###

a = input()
b = input()
c = input()
x = input()

a = int(a)
b = int(b)
c = int(c)
x = int(x)

# a = 2
# b = 2
# c = 2
# x = 100

cnt = 0
for i1 in range(0,a+1):
    for i2 in range(0,b+1):
        for i3 in range(0,c+1):
            s = 500*i1+100*i2+50*i3
            if(s==x):
                cnt = cnt + 1
print(cnt)
import sys
import bisect
import math
import numpy as np
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from operator import itemgetter

n,s=map(int,readline().split())
a=list(map(int,readline().split()))
mod=998244353
dp=np.zeros((3030,3030),np.int64)
dp[0,0]=1
for i in range(n):
    for j in range(s+1):
        dp[i+1,j]+=2*dp[i,j]
        dp[i+1,j]%=mod
        if j+a[i]<=s:
            dp[i+1,j+a[i]]+=dp[i,j]
            dp[i+1,j+a[i]]%=mod
print(dp[n,s])

### FIXED CODE ###

import sys
import bisect
import math
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from operator import itemgetter

n,s=map(int,readline().split())
a=list(map(int,readline().split()))
mod=998244353
dp=[[0 for j in range(s+1)] for i in range(n+1)]
dp[0][0]=1
for i in range(n):
    for j in range(s+1):
        dp[i+1][j]+=2*dp[i][j]
        dp[i+1][j]%=mod
        if j+a[i]<=s:
            dp[i+1][j+a[i]]+=dp[i][j]
            dp[i+1][j+a[i]]%=mod
print(dp[n][s])
n,k = map(int,input().split())
scale = 21
scale = 3
seg = [0 for _ in range(2**scale)]
db = [2**i for i in range(scale)]
rdb = list(reversed(db))
#print(db)
#print(rdb)
#print(db)
for _ in range(n):
  c = int(input())
  l = max(c-k,0)
  r = min(c+k+1,2**(scale-1))
  maxi = 0
  now = [[l,r]]
  #print(now)
  for i in range(scale):
    last = now
    now = []
    for xy in last:
      x,y = xy
      if x == y:
        continue
      X = (x-1) // rdb[i] + 1
      Y = y     // rdb[i]
      #print(x,y,X,Y,rdb[i])
      if X < Y:
        maxi = max(maxi,seg[db[i]+X])
        now.append([x,X*rdb[i]])
        now.append([Y*rdb[i],y])
      else:
        now.append(xy)
      #print(int(X<Y),X,maxi)
    #print(now,i,maxi)
  c += db[-1]
  while True:
    seg[c] = max(seg[c],maxi + 1)
    c //= 2
    if not c:
      break
  #print(seg)
print(seg[1])

### FIXED CODE ###

n,k = map(int,input().split())
scale = 21
#scale = 4
seg = [0 for _ in range(2**scale)]
db = [2**i for i in range(scale)]
rdb = list(reversed(db))
#print(rdb)
for _ in range(n):
  c = int(input())
  l = max(c-k,0)
  r = min(c+k+1,2**(scale-1))
  maxi = 0
  now = [[l,r]]
  #print(now)
  for i in range(scale):
    last = now
    now = []
    for xy in last:
      x,y = xy
      if x == y:
        continue
      X = (x-1) // rdb[i] + 1
      Y = y     // rdb[i]
      #print(x,y,X,Y,rdb[i])
      if X < Y:
        for Z in range(X,Y):
          maxi = max(maxi,seg[db[i]+Z])
        now.append([x,X*rdb[i]])
        now.append([Y*rdb[i],y])
      else:
        now.append(xy)
      #print(int(X<Y),X,maxi)
    #print(now,rdb[i],maxi)
  c += db[-1]
  while True:
    seg[c] = max(seg[c],maxi + 1)
    c //= 2
    if not c:
      break
  #print(seg)
print(seg[1])
n = input() % 10
if n in ("2", "4", "5", "7", "9"):
    print("hon")
elif n in ("0", "1", "6", "8"):
    print("pon")
else:
  	print("bon")

### FIXED CODE ###

n = int(input().strip()) % 10
if n in (2, 4, 5, 7, 9):
    print("hon")
elif n in (0, 1, 6, 8):
    print("pon")
else:
  	print("bon")
import sys
sys.setrecursionlimit(4100000)

s = input()
cont_list = []
ini_di = s[0]
count = 1
for i in range(1, len(s)):
    if s[i] == s[i-1]:
        count += 1
        if i == len(s) - 1:
            cont_list.append(count)
    else:
        cont_list.append(count)
        count = 1
        if i == len(s) - 1:
            cont_list.append(count)


def counting(i):
    a = max(cont_list[i], cont_list[i + 1])
    b = min(cont_list[i], cont_list[i + 1])
    return (1 + a) * a / 2 + b * (b - 1) / 2


if ini_di == "<":
    count2 = 0
    if len(cont_list) % 2 == 0:
        for i in range(0, len(cont_list), 2):
            count2 += counting(i)
    else:
        for i in range(0, len(cont_list)-1, 2):
            count2 += counting(i)
        las = cont_list[len(cont_list)-1]
        count2 += (1+las)*las/2
    print(int(count2))
else:
    count2 = 0
    if len(cont_list) % 2 == 1:
        ini = cont_list[0]
        count2 += (1+ini)*ini/2
        for i in range(1, len(cont_list), 2):
            count2 += counting(i)
    else:
        ini = cont_list[0]
        count2 += (1 + ini) * ini / 2
        las = cont_list[len(cont_list) - 1]
        count2 += (1 + las) * las / 2
        for i in range(1, len(cont_list)-1, 2):
            count2 += counting(i)
    print(int(count2))


### FIXED CODE ###

import sys
sys.setrecursionlimit(5000000)

s = input()
if len(s) == 1:
    print("1")
    exit()
cont_list = []
ini_di = s[0]
count = 1
for i in range(1, len(s)):
    if s[i] == s[i-1]:
        count += 1
        if i == len(s) - 1:
            cont_list.append(count)
    else:
        cont_list.append(count)
        count = 1
        if i == len(s) - 1:
            cont_list.append(count)


def counting(i):
    a = max(cont_list[i], cont_list[i + 1])
    b = min(cont_list[i], cont_list[i + 1])
    return (1 + a) * a / 2 + b * (b - 1) / 2


if ini_di == "<":
    count2 = 0
    if len(cont_list) % 2 == 0:
        for i in range(0, len(cont_list), 2):
            count2 += int(counting(i))
    else:
        for i in range(0, len(cont_list)-1, 2):
            count2 += int(counting(i))
        las = cont_list[len(cont_list)-1]
        count2 += int((1+las)*las/2)
    print(count2)
else:
    count2 = 0
    if len(cont_list) % 2 == 1:
        ini = cont_list[0]
        count2 += int((1+ini)*ini/2)
        for i in range(1, len(cont_list), 2):
            count2 += int(counting(i))
    else:
        ini = cont_list[0]
        count2 += int((1 + ini) * ini / 2)
        las = cont_list[len(cont_list) - 1]
        count2 += int((1 + las) * las / 2)
        for i in range(1, len(cont_list)-1, 2):
            count2 += int(counting(i))
    print(count2)
N = int(input())
A = list(map(int, input().split()))
def gcd(X):
    tmp = X
    X.sort()
    m = min(X)
    for i in range(len(X)):
        if X[i] != m:
            X[i] = X[i]%m
    if X == tmp:
        return m
    else:
        while 0 in X:
            X.remove(0)
        return gcd(X)

ans = 1
tmp = A
for i in range(len(A)-1):
    A.pop(i)
    if gcd(A) > ans:
        ans = gcd(A)
    A = tmp
print(ans)
    

### FIXED CODE ###

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

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

L_gcd = [0]*(N+1)
R_gcd = [0]*(N+1)

for i in range(N):
    L_gcd[i+1] = gcd(L_gcd[i],A[i])
    R_gcd[N-i-1] = gcd(R_gcd[N-i],A[N-i-1])

ans = 0
for i in range(N):
    if gcd(L_gcd[i],R_gcd[i+1])>ans:
        ans = gcd(L_gcd[i],R_gcd[i+1])
    
print(ans)
n,x,m = map(int,input().split())
mod = m
ans = 0
bit = [-1 for i in range(m)]
cycle = False
for i in range(n):
    if i == 0 :
        a = x
        bit[a] = i
        ans += a
    else:
        a = (a**2)% mod
        if bit[a] != -1:
            cy_st = bit[a]
            cy_fi = i -1
            cycle = True
            break
        else:
            bit[a] = i
            ans += a

if cycle:
    ans2 = x
    a = x
    for j in range(1,cy_st):
        a = (a**2)% mod
        ans2 += a
    cy_num = ans - ans2
    cy_repe = (n-cy_st) // (cy_fi - cy_st + 1)
    ans3 = cy_num * cy_repe
    cy_amari = (n-cy_st) % (cy_fi - cy_st + 1)
    for i in range(cy_amari):
        a = (a**2)% mod
        ans3 += a

print(ans2+ans3)


### FIXED CODE ###

n,x,m = map(int,input().split())
mod = m
ans = 0
bit = [-1 for i in range(m)]
cycle = False
for i in range(n):
    if i == 0 :
        a = x
        bit[a] = i
        ans += a
    else:
        a = (a**2)% mod
        if bit[a] != -1:
            cy_st = bit[a]
            cy_fi = i -1
            cycle = True
            break
        else:
            bit[a] = i
            ans += a

if cycle:
    ans2 = 0
    b =  -1
    for j in range(cy_st):
        if j == 0 :
            b = x
            ans2 += b
        else:
            b = (b**2)% mod
            ans2 += b
    cy_num = ans - ans2
    cy_repe = (n-cy_st) // (cy_fi - cy_st + 1)
    ans3 = cy_num * cy_repe
    cy_amari = (n-cy_st) % (cy_fi - cy_st + 1)
    
    if b == -1:
        for j in range(cy_amari):
            if j == 0 :
                b = x
                ans3 += b
            else:
                b = (b**2)% mod
                ans3 += b
        
    else:
        for i in range(cy_amari):
            b = (b**2)% mod
            ans3 += b

    print(ans2+ans3)
else:
    print(ans)
a,b=[int(x) for x in input().split()]

c=1
ans=0:
while True:
  if c>=b:
    break
  else:
    c+=a
    ans+=1

### FIXED CODE ###

a,b=[int(x) for x in input().split()]
 
c=1
ans=0
while True:
  if c>=b:
    break
  else:
    c+=a-1
    ans+=1
print(ans)