Harryxun/stf_run huggingface dataset:
from collections import defaultdict, deque
import math

kMod = 10**9 + 7

N = int(input())
key2count = defaultdict(lambda: [0, 0])

for _ in range(N):
    a, b = map(int, input().split())
    g = math.gcd(a, b)
    a, b = a//g, b//g
    if a < 0:
        a, b = -a, -b
    idx = 0
    if b < 0:
        idx = 1
        a, b = -b, a
    key2count[(a, b)][idx] += 1

print(key2count)
ans = 1
for key, val in key2count.items():
    plus, minus = val
    ans *= (pow(2, plus, kMod) + pow(2, minus, kMod)-1)
    ans %= kMod

print((ans + kMod-1) % kMod)

### FIXED CODE ###

from collections import defaultdict, deque
import math

kMod = 1000000007

N = int(input())
key2count = defaultdict(lambda: [0, 0])

for _ in range(N):
    a, b = map(int, input().split())
    g = math.gcd(a, b)
    if a < 0 or a == 0 and b < 0:
        a, b = -a, -b
    if g > 0:
        a, b = a//g, b//g
    idx = 0
    if b <= 0:
        idx = 1
        a, b = -b, a
    key2count[(a, b)][idx] += 1

ans = 1
for key, val in key2count.items():
    if key == (0, 0):
        continue
    plus, minus = val
    ans *= (pow(2, plus, kMod) + pow(2, minus, kMod)-1)
    ans %= kMod

ans += sum(key2count[(0, 0)])

print((ans + kMod-1) % kMod)
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
cnt = 0
for i in range(3):
    cnt += B[A[i]-1]
    if i < 2:
        if A[i]+1==A[i+1]:
            cnt += C[A[i]-1]
print(cnt)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
cnt = 0
for i in range(N):
    cnt += B[A[i]-1]
    if i < N-1:
        if A[i]+1==A[i+1]:
            cnt += C[A[i]-1]
print(cnt)
S = S + 'E'   # 終端処理
ans = -1    # 答えの初期値（十分に小さい値）

# 立った人の連続の数
if (S[0] == '0'):
    stand = 1
else:
    stand = 0

L = 0
R = 0

# 尺取り法
while (R < N):
    # 右端を進めることが可能（立った人の連続の数がK以下）なら、右端を進める
    if (stand <= K):
        # 立った人の連続の数が増えるなら1足す
        if (S[R] == '1' and S[R + 1] == '0'):
            stand += 1
        # 答えの更新
        ans = max(ans, R - L + 1)
        R += 1
    # 進められない場合、左端と右端が同じなら両者を進める
    # 左端が右端を追い越さないための処理
    """
    elif (L == R):
        L += 1
        R += 1
    # それ以外は左端のみを進める
    else:
        # 立った人の連続の数が減るなら1減らす
        if (S[L] == '0' and S[L + 1] == '1'):
            stand -= 1
        L += 1
        # 左端のみを進めた場合は答えを更新し得ない
    """

print(ans)

### FIXED CODE ###

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

S = S + 'E'   # 終端処理
ans = -1    # 答えの初期値（十分に小さい値）

# 立った人の連続の数
if (S[0] == '0'):
    stand = 1
else:
    stand = 0

L = 0
R = 0

# 尺取り法
while (R < N):
    # 右端を進めることが可能（立った人の連続の数がK以下）なら、右端を進める
    if (stand <= K):
        # 立った人の連続の数が増えるなら1足す
        if (S[R] == '1' and S[R + 1] == '0'):
            stand += 1
        # 答えの更新
        ans = max(ans, R - L + 1)
        R += 1
    # 進められない場合、左端と右端が同じなら両者を進める
    # 左端が右端を追い越さないための処理
    elif (L == R):
        L += 1
        R += 1
    # それ以外は左端のみを進める
    else:
        # 立った人の連続の数が減るなら1減らす
        if (S[L] == '0' and S[L + 1] == '1'):
            stand -= 1
        L += 1
        # 左端のみを進めた場合は答えを更新し得ない

