Harryxun/stf_run huggingface dataset:
N, M = map(int, input().split())
a = [int(input()) for i in range(M)]
n = [0] * N
n[0] = 1
n[1] = 2

if 1 in a and N == 1:
    print(0)
    exit()
if 1 in a and 2 in a:
    print(0)
if 1 in a:
    n[0] = 0
    n[1] = 1

for i in range(N - 2):
    if i + 3 not in a:
        n[i + 2] = (n[i + 1] + n[i]) % 1000000007

print(n[N - 1])

### FIXED CODE ###

N, M = map(int, input().split())
a = set([int(input()) for i in range(M)])
n = [0] * (N + 1)
n[0] = 1
n[1] = 1

#listの中をinで探すのはくっそ遅い
if 1 in a:
    n[1] = 0

for i in range(2, N + 1):
    if i in a:
        continue
    else:
        n[i] = (n[i - 1] + n[i - 2]) % 1000000007

print(n[N])
20 3
0 5 15

### FIXED CODE ###

K,N = map(int,input().split())
A = list(map(int,input().split()))
B = [0 for i in range(N)]
C = 0
for i in range(N):
  if i == N-1:
    B[i] = A[0] + K - A[i]
  else:
    B[i] = A[i+1] - A[i]
  if B[i] > C:
    C = B[i]
print(K-C)
N = int(input())
H = [int(input()) for _ in range(N)]
cost = 0
for i in range(N-1):
  if H[i] > H[i+1]:
    cost += (H[i] - H[i+1])
cost += H[N-1]
print(cost)
    

### FIXED CODE ###

N = int(input())
H = list(map(int, input().split(' ')))
cost = 0
for i in range(N-1):
  if H[i] > H[i+1]:
    cost += (H[i] - H[i+1])
cost += H[N-1]
print(cost)
import sys

N, A, V = map(int, sys.argv[1:])
return (N*A) + V

### FIXED CODE ###

import sys

for line in sys.stdin:
  N, A, B = map(int, line.split())

print min(N*A, B)
a,b=map(int,input().split())
if a>=b:
	print(b)
else
	print(a)

### FIXED CODE ###

a,b=map(int,input().split())
if a==b:
	print(b)
elif b<a:
	print(a-1)
else:
	print(a)
a=int(input())
b=int(input())
h=int(input())

