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

ans = x % m
dic = dict()
dicNum = dict()
dicSum = dict()

for i in range(2,n+1):
    b = x
    x = x**2 % m
    if x in dicNum.keys():
        t = i - dicNum[x]
        zan = n - i + 1
        k = zan // t
        ans += (dicSum[i-1] - dicSum[dicNum[x]-1]) * k
        zan = zan % t
        ans += dicSum[dicNum[x] - 1 + zan] - dicSum[dicNum[x]-1]
        break
    else:
        ans += x
        dicSum[i] = ans
        dic[x] = ans
        dicNum[x] = i

print(ans)

### FIXED CODE ###

n,x,m = list(map(int,input().split()))

if x == 0:
    ans = 0
else:
    ans = x % m
dicNum = dict()
dicSum = dict()
dicNum[x] = 1
dicSum[1] = x
dicSum[0] = 0

for i in range(2,n+1):
    b = x
    x = x**2 % m
    if x in dicNum.keys():
        t = i - dicNum[x]
        zan = n - i + 1
        k = zan // t
        ans += (dicSum[i-1] - dicSum[dicNum[x]-1]) * k
        if zan% t != 0:
            zan = zan % t
            ans += dicSum[dicNum[x] - 1 + zan] - dicSum[dicNum[x]-1]
        break
    else:
        ans += x
        dicSum[i] = ans
        dicNum[x] = i

print(ans)
def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y)

N = int(input())
A = list(map(int, input().split()))
#N = 7
#A = [994, 518, 941, 851, 647, 2, 581]
t = A[0]
for i in range(1,N):
	if (t % A[i] == 0):
		continue
	t = t * A[i] / gcd(t, A[i])
sum = 0
t -= 1
for i in range(N):
	sum += t % A[i]
print(int(sum))


### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
print(sum(A)-N)
x,n=map(int,input().split())
a=list(map(int,input().split()))

dtmp = 100
for i in range(n):
  d=abs(x-a[i])
  if d<dtmp:
    dtmp=d
    ans=x
  elif d==dtmp:
    ans=x
print(ans)

### FIXED CODE ###

x,n=map(int,input().split())
if n==0:
  print(x)
else:
  a=list(map(int,input().split()))
  flag=0
  i=0
  while flag==0:
    continueflag=0
    for j in range(n):
      if a[j]==x-i:
        continueflag=1
        break
    if continueflag==0:
      print(x-i)
      break
      
    continueflag=0
    for j in range(n):
      if a[j]==x+i:
        continueflag=1
        break
    if continueflag==0:
      print(x+i)
      break
    i=i+1
def university(xxx, pattern):
    tate = 0
    yoko = 1
    for current_tate in range(8-xxx[tate]+1):
        for current_yoko in range(8-xxx[yoko]+1):
            if absolutely_fantastic(current_tate, current_yoko):
                return True

def absolutely_fantastic(current_tate, current_yoko):
    tate = 0
    yoko = 1
    run = []
    for add_tate in range(xxx[tate]):
        for add_yoko in range(xxx[yoko]):
            run.append(mapppp[current_tate+add_tate][current_yoko+add_yoko])
    if run == pattern:
        print xxx[2]
        return True

A = {(2,2,'A'):[1,1,1,1]}
B = {(4,1,'B'):[1,1,1,1]}
C = {(1,4,'C'):[1,1,1,1]}
D = {(3,2,'D'):[0,1,1,1,1,0]}
E = {(2,3,'E'):[1,1,0,0,1,1]}
F = {(3,2,'F'):[1,0,1,1,0,1]}
G = {(2,3,'G'):[0,1,1,1,1,0]}
lis = [A,B,C,D,E,F,G]
mapppp = []
while True:
    for i in range(8):
        input_line = raw_input()
        yoko = [int(char) for char in input_line]
        mapppp.append(yoko)
    for XXX in lis:
        flag = False
        for xxx, pattern in XXX.items():
            if university(xxx, pattern):
                flag = True
                break
        if flag == True:
            break
    raw_input()

### FIXED CODE ###

