Harryxun/stf_run huggingface dataset:
def find(tab, a):
    if tab[0][a]==-1:
        return a
    tab[0][a] = find(tab, tab[0][a])
    return tab[0][a]

def union(tab, a, b):
    p1, p2 = (find(tab, a), find(tab, b))
    if p1 != p2:
        tab[0][p1] = p2
        tab[1][p2] += tab[1][p1]

def size(tab, a):
    return tab[1][a]

N, M = [int(a) for a in input().split(" ")]
ABs = [[int(a) for a in input().split(" ")] for i in range(M)]
tab = [[-1 for i in range(N)], [1 for i in range(N)]]
arr = []

for a, b in reversed(ABs):
    a, b = (a-1, b-1)
    pa, pb = (find(tab, a), find(tab, b))
    na, nb = (size(tab, pa), size(tab, pb))
    if pa!=pb:
        dn = ((na+nb)*(na+nb-1)//2)-(na*(na-1)//2)-(nb*(nb-1)//2)
        arr.append(dn)
        union(tab, a, b)
    else:
        arr.append(0)

acc = 0
for cp in reversed(arr):
    acc += cp
    print(acc)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

def find(tab, a):
    if tab[0][a]==a:
        return a
    tab[0][a] = find(tab, tab[0][a])
    return tab[0][a]

def union(tab, a, b):
    p1, p2 = (find(tab, a), find(tab, b))
    if p1 != p2:
        tab[0][p1] = p2
        tab[1][p2] += tab[1][p1]

def size(tab, a):
    return tab[1][a]

N, M = [int(a) for a in input().split(" ")]
ABs = [[int(a) for a in input().split(" ")] for i in range(M)]
tab = [[i for i in range(N)], [1 for i in range(N)]]
arr = []

for a, b in reversed(ABs):
        a, b = (a-1, b-1)
        pa, pb = (find(tab, a), find(tab, b))
        na, nb = (size(tab, pa), size(tab, pb))
        if pa!=pb:
            dn = ((na+nb)*(na+nb-1)//2)-(na*(na-1)//2)-(nb*(nb-1)//2)
            arr.append(dn)
            union(tab, a, b)
        else:
            arr.append(0)

acc = 0
for cp in reversed(arr):
    acc += cp
    print(acc)
N,K = map(int, input().split())
x = list(map(int, input().split()))
ans = 10**8 * 2
for i in range(N-K):
    l = x[i]
    r = x[i+K-1]
    if l*r >= 0:
        time = max(abs(l), abs(r))
    else:
        time = min(abs(l)*2+abs(r), abs(l)+abs(r)*2)
    if time < ans:
        ans = time
print(time)

### FIXED CODE ###

N,K = map(int, input().split())
x = list(map(int, input().split()))
ans=min([min(abs(x[i])+abs(x[i]-x[i+K-1]),abs(x[i+K-1])+abs(x[i+K-1]-x[i])) for i in range(N-K+1)])
print(ans)
a,b,c=input().split()
print(a.upper[0]+b.upper[0]+c.upper[0])
     

### FIXED CODE ###

a,b,c=input().split()
print(a[0].upper()+b[0].upper()+c[0].upper())
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N > K:
  print(K*X + (N-K)*Y)
else :
  print(N*

### FIXED CODE ###

N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N > K:
  print(K*X + (N-K)*Y)
else :
  print(N*X)
a,b=map(int,input()split())
c=a*b
print(c)

### FIXED CODE ###

a,b=map(int,input().split())
c=a*b
print(c)
N, M = map(int, input().split())
lis = []
for _ in range(N):
  a, b = map(int, input().split)
  for l in range(b):
    lis.append(a)
lis.sort()
total = 0
for i in range(M):
  total = total + lis[i]
print(total)  

### FIXED CODE ###

N, M = map(int, input().split())
lis = []
for _ in range(N):
  a, b = map(int, input().split())
  lis.append((a, b))
def eval(data):
  return data[0]
lis.sort(key=eval)
total = 0
num = 0
mark = 0
for i in range(N):
  num = num + lis[i][1]
  total = total + lis[i][0]*lis[i][1]
  if num > M:
    mark = i
    total = total - lis[i][0]*lis[i][1]
    num = num - lis[i][1]
    break
total = total + (M - num)*lis[mark][0]
print(total)
import sys
mod = 10 ** 9 + 7

n,m = map(int,input().split())
if n in [0,1]:
    print(1)
    sys.exit()
    
if not m == 0: lis = [int(input()) for x in range(m)]
else: lis = []
val1 = 1
if 1 in lis: val2 = 0
else: val2 = 1

if lis[0] == 1 and len(lis) >= 2:
    flg = lis[1]
    nex = 1
else:
    flg = lis[0]
    nex = 0
#print(lis)
for x in range(2,n):
    if x == flg: #x in lis
        #print(flg)
        nex += 1
        try: flg = lis[nex]
        except:flg = 0
        now = 0
    else:
        now = (val1 + val2) % mod
    val1,val2 = val2,now
    
print((val1 + val2) % mod)

### FIXED CODE ###

import sys
mod = 10 ** 9 + 7

n,m = map(int,input().split())
if n in [0,1]:
    print(1)
    sys.exit()
    
if not m == 0: lis = [int(input()) for x in range(m)]
else: lis = [-1]
val1 = 1
if 1 in lis: val2 = 0
else: val2 = 1

if lis[0] == 1 and len(lis) >= 2:
    flg = lis[1]
    nex = 1
else:
    flg = lis[0]
    nex = 0
#print(lis)
for x in range(2,n):
    if x == flg: #x in lis
        #print(flg)
        nex += 1
        try: flg = lis[nex]
        except:flg = 0
        now = 0
    else:
        now = (val1 + val2) % mod
    val1,val2 = val2,now
    
print((val1 + val2) % mod)
n = int(input())
a = [int(e) for e in input().split()]
b = []
for i in range(0,n):
    b[a[i]] = i + 1
for j in range(0,n):
    print(b[j], end = " ")

### FIXED CODE ###

n = int(input())
a = [int(e) for e in input().split()]
b = [0] * n
for i in range(0,n):
    b[a[i] - 1] = i + 1
for j in range(0,n):
    print(b[j], end = " ")
N, A, B = map(int, input().split())
if (A-B) % 2 == 0:
    print("Alice)
else:
    print("Borys")

### FIXED CODE ###

N, A, B = map(int, input().split())
if (A-B) % 2 == 0:
    print("Alice")
else:
    print("Borys")
N = int(input())
S = str(input())
S = list(S)

if N%2 != 0:
    print('No')
    exit()

S1, S2 = [], []
for i, s enumerate(S):
    if i < (N/2):
        s1.append(s)
    else:
        s2.append(s)

s1, s2 = ' ', ' '
for s in S1:
    s1 += s

for s in S2:
    s2 += s

if s1 ==s2:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

N = int(input())
S = str(input())
S = list(S)

if N%2 != 0:
    print('No')
    exit()

S1, S2 = [], []
for i, s in enumerate(S):
    if i < (N/2):
        S1.append(s)
    else:
        S2.append(s)

s1 = ' '
for s in S1:
    s1 += s

s2 = ' '
for s in S2:
    s2 += s

if s1 == s2:
    print('Yes')
else:
    print('No')
import collections
N=int(input())
siritori=collections.defaultdict(int)
prev=""
for i in range(N):
  word = input()
  if word in siritori:
    print("No")
  elif prev[-1]==word[0]:
    print("No")
  siritori[word]+=1
  prev=word
print("Yes")

### FIXED CODE ###

import collections
N=int(input())
siritori=collections.defaultdict(int)
prev=" "
for i in range(N):
  word = input()
  if word in siritori:
    print("No")
    exit(0)
  elif prev[-1]!=word[0] and i != 0:
    print("No")
    exit(0)
  siritori[word]+=1
  prev=word
print("Yes")
from math import sqrt
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
C = set(A)
B = dict(Counter(A))

n = 10**6
prime = {i for i in range(2, n)}
for i in range(2, n):
    if i in prime:
        for j in range(i*2, n, i):
            if j in prime:
                prime.remove(j)
ans = 0
for i in range(N):
    if B[A[i]] > 1:
        pass
    else:
        if A[i] in prime: 
            ans+=1 
            continue
        flag = True
        for j in range(1, A[i]+1):
            if A[i] % j == 0:
                if A[i]//j in C:
                    if A[i]//j < A[i]:
                        flag = False
                        break
                if j in C:
                    if j < A[i]:
                        flag = False
                        break
            if j**2 > A[i]:
                flag = False
        ans += flag(int)
print(ans)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
visited=[False for i in range(10**6+1)]
ban=[False for i in range(10**6+1)]
from collections import Counter
A.sort()
D=dict(Counter(A))
for n in A:
    if visited[n]==False:
        visited[n]=True
        for j in range(2,10**6):
            if 10**6<n*j:
                break 
            ban[n*j]=True
ans=0
for n in A:
    if D[n]==1 and ban[n]==False:
        ans+=1
print(ans)
N = int(input())
S = input()
X = int(S, 2)

r = S.count("1") + 1
l = r if r == 1 else r - 2

lcnt = [0] * (l + 1)
rcnt = [0] * (r + 1)
for i in range(1, l + 1):
    lcnt[i] = lcnt[i % bin(i).count("1")] + 1

for i in range(1, r + 1):
    rcnt[i] = rcnt[i % bin(i).count("1")] + 1

for i in range(N):
    NX = 0
    if S[i] == "0":
        NX = X + (2 ** (N - i - 1))
        print(rcnt[NX % r] + 1)
    else:
        NX = X - (2 ** (N - i - 1))
        print(lcnt[NX % l] + 1)



### FIXED CODE ###

N = int(input())
X = input()

n1 = X.count("1")
Xn = int(X, 2)

Xms = (Xn % (n1 - 1)) if n1 > 1 else 0
Xml = Xn % (n1 + 1)

p2s = [1]
p2l = [1]
s2 = 1
l2 = 1
for i in range(N - 1):
    s2 = (s2 * 2) % (n1 - 1) if n1 > 1 else 0
    l2 = (l2 * 2) % (n1 + 1)
    p2s.append(s2)
    p2l.append(l2)

for i in range(N):
    cnt = 0
    p2 = 2 ** (N - i - 1)
    Xim = 0

    if X[i] == "1" and n1 == 1:
        print(cnt)
        continue
    elif X[i] == "1":
        Xim = (
            Xms - p2s[-i - 1]
            if Xms - p2s[-i - 1] >= 0
            else ((n1 - 1) + (Xms - p2s[-i - 1]))
        )
    else:
        Xim = (
            Xml + p2l[-i - 1]
            if Xml + p2l[-i - 1] < (n1 + 1)
            else (Xml + p2l[-i - 1] - (n1 + 1))
        )

    cnt += 1
    while Xim > 0:
        Xim %= bin(Xim).count("1")
        cnt += 1
    print(cnt)
n, d = map(int, input())
ans = 0
for i in range(n):
  x, y = map(int, input())
  if x**2 + y**2 <= d**2:
    ans += 1
print(ans)

### FIXED CODE ###

n, d = map(int, input().split())
ans = 0
for i in range(n):
  x, y = map(int, input().split())
  if x**2 + y**2 <= d**2:
    ans += 1
print(ans)
import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    def df(c, d):
        res = c // d
        if res * d > c: res -= 1
        return res

    q = int(input())
    L = [list(map(int, input().split())) for _ in range(q)]
    for a, b in L:
        if (a, b) == (1, 1):
            print(0)
            continue
        c = a * b - 1
        rc = int(c ** 0.5)
        rc -= 1
        while (rc + 1) ** 2 < c:
            rc += 1
        ans = rc * 2
        if rc * (rc + 1) > c:
            ans -= 1
        ab = [a, b]
        for k in ab:
            ans -= 1
            if k > rc:
                y = df(c, k)
                if y == 0:
                    ans += 1
                else:
                    x = df(c, y)
                    if x != k or (df(c, k) == df(c, k - 1)):
                        ans += 1
        print(ans)

main()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    def df(c, d):
        res = c // d
        if res * d > c: res -= 1
        return res

    q = int(input())
    L = [list(map(int, input().split())) for _ in range(q)]
    for a, b in L:
        if (a, b) == (1, 1):
            print(0)
            continue
        c = a * b - 1
        rc = int(c ** 0.5)
        rc -= 1
        while (rc + 1) ** 2 <= c:
            rc += 1
        ans = rc * 2
        if rc * (rc + 1) > c:
            ans -= 1
        ab = [a, b]
        for k in ab:
            ans -= 1
            if k > rc:
                y = df(c, k)
                if y == 0:
                    ans += 1
                else:
                    x = df(c, y)
                    if x != k or (df(c, k) == df(c, k - 1)):
                        ans += 1
        print(ans)

main()
from math import sqrt

N=int(input())
for i in range(int(sqrt(N)),0,-1):
  if N%i==0:
    j=N//i
    pirnt(i+j-2)
    break


### FIXED CODE ###

from math import sqrt

N = int(input())
for i in range(int(sqrt(N)), 0, -1):
    if N % i == 0:
        j = N // i
        print(i + j - 2)
        break
n=int(input())
hoge=list(map(int,input().split()))
###
def huga(a,b):
  x=max(a,b)
  y=min(a,b)
  z=1
  for i in range(y):
    wa=y-i
    if(x%wa==0 and y%wa==0):
      z=wa
      break
  return z
###
hoge.sort(reverse=True)
ans=hoge[0]
for i in range(n-1):
  ans=huga(ans,hoge[i+1])
  
print(ans)

### FIXED CODE ###

a,b=map(int,input().split())

if(b%a==0):
  print(a+b)
else:
  print(b-a)
n = int(input())
st = map(int, input().split())
flag = True
count = 0
check(st, count)
def check(st,count):
    new_list = []
	for i in len(st):
      if i % 2 == 0:
        new_list.append(i)
      else:
        flag = True
        break
    if flag:
      print(count)
      return
    else:
      count += 1
      check(new_list, count)

### FIXED CODE ###

def check(st,count):
    flag = False
    new_list = []
    for i in st:
        if i % 2 == 0:
            i = i // 2
            new_list.append(i)
        else:
            flag = True
            break
    if flag:
        print(count)
        return
    else:
      count += 1
      check(new_list, count)

n = int(input())
st = list(map(int, input().split()))
count = 0
check(st, count)
import math

a, b = [int(x.strip()) for x in input().split()]
print((a * b) // math.gcd(a, b))


### FIXED CODE ###

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


def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n
def lcm(x, y):
    return (x * y) // gcd(x, y)

def sol(a, b):
    return (a * b) // gcd(a, b)


a, b = list(map(int, input().split()))
print(sol(a, b))
import math
from functools import reduce

n,x = map(int,input().split())
lst=list(map(int,input().split()))
new_lst=[abs(i-x) for i in lst]

def gcd(*numbers):
    return reduce(math.gcd, numbers)

print(gcd(*new_lst))

### FIXED CODE ###

import fractions
from functools import reduce

n,x = map(int,input().split())
lst=list(map(int,input().split()))
new_lst=[abs(i-x) for i in lst]

def gcd(*numbers):
  return reduce(fractions.gcd, numbers)
def gcd_list(numbers):
  return reduce(math.gcd, numbers)

print(gcd(*new_lst))
print('Odd' if int(input())%2 else 'Even')

### FIXED CODE ###

a,b=map(int, input().split())
print('Odd' if a*b%2 else 'Even')
N, Q = map(int, input().split())
S = list(input())
TD = [tuple(input().split()) for _ in range(Q)]

TEST = [0, 0, 0, 1, 1, 1, 0, 0]

def bs_l(f, s, e):
	if s==e:
		return s if(1==f(s)) else s+1

	c = (s+e)//2
	if f(c):
		#左
		return bs_l(f, s, c if c == s else c-1)
	else:
		#右
		return bs_l(f, c if c == e else c+1, e)

def bs_r(f, s, e):
	if s==e:
		return s if(1==f(s)) else s-1

	c = (s+e)//2
	if not f(c):
		#左
		return bs_r(f, s, c if c == s else c-1)
	else:
		#右
		return bs_r(f, c if c == e else c+1, e)

def isAlive_l(c):
	for t, d in TD:
		if S[c] == t:
			c += 1 if "R" == d else -1
			if c < 0:
				return False
	return True

def isAlive_r(c):
	for t, d in TD:
		if S[c] == t:
			c += 1 if "R" == d else -1
			if N <= c:
				return False
	return True

S, E = bs_l(isAlive_l, 0, N-1), bs_r(isAlive_r, 0, N-1)
print(E-S+1)


### FIXED CODE ###

N, Q = map(int, input().split())
S = list(input())
TD = [tuple(input().split()) for _ in range(Q)]

def bs_l(f, s, e):
	if s==e:
		return s if f(s) else s+1

	c = (s+e)//2
	if f(c):
		#左
		return bs_l(f, s, c if c == s else c-1)
	else:
		#右
		return bs_l(f, c if c == e else c+1, e)

def bs_r(f, s, e):
	if s==e:
		return s if f(s) else s-1

	c = (s+e)//2
	if not f(c):
		#左
		return bs_r(f, s, c if c == s else c-1)
	else:
		#右
		return bs_r(f, c if c == e else c+1, e)

def isAlive(c):
	for t, d in TD:
		if S[c] == t:
			c += 1 if "R" == d else -1
			if c < 0 or N <= c:
				return False
	return True

S, E = bs_l(isAlive, 0, N-1), bs_r(isAlive, 0, N-1)
print(max(E-S+1, 0))
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
s = {}
for i in range(n):
	S,P = map(str,input().split())
	s[i+1] = [S, -int(P)]

note = sorted(s.items(), key=lambda x: (x[1][0],x[1][1])
print(note)

### FIXED CODE ###

a,p = map(int,input().split())
print((3*a + p)//2)
n = int(input())
 
a = list(map(int,input().split()))
 
s = 1
t = 0
 
for i in range(n):
 if s == a[i]:
      s += 1
   else:
      t +=1
      
if t != n:
  print(t)
else:
  print(-1)

### FIXED CODE ###

n = int(input())
renga = list(map(int,input().split()))
 
next = 1
ans = 0
 
for i in range(n):
    if next == renga[i]:
        next += 1
    else:
        ans += 1
if ans == n:
    ans = -1
print(ans)
N = int(input())
S = [input() for _ in range(N)]

T = set(S)
U = list(T)
V = [S.count(U[i]) for i in range(len(T))]

for i in range(len(T)):
    if S.count(U[i]) != max(V):
        U[i] = ''

for i in range(len(T)):
    if U[i] != '':
        print(U[i])

### FIXED CODE ###

n = set(map(int, input().split()))
if len(n) == 2:
    print('Yes')
else:
    print('No')
class BIT:
  def __init__(self, n):
    self.N = n+1
    self.bit = [0]*self.N
  
  def bit_sum(self, i):
    s = 0
    i += 1
    while i>0:
      s += self.bit[i]
      i -= i & -i
    return s

  def bit_add(self, i, n):
    i += 1
    while i<=self.N:
      self.bit[i] += n
      i += i & -i

N, *A = map(int, open(0).read().split())
inf = [(a,i) for i, a in enumerate(A)]
n = A[0]
ls = [0]
for i in range(1,N):
  if A[i]>n:
    n = A[i]
    ls.append(i)
B = BIT(N)
inf.sort(reverse=True)
cnt = [0]*N
for a,i in inf:
  B.bit_add(i,1)
  cnt[i] = B.bit_sum(N-1)-B.bit_sum(i-1)

s = sum(A)
ans = [0]*N
for i in range(len(ls)-1,0,-1):
  a = ls[i]
  b = ls[i-1]
  m = A[a]-A[b]
  ans[a] = m*cnt[a]
  s -= m*cnt[a]
ans[0] = s
print('\n'.join(map(str,ans)))

### FIXED CODE ###

class BIT:
  def __init__(self, n):
    self.N = n+1
    self.bit = [0]*self.N
  
  def bit_sum(self, i):
    s = 0
    i += 1
    while i>0:
      s += self.bit[i]
      i -= i & -i
    return s

  def bit_add(self, i, n):
    i += 1
    while i<self.N:
      self.bit[i] += n
      i += i & -i

N, *A = map(int, open(0).read().split())
inf = [(a,i) for i, a in enumerate(A)]
n = A[0]
ls = [0]
for i in range(1,N):
  if A[i]>n:
    n = A[i]
    ls.append(i)
B = BIT(N)
C = BIT(N)
inf.sort(reverse=True)
cnt = [0]*N
ccnt = [0]*N
for a,i in inf:
  B.bit_add(i,a)
  cnt[i] = B.bit_sum(N-1)-B.bit_sum(i)
for a, i in inf:
  C.bit_add(i,1)
  ccnt[i] = C.bit_sum(N-1)-C.bit_sum(i)

ans = [0]*N
s = sum(A)
p = 0
x = 0
for i in range(len(ls)-1,0,-1):
  a = ls[i]
  b = ls[i-1]
  m = cnt[b]-A[b]*ccnt[b]
  n = m-x
  ans[a] = n
  s -= n
  x += ans[a]
ans[0] = s
print('\n'.join(map(str,ans)))
import sys
lw = sys.argv[1]
print(lw.startsWith("ABC") ? "ARC" : "ABC")


### FIXED CODE ###

tw ="ABC" if input().startswith("ARC") else "ARC"
print(tw)
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)[::-1]
memo = [0 for i in range(N)]
memo[0] = N-1
memo[1] = N-1
if N % 2 == 0:
    for i in range(2, N):
        memo[i] = memo[i-2]-2
        if memo[i] != A[i]:
            print(0)
            exit()
else:
    for i in range(2, N-1):
        memo[i] = memo[i-2]-2
        if memo[i] != A[i]:
            print(0)
            exit()


# 最初(N//2)**2にしていた、それぞれの場合の数ではなくなってしまう
print((2**(N // 2))%(10**9+7))

### FIXED CODE ###

a,p,b = input().split()
a = int(a)
b = int(b)
if p == '+':
  print(a+b)
else:
  print(a-b)
K =input()
A,B = map(int,input().split())	

cnt = 0
for i in range(A, B+1):
    if(i % K == 0):
        print("OK")
        cnt += 1
        break
if(cnt == 0):
    print("NG")

### FIXED CODE ###

K = int(input())
A,B = map(int,input().split())
cnt = 0
for i in range(A, B+1):
    if(i % K == 0):
        print("OK")
        cnt += 1
        break
if(cnt == 0):
    print("NG")
a = int(input())
    s = input()
    if(a>=3200):
      print(s)
    else:
      print("red")

### FIXED CODE ###

a = int(input())
s = input()
if(a>=3200):
	print(s)
else:
	print("red")
N,M,R=map(int, input().split())
r=map(lambda x:int(x)-1, input().split())
dp=[[10**9]*N for _ in range(N)]
for _ in range(M):
    A,B,C=map(int, input().split())
    A-=1
    B-=1
    dp[A][B]=C
    dp[B][A]=C
for z in range(N):
    for x in range(N):
        for y in range(N):
            dp[x][y]=min(dp[x][y], dp[x][z]+dp[z][y])

import itertools
ans=10**9
for p in itertools.permutations(range(R)):
    t=0
    rp=[r[i] for i in p]
    for i in range(R-1):
        t+=dp[rp[i]][rp[i+1]]
    ans=min(ans,t)
print(ans)

### FIXED CODE ###

N,M,R=map(int, input().split())
r=list(map(int, input().split()))
dp=[[10**9]*N for _ in range(N)]
for _ in range(M):
    A,B,C=map(int, input().split())
    A-=1
    B-=1
    dp[A][B]=C
    dp[B][A]=C
for z in range(N):
    for x in range(N):
        for y in range(N):
            dp[x][y]=min(dp[x][y], dp[x][z]+dp[z][y])

import itertools
ans=10**9
for p in itertools.permutations(range(R)):
    t=0
    rp=[r[i] for i in p]
    for i in range(R-1):
        t+=dp[rp[i]-1][rp[i+1]-1]
    ans=min(ans,t)
print(ans)
"""print yes or no"""
N = str(input("Enter something:"))
for str in N:
    if N[3] == N[4] and N[5] == N[6]:
        print("yes")
    else:
        print("No")

### FIXED CODE ###

s = input()
if s[2] == s[3] and s[4] == s[5]:
	print('Yes')
else:
	print('No')
ｎ

### FIXED CODE ###


N,A,B,C,D = map(int,input().split())
a= input()
f = 0
s = 0
d = 1
t = []
k = []

f1 = 0
s1 = 0
d1 = 1
t1 = []
k1 = []


for i in a[A-1:C]:
    if i == "." and f ==1:
        k.append(d)
        s = 1
        f = 0
    elif i == ".":s+=1
    
    elif i == "#" and f==0:
        t.append(s)
        d = 1
        f = 1
    elif i == "#":d+=1
else:
    if f==1:
        k.append(d)
    else:
        t.append(s)
for i in a[B-2:D]:
    if i == "." and f1 ==1:
        k1.append(d1)
        s1 = 1
        f1 = 0
    elif i == ".":s1+=1
    
    elif i == "#" and f1==0:
        t1.append(s1)
        d1 = 1
        f1 = 1
    elif i == "#":d1+=1
else:
    if f1==1:
        k1.append(d1)
    else:
        t1.append(s1)
# print(t,k)
# print(t1,k1)
if C < D :
    if len(k) == sum(k) and  len(k1) == sum(k1):
        print("Yes")
    else:
        print("No")
else:
    if len(k) == sum(k) and any([i > 2 for i in t1]) :
        print("Yes")
    elif len(k) == sum(k) and t1[-1] >1:
        print("Yes")
    else:
        print("No")
L,R=map(int,input().split())
# L <= i < j <= R
# (i*j)%2019 の最小値
M=[]
for i in range(L, R):
    for j in range(i+1, R+1):
        #print(i,j)
        M.append((i*j)%20119)
        if M[-1]==0:
			print(0)
		exit()
print(min(M))


### FIXED CODE ###

L,R=map(int,input().split())
# L <= i < j <= R
# (i*j)%2019 の最小値
M=[]
for i in range(L, R):
    for j in range(i+1, R+1):
        #print(i,j)
        M.append((i*j)%2019)
        if M[-1]==0:
            print(0)
            exit()
print(min(M))
K = int(input())
if K%2 == 0:
  print(int((K/2)**2))
else:
  print(int((K-1)(K+1)/4))
  


### FIXED CODE ###

K = int(input())
if K%2 == 0:
  print(int((K/2)**2))
else:
  print(int((K-1)*(K+1)/4))
n, a_, b_ = map(int, input().split())
a = a_-1
b = b_-1
A = [0]*n
B = [0]*n
for i in range(n):
  A[i] = abs(i-a)
  B[i] = abs(i-b)
for i in range(n):
  if A[i]==B[i]:
    print(A[i])
    exit()
m = [A[0], B[0], A[n-1], B[n-1]]
M = m.index(min(m))
if M == 0:
  print(m[1])
elif M == 1:
  print(m[0])
elif M == 2:
  print(m[3])
elif M == 3:
  print(m[2])

### FIXED CODE ###

n, a, b = map(int, input().split())
if abs(a-b)%2==0:
       print(abs(a-b)//2)
else:
  x = min(n-a, n-b, a-1, b-1)
  print(x+(abs(a-b)+1)//2)
a,b = map(int,input().split())
print(max(a+b.a-b,a*b))

### FIXED CODE ###

a,b = map(int,input().split())
print(max(a+b,a-b,a*b))
tem = input()
if tem >= 30:
  print("Yes")
else:
  Print("No")

### FIXED CODE ###

tem = int(input())
if tem >= 30:
  print("Yes")
else:
  print("No")
import math
X = int(input())
n = math.sqrt(2*X) -1

def sum(a):
    x = 0
    for i in range(a+1):
        x += i
    return x

for i in range(n,X+1):
    if sum(i)>= X:
        result = i
        break

print(result)

### FIXED CODE ###

import math
X = int(input())
n = int(math.sqrt(2*X) -2)

def sum(a):
    return a*(a+1)/2

result = 0

for i in range(n,X+1):
    if sum(i)>= X:
        result = i
        break

print(result)
import math
 
h,w = list(map(int, input().split()))
 
 
 
if h%2==1 and w%2==1:
 
    a = (h//2) * w
    b = math.ceil(w/2)

 
    print(a+b)
else:
 
    print(h*w//2)

### FIXED CODE ###

lst = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())

print(lst[k-1])