print(int((a+b)*h/2)

### FIXED CODE ###

a=int(input())
b=int(input())
h=int(input())

print(int((a+b)*h/2))
import sys

n=int(input())
xyh=[[] for i in range(n)]
for i in range(n):
    x,y,h=map(int,input().split())
    xyh[i].append(x)
    xyh[i].append(y)
    xyh[i].append(h)
for i in range(101):
    for j in range(101):
        f=0
        dis=[[i] for i in range(205)]
        for q in range(n):
            x=xyh[q][0]
            y=xyh[q][1]
            h=xyh[q][2]
            d=abs(x-i)+abs(y-j)
            if len(dis[d])==1 and h!=0:
                dis[d].append(h)
            elif dis[d][1]!=h:
                f=1
        
        dis=[dis[e] for e in range(205) if len(dis[e])!=1]
        m=len(dis)
        if m==1 and f==0:
            print(i,j,dis[0][0]+dis[0][1])
            sys.exit()
            
        else:
            if all(dis[e][0]+dis[e][1]==dis[e+1][0]+dis[e+1][1] for e in range(m-1)) and f==0:
                print(i,j,dis[0][0]+dis[0][1])
                sys.exit()
print(0,0,0)
                

        
        
        
          


### FIXED CODE ###

import sys

n=int(input())
xyh=[[] for i in range(n)]
for i in range(n):
    x,y,h=map(int,input().split())
    xyh[i].append(x)
    xyh[i].append(y)
    xyh[i].append(h)
for i in range(101):
    for j in range(101):
        f=0
        dis=[[i] for i in range(205)]
        for q in range(n):
            x=xyh[q][0]
            y=xyh[q][1]
            h=xyh[q][2]
            d=abs(x-i)+abs(y-j)
            
            if len(dis[d])==1:
                dis[d].append(h)
            elif len(dis[d])!=1 and dis[d][1]!=h:
                f=1
        
        dis=[dis[e] for e in range(205) if len(dis[e])!=1]
        m=len(dis)
        if m==1 and f==0:
            print(i,j,dis[0][0]+dis[0][1])
            sys.exit()
            
        else:
            if all(dis[e][0]+dis[e][1]==dis[e+1][0]+dis[e+1][1] for e in range(m-1) if dis[e+1][1]!=0) and f==0:
                print(i,j,dis[0][0]+dis[0][1])
                sys.exit()
x=int(input())
if x=1:
    print(0)
else:
    print(1)

### FIXED CODE ###

x=int(input())
if x==1:
    print(0)
else:
    print(1)
N, M, X = map(int, input().split(' '))
price, exp, rst = [], [ [] for i in range(N) ], -1
for i in range(N):
    ls = list(map(int, input().split(' ')))
    price.append(ls[0])
    exp[i] = ls[1:]
for i in range(1 << M):
    price_combi, exp_combi, exp_sum, cnt_ls = [], [], [0] * M, []
    for j in range(M):
        if i >> j & 1:
            price_combi.append(price[j])
            exp_combi.append(exp[j])
    for s in exp_combi:
        for t in range(M):
            exp_sum[t] += s[t]
    [ cnt_ls.append(x) for x in exp_sum if x >= X ]
    if len(cnt_ls) == M:
        if rst == -1:
            rst = sum(price_combi)
        else:
            rst = min(rst, sum(price_combi))
print(rst)

### FIXED CODE ###

N, M, X = map(int, input().split(' '))
price, exp, rst = [], [], -1
for i in range(N):
    ls = list(map(int, input().split(' ')))
    price.append(ls[0])
    exp.append(ls[1:])
for i in range(1 << N):
    price_combi, exp_combi, exp_rst, cnt = [], [], [0] * M, []
    for j in range(N):
        if (i >> j) & 1:
            price_combi.append(price[j])
            exp_combi.append(exp[j])
    for s in range(len(exp_combi)):
        for t in range(M):
            exp_rst[t] += exp_combi[s][t]
    [cnt.append(i) for i in exp_rst if i >= X]
    if len(cnt) == M:
        if rst == -1:
            rst = sum(price_combi)
        else:
            rst = min(rst, sum(price_combi))
print(rst)
def solve(string):
    n, *ab = map(int, string.split())
    a, b = ab[:n + 1], ab[n + 1:]
    _sum = sum(a)
    for i, _b in enumerate(b[::-1]):
        if a[n - i] < _b:
            _b -= a[n - i]
            a[n - i] = 0
            a[n - i - 1] = max(0, a[n - i - 1] - _b)
        else:
            a[n - i] -= _b
    return str(_sum - sum(a))


if __name__ == '__main__':
    n = int(input())
    print(solve('{}\n'.format(n) + '\n'.join([input() for _ in range(n)])))


### FIXED CODE ###

def solve(string):
    n, *ab = map(int, string.split())
    a, b = ab[:n + 1], ab[n + 1:]
    _sum = sum(a)
    for i, _b in enumerate(b[::-1]):
        if a[n - i] < _b:
            _b -= a[n - i]
            a[n - i] = 0
            a[n - i - 1] = max(0, a[n - i - 1] - _b)
        else:
            a[n - i] -= _b
    return str(_sum - sum(a))


if __name__ == '__main__':
    n = int(input())
    print(solve('{}\n'.format(n) + '\n'.join([input() for _ in range(2)])))
s = str(input())
n = len(s)
i = 0
d = ["dream", "dreamer"]
e = ["erase", "eraser"]
while i<n:
    if s[i]=="d":
        if s[i:i+5]==d[0]:
            i+=5
        else:
            break

        if s[i:i+3]=="era":
            continue
        elif s[i:i+2]!="er" and s[i+2]=="e":
            i+=2
        else:
            break
    elif s[i]=="e":
        if s[i:i+5]==e[0]:
            i+=5
        else:
            break

        if s[i:i+1]=="r":
            i+=1
        else:
            continue
    else:
        break
if i<n:
    print("NO")
else:
    print("YES")

### FIXED CODE ###

s = list(input())
n = len(s)
s.reverse()
for i in range(6):
    s.append("x")
s = "".join(s)
i = 0
word = ["maerd", "esare", "resare","remaerd"]
while i<n:
    if s[i:i+5]==word[0]:
        i+=5
    elif s[i:i+5]==word[1]:
        i+=5
    elif s[i:i+6]==word[2]:
        i+=6
    elif s[i:i+7]==word[3]:
        i+=7
    else:
        print("NO")
        exit()
print("YES")
a,b,c=input().split()
if a*b<=c:
  print(int(a*b))
else:
  print(c)

### FIXED CODE ###

a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if a*b<=c:
  print(int(a*b))
else:
  print(c)
N,M=map(int,input().split())
A=list(map(int,input().split()))

count=[0]*M#あまりが0~M-1
S=[0]*(N+1)

for i in range(N):
    S[i+1]=S[i]+A[i]
    S[i+1]%=M
    
ans=0
for i in range(N+1):
    ans+=count[S[i]]
    count[S[i]]+=1
    
print(ans)
    

### FIXED CODE ###

from collections import defaultdict

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

dd = defaultdict(int)#あまりをカウント
S=[0]*(N+1)

for i in range(N):
    S[i+1]=S[i]+A[i]
    S[i+1]%=M
    
ans=0
for i in range(N+1):
    ans+=dd[S[i]]
    dd[S[i]]+=1
    
print(ans)
import collections

x = collections.deque(input())
n = int(input())

for i in range(n):
    y = input()
    if len(y) == 1:
      x.reverse()
    else:
      if int(y[1]) == 2:
          x.append(y[2])
      else:
          x.appendleft(y[2])

print("".join(x))

### FIXED CODE ###

import collections

x = collections.deque(input())
n = int(input())
rev = False

for i in range(n):
    y = input().split()
    if len(y) == 1:
      rev = not rev
    elif rev:
      if int(y[1]) == 2:
          x.appendleft(y[2])
      else:
          x.append(y[2])
    else:
      if int(y[1]) == 2:
          x.append(y[2])
      else:
          x.appendleft(y[2])

if rev:
  x.reverse()

print("".join(x))
s = input()
n = len(s)
p = 0
for e in s:
  if e == 'p':
    p += 1
print(s//2 - p)

### FIXED CODE ###

s = input()
n = len(s)
p = 0
for e in s:
  if e == 'p':
    p += 1
print(n//2 - p)
def printing(a_start, a_2, n):

    a_3 = []
    mod_list = []
    for i in range(len(a_2)):
        if a_2[i][1] % a_start[1] not in mod_list and a_2[i][1] % a_start[1] != 0:
            a_3.append(a_2[i])
            mod_list.append(a_2[i][1] % a_start[1])
    a_3.sort(key=lambda x: x[1], reverse=True)


    if a_start[0] + a_3[-1][0] < n and len(a_3) >= 2:
        if a_3[0][0] < a_3[1][0] and a_3[1][0] > a_start[0]:
            a_3.pop(0)


    ans = ""
    while n % a_start[1] != 0:
        for i in range(len(a_3)):
            if n % a_start[1] >= a_3[i][1] % a_start[1]:
                n -= a_3[i][1]
                ans += str(a_3[i][0])
                break
            elif n % a_start[1] == 0:
                break
        else:
            n -= a_3[0][1]
            ans += str(a_3[0][0])

    ans = ans + str(a_start[0]) * (n // a_start[1])
    ans_list = sorted([ans[i] for i in range(len(ans))], reverse=True)
    print("".join(ans_list))

def main():
    n, m = [int(i) for i in input().split()]
    a = sorted([int(i) for i in input().split()], reverse=True)
    number = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
    a_list = []
    a_2 = []

    for i in range(m):
        if number[a[i]] not in a_list:
            a_2.append([a[i], number[a[i]]])
            a_list.append(number[a[i]])
    a_2.sort(key=lambda x: x[1])
    a_start = a_2.pop(0)
    printing(a_start, a_2, n)

main()




### FIXED CODE ###

def printing(a_start, a_2, n):

    a_3 = []
    mod_list = []
    for i in range(len(a_2)):
        if a_2[i][1] % a_start[1] not in mod_list and a_2[i][1] % a_start[1] != 0:
            a_3.append(a_2[i])
            mod_list.append(a_2[i][1] % a_start[1])
    a_3.sort(key=lambda x: x[1], reverse=True)


    if len(a_3) >= 2:
        if a_start[0] + a_3[-1][0] < n and a_3[0][0] < a_3[1][0] and a_3[1][0] > a_start[0]:
            a_3.pop(0)


    ans = ""
    while n % a_start[1] != 0:
        for i in range(len(a_3)):
            if n % a_start[1] >= a_3[i][1] % a_start[1]:
                n -= a_3[i][1]
                ans += str(a_3[i][0])
                break
            elif n % a_start[1] == 0:
                break
        else:
            n -= a_3[0][1]
            ans += str(a_3[0][0])

    ans = ans + str(a_start[0]) * (n // a_start[1])
    ans_list = sorted([ans[i] for i in range(len(ans))], reverse=True)
    print("".join(ans_list))

def main():
    n, m = [int(i) for i in input().split()]
    a = sorted([int(i) for i in input().split()], reverse=True)
    number = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
    a_list = []
    a_2 = []

    for i in range(m):
        if number[a[i]] not in a_list:
            a_2.append([a[i], number[a[i]]])
            a_list.append(number[a[i]])
    a_2.sort(key=lambda x: x[1])
    a_start = a_2.pop(0)
    printing(a_start, a_2, n)

main()
def input(): return sys.stdin.readline().rstrip()

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

ans = 0
for i in range(n):
    a = A[i]
    ato = i+a
    if i+a > n:
        ato = n
    for j in range(ato,n):
        if j-i == A[i]+A[j]:
            ans += 1

print(ans)



 

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
 
X = dict()
ans = 0
for i in range(N):
    L = i + A[i]
    if L not in X:
        X[L] = 1
    else:
        X[L] += 1

for j in range(N):
    R = j - A[j]
    if R in X:
        ans += X[R]

print(ans)
# coding: utf-8
n=int(input())
D=list(map(int,input().split()))
m=int(input())
T=list(map(int,input().split()))
d={}
t={}
for d_ in D:
    if str(d_) in d:
        d[str(d_)]+=1
    else:
        d[str(d_)] = 1
for t_ in T:
    if str(t_) in t:
        t[str(t_)]+=1
    else:
        t[str(t_)] = 1

D_=list(set(D))
T_=list(set(T))
flg=True
if len(T_) > len(D_):
    flg=False
if flg:
    for t_ in T_:
        #print(t_)
        #print(t[str(t_)], d[str(t_)])
        if t[str(t_)] <= d[str(t_)]:
            pass
        else:
            flg=False
if flg:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

# coding: utf-8
import collections
n=int(input())
D=list(map(int,input().split()))
m=int(input())
T=list(map(int,input().split()))
T_=list(set(T))
c = collections.Counter(D)
c2 = collections.Counter(T)
flg=True
for t in T_:
    #print(c[t], c2[t])
    if c[t] < c2[t]:
        flg=False
if flg:
    print("YES")
else:
    print("NO")
s = input()
K = int(input())


def brute_force(s, K):
    substring_set = set()

    # brute-force
    for start in range(len(s)):
        # 5まででよかった...
        for length in range(len(s) - start + 1):
            if length == 0:
                substring = s[start]
            else:
                substring = s[start:start+length]
            substring_set.add(substring)
            if length == 4:
                break

    substring_list = sorted(list(substring_set))
    print(substring_list[K - 1])

brute_force(s, K)

### FIXED CODE ###

s = input()
K = int(input())


def brute_force(s, K):
    substring_set = set()

    # brute-force
    for start in range(len(s)):
        # 5まででよかった...
        for length in range(1, 6):
            substring = s[start:start+length]
            substring_set.add(substring)

    substring_list = sorted(list(substring_set))
    print(substring_list[K - 1])

brute_force(s, K)
def get(i, value, vis):
    if vis[i]:
        return value[i]
    vis[i] = True
    ans = 0
    for j in adj[i]:
        ans = max(ans, 1+get(j, value, vis))
    value[i] = ans
    return ans


n, m = map(int, input().split())
adj = {}
for i in range(n):
    adj[i] = []
for i in range(m):
    x, y = map(int,input().split())
    adj[x-1].append(y-1)
vis = [False for i in range(n)]
value = [0 for i in range(n)]
for i in range(n):
    value[i] = get(i, value, vis)
x = 0
for i in value:
    x = max(x, i)
print(x)

### FIXED CODE ###

from sys import stdin, setrecursionlimit as srl
from threading import stack_size
srl(int(1e9)+7)
stack_size(int(1e8))

def get(i, value, vis):
    if vis[i]:
        return value[i]
    vis[i] = True
    ans = 0
    for j in adj[i]:
        ans = max(ans, 1+get(j, value, vis))
    value[i] = ans
    return ans


n, m = map(int, input().split())
adj = {}
for i in range(n):
    adj[i] = []
for i in range(m):
    x, y = map(int,input().split())
    adj[x-1].append(y-1)
vis = [False for i in range(n)]
value = [0 for i in range(n)]
for i in range(n):
    value[i] = get(i, value, vis)
x = 0
for i in value:
    x = max(x, i)
print(x)
K, X = input().split()
G = 500 * int (K)
if G > X:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

K, X = input().split()
G = 500 * int(K)
if G >= int(X):
    print("Yes")
else:
    print("No")
bilding = [[[0 for x in range(10)] for x in range(3)]for x in range(4)]

n = int(input())
for i in range(n):
    b, f, r, v = map(int, raw_input().split())
    bilding[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        print(" "+" ".join(str,bilding[i][j]))
    if i % 4 != 0:
        print "#"*20

### FIXED CODE ###

bilding = [[[0 for x in range(10)] for x in range(3)]for x in range(4)] 
n = int(input())
for k in range(n):
    b, f, r, v = map(int, raw_input().split())
    bilding[b-1][f-1][r-1] += v

for b in range(4):
    for f in range(3):
        print(" "+" ".join(map(str, bilding[b][f])))
    if b != 3:
        print("#"*20)
import heapq
from itertools import accumulate
n, k = map(int, input().split())
vs = list(map(int, input().split()))
vs_hq = vs.copy()
rsw_l = list(accumulate(vs))
rsw_r = vs.copy()
for i in reversed(range(n-1)):
    rsw_r[i] = rsw_r[i+1] + rsw_r[i]
rsw_l = [0] + rsw_l
rsw_r = rsw_r + [0]
n_minus_l = [0]*n
if vs[0] < 0:
    n_minus_l[0] = 1
for i in range(1,n):
    if vs[i] < 0:
        n_minus_l[i] = n_minus_l[i-1] + 1
    else:
        n_minus_l[i] = n_minus_l[i - 1]
n_minus_l = [0] + n_minus_l
n_minus_r = [0]*n
if vs[n-1] < 0:
    n_minus_r[n-1] = 1
for i in reversed(range(n-1)):
    if vs[i] < 0:
        n_minus_r[i] = n_minus_r[i+1] + 1
    else:
        n_minus_r[i] = n_minus_r[i+1]
n_minus_r = n_minus_r + [0]
res = 0
for i in range(min(n,k)+1):
    for j in range(k-i+1):
        tmp = rsw_l[i] + rsw_r[n-j]
        n_dis = min(k-i-j,n_minus_l[i]+n_minus_r[n-j])
        arr = []
        if i > 0:
            arr += vs[:i]
        if j > 0:
            arr += list(reversed(vs))[:j]
        if arr != []:
            tmp -= sum(sorted(arr)[:n_dis])
        res = max(res,tmp)
print(res)

### FIXED CODE ###

from itertools import accumulate
n, k = map(int, input().split())
vs = list(map(int, input().split()))
res = 0
for i in range(min(n,k)+1):
    for j in range(min(n-i,k-i)+1):
        res_tmp = 0
        arr = []
        if i > 0:
            arr += vs[:i]
        if j > 0:
            arr += vs[(n-j):]
        if arr != []:
            arr.sort()
            n_len = len(arr)
            for m in range(min(k-i-j,n_len)):
                if arr[m] >= 0:
                    break
                res_tmp -= arr[m]
            res_tmp += sum(arr)
        res = max(res,res_tmp)
print(res)
n, m = map(int, input().split())
s = []
c = []
for i in range(m):
    t, d = map(int, input().split())
    s.append(t)
    c.append(d)
a = -2
for i in range(m-1):
    for j in range(i+1, m):
        if s[i] == s[j]:
            if c[i] != c[j]:
                a = -1
if a == -2:
    if n == 1:
        a = c[0]
    if n == 2:
        for i in range(10, 100):
            b = 0
            for j in range(m):
                if s[j] == 1:
                    if i//10 == c[j]:
                        b += 1
                else:
                    if i%10 == c[j]:
                        b += 1
            if b == m:
                a = i
                break;
    if n == 3:
        for i in range(100, 1000):
            b = 0
            for j in range(m):
                if s[j] == 1:
                    if i//100 == c[j]:
                        b += 1
                elif s[j] == 1:
                    if (i//10)//10 == c[j]:
                        b += 1
                else:
                    if i%10 == c[j]:
                        b += 1
            if b == m:
                a = i
                break;
if a == -2:
    a = -1
print(a)

### FIXED CODE ###

n, m = map(int, input().split())
s = []
c = []
for i in range(m):
    t, d = map(int, input().split())
    s.append(t)
    c.append(d)
a = -2
if m == 0:
    if n == 1:
        a = 0
    elif n == 2:
        a = 10
    else:
        a = 100
else:
    for i in range(m-1):
        for j in range(i+1, m):
            if s[i] == s[j]:
                if c[i] != c[j]:
                    a = -1
    if a == -2:
        if n == 1:
            a = c[0]
        if n == 2:
            for i in range(10, 100):
                b = 0
                for j in range(m):
                    if s[j] == 1:
                        if i//10 == c[j]:
                            b += 1
                    else:
                        if i%10 == c[j]:
                            b += 1
                if b == m:
                    a = i
                    break;
        if n == 3:
            for i in range(100, 1000):
                b = 0
                for j in range(m):
                    if s[j] == 1:
                        if i//100 == c[j]:
                            b += 1
                    elif s[j] == 2:
                        if (i//10)%10 == c[j]:
                            b += 1
                    else:
                        if i%10 == c[j]:
                            b += 1
                if b == m:
                    a = i
                    break;
    if a == -2:
        a = -1
print(a)
w, h, n = map( int, input().split())
l = 0,r = w,d = 0,u = h
for _ in range(n):
    x, y, a = map( int, input().split())
    if a == 1:
        l = max(l,x)
    elif a == 2:
        r = min(r,x)
    elif a == 3:
        d = max(d,y)
    else:
        u = min(u,y)
if r-l <= 0 or u-d <= 0:
    print(0)
else:
    print(max(0,(r-l)*(u-d)))

### FIXED CODE ###

w, h, n = map( int, input().split())
l = 0
r = w
d = 0
u = h
for _ in range(n):
    x, y, a = map( int, input().split())
    if a == 1:
        l = max(l,x)
    elif a == 2:
        r = min(r,x)
    elif a == 3:
        d = max(d,y)
    else:
        u = min(u,y)
if r-l <= 0 or u-d <= 0:
    print(0)
else:
    print(max(0,(r-l)*(u-d)))
# coding: utf-8

n, q = map(int, input().split())
s = input()

[0]*(n+1)
for i in range(n):
    if s[i:i+2] == 'AC':
        i[i+1] = i[i] + 1
    else:
        i[i+1] = i[i]

for i in range(q):
    l,r = (map(int, input().split()))
    ans = t[r-1] - t[l-1]
    print(ans)


### FIXED CODE ###

# coding: utf-8

n, q = map(int, input().split())
s = input()

t = [0]*(n+1)
for i in range(n):
    if s[i:i+2] == 'AC':
        t[i+1] = t[i] + 1
    else:
        t[i+1] = t[i]

for i in range(q):
    l,r = (map(int, input().split()))
    ans = t[r-1] - t[l-1]
    print(ans)
import sys
import numpy as np
from fractions import gcd
a, b = [int(i) for i in sys.stdin.readline().split()]
_gcd = gcd(a,b)
memo_ls = np.zeros(_gcd).flatten()
#memo_set = set()
cnt = 0
if _gcd == 1:
    print(1)
else:
    for i in range(2, _gcd+1):
        if _gcd % i == 0 and memo_ls[i-1] != 1:
            memo_ls[i-1::i] = 1
            cnt += 1
            #memo_set.add(i)
    #print(memo_set)
    print(cnt + 1)

### FIXED CODE ###

import sys
from fractions import gcd
def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a

def main(a, b):
    #a, b = [int(i) for i in sys.stdin.readline().split()]
    _gcd = gcd(a,b)
    #memo_ls = [0 for i in range(_gcd)]
    #memo_set = set()
    cnt = 0
    if _gcd == 1:
        print(1)
    else:
        res = prime_factorize(_gcd)
        print(len(res) + 1)
if __name__ == "__main__":
    a, b = [int(i) for i in sys.stdin.readline().split()]
    main(a, b)
import math
a = []
b = []
toki = []
h, n = map(int, input().split())
for i in range(n):
  ai, bi =  map(float, input().split())
  toki.append((ai, bi))

def yeah(hp, toki):
  mp = 0
  dps = 0
  kou = 0
  for ai, bi in toki:
    t = ai
    if (hp - ai) <= 0:
      t = hp
    dps2 = float(t/bi)
    if dps <= dps2:
      dps = dps2
      mp = bi
      kou = t
  return (hp-kou, mp)
mp = 0
zan = h
while True:
  zan, mp2 = yeah(zan, toki)
  mp += mp2
  if zan <=0:
    break
print(int(mp))
  

### FIXED CODE ###

import math 
h = int(input())
ans = 0
t = int(math.log2(h)+1)

for i in range(t):
  ans += 2**i
print(ans)
n = int(input())
print(sum(list(range(n))))

### FIXED CODE ###

n = int(input())
print(n*(n-1)//2)
import sys
for l in sys.stdin:
    a,b,c,d,e,f = map(int, l.split())
    x = (c*e -f*b) / (a*e - d*b)
    y = (f - d*x) / e
    print "%f %f" %(round(x,3), round(y,3))
 

### FIXED CODE ###

import sys
for l in sys.stdin:
    a,b,c,d,e,f=map(float,l.split())
    x=a*e-b*d
    print"%0.3f %0.3f"%(c*e/x-b*f/x,a*f/x-c*d/x)