# -*- coding: utf-8 -*-
figures = {
    'A': [['1', '1'], ['1', '1']],
    'B': [['1'], ['1'], ['1'], ['1']],
    'C': [['1', '1', '1', '1']],
    'D': [['0', '1'], ['1', '1'], ['1', '0']],
    'E': [['1', '1', '0'], ['0', '1', '1']],
    'F': [['1', '0'], ['1', '1'], ['0', '1']],
    'G': [['0', '1', '1'], ['1', '1', '0']],
}


def f1(lines):
    for n, figure in figures.items():
        found = f2(lines, figure)
        if found:
            print(n)
            break


def f2(lines, figure):
    height = len(figure)
    width = len(figure[0])
    for h in range(8 - height + 1):
        for w in range(8 - width + 1):
            found = f3(lines, figure, height, width, h, w)
            if found:
                return True


def f3(lines, figure, height, width, h, w):
    _figure = [[lines[h+_h][w+_w] for _w in range(width)]
               for _h in range(height)]
    if figure == _figure:
        return True


try:
    while True:
        f1([list(input()) for _ in range(8)])
        input()
except EOFError:
    pass
while 1:
    n = int(input())
    if n == 0:
        break
    lst = []
    for i in range(n+1,n*2+1,1):
        sum = 0
        for j in range(2,i/2+1):
            if i%j == 0:
                sum += 1
        if sum == 0:
            lst.append(i)
    print len(lst)

### FIXED CODE ###

import math
while 1:
	n = int(input())
	if n == 0:
		break
	count = 0
	if n == 1:
		count = 1
		x = n + 2
	elif n % 2 == 1:
		x = n + 2
	elif n == 2:
		count = 1
		x = n + 1
	else:
		x = n + 1
	for i in range(x,n*2+1,2):
		y = math.trunc(math.sqrt(i))+3
		if y % 2 == 1:
			z = y-2
		else:
			z = y-1
		for j in range(3,y,2):
			if i % j == 0:
				break
			if j == z:
				count += 1
	print count
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
if k<=n:
  for i in range(k):
    a[i]=0
  print(sum(h))
else:
  print(0)

### FIXED CODE ###

n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
if k<=n:
  for i in range(k):
    h[i]=0
  print(sum(h))
else:
  print(0)
n = int(input())
cnt  = [0 for i in range(10001)]

for x in range(1,105):
    for y in range(1, 105):
        for z in range(1, 105):
                ans = x**2 + y**2 + z**2 + x*y + y*z + z*x 
                if ans <= 10000:    
                    cnt[ans] +=1
for i in range(1, N+1):  
    print(cnt[i])

### FIXED CODE ###

L,R,d = map(int,input().split())

cnt=0
for i in range(L,R+1):
    if i%d==0:
        cnt+=1
print(cnt)
a,b,c,k=map(int,input().split())
 
if a>=k:
  print(a)
  exit()
else:
  if k-a=<b:
    print(a)
    exit()
  else:
    c=k-a-b
    print(a-c)

### FIXED CODE ###

a,b,c,k=map(int,input().split())
 
if a>=k:
  print(k)
  exit()
else:
  if k-a<=b:
    print(a)
    exit()
  else:
    c=k-a-b
    print(a-c)
a=list(input())

IN=[int(x) for x in a if x != " "]
N=IN[0]
A=IN[1]
B=IN[2]

Times = N // (A + B)
rest = N - Times * (A + B)

if rest < A:
        ans = A * Times + rest
else:
        ans = A * Times + A

print(ans)

### FIXED CODE ###

S=list(input())

if S[0] == S[1]:
        if S[1] == S[2]:
                print("No")
        else:
                print("Yes")
else:
        print("Yes")
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def combinations_mod(n, r, mod=1000000007):
    """Returns nCr in mod."""
    r = min(r, n - r)
    combs = 1
    for i, j in zip(range(n - r + 1, n + 1), range(1, r + 1)):
        combs *= (i % mod) * pow(j, mod - 2, mod)
        combs %= mod
    return combs


