Harryxun/stf_run huggingface dataset:
import itertools
import numpy as np

n, m, x = map(int, input().split())
san = []
for i in range(n):
    san.append(list(map(int, input().split())))

result = []
adds = []
for j in range(1,n+1):
     for conb in itertools.combinations(san, j):
        result.append(list(conb)) #タプルをリスト型に変換

for i in result:
    t = np.zeros([m+1], dtype=int)
    for j in i:
        t = t + np.array(j)

    adds.append(t)

price = -1
ans = 0
for num, i in enumerate(adds):
    use = True
    for j in range(1,m+1):
        if i[j] < 10:
            # print(i)
            use = False
            break

    if use:
        # print(i)
        # print(result[num])
        if price == -1 or price > i[0]:
        # if price > i[0]:
            price = i[0]
            ans = num

print(price)

### FIXED CODE ###

import itertools
import numpy as np

n, m, x = map(int, input().split())
san = []
for i in range(n):
    san.append(list(map(int, input().split())))

result = []
adds = []
for j in range(1,n+1):
     for conb in itertools.combinations(san, j):
        result.append(list(conb)) #タプルをリスト型に変換

for i in result:
    t = np.zeros([m+1], dtype=int)
    for j in i:
        t = t + np.array(j)

    adds.append(t)

price = -1
ans = 0
for num, i in enumerate(adds):
    use = True
    for j in range(1,m+1):
        if i[j] < x:
            # print(i)
            use = False
            break

    if use:
        # print(i)
        # print(result[num])
        if price == -1 or price > i[0]:
        # if price > i[0]:
            price = i[0]
            ans = num

print(price)
a=S[::2]
b=S[1::2]
if 'L' not in a:
	pass
	if 'R' not in b:
		print('Yes')
else:
	print('No')

### FIXED CODE ###

S=input()
a=S[::2]
b=S[1::2]
if 'L' not in a:
	if 'R' not in b:
		print('Yes')
	elif 'R' in b:
		print('No')
elif 'L' in a:
	print('No')
x = int(input())

if x == 1:
    a = 1
    b = 0
else:
    p = 1
    while True:
        while True:
            if x % p == 0:
                q = int(x / p)
                break
            else:
                p += 1
        ap = p
        am = p
        bp = 0
        bm = 0
        for i in range(200):
            if ap**4 + ap**3 * bp + ap**2 * bp**2 + ap * bp**3 + bp**4 == q:
                a = ap
                b = bp
                break
            elif am**4 + am**3 * bm + am**2 * bm**2 + am * bm**3 + bm**4 == q:
                a = am
                b = bm
                break
            ap += 1
            bp += 1
            am -= 1
            bm -= 1
        else:
            p += 1
            continue
        break

print('{} {}'.format(a, b))

### FIXED CODE ###

S = input()

if S == 'ABC':
    print('ARC')
else:
    print('ABC')
N = int(input())
a = n[0]
b = n[1]
c = n[2]
d = n[3]
if a == b and b == c and c == d:
    print("Yes")
elif a == b and b == c:
    print("Yes")
elif b == c and c == d:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N = input()
a = N[0]
b = N[1]
c = N[2]
d = N[3]
if a == b and b == c and c == d:
    print("Yes")
elif a == b and b == c:
    print("Yes")
elif b == c and c == d:
    print("Yes")
else:
    print("No")
def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])
x = int(arr_data[0][1])

arr=[int(arr_data[1][x]) for x in range(0,n)]
cnt=0
for i in range(n-1):
    
    if arr[i]+arr[i+1]>x:
        
        if arr[i]-x>=0:
            
            cnt+=arr[i-x]
            arr[i]=0
            
        if arr[i]+arr[i+1]-x>=0:
            
            cnt+=arr[i+1]-x
            arr[i+1]=arr[i+1]-x
                   
print(cnt)        
 

### FIXED CODE ###

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()
    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            if(data != ""):
                
                array_result.append(data.split(" "))

            else:

                flg = 0
    finally:

        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])
x = int(arr_data[0][1])

arr=[int(arr_data[1][x]) for x in range(0,n)]

cnt=0