print(ans)
m,d=input().strip().split(' ')
m,d=[int(m),int(d)]
c=0
for i in range(22,d+1):
  d1=str(d)
  if int(d1[1])>=2 and int(d1[1]*d1[0])<=m:
    c+=1
print c

### FIXED CODE ###

m,d=input().strip().split(' ')
m,d=[int(m),int(d)]
c=0
for i in range(22,d+1):
  d1=str(i)
  if int(d1[1])>=2 and int(d1[1])*int(d1[0])<=m:
    c+=1
print (c)
zA, B = map(int, input().split())
 
ans = 0
consent = 1
 
while consent < B:
    ans += 1
    consent -= 1
    consent += A
print(ans)

### FIXED CODE ###

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

ans = 0
consent = 1

while consent < B:
    ans += 1
    consent -= 1
    consent += A
print(ans)
H,W=map(int,input(),split())
h,w=map(int,input(),split())
print((H-h)*(W-w))

### FIXED CODE ###

H,W=map(int,input().split())
h,w=map(int,input().split())
print((H-h)*(W-w))
n,m=map(int,input().split())
a_b=[list(map(int,input().split()) for _ in range(n)]
c_d=sorted([list(map(int,input().split()) for _ in range(m)])
for i in range(n):
  res=1
  d=abs(a_b[i][0]-c_d[0][0])+abs(a_b[i][1]-c_d[0][1])
  for j in range(m):
    t=abs(a_b[i][0]-c_d[j][0])+abs(a_b[i][1]-c_d[j][1])
    if t<d:
      d=t
      res=j+1
  print(res)
    
  

### FIXED CODE ###

n,m=map(int,input().split())
a_b=[list(map(int,input().split())) for _ in range(n)]
c_d=[list(map(int,input().split())) for _ in range(m)]
for i in range(n):
  res=1
  d=abs(a_b[i][0]-c_d[0][0])+abs(a_b[i][1]-c_d[0][1])
  for j in range(1,m):
    t=abs(a_b[i][0]-c_d[j][0])+abs(a_b[i][1]-c_d[j][1])
    if t<d:
      d=t
      res=j+1
  print(res)
h, w = list(map(int, input().split()))
s = [list(input()) for i in range(h)]
dir = [[-1, 0], [1, 0], [0, -1], [0, 1]]
for y in range(h):
    for x in range(w):
        can_put = True
        if s[y][x] == "#":
            for dx, dy in dir:
                cx = x + dx
                cy = y + dy
                if x >= 0 and x < w and y >= 0 and y < h and s[cy][cx] == "#":
                    can_put = True
                    break
            else:
                can_put = False
        if can_put == False:
            break
if can_put == True:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

h, w = list(map(int, input().split()))
s = [list(input()) for i in range(h)]
dir = [[-1, 0], [1, 0], [0, -1], [0, 1]]
for y in range(h):
    for x in range(w):
        can_put = True
        if s[y][x] == "#":
            for dx, dy in dir:
                cx = x + dx
                cy = y + dy
                if cx >= 0 and cx < w and cy >= 0 and cy < h:
                    if s[cy][cx] == "#":
                        can_put = True
                        break
            else:
                can_put = False
        if can_put == False:
            break
    else:
        continue
    break
if can_put == True:
    print("Yes")
else:
    print("No")
Arr=[]
Arr=input.split()
print(Arr[0]*Arr[1])
print(2*Arr[0]+2*Arr[1])

### FIXED CODE ###

x = int(input())
print(x*x*x)
x = int(input())
ans = 0
lis = []
for i in range(1, x + 1):
    for j in range(2, x+1):
        ans = i ** j
        if ans <= x:
            lis.append(ans)
print(lis[-1])

### FIXED CODE ###

x = int(input())
ans = 1
for i in range(1, 32):
    for j in range(2, 10):
        p = pow(i, j)
        if p > x:
            break
        if p > ans:
            ans = p
print(ans)
from bisect import bisect_left, bisect_right
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans=0
for j in range(N):
    a=bisect_left(a, B[i])
    c=bisect_right(a, B[i])
    ans+=a*c
print(ans)


### FIXED CODE ###

from bisect import bisect_left, bisect_right
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans=0
for j in range(N):
    a=bisect_left(A, B[j])
    c=bisect_right(C, B[j])
    ans+=a*(N-c)
print(ans)
import math
import re
T=input()
x=0
Td=T
d = len(re.sub(r'0', '', Td))
x += math.ceil((d/2+1)*d/2)
spT = T.split('0')
lenT = list(map(len, spT))

tmpX = math.ceil(d/2)
bT = 0
aT = d
tmp = ''
for i in range(len(spT) - 1):
    tmp += spT[i]
    bT += lenT[i]
    aT -= lenT[i]
    if bT % 2==1:
        bT += 1
        if aT % 2 ==1:
            tmpX += 1
        x += tmpX
        tmp += '0'
    else:
        tmp +='+'
tmp += spT[-1]

spT = tmp.split('+')
vT =[]
aT = bT
bT = 0
odT = 0
for i in range(len(spT)):
    od = len(re.sub(r'0', '', spT[i][::2]))
    ev = len(re.sub(r'0', '', spT[i][::2]))
    odT += od
    vt.append(od - ev)

while len(vT) >1:
    tmpIdx = len(vT)-1
    tmpL = -sum(vT[i:])
    tmpMax = -1
    for i in range(1, len(vT)):
        if odT + tmpL > tmpMax:
            tmpIdx = i
            tmpMax = odT + tmpL
        tmpL += vt[i]
    odT = tmpMax
    x += odT
    vT[tmpIdx-1] += vT[tmpIdx]

    del vT[tmpIdx]

print(x)

### FIXED CODE ###

import math
import re
T=input()
x=0
Td=T
d = len(re.sub(r'0', '', Td))
x += math.ceil((d/2+1)*d/2)
spT = T.split('0')
lenT = list(map(len, spT))

tmpX = math.ceil(d/2)
bT = 0
aT = d
tmp = ''
for i in range(len(spT) - 1):
    tmp += spT[i]
    bT += lenT[i]
    aT -= lenT[i]
    if bT % 2==1:
        bT += 1
        if aT % 2 ==1:
            tmpX += 1
        x += tmpX
        tmp += '0'
    else:
        tmp +='+'
tmp += spT[-1]

spT = tmp.split('+')
vT =[]
aT = bT
bT = 0

odT = 0
tmpOd = True

for i in range(len(spT)):
    
    od = len(re.sub(r'0', '', spT[i][0 if tmpOd else 1::2]))
    ev = len(re.sub(r'0', '', spT[i][1 if tmpOd else 0::2]))
    odT += od
    vT.append(od - ev)
    if len(spT[i]) %2 == 1:
        tmpOd = not tmpOd

for i in reversed(range(1, len(spT))):
    odT = odT - vT[i]
    x += odT
    vT[i-1] -= vT[i]


print(x)
from functools import reduce
from math import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

n = int(input())
a = list(map(int, input().split()))
b = [0]*n

lcm_a = lcm_list(a)

b = [lcm_a//a[i] for i in range(n)]

print(sum(b) % ((10**9)+7))

### FIXED CODE ###

import functools

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

def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(m, n):
    return m//gcd(m, n)*n

def lcm_list(nums):
        return functools.reduce(lcm, nums)

lcm_a = lcm_list(a)

b = [lcm_a//a[i] for i in range(n)]

print(sum(b) % ((10**9)+7))
N = int(input())
a = list(map(int,input().split()))
Kisuu = 0
YonBaisuu = 0
NiBaisuu = 0

for j in range(N):
  print(j)
  if a[j]%2 == 1:
    Kisuu += 1
  elif a[j]%4 == 0:
    YonBaisuu += 1
  else :
    NiBaisuu +=1

  
if Kisuu <= YonBaisuu:
  print('Yes')
else :
  if NIBaisuu == 0:
    print('Yes')
  else:
    print('No')

print(Kisuu)
print(NiBaisuu)
print(YonBaisuu)


### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
one = 0
four = 0
two = 0

for j in range(N):

  if a[j]%2 == 1:
    one += 1
  elif a[j]%4 == 0:
    four += 1
  else :
    two +=1

print("Yes" if four >= one or (four == one - 1 and two == 0) else "No")
# Me
class Check():
    def __init__(self):
        self.now_t, self.now_x, self.now_y = 0, 0, 0

    def do(self, t, x, y):
        distance = ((x - self.now_x) + (y - self.now_y))
        duration = t - self.now_t
        if duration < distance:
            return False

        if distance % 2 != duration % 2:
            return False

        self.now_t, self.now_x, self.now_y = t, x, y
        return True


N = int(input())
c = Check()
for i in range(N):
    a = [int(x) for x in input().split()]
    if not c.do(a[0], a[1], a[2]):
        print('No')
        exit()
print('Yes')


### FIXED CODE ###

def f():
    a, b = input().split()
    a, b = int(a), int(b)
    rem = int(a) * int(b) % 2
    if rem == 1:
        print('Odd')
        return
    if rem == 0:
        print('Even')
        return


f()
# from pprint import pprint
# import math
# import collections
from numba import jit

N = int(input())

loops = 0


# n, k = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

@jit('i8(i8,i8,i8)', cache=True)
def calc(x, y, z):
    return x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x


res = [0] * 1000000

for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            n = calc(x, y, z)
            res[n - 1] += 1

for i in range(N):
    print(res[i])


### FIXED CODE ###

# from pprint import pprint
# import math
# import collections

# n = int(input())
l, r, d = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))
# a = []
# for i in range(n):
#     a.append(int(input()))
cnt = 0
for n in range(l, r + 1):
    if n % d == 0:
        cnt += 1

print(cnt)
S = raw_input().split(' ')
for i in range(0, len(S)):
  S[i] = int(S[i])

if 0 < x+r & x+r < w & 0 < y+r & y+r < h:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S = raw_input().split(' ')
for i in range(0, len(S)):
  S[i] = int(S[i])

w = S[0]
h = S[1]
x = S[2]
y = S[3]
r = S[4]

if 0 <= x-r and x+r <= w and 0 <= y+r and y+r <= h:
  print("Yes")
else:
  print("No")
import math
n,m=map(int,input().split())
if abs(n-m)>1:
  print(0)
  exit()
p=10**9+7
print((2*((math.factorial(m))%)*((math.factorial(m))%))%p)


### FIXED CODE ###

import math
n,m=map(int,input().split())
if abs(n-m)>1:
  print(0)
  exit()
p=10**9+7
if n==m:
  print((2*((math.factorial(m))%p)*((math.factorial(n))%p))%p)
else:
  print((((math.factorial(m))%p)*((math.factorial(n))%p))%p)
s = input()
if len(S) == 2:
  print(s)
else:
  print(s[2]+s[1]+s[0])

### FIXED CODE ###

s = input()
if len(s) == 2:
  print(s)
else:
  print(s[2]+s[1]+s[0])
S=input()
N=len(S)
S1=S[:(N-1)//2]
S2=S[(N+3)//2:]
if S==S[::-1] and S1=S1[::-1] and S2==S2[::-1]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S=input()
N=len(S)
S1=S[:(N-1)//2]
S2=S[(N+1)//2:]
if S==S[::-1] and S1==S1[::-1] and S2==S2[::-1]:
  print("Yes")
else:
  print("No")
n = int(input())
h = n // 3600
m = h // 60
s = n - 3600 * h - 60 * m
print '{0}:{1}:{2}'.format(h, m, s)


### FIXED CODE ###

s = int(input())
print(':'.join(map(str, (s // 3600, s // 60 % 60, s % 60))))
n,k=map(int,input().split())
A=list(map(int,input().split()))
p=1
l=[0]*n
#l[0]+=1
if k<=100000:
    for i in range(k):
        p=A[p-1]
        l[p-1]+=1
    print(p)
    exit()
else:
    for i in range(100001):
        p=A[p-1]#A[0]の番号の町に飛ぶ
        l[p-1]+=1
        #print(p)
        if l[p-1]==2:
            x=i
            break
    #print("p=",str(p))
    #print(l,x)

    d=1
    for j in range(100001):
        d=A[d-1]#A[0]の番号の町に飛ぶ
        if d==p:
            y=j
            break
    #print("y=",str(y))
    z=(k-x-1)%(x-y)#yから数えて残り回す回数
    for i in range(z):

### FIXED CODE ###

n,k=map(int,input().split())
A=list(map(int,input().split()))
p=1
l=[0]*n
#l[0]+=1
if k<=200000:
    for i in range(k):
        p=A[p-1]
        l[p-1]+=1
    print(p)
    exit()
else:
    for i in range(200001):
        p=A[p-1]#A[0]の番号の町に飛ぶ
        l[p-1]+=1
        #print(p)
        if l[p-1]==2:
            x=i
            break
    #print("p=",str(p))
    #print(l,x)

    d=1
    for j in range(200001):
        d=A[d-1]#A[0]の番号の町に飛ぶ
        if d==p:
            y=j
            break
    #print("y=",str(y))
    z=(k-x-1)%(x-y)#yから数えて残り回す回数
    #print(z)
    for i in range(z):
        p=A[p-1]
        #print(p)
    print(p)
N, K = map(int, input().split())
S = input()
new_S = []
count_S = []

cur_c = S[0]
cur_count = 0

new_S.append(cur_c)
for c in S:
    if c == cur_c:
        cur_count += 1
    else:
        new_S.append(c)
        count_S.append(cur_count)
        cur_count = 1
        cur_c = c
count_S.append(cur_count)
        

new_count = []
st_ix = 0
maxlen_ix = len(count_S)-1
if S[0] == '0':
    cur_sum = sum(count_S[:min(2*K, maxlen_ix)])
    st_ix = 1
    new_count.append(cur_sum)

else:
    cur_sum = sum(count_S[:max(2*K+1, maxlen_ix)])
    new_count.append(cur_sum)

en_ix = st_ix + 2*K + 1
cur_sum = sum(count_S[st_ix:max(en_ix, maxlen_ix)])
new_count.append(cur_sum)
while en_ix < len(count_S):
    # shift st_ix
    st_ix = st_ix + 2
    en_ix = en_ix + 2
    cur_sum -= (count_S[st_ix-2] + count_S[st_ix-1])
    cur_sum += (count_S[en_ix-2] + count_S[en_ix-1])
    new_count.append(cur_sum)

print(max(new_count))


### FIXED CODE ###

N, K = map(int, input().split())
S = input()
new_S = []
count_S = []

cur_c = S[0]
cur_count = 0

new_S.append(cur_c)
for c in S:
    if c == cur_c:
        cur_count += 1
    else:
        new_S.append(c)
        count_S.append(cur_count)
        cur_count = 1
        cur_c = c
count_S.append(cur_count)        

new_count = []
st_ix = 0
if S[0] == '0':
    cur_sum = sum(count_S[:2*K])
    st_ix = 1
    new_count.append(cur_sum)
else:
    cur_sum = sum(count_S[:2*K+1])
    new_count.append(cur_sum)

en_ix = st_ix + 2*K + 1
cur_sum = sum(count_S[st_ix:en_ix])
new_count.append(cur_sum)

while en_ix < len(count_S):
    # shift st_ix
    st_ix = st_ix + 2
    en_ix = en_ix + 2
    if en_ix >= len(count_S):
        new_count.append(sum(count_S[st_ix:]))
    else:
        cur_sum -= (count_S[st_ix-2] + count_S[st_ix-1])
        cur_sum += (count_S[en_ix-2]
                        + count_S[en_ix-1])
    new_count.append(cur_sum)

print(max(new_count))
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

""" どのパワー以上の組み合わせまで握手するのか二分探索で調べる
    同じパワーとなる組み合わせに注意 """
N, M = lr()
A = np.array(lr(), np.int64)
B = A[:, None] + A[None, :]
B = B.ravel()
B.sort() # 昇順
N = N ** 2
if M == N:
    print(B.sum()); exit()

def check(x):
    # x以上の幸福度と握手した場合、M回以下になる場合、Trueを返す
    i = np.searchsorted(B, x, side='l')
    return (N - i) <= M

ok = 10 ** 5 * 2 + 1; ng = 0
while abs(ng-ok) > 1:
    mid = (ok+ng) // 2
    if check(mid):
        ok = mid
    else:
        ng = mid

i = np.searchsorted(B, ok, side='l')
if i == N:
    answer = B[-1] * M
else:
    time = N - i
    answer = B[i:].sum() + B[i-1] * (M-time)
print(answer)
#

### FIXED CODE ###

import sys
import numpy as np

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N, M = rl()
A = np.array(rl())
A.sort()

def shake_cnt(x):
    Y = np.searchsorted(A,x-A)
    return N*N - Y.sum()

right = 10 ** 6
left = 0 #握手するのがM人以上
while right > left + 1:
    mid = (left+right) // 2
    if shake_cnt(mid) >= M:
        left = mid
    else:
        right = mid

X = np.searchsorted(A, right-A) #握手しない人数
Acum = np.zeros(N+1, np.int64)
Acum[1:] = A.cumsum()

shake = N*N - X.sum()
happy = (Acum[-1] - Acum[X]).sum() + (A * (N-X)).sum()
happy += (M-shake) * left
print(happy)
def x_cubic(x):
  return x*x*x;

x_cubic(x);

### FIXED CODE ###

n = input()

print n*n*n;
N, M = map(int, input().split())

A = 0
for i in range(M):
    s = int(input())
    A += s

sub = N - A

if sub >= 0:
    print(sub)
else:
    print(-1)

### FIXED CODE ###

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

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

sub = N - sum(A)

if sub >= 0:
    print(sub)
else:
    print(-1)
import sys
import numpy as np
input = sys.stdin.readline
N, X = [int(x) for x in input().split()]
x = np.array([int(x) for x in input().split()])
x -= X
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
    
x.tolist()
D = gcd(* x)
print(D)

### FIXED CODE ###

import sys
import numpy as np
input = sys.stdin.readline
N, X = [int(x) for x in input().split()]
x = np.array([int(x) for x in input().split()])
if len(x) == 1:
    print(abs(X-x[0]))
    sys.exit()
x -= X
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
    
x.tolist()
D = gcd(* x)
print(abs(D))
a=[*input()]
b=a[::-1]
n=len(a)
if n==1:
    print(0)
else:
    x=0
    y=0
    for i in range(n-1):
        if a[i]==a[i+1]:
            x+=1
            if a[i]=='0':
                a[i+1]='1'
            else:
                a[i+1]='0'
        if b[i]==b[i+1]:
            y+=1
            if b[i]=='0':
                b[i+1]='1'
            else:
                b[i+1]='0'
    print(min(x,y))


### FIXED CODE ###

a=list(input())
b=a[::-1]
n=len(a)
if n==1:
    print(0)
else:
    x=0
    y=0
    for i in range(n-1):
        if a[i]==a[i+1]:
            x+=1
            if a[i]=='0':
                a[i+1]='1'
            else:
                a[i+1]='0'
        if b[i]==b[i+1]:
            y+=1
            if b[i]=='0':
                b[i+1]='1'
            else:
                b[i+1]='0'
    print(min(x,y))
print("ABC{0}".format(intput()))

### FIXED CODE ###

print("ABC{0}".format(input()))
S = list(input())
N = len(S)

c=0
i=0
f=0
while(1):
    if S[i] != S[i+1]:
        del S[i:i+2]
        c+=2
        N-=2
        i-=1
        f=1
    if N<2:
        break
    i+=1
    if i+1 == N:
        i=0
        if f==0:
            break
        f=0
print(c)

### FIXED CODE ###

S = list(input())
N = len(S)

c=0
i=0
f=0
while(1):
    if i+1 == N or N < 2:
        break
    if S[i] != S[i+1]:
        del S[i:i+2]
        c += 2
        N -= 2
        if i >= 1:
            i -= 2
        else:
            i -= 1
    i += 1
    #print(i,N,S,f)                                                                      
print(c)
n,k=map(int, input().split())
P = list(map(int, input().split()))
P=[i-1 for i in P]
C = list(map(int, input().split()))
visited=[-1]*n
group=[]

for i in range(n):
    if visited[i]!=-1:
        continue
    visited[i]=0
    group.append([i])
    now=P[i]
    while now!=i:
        group[-1].append(now)
        visited[now]=0
        now=P[now]
dp=[[0] for i in range(n)]

from collections import defaultdict
d=defaultdict(list)
for g in group:
    for i in g:
        now=i
        point=0
        for j in range(len(g)):
            now=P[now]
            point+=C[now]
            d[i].append(point)
ans=-float('inf')

for i in range(n):
    dic=d[i]
    leng=len(dic)
    if k<=leng:
        ans=max(ans, max(dic[:k]))
    else:
        if dic[-1]<=0:
            ans=max(ans, max(dic))
        else:
            ans=max(ans,(k//leng)*dic[-1]+max(dic[:k%leng]))
            ans=max(ans,(k//leng-1)*dic[-1]+max(dic))
print(ans)

### FIXED CODE ###

n,k=map(int, input().split())
P = list(map(int, input().split()))
P=[i-1 for i in P]
C = list(map(int, input().split()))
visited=[-1]*n
group=[]

for i in range(n):
    if visited[i]!=-1:
        continue
    visited[i]=0
    group.append([i])
    now=P[i]
    while now!=i:
        group[-1].append(now)
        visited[now]=0
        now=P[now]
dp=[[0] for i in range(n)]

from collections import defaultdict
d=defaultdict(list)
for g in group:
    for i in g:
        now=i
        point=0
        for j in range(len(g)):
            now=P[now]
            point+=C[now]
            d[i].append(point)
ans=-float('inf')

for i in range(n):
    dic=d[i]
    leng=len(dic)
    if k<=leng:
        ans=max(ans, max(dic[:k]))
    else:
        if dic[-1]<=0:
            ans=max(ans, max(dic))
        else:
            if k%leng!=0:
                ans=max(ans,(k//leng)*dic[-1]+max(dic[:k%leng]))
            ans=max(ans,(k//leng-1)*dic[-1]+max(dic))
print(ans)
from fractions import gcd

A, B, K = [int(i) for i in input()]

gcd_ = gcd(A, B)
count = 0
flg = 0
for n in range(gcd_, 0, -1):
    if flg:
        break
    if A % n == 0 and B % n == 0:
        count += 1
        if count == K:
            print(n)
            flg = 1
            break


### FIXED CODE ###

from fractions import gcd

A, B, K = [int(i) for i in input().split()]

count = 0
for i in range(gcd(A, B), 0, -1):
    if A % i == 0 and B % i == 0:
        count += 1
        if count == K:
            print(i)
            break
import math
a, b, c = map(int, input().split())
a_sqrt = math.sqrt(a)
b_sqrt = math.sqrt(b)
c_sqrt = math.sqrt(c)

a_sqrt = round(a_sqrt,-13)
b_sqrt = round(b_sqrt,-13)
c_sqrt = round(c_sqrt,-13)

if (a_sqrt+b_sqrt) < c_sqrt:
	print('Yes')
else:
	print('No')

### FIXED CODE ###

list_32 = [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())
K -= 1
print(list_32[K])
print(chr(ord(int(input())) + 1))

### FIXED CODE ###

print(chr(ord(input()) + 1))
import collections
n = int(input())
a_list = sorted([int(i) for i in input().split()])

count = 0
while len(a_list) > 2:
    x = a_list[0]
    if x == a_list[1]:
        a_list = a_list[1:]
    else:
        count += 1
        a_list = [i for i in a_list[1:] if i % x != 1]

if a_list[0] % a_list[1] != 0:
    count += 1

print(count)


### FIXED CODE ###

n = int(input())
a_list = sorted(map(int, input().split()))

max_num = max(a_list)

is_ans = [False]*(max_num+1)
memo = [0]*(max_num+1)
for i in a_list:
    is_ans[i] = True
    memo[i] += 1

for i in range(1, max_num+1):
    if is_ans[i]:
        for j in range(2*i, max_num+1, i):
                is_ans[j] = False

    if memo[i] > 1:
        is_ans[i] = False

ans = is_ans.count(True)
print(ans)