def main():
    n, a, b = NMI()
    all = pow_mod(2, n, MOD) - 1
    ans = all - combinations_mod(n, a) - combinations_mod(n, b)
    ans %= MOD
    print(ans)



if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def combinations_mod(n, r, mod=1000000007):
    """Returns nCr in mod."""
    r = min(r, n - r)
    combs = 1
    for i, j in zip(range(n - r + 1, n + 1), range(1, r + 1)):
        combs *= (i % mod) * pow(j, mod - 2, mod)
        combs %= mod
    return combs


def main():
    n, a, b = NMI()
    all = pow(2, n, MOD) - 1
    ans = all - combinations_mod(n, a) - combinations_mod(n, b)
    ans %= MOD
    print(ans)



if __name__ == "__main__":
    main()
N = input()
if N[0] == N[1] == N[2] or N[1] == N[2] == N[3]:
    print("Yes")
else:
    print("No)

### FIXED CODE ###

N = input()
if N[0] == N[1] == N[2] or N[1] == N[2] == N[3]:
  print("Yes")
else:
  print("No")
r=int(input(""))
g=int(input(""))
b=int(input(""))
d=r*100+g*10+b
if d%4==0:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

r, g, b = map(str, input().split())
ans = r + g + b
# print(ans)
ans_i = int(ans)
 
if ans_i % 4 == 0:
    print('YES')
else:
    print('NO')
def main():
    s = input()
    N = len(s)

    nox = []
    idxs = []
    ans = 0
    for i, c in enumerate(s):
        if c != "x":
            nox.append(c)
            idxs.append(i)
    
    if nox != nox[::-1]:
        print(-1)
        exit()
    

    if len(nox)%2 == 0:
        left = len(nox)//2 - 1
        right = len(nox)//2
        
        left_idx = idxs[left]
        right_idx = idxs[right]
        
    else:
        center = len(nox)//2
        left_idx = idxs[center]
        right_idx = idxs[center]

    old_left = -1
    old_right = -1
    while not (old_left == left_idx and old_right == right_idx):
        old_left = left_idx
        old_right = right_idx

        if s[left_idx] == s[right_idx]:
            if left_idx > 0:
                left_idx -= 1
            if right_idx < N-1:
                right_idx += 1
        elif s[left_idx] == "x":
            ans += 1
            if left_idx > 0:
                left_idx -= 1
        elif s[right_idx] == "x":
            ans += 1
            if right_idx < N-1:
                right_idx += 1

    print(ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    s = input()
    N = len(s)

    nox = []
    idxs = []
    ans = 0
    for i, c in enumerate(s):
        if c != "x":
            nox.append(c)
            idxs.append(i)
    
    if nox != nox[::-1]:
        print(-1)
        exit()
    
    if len(nox) == 0:
        print(0)
        exit()

    if len(nox)%2 == 0:
        left = len(nox)//2 - 1
        right = len(nox)//2
        
        left_idx = idxs[left]
        right_idx = idxs[right]

    else:
        center = len(nox)//2
        left_idx = idxs[center]
        right_idx = idxs[center]

    while not(left_idx == 0 and right_idx == N-1):
        if s[left_idx] == s[right_idx]:
            if left_idx > 0 and right_idx < N - 1:
                left_idx -= 1
                right_idx += 1
            else:
                if left_idx <= idxs[0] and right_idx >= idxs[-1] and (left_idx > 0 or right_idx < N - 1):
                    ans += 1
                if left_idx > 0:
                    left_idx -= 1
                if right_idx < N-1:
                    right_idx += 1

        elif s[left_idx] == "x":
            ans += 1
            if left_idx > 0:
                left_idx -= 1
        elif s[right_idx] == "x":
            ans += 1
            if right_idx < N-1:
                right_idx += 1
    print(ans)

if __name__ == "__main__":
    main()
x,y=input().split()
if x>Y:print(">"):
elif x<Y:print("<")
else:print("=")

### FIXED CODE ###

x,y=input().split()
if x>y:print(">")
elif x<y:print("<")
else:print("=")
import sys
 
for line in sys.stdin:
    h, a = list(map(lambda x: int(x), line.split()))
    hits = h // a
    if a % h and a > 0:
      return hits
    return hits + 1


### FIXED CODE ###

import sys
 
for line in sys.stdin:
    h, a = list(map(lambda x: int(x), line.split()))
    hits = h // a
    if h % a == 0 and a > 0:
        print(hits)
    else:
    	print(hits + 1)
N = int(input()) 

list = []
for i in range(N) :
    a = input()
    list.append(a)

print(int(list[N-1])-int(list[0]))


### FIXED CODE ###

input()
a = sorted(map(int, input().split()))
print(a[-1]-a[0])
from sys import stdin
import math
import itertools


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]

from bisect import bisect_left
def find_lt(a, x):
    'Find rightmost value less than x'
    i = bisect_left(a, x)
    if i:
        return i
    else:
        return 0

def solve(input_string):
    N, M = makeMultiInteger(input_string[0])
    A = makeMultiInteger(input_string[1])
    _S = makeIntMatrix(input_string[2:])
    cards = sorted(A)
    S = sorted(_S, key=lambda x: x[1], reverse=True)

    i = 1
    if i < len(S):
        while(True):
            b = S[i][0]
            c = S[i][1]
            if S[i-1][1] == c:
                S[i-1][0] += b
                del S[i]
                i -= 1
            i += 1
            if i >= len(S):
                break

    for s in S:
        b = s[0]
        c = s[1]
        if c > cards[0]:
            for i in range(b):
                if c > cards[i]:
                    cards[i] = c
                else:
                    break
            part_cards = cards[b:]
            s_l = find_lt(part_cards, cards[0])
            if s_l != 0:
                cards = part_cards[:s_l] + cards[0:b] + part_cards[s_l:]
        else:
            break
    return sum(cards)

def main():
    input_lines = stdin.readlines()
    answer = solve(input_lines)
    print(answer)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# from sys import exit
N, M = [int(n) for n in input().split()]
# N = int(input())
a = [(int(n), 1) for n in input().split()]
B = [0 for _ in range(M)]
C = [0 for _ in range(M)]
for i in range(M):
    B[i], C[i] = [int(n) for n in input().split()]
    a.append((C[i], B[i]))

a = sorted(a, key=lambda x: -x[0])
i = 0
ans = 0
# print(a)
while(N != 0):
    num = min(N, a[i][1])
    ans += num*a[i][0]
    # print(num*a[i][0])
    N -= num
    i += 1

print(ans)
X = int(input())

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

flag = False
for x in range(A, B+1):
  if x % K == 0:
    flag = True
    
if flag:
  print("OK")
else: 
  print("NG")

### FIXED CODE ###

K = int(input())

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

flag = False
for x in range(A, B+1):
  if x % K == 0:
    flag = True


if flag:
  print("OK")
else: 
  print("NG")
from operator import mul
from functools import reduce

MOD = 10 ** 9 + 7

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

a, b = (2 * X - Y) // 3, (2 * Y - X) // 3
# maxf = 2 * 10 ** 6 + 100
maxf = a + b + 10

if 2 * a + b != X or a + 2 * b != Y:
    print(0)
    exit()

f, invf = [1] * maxf, [1] * maxf

for i in range(1, maxf):
    f[i] = (f[i - 1] * i) % MOD
invf[maxf - 1] = pow(f[maxf - 1], MOD - 2, MOD)
for i in range(maxf - 1, 0, -1):
    invf[i - 1] = (invf[i] * i) % MOD

comb = lambda a, b: f[a + b] * invf[a] * invf[b] % MOD

print(comb(a, b) % MOD)


### FIXED CODE ###

MOD = 10 ** 9 + 7

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

a, b = (2 * X - Y) // 3, (2 * Y - X) // 3
maxf = a + b + 10

if (not ((2 * X - Y) % 3 == 0 and (2 * Y - X) % 3 == 0)) or (a < 0 or b < 0):
    print(0)
    exit()

f, invf = [1] * maxf, [1] * maxf

for i in range(1, maxf):
    f[i] = (f[i - 1] * i) % MOD
invf[maxf - 1] = pow(f[maxf - 1], MOD - 2, MOD)
for i in range(maxf - 1, 0, -1):
    invf[i - 1] = (invf[i] * i) % MOD

comb = lambda a, b: f[a + b] * invf[a] * invf[b] % MOD

print(comb(a, b) % MOD)
N = int(input())

a = list(range(1, N+1))

if N ==1:
    sc = 0
else:
    sc = int((N**2-N)/2)
print(sc)


### FIXED CODE ###

N = int(input())

a = list(range(1, N+1))

if N ==1:
    sc = 0
else:
    sc = int((N**2-N)/2)
print(sc)
n=int(input())
xyh = [list(map(int,input().split())) for i in range(n)]

ansh=-1
ans=[]
flag=True
for cx in range(0,101):
  if len(ans)>0:
    break
  for cy in range(0,101):
    if len(ans)>0:
      break
    ansh = -1
    for pira in xyh:
      
      if flag and pira[2] == 0 and ansh==-1 and pira[2]+abs(cx-pira[0])+abs(cy-pira[1])<=0:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
      
      elif flag and pira[2] > 0 and ansh == -1:
        ansh = pira[2]+abs(cx-pira[0])+abs(cy-pira[1])
        ans.append([cx,cy,ansh])
        flag=False
        
      elif len(ans)>0 and pira[2] > 0 and ansh !=pira[2]+abs(cx-pira[0])+abs(cy-pira[1]):
        ans=[]
        break
        
      elif len(ans)>0 and pira[2]==0 and ansh-abs(cx-pira[0])-abs(cy-pira[1])>0:
        ans=[]
        break
print(*ans[0])


### FIXED CODE ###

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

ansh=-1
ans=[[]]
flag=True
for cx in range(0,101):
  if flag==False:
    break
    
  for cy in range(0,101):
    ansh = 0
    for pira in xyh:
      if ansh==0:
        ansh=pira[2]+(abs(cx-pira[0])+abs(cy-pira[1]))
        ans[0]=[cx,cy,ansh]
        
      elif len(ans[0])>0 and max(ansh -(abs(cx-pira[0])+abs(cy-pira[1])), 0) != pira[2]:
        ans[0]=[]
    if len(ans[0])>0:
      flag=False
      break
print(*ans[0])
a,b,c,d=[int(i) for i in input().split()]
M=[4*a,2*b,c,d/2]
N=int(input())

if M[0]==min(M):
    print(N*M[0])
elif M[1]==min(M):
    print(N*M[1])
elif M[2]==min(M):
    print(N*M[2])
else:
    if N%2==0:
        print(int(N//2*int(M[3]*2))
    else:
        if M[0]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[0])
        elif M[1]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[1])
        elif M[2]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[2])