for i in range(n-1):
    
    zan=arr[i]+arr[i+1]-x
     
    if 0<arr[i+1]<=zan:

        cnt+=arr[i+1]
        zan-=arr[i+1]
        arr[i+1]=0

    elif arr[i+1]>zan>0:

        cnt+=zan
        arr[i+1]-=zan
        zan=0

    if 0<arr[i]<=zan:

        cnt+=arr[i]
        zan-=arr[i]
        arr[i]=0

    elif arr[i]>zan>0:

        cnt+=zan
        arr[i]-=zan
        zan=0

    
print(cnt)
N = ini()
print(int((N*(N+1))/2))
'''
sum = 0
for i in range(N):
    sum += (i+1)
print(sum)
'''

### FIXED CODE ###

import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

N = ini()
print(int((N*(N+1))/2))
'''
sum = 0
for i in range(N):
    sum += (i+1)
print(sum)
'''
s = list(input())
t = list(input())

count = 0
n = 0
ans = []
flag = 0
while n <len(s)-len(t)+1:
    count = 0
    for m in range(len(t)):
        if s[n+m] == "?" or s[n+m]==t[m]:
            count += 1
    if count == len(t):
        flag = 1
        ans = s[0:n+m+1]
        break
    n += 1
#print(n,m)
if flag == 1:
    for i in range(n):
        if ans[i] == "?":
            ans[i] = "a"
    for i in range(m+1):
        ans[n+i] =t[i]
    for _ in ans:
        #print(*_,end="")
else:
    print("UNRESTORABLE")

### FIXED CODE ###

s = list(input())
t = list(input())

count = 0
n = 0
ans = []
flag = 0
n=len(s)-len(t)
while n >=0:
    count = 0
    for m in range(len(t)):
        if s[n+m] == "?" or s[n+m]==t[m]:
            count += 1
        else:
            break
    if count == len(t):
        flag = 1
        break
    else:
        n -= 1

if flag == 1:
    for i in range(len(s)):
        if s[i] == "?":
            s[i] = "a"
    for i in range(m+1):
        s[n+i] =t[i]
    
    for _ in s:
        print(*_,end="")

else:
    print("UNRESTORABLE")
DIV = 998244353

N = input()
a = []
for i in range(N):
    a.append(input())
a.sort()
suma = sum(a)
dp = [[0] * (suma+1) for i in range(N)]
dp[0][0] = 2
dp[0][a[0]] = 1
allc = 3
for i in range(1,N):
	allc = allc*3
	k = a[i]
	for j in range(sum(a[:i+1])+1):
		if(j < k):
			dp[i][j] = dp[i-1][j]*2
		else:
			dp[i][j] = dp[i-1][j]*2+dp[i-1][j-k]
allc = allc - sum(dp[N-1][suma-suma/2:])*3
if(suma%2 == 0):
	dp2 = [[0] * (suma+1) for i in range(N)]
	dp2[0][0] = 1
	dp2[0][a[0]] = 1 
	for i in range(1,N):
		k = a[i]
		for j in range(sum(a[:i+1])+1):
			if(j < k):
				dp2[i][j] = dp2[i-1][j]
			else:
				dp2[i][j] = dp2[i-1][j]+dp2[i-1][j-k]
	allc += dp2[N-1][suma/2]*3
print(allc%DIV)

### FIXED CODE ###

N = input()
S = raw_input()
flag1 = 0
a = 0
count = [0,0]
count2 = []
count3 = []
for c in S:
	if(c == "#"):
		if(flag1 == 1):
			flag1 = 0
			count2.append(count[0])
			count3.append(count[1])
		count[0] += 1
	else:
		count[1] += 1
		flag1 = 1
countf = []
for i in range(len(count2)):
	countf.append(count2[i] + count[1] - count3[i])
countf.append(N - count[0])
countf.append(N - count[1])
print(min(countf))
h,w=map(int,input().split())
if h*w%3==0:
  print(0)
else:
  ans=min(h,w)
  hh=h//2
  for ww in range(1,w):
    A=[hh*ww,(h-hh)*ww,h*(w-ww)]
    ans=min(ans,max(A)-min(A))
  ww=w//2
  for hh in range(1,h):
    B=[ww*hh,(w-ww)*hh,(h-hh)*w]
    ans=min(ans,max(B)-min(B))
print(ans)

### FIXED CODE ###

h,w=map(int,input().split())
if h*w%3==0:
  print(0)
else:
  ans=min(h,w)
  hh=h//2
  for ww in range(1,w):
    A=[hh*ww,(h-hh)*ww,h*(w-ww)]
    ans=min(ans,max(A)-min(A))
  ww=w//2
  for hh in range(1,h):
    B=[ww*hh,(w-ww)*hh,(h-hh)*w]
    ans=min(ans,max(B)-min(B))
  print(ans)
n,m=map(int,input().split())

WA=[0]*n
AC=[0]*n

for i in range(m):
    problem,status=input().split()
    problem=int(problem)

    if status=='WA' and AC[problem-1]==0:
        WA[problem-1]+=1
    elif status=='AC':
        AC[problem-1]=1
print(sum(WA),sum(AC))


### FIXED CODE ###

character=input()


print(chr(ord(character)+1))
sal
n = int(input())
l = list(map(int,input().split()))
r = [0]*n
for i in range(n):
  r[l[i]-1] = i+1
for x in r:
  print(x)


### FIXED CODE ###

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

for i in range(a):
  b[c[i]-1]+=i+1
print(' '.join(map(str, b)))
n,y = int(input())
for a in range(n+1):
  for b in range(n+1-b):
    if a*10000+b*5000+(n-a-b)*1000==n:
      print str(a)+" "+str(b)+" "+ str(n-a-b)
print "-1 -1 -1"

### FIXED CODE ###

n,y = map(int, input().split())
for a in range(n+1):
  for b in range(n+1-a):
    if a*10000+b*5000+(n-a-b)*1000==y:
      print(str(a)+" "+str(b)+" "+ str(n-a-b))
      exit()
print("-1 -1 -1")
import math
while 1:
    e = int(input())
    if  e == 0 :break
    m = e
    for z in range(e):
        for y in range(int(math.sqrt(e))+ 1):
            if  e-y**2-z**3+y+z < 0 or e - y**2 -z**3 <0:break
            if m > e-y**2-z**3+y+z: m = e-y**2-z**3+y+z
    print(m)


### FIXED CODE ###

import math
while 1:
    e = int(input().strip())
    if e ==0:break
    m=e
    z =0
    while z**3 <= e:
        y = int(math.sqrt(e-z**3))
        x = e - y**2- z**3 
        if x < 0:break
        if m > x+y+z: m = x+y+z    
        z+=1
    print(m)
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = []
for b in range(Q):
  BC.append(list(map(int, input().split())))

T = [0]*100000
#T[i] = A中の数値iの数

for i in A:
  T[i]+=1
S = sum(A)
for i in BC:
  b,c = i
  n = int(T[b])
  sa = c*n - b*n
  S = S + c*n - b*n
  print(S)
  T[b]=0
  T[c]+=n
  #print(S, [b,T[b], 0],[c,T[c],T[c]+T[b]], sa, S+sa)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
BC = []
for b in range(Q):
  BC.append(list(map(int, input().split())))

T = [0]*200000
#T[i] = A中の数値iの数

for i in A:
  T[i]+=1
S = sum(A)
for i in BC:
  b,c = i
  n = int(T[b])
  sa = c*n - b*n
  S = S + c*n - b*n
  print(S)
  T[b]=0
  T[c]+=n
  #print(S, [b,T[b], 0],[c,T[c],T[c]+T[b]], sa, S+sa)
import sys

a = int(sys.argv[1])
b = int(sys.argv[2])
num = a * b
length = (a * 2) + (b * 2)
print(num + " " + length, end="\n")

### FIXED CODE ###

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

if (a >= 1) or (b <= 100):
    num = str(a * b)
    length = str((a * 2) + (b * 2))
    print(num + " " + length, end="\n")
else:
    pass
N = int(input())

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



ans = 1

for i in range(N):
    if ans > 10 ** 18:
    ans = -1
    break
    else:
        ans = ans * aaa[i]

print(ans)






### FIXED CODE ###


N = int(input())

aaa = list(map(int, input().split()))
ans = 1

if 0 in aaa:
    ans = 0
else:
    for i in range(N):
        if ans > 10 ** 18:
            ans = -1
            break
        else:
            ans = ans * aaa[i]