### FIXED CODE ###

a,b,c,d=[int(i) for i in input().split()]
M=[4*a,2*b,c,d/2]
N=int(input())

if M[0]==min(M):
    print(N*M[0])
elif M[1]==min(M):
    print(N*M[1])
elif M[2]==min(M):
    print(N*M[2])
else:
    if N%2==0:
        print(int(N//2*int(M[3]*2)))
    else:
        if M[0]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[0])
        elif M[1]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[1])
        elif M[2]==min([4*a,2*b,c]):
            print(N//2*int(M[3]*2)+M[2])
N = int(input())
S = input()
s = [S[i: i + 1] for i in range(N)]
ans = 0
bflag = 0
for i, st in enumerate(s):
    if bflag == 1:
        if st == '.':
            ans += 1
        else:
            bflag = 0
    else:
        if st == '#':
            bflag = 1
wflag = 0
ans2 = 0
for i in range(1, N + 1):
    if wflag == 1:
        if s[-i] == '#':
            ans2 += 1
        else:
            wflag == 0:
    else:
        if s[-i] == '.':
            wflag == 1
print(min(ans, ans2))


### FIXED CODE ###

N = int(input())
S = input()
s = [S[i: i + 1] for i in range(N)]
bcount = 0
wcount = 0
for word in s:
    if word == '.':
        wcount += 1
ans = wcount
preans = ans
for word in s:
    if word == '#':
        preans += 1
    else:
        preans -= 1
    ans = min(ans, preans)
print(ans)
n = int(input())
a = []
for i in range(n):
  a.append(int(input()%2))
k = sum(a)

if(k%2)or n==2:
  print("first")
else:
  print("second")


### FIXED CODE ###

n = int(input())
f=True
for i in range(n):
  s = int(input())
  if s%2==1:
    f = False 
if not f:
  print("first")
else:
  print("second")
def main():
    import sys
    input = sys.stdin.readline

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

    from scipy.sparse import csgraph, csr_matrix

    start = [i for i in range(N-1)] + [i for i in range(N-2)]
    end = [i+1 for i in range(N-1)] + [i+2 for i in range(N-2)]
    cost = [abs(h1-h2) for h1, h2 in zip(H[0:-1], H[1:])] + \
        [abs(h1-h2) for h1, h2 in zip(H[0:-2], H[2:])]
    csr = csr_matrix((cost, (start, end)), shape=(N, N))
    d = csgraph.shortest_path(csr, indices=0)

    print(int(d[N-1]))


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline

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

    inf = float("inf")
    dp = [inf]*N

    dp[0] = 0
    step1, step2 = inf, inf

    for i in range(1, N):
        step1 = abs(H[i-1]-H[i]) + dp[i-1]
        if i >= 2:
            step2 = abs(H[i-2]-H[i]) + dp[i-2]
        step = min(step1, step2)

        dp[i] = min(dp[i], step)
    print(dp[-1])


if __name__ == "__main__":
    main()
from math import floor
a, b = [i for i in input().split()]
p = int(b[0] + b[2] + b[3])
print(a * p // 100)


### FIXED CODE ###

from math import floor
a, b = [i for i in input().split()]
p = int(b[0] + b[2] + b[3])
print(int(a) * p // 100)
import math
R=int(input())
l=2*(math.pi)*R

print(l)1   

### FIXED CODE ###

import math
R=int(input())
l=2*(math.pi)*R

print(l)
import sys
input = sys.stdin.readline

def main():
    x = int(input())
    for i in range(-1000, 1000):
        for j in range(-1000, 1000):
            if x == i**5 - j**5:
                print(i, j)
                break
        else:
            continue
        break

if __name__ == '__main__':
    main()

### FIXED CODE ###

a = input()
if a == 'ABC':
    print('ARC')
else:
    print('ABC')
# -*- coding:utf-8 -*-
import math
N = int(input())
a = list(set([max(int(math.log10(N//B))+1,int(math.log10(B))+1) for B in range(1,int(math.sqrt(N+1))) if N%B == 0 ]))
a.sort()
print(min(a))

### FIXED CODE ###

# -*- coding:utf-8 -*-
import math
N = int(input())
print(min(sorted(list(set([max(int(math.log10(N//B))+1,int(math.log10(B))+1) for B in range(1,int(math.sqrt(N+1))+1) if N%B == 0])))))
n=int(input())
s=input()
if n%2!=0:
  print("No")
else:
  if s[:int(n/2)]==s[int(n/2):]:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

a=int(input())
print(a*a)
a = int(input())
b = int(input())
c = int(input())
if a == b and b== c:
 print("1")
elif a == b or b ==c or a == c:
 print("2")
else:
 print("3")

### FIXED CODE ###

j = input().split()
a = int(j[2])
b = int(j[1])
c = int(j[0])
if a == b and b== c:
 print("1")
elif a == b:
 print("2")
elif b == c:
 print("2")
elif a==c:
 print("2")
else:
 print("3")
X, A = map(int, input().split)

if X < A:
    print('{}'.format('0'))
else:
    print('{}'.format('10'))

### FIXED CODE ###

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

if X < A:
    print('{}'.format('0'))
else:
    print('{}'.format('10'))
c=input()
if c=='a' or c=='i' or c=='u' or c=='e' or c=='o':
  print(vowel)
else:
  print(consonant)

### FIXED CODE ###

c=input()
if c=='a' or c=='i' or c=='u' or c=='e' or c=='o':
  print('vowel')
else:
  print('consonant')