if ans > 10 ** 18:
    ans = -1


print(ans)
def reduce (last, count, time):
    if last == 0:
        return time-1
    if last-time==0 or last-time > time:
        return reduce(last-time, count+1, time+1)
    else:
        return reduce(last, count, time+1)
        

if __name__ == '__main__':
    X = int(input())
    ret = reduce(X, 0, 1)
    print(ret)


### FIXED CODE ###

N = int(input())

for t in range(10**5):
    if t*(t+1)/2 >= N:
        print(t)
        break
from sys import stdin
input = stdin.readline
 
A,V = input().rstrip().split()
B,W = input().rstrip().split()
T = int(input().rstrip())
s=0
for t in range(T):
  if B<A:
    A-=V
    B-=W
    if B>=A:
      print('Yes')
      s=1
      break
  else:
    A+=V
    B+=W
    if B<=A:
      print('Yes')
      s=1
      break
 
if s!=1:
  print('No')

### FIXED CODE ###

from sys import stdin
input = stdin.readline
 
A,V = input().rstrip().split()
B,W = input().rstrip().split()
T = int(input().rstrip())
A,V,B,W = int(A),int(V),int(B),int(W)
s=0
L1=A-B
L2=B-A
S=V-W
if V<=W:
  print('NO')
  s=1
else:
    if B<A:
      if L1/S<=T:
        print('YES')
      else:print('NO')
    else:
      if L2/S<=T:
        print('YES')
      else:print('NO')
N = int(input())
a = list(map(int, input().split()))

cnt = [0 for i in range(8)]
count = 0

for i in range(N):
    if 1<= a[i] <= 399:
        cnt[0] += 1
    elif 400<=a[i]<=799:
        cnt[1] += 1
    elif 800<=a[i]<=1199:
        cnt[2] += 1
    elif 1200<=a[i]<=1599:
        cnt[3] += 1
    elif 1600<=a[i]<=1999:
        cnt[4] += 1
    elif 2000<=a[i]<=2399:
        cnt[5] += 1
    elif 2400<=a[i]<=2799:
        cnt[6] += 1
    elif 2800<=a[i]<=3199:
        cnt[7] += 1
    else:
        count += 1

ans_min = len([s for s in cnt if s != 0])
ans_max = ans_min + count

print("{} {}".format(max(1,ans_min), min(8,ans_max))

### FIXED CODE ###

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

cnt = [0 for i in range(8)]
count = 0

for i in range(N):
    if 1<= a[i] <= 399:
        cnt[0] = 1
    elif 400<=a[i]<=799:
        cnt[1] = 1
    elif 800<=a[i]<=1199:
        cnt[2] = 1
    elif 1200<=a[i]<=1599:
        cnt[3] = 1
    elif 1600<=a[i]<=1999:
        cnt[4] = 1
    elif 2000<=a[i]<=2399:
        cnt[5] = 1
    elif 2400<=a[i]<=2799:
        cnt[6] = 1
    elif 2800<=a[i]<=3199:
        cnt[7] = 1
    else:
        count += 1

ans_min = sum(cnt)
ans_max = ans_min + count
if ans_min == 0:
    ans_min =1

print("{} {}".format(ans_min, ans_max))
from sys import stdin

a = stdin.readline().rstrip()
print(a.upper())
print(output)

### FIXED CODE ###

s = input()
n = 0
ans = 0
for n in range( 1 << len(s) -1):
    p = 0
    for i in range(len(s) - 1):
        if n & (1 << i):
            ans += int(s[p:i + 1])
            p = i + 1
    if p < len(s):
        ans += int(s[p:])
print(ans)
num=int(input())
for i in range (num):
    info=list(map(float,input().split()))
    if info[2]==info[0]:
        if info[6]==info[4]:
            print("YES")
        else:
            print("NO")
    else:
        if (info[3]-info[1])/(info[2]-info[0])==(info[7]-info[5])/(info[6]-info[4]):
            print("YES")
        else:
            print("NO")
        

### FIXED CODE ###

num=int(input())
for i in range (num):
    info=list(map(float,input().split()))
    info=list(map(lambda x:int(x*10**6),info))
    if info[2]==info[0]:
        if info[6]==info[4]:
            print("YES")
        else:
            print("NO")
    elif info[6]==info[4]:
        if info[2]==info[0]:
            print("YES")
        else:
            print("NO")
    else:
        if (info[3]-info[1])/(info[2]-info[0])==(info[7]-info[5])/(info[6]-info[4]):
            print("YES")
        else:
            print("NO")
L = list(input())
L_ = []
a = L.pop(0)
cnt = 0

while True:
    if len(L) == 0:
        break
    else:
        b = L.pop(0)
    if a is not b:
        cnt += 1
        # L = L_ + L
        # L_ = []
        a = L_.pop(0)
    elif a is b:
        L_.append(a)
        a = b
    # print(L_, a,  L)

print(cnt * 2)



### FIXED CODE ###

a, b, c = map(int, input().split())
res = b // a
if res > c:
  res = c
print(res)
s = sorted(int(input()))
t = sorted(int(input()),reverse=True)
if s<t:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s = sorted(input())
t = sorted(input(),reverse=True)
if s<t:
  print("Yes")
else:
  print("No")
n = input()
ws = list(map(int, input().split()))
ans = float('inf')
s = 0
whole = sum(ws)

for i in range(n-1):
  s += ws[i]
  ans = min(ans, abs(whole- 2*s))

print(ans)

### FIXED CODE ###

n = int(input())
ws = list(map(int, input().split()))
ans = float('inf')
s = 0
whole = sum(ws)

for i in range(n-1):
  s += ws[i]
  ans = min(ans, abs(whole- 2*s))

print(ans)
import sys
input = sys.stdin.readline
# 文字列をinput()した場合、末尾に改行が入るので注意
def main(R,C,K,rcv):
  inf=float('inf')
  dp0=[[-inf,-inf,-inf,0] for _ in range(C)]
  dp1=[[-inf]*4 for _ in range(C)]
  dp0[0][3]=0
  rcv.sort(key=lambda x:R*x[0]+x[1])
  i=0
  nowc=0
  while rcv[i][0]==1:
    nextc=rcv[i][1]-1
    for j in range(nowc+1,nextc+1):
      dp0[j][0]=dp0[nowc][0]
      dp0[j][1]=dp0[nowc][1]
      dp0[j][2]=dp0[nowc][2]
    v=rcv[i][2]
    dp0[nextc][0]=max(dp0[nextc][0],dp0[nextc][1]+v)
    dp0[nextc][1]=max(dp0[nextc][1],dp0[nextc][2]+v)
    dp0[nextc][2]=max(dp0[nextc][2],dp0[nextc][3]+v)
    i+=1
    nowc=nextc
    for j in range(nowc+1,C):
      dp0[j][0]=dp0[nowc][0]
      dp0[j][1]=dp0[nowc][1]
      dp0[j][2]=dp0[nowc][2]
  for j in range(1,R):
    for c in range(C):
      dp0[c][3]=max(dp0[c])
      dp0[c][2]=-inf
      dp0[c][1]=-inf
      dp0[c][0]=-inf
    nowc=0
    while i<K and rcv[i][0]==j+1:
      nextc=rcv[i][1]-1
      for k in range(nowc+1,nextc+1):
        dp0[k][0]=dp0[nowc][0]
        dp0[k][1]=dp0[nowc][1]
        dp0[k][2]=dp0[nowc][2]
      v=rcv[i][2]
      dp0[nextc][0]=max(dp0[nextc][0],dp0[nextc][1]+v)
      dp0[nextc][1]=max(dp0[nextc][1],dp0[nextc][2]+v)
      dp0[nextc][2]=max(dp0[nextc][2],dp0[nextc][3]+v)
      i+=1
      nowc=nextc
    for j in range(nowc+1,C):
      dp0[j][0]=dp0[nowc][0]
      dp0[j][1]=dp0[nowc][1]
      dp0[j][2]=dp0[nowc][2]
    #print(dp0)

  print(max(dp0[-1]))


if __name__=='__main__':
  R,C,K=map(int,input().split())
  rcv=[list(map(int,input().split())) for _ in range(K)]
  #import datetime
  #print(datetime.datetime.now())
  main(R,C,K,rcv)
  #print(datetime.datetime.now())




### FIXED CODE ###

import sys
input = sys.stdin.readline
def main(R,C,K,rcv):
  inf=float('inf')
  dp0=[[-inf,-inf,-inf,0] for _ in range(C)]
  # dp0[i][j]:i列目の時点で残りちょうどj個取れる時の最大値
  rcv.sort(key=lambda x:C*R*x[0]+x[1])
  i=0
  nowc=0
  for j in range(R):
    # j+1行目に対する操作
    # 初期化
    for c in range(C):
      dp0[c][3]=max(dp0[c])
      dp0[c][2]=-inf
      dp0[c][1]=-inf
      dp0[c][0]=-inf
    nowc=0
    while i<K and rcv[i][0]==j+1:
      nextc=rcv[i][1]-1
      for k in range(nowc+1,nextc+1):
        dp0[k][0]=max(dp0[k][0],dp0[nowc][0])
        dp0[k][1]=max(dp0[k][1],dp0[nowc][1])
        dp0[k][2]=max(dp0[k][2],dp0[nowc][2])
      v=rcv[i][2]
      dp0[nextc][0]=max(dp0[nextc][0],dp0[nextc][1]+v)
      dp0[nextc][1]=max(dp0[nextc][1],dp0[nextc][2]+v)
      dp0[nextc][2]=max(dp0[nextc][2],dp0[nextc][3]+v)
      i+=1
      nowc=nextc
    for k in range(nowc+1,C):
      dp0[k][0]=max(dp0[k][0],dp0[nowc][0])
      dp0[k][1]=max(dp0[k][1],dp0[nowc][1])
      dp0[k][2]=max(dp0[k][2],dp0[nowc][2])
    #print(dp0)
  print(max(dp0[-1]))
if __name__=='__main__':
  R,C,K=map(int,input().split())
  rcv=[list(map(int,input().split())) for _ in range(K)]
  main(R,C,K,rcv)
S = list(input())
ans = 0
for i in S:
    if i == '+':
        ans += 1
    else:
        ans -= 1 S = list(input())
ans = 0
for i in S:
    if i == '+':
        ans += 1
    else:
        ans -= 1 
print(ans)

### FIXED CODE ###

S = list(input())
ans = 0

for i in S:
    if i == '+':
        ans += 1
    else:
        ans -= 1 
print(ans)
A, B, C = int(input())
print('YES' if A, B, C == 5 7 5 else 'NO')

### FIXED CODE ###

x = input().split()
print('YES' if x.count('5')==2 and x.count('7')==1 else 'NO')
from fractions import gcd

def FindAllDivisors(x):
    divList = []
    y = 1
    while y <= math.sqrt(x):
        if x % y == 0:
            divList.append(y)
            divList.append(int(x / y))
        y += 1
    return sorted(divList)

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

max_divs = gcd(A, B)

divs = FindAllDivisors(max_divs)

results = []
for div in divs[1:]:
    flag = True
    for result in results:
        if div % result == 0:
            flag = False
            break
    if flag:
        results.append(div)

print(len(results) + 1)

### FIXED CODE ###

from fractions import gcd

def FindAllDivisors(x):
    divList = []
    y = 1
    while y <= x**0.5:
        if x % y == 0:
            divList.append(y)
            divList.append(int(x / y))
        y += 1
    return sorted(list(set(divList)))

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

max_divs = gcd(A, B)
divs = FindAllDivisors(max_divs)

results = []
for div in divs[1:]:
    flag = True
    for result in results:
        if div % result == 0:
            flag = False
            break
    if flag:
        results.append(div)

print(len(results) + 1)
a =int(input())
if "9" in a:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a =input()
if "9" in a:
  print("Yes")
else:
  print("No")
n = int(input())
arr = []
c=0
for i in range(0,n):
	if arr[i]!= i+1 :
		c+=1
          
if c > 2:
	print('NO')
else:
	print('YES')

### FIXED CODE ###

n = int(input())
arr =list(map(int,input().split()))
c=0
for i in range(0,n):
	if arr[i]!= i+1 :
		c+=1
          
if c > 2:
	print('NO')
else:
	print('YES')
n = int(input())
s =""
k = 0
while n!=0:
  if n%(2**(k+1)) == 2**k:
    if k%2 == 0:
      n -= 2**k
    else:
      n += 2**k
    s += "1"
  else:
    s += "0"
  k += 1

if s="":
  s="0"

print("".join(s))

### FIXED CODE ###

n = int(input())
s = ""
k = 0
while n!=0:
  if n%(2**(k+1)) == 2**k:
    if k%2 == 0:
      n -= 2**k
    else:
      n += 2**k
    s = "1"+s
  else:
    s = "0"+s
  k += 1

if s=="":
  s="0"

print("".join(s))
H, A = map(int, intput().split())
res = H // A
if H % A > 0:
  	res += 1
print(res)


### FIXED CODE ###

H, A = map(int, input().split())
res = H // A + (H % A > 0)
print(res)
# -*- coding:utf-8 -*-
import sys

def dfs(x, y, sym):
	tile[x][y] = "."
	for i in range(len(DX)):
		nx = x + DX[i]
		ny = y + DY[i]
		if 0<=nx and nx<N and 0<=ny and ny<M and tile[nx][ny] is sym:
			dfs(nx, ny, sym)

def solve():
	res = 0
	for i in range(N):
		for j in range(M):
			sym = tile[i][j]
			if tile[i][j] != ".":
				if tile[i][j] is sym:
					dfs(i, j, sym)
					res += 1
	print(res)

counter=0
flg=1
DX = [-1, 0, 1, 0]
DY = [0, -1, 0, 1]
sys.setrecursionlimit(10000000)
while True:
	line = input()
	counter+=1
	if flg is 1:
		nums = line.split(" ")
		N = int(nums[0])
		M = int(nums[1])
		tile = [[0 for i in range(N)] for j in range(M)]
		flg=0
	else:
		tile[counter-2] = list(line)
	if N is 0 and M is 0:
		break
	if counter-1 is M:
		solve()
		flg=1
		counter = 0

### FIXED CODE ###

# -*- coding:utf-8 -*-
import sys
def dfs(x, y, sym):
	tile[x][y] = "."
	for i in range(len(DX)):
		nx = x + DX[i]
		ny = y + DY[i]
		if (0<=nx and nx<N and 0<=ny and ny<M and tile[nx][ny] is sym):
			dfs(nx, ny, sym)

def solve():
	res = 0
	for i in range(N):
		for j in range(M):
			sym = tile[i][j]
			if tile[i][j] != ".":
				if tile[i][j] is sym:
					dfs(i, j, sym)
					res += 1
	print(res)

counter=0
DX = [-1,0,1,0]
DY = [0,-1,0,1]
sys.setrecursionlimit(10**7)
while True:
	line = input()
	if " " in line:
		nums = line.split(" ")
		N = int(nums[0])
		M = int(nums[1])
		tile = [[0 for i in range(M)] for j in range(N)]
	else:
		tile[counter-1] = list(line)
	if N is 0 and M is 0:
		break
	counter += 1
	if counter-1 is N:
		solve()
		counter = 0
input_N_L = input()
#print( input_N_L )
N, L = map( int, input_N_L.split() )

#print( N )
#print( L )

str_set = []
for i in range( L ):
  str_set.append( input() )
#print( array )

sorted_str = ""
for s in sorted( str_set ):
  sorted_str += s
print( sorted_str )

### FIXED CODE ###

n, l = map( int, input().split( ' ' ) )
strs = sorted( [ input() for i in range(n) ] )
print( ''.join( strs ) )
w, h, x, y = list(map(int, input().split(" ")))

if w == 0 and y == 0:
	print(0,"1")
else:
	S = w*h/2.0
	if w%x == 0 and h%y == 0:
		print(S, "1")
	else:
		print(S, "0")

### FIXED CODE ###

w, h, x, y = list(map(int, input().split(" ")))

if x*2 == w  and y*2 == h:
	print(w*h/2.0, "1")
else:
	print(w*h/2.0, "0")
n=int(input())
k=int(input())
a=1
for i in range(1,n+1):
  if a >k:
    a=a+k
  else:
    a=2a
    
    





### FIXED CODE ###

n=int(input())
k=int(input())
a=1
for i in range(0,n):
    if a >k:
        a=a+k
    else:
        a=2*a
print(a)