Harryxun/stf_run huggingface dataset:
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

def coprime(a, b):
    return gcd(a, b) == 1

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

A,B=map(int, input().split())
if A==B:
  print(0)
elif (A==1 and B!=1)or(A!=1 and B==1)or(coprime(A,B)):
  print(1)
else:
  A=make_divisors(A)
  B=make_divisors(B)
  C=list(set(A)&set(B))
  C.sort(reverse=True)
  count=0
  for i in range(len(C)):
    for j in range(i+1,len(C)):
      if (C[j]!=1)and(C[i]%C[j]==0):
        count=count+1
        break
print(len(C)-count)

### FIXED CODE ###

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

def coprime(a, b):
    return gcd(a, b) == 1

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

A,B=map(int, input().split())
if (A==1)or(B==1)or(coprime(A,B)):
  print(1)
else:
  A=make_divisors(A)
  B=make_divisors(B)
  C=list(set(A)&set(B))
  C.sort(reverse=True)
  count=0
  for i in range(len(C)):
    for j in range(i+1,len(C)):
      if (C[j]!=1)and(C[i]%C[j]==0):
        count=count+1
        break
  print(len(C)-count)
s = input()
if s[2] == s[3] and s[4] == s[5]:
  print('Yes')
else:
  print('No)

### FIXED CODE ###

from sys import stdin


inp = stdin.readline

t = inp().strip()

if t[2] == t[3] and t[4] == t[5]:
    print("Yes")
else:
    print("No")
import sys
from functools import lru_cache
inf = float('inf')

n, A, B, C, *l = map(int, sys.stdin.read().split())

@lru_cache
def cost(a, b, c, cnt, i):
    if i == n:
        if not (a and b and c): return inf
        return abs(A - a) + abs(B - b) + abs(C - c) + 10 * (cnt - 3)
    return min(cost(a, b, c, cnt, i+1), 
               cost(a+l[i], b, c, cnt+1, i+1),
               cost(a, b+l[i], c, cnt+1, i+1),
               cost(a, b, c+l[i], cnt+1, i+1))

def main():
    print(cost(0, 0, 0, 0, 0))

if __name__ ==  '__main__':
    main()

### FIXED CODE ###

import sys
from itertools import product

inf = float('inf')

n, *target = map(int, sys.stdin.readline().split())
target = [None] + target
*l,  = map(int, sys.stdin.read().split())

def main():
    costs = []
    for p in product(range(4), repeat=n):
        tmp = [[] for _ in range(4)]
        p = list(p)
        for i in range(n):
            tmp[p[i]].append(l[i])

        cost = [0] * 4
        for i in range(1, 4):
            if not tmp[i]:
                break
            cost[i] += 10 * (len(tmp[i]) - 1)
            cost[i] += abs(target[i] - sum(tmp[i]))
        else:
            costs.append(sum(cost))

    return min(costs)

if __name__ == '__main__':
    ans = main()
    print(ans)
n,w=map(int,input().split())
w_sub,v_sub=map(int,input().split())
w0=w_sub
inf=1000000001
x=[[inf,v_sub],[inf],[inf],[inf]]
for i in range(n-1):
    w_sub,v_sub=map(int,input().split())
    w_sub-=w0
    x[W_sub].append(v_sub)
for i in range(4):
    x[i].sort(key=lambda x:-x)
    x[i][0]=0
    l_sub=len(x[i])
    for j in range(1,l_sub):
        x[i][j]+=x[i][j-1]

ma=0
l3=len(x[3])
l2=len(x[2])
l1=len(x[1])
l0=len(x[0])
for i in range(l3):
    for j in range(l2):
        d=w-i*(w0+3)-j*(w0+2)
        if d>=0:
            for k in range(l1):
                d=w-i*(w0+3)-j*(w0+2)-k*(w0+1)
                if d>=0:
                    ma=max(ma,x[3][i]+x[2][j]+x[1][k]+x[0][min(d//w0,l0-1)])
                else:
                    break
        else:
            break

print(ma)


### FIXED CODE ###

n,w=map(int,input().split())
wv=[list(map(int,input().split())) for i in range(n)]
wv.sort(key=lambda x:-x[1])
wv.sort(key=lambda x:x[0])
#print(wv)
w0=wv[0][0]
x=[[0],[0],[0],[0]]
for i in range(n):
    if wv[i][0]==w0:
        k=wv[i][1]+x[0][-1]
        l=len(x[0])
        if l*w0<=w:x[0].append(k)
    elif wv[i][0]==w0+1:
        k=wv[i][1]+x[1][-1]
        l=len(x[1])
        if l*(w0+1)<=w:x[1].append(k)
    elif wv[i][0]==w0+2:
        k=wv[i][1]+x[2][-1]
        l=len(x[2])
        if l*(w0+2)<=w:x[2].append(k)
    else:
        k=wv[i][1]+x[3][-1]
        l=len(x[3])
        if l*(w0+3)<=w:x[3].append(k)
#print(x)
ma=0
for i in range(len(x[0])):
    for j in range(len(x[1])):
        for k in range(len(x[2])):
            for l in range(len(x[3])):
                ma_sub=0
                if i*w0+j*(w0+1)+k*(w0+2)+l*(w0+3)<=w:
                    ma_sub+=x[0][i]
                    ma_sub+=x[1][j]
                    ma_sub+=x[2][k]
                    ma_sub+=x[3][l]
                ma=max(ma,ma_sub)
print(ma)
N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

if N==1:
    f2 = T[0]

elif N==2:
    import math
    a,b = T[0], T[1]
    f=math.gcd(a,b)
    f2=a*b//f

else:
    for i in range(2,N):
        a,b=f2, T[i]
        f=math.gcd(a,b)
        f2=a*b//f

print(f2)


### FIXED CODE ###


N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
# print('T:',T)

if N==1:
    f2 = T[0]

elif N==2:
    import math
    a,b = T[0], T[1]
    f=math.gcd(a,b)
    f2=a*b//f

else:
    import math
    a,b = T[0], T[1]
    f=math.gcd(a,b)
    f2=a*b//f
    for i in range(2,N):
        a,b=f2, T[i]
        f=math.gcd(a,b)
        f2=a*b//f

print(f2)
a, b, x = map(int, input().split())
b += x-1-(b % x)
if a % x:
    a += x-(a % x)
print(max(b-a+1, 0)


### FIXED CODE ###

a,b,c=map(int,input().split())
if a%c==0:
 print((b-a)//c+1)
else:
 print((b-(a//c+1)*c)//c+1)
S, T= input().split()
A, B= map(int, input().split())
U= input().split()
 
if (S==U):
    print(A-1,B)
else if (T==U):
    print(A,B-1)

### FIXED CODE ###

S, T= input().split()
A, B= map(int, input().split())
U= input()
if (S == U):
    print(A-1,B)
elif (T == U):
    print(A,B-1)
else:
    print(A,B)
n=int(input())
a=list(map(int,input().split()))
M=max(a)
m=min(a)
if M>m+1:
  print("No")
elif M==m+1:
  cntm=a.count(m)
  cntM=n-cntm
  if cntm>m:
    print("No")
  elif cntm+cntM//2<M:
    print("No")
  else:
    print("Yes")
elif M==m:
  if m<=n//2:
    print("Yes")
  else if m==n-1:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
M=max(a)
m=min(a)
if M>m+1:
  print("No")
elif M==m+1:
  cntm=a.count(m)
  cntM=n-cntm
  if cntm>m:
    print("No")
  elif cntm+cntM//2<M:
    print("No")
  else:
    print("Yes")
elif M==m:
  if m<=n//2:
    print("Yes")
  elif m==n-1:
    print("Yes")
  else:
    print("No")
while 1:
    m=input().split()
    h=int(m[0])
    w=int(m[1])
    if a==0 & b==0:
      break
    for i in range(h):
       print("#"*w)
    
    


### FIXED CODE ###

while True:
    v=input().split()
    a=int(v[0])
    b=int(v[1])
    if a==0 and b==0:
       break
    for i in range (a):
        print('#'*b)
    print()
import math
import numpy
a, b, x = map(uint64, input().split())

res = 0    
res += math.floor((b-a)/x)

if a%x == 0:
    res += 1

if b%x == 0:
    res += 1


print(res)

### FIXED CODE ###

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

def f(n, x):
    if n >= 0:
        return (n//x) + 1
    else:
        return 0

print(f(b, x) - f(a-1, x))
import sys
sys.setrecursionlimit(10**6)

n = int(input())
#b = list(map(int, input().split()))
#n, m = map(int, input().split())
#s = input()
#s,t = input().split()
#
readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

MAX_N = 10**5*2+5
w = [0]*MAX_N

for _ in range(n):
    a,b = [int(i) for i in readline().split()]
    w[b] += a

s = 0
for i in range(MAX_N):
    if w[i]:
        s += w[i]
        if s > i:
            print('No')
            break
else:
    print('Yes')

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

n = int(input())

readline = sys.stdin.readline

d = {}

for _ in range(n):
    a,b = [int(i) for i in readline().split()]
    d[b] = d.get(b, 0) + a

d_sorted = sorted(d.items(), key=lambda x:x[0])

s = 0
for t, w in d_sorted:
    s += w
    if s > t:
        print('No')
        break
else:
    print('Yes')
ans=0.0
n=int(input())
for i in range(n):
  a, s = input().split()
  a = double(a)
  if s=="BTC" :
    a *= 380000.0
  ans += a
print(ans)

### FIXED CODE ###

ans=0.0
n=int(input())
for i in range(n):
  a, s = input().split()
  a = float(a)
  if s=="BTC" :
    a *= 380000.0
  ans += a
print(ans)
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

n,a,b,c=map(int,input().split())
L=[]
for _ in range(n):
    L.append(int(input()))

ans=99999
for i in range(4**len(L)+1):
    i_4_list=list(Base_10_to_n(i, 4).zfill(len(L)))
    at,bt,ct=[],[],[]
    for num,i_4 in enumerate(i_4_list):
        if i_4=='0':
            at.append(L[num])
        elif i_4=='1':
            bt.append(L[num])
        elif i_4=='2':
            ct.append(L[num])
        else:
            continue
    if min(len(at),len(bt),len(ct))>0:
        al=0
        al+=(len(at)+len(bt)+len(ct)-3)*10
        al+=(abs(sum(at)-a)+abs(sum(bt)-b)+abs(sum(ct)-c))
        if al < ans:
            ans=al
print(ans)

### FIXED CODE ###

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)

n,a,b,c=map(int,input().split())
L=[]
for _ in range(n):
    L.append(int(input()))

ans=99999
for i in range(4**len(L)):
    i_4_list=list(Base_10_to_n(i, 4).zfill(len(L)))
    at,bt,ct=[],[],[]
    for num,i_4 in enumerate(i_4_list):
        if i_4=='0':
            at.append(L[num])
        elif i_4=='1':
            bt.append(L[num])
        elif i_4=='2':
            ct.append(L[num])
        else:
            continue
    if min(len(at),len(bt),len(ct))>0:
        al=0
        al+=(len(at)+len(bt)+len(ct)-3)*10
        al+=(abs(sum(at)-a)+abs(sum(bt)-b)+abs(sum(ct)-c))
        if al < ans:
            ans=al
print(ans)
import fractions
t=1
for i in range(int(input())):
    s=int(input())
    t=t*s//math.gcd(s,t)
print(t)

### FIXED CODE ###

n=int(input())
t=1
for i in range(n):
    s=int(input())
    if t>s: a,b=t,s
    else: a,b=s,t
    
    while b!=0:
        a, b = b, a%b
    t=t*s//a
print(t)
a,b=[x for x in input().split()]
if a>=13:
    print(b)
elseif 6<=a<=12:
    print(b/2)
else:
    print(0)

### FIXED CODE ###

a,b=[int(x) for x in input().split()]
if a>=13:
    print(b)
elif 6<=a<=12:
    print(int(b/2))
else:
    print(0)
n=int(input())
t = list(map(int,input().split()))
m = int(input())
l = [list(map(int,input().split())) for i in range(m)]
print(sum(t)-t[l[0][0]-1]+l[0][1])
print(sum(t)-t[l[1][0]-1]+l[1][1])
print(sum(t)-t[l[2][0]-1]+l[2][1])

### FIXED CODE ###

a,b,c=input().split()
print(eval(a+b+c))
S = input()
K = int(input())

A = [" " for _ in range(K)]

zan = K
for i in range(len(S)):
  n = (ord('z') - ord(S[i]) + 1) % 26 # aに変換するのに必要な回数
  if zan >= n:
    zan -= n
    A[i] = 'a'
  else:
    A[i] = S[i]

if zan > 0:
  A[i] = chr((ord(A[i]) - ord('a') + zan)%26 + ord('a'))
print("".join(A))

### FIXED CODE ###

S = input()
K = int(input())

A = [" " for _ in range(len(S))]

zan = K
for i in range(len(S)):
  n = (ord('z') - ord(S[i]) + 1) % 26 # aに変換するのに必要な回数
  if zan >= n:
    zan -= n
    A[i] = 'a'
  else:
    A[i] = S[i]

if zan > 0:
  A[-1] = chr((ord(A[-1]) - ord('a') + zan)%26 + ord('a'))
print("".join(A))
N=int(input())
A=list(map(int,input().split()))
if N%2==0:
    n1=0
    n2=0
    for i in range(N):
        if i%2==0:
            n1=n1+A[i]
        else:
            n2=n2+A[i]
    #print(max(n1,n2))
else:
    #print(A[0],A[1])
    dp=[[-float("inf") for _ in range(3)] for _ in range(N+1)]
    if N==3:
        print(max(A[0],A[1],A[2]))
    elif N==1:
        print(A[0])
    else:
        for i in range(N):
            if i<3:
                if i==0:
                    dp[i][0]=A[0]
                if i==1:
                    dp[i][1]=A[0]
                    dp[i][0]=A[1]
                if i==2:
                    dp[i][2]=A[2]
                    dp[i][1]=A[1]
                    dp[i][0]=A[0]+A[1]
            else:
                for j in range(3):
                    if j==0:#ここでも2こずつ規則よく飛ばすと決めた
                        dp[i][0]=max(dp[i][0],dp[i-2][0]+A[i])
                    elif j==1:#1回だけ無茶した
                        dp[i][1]=max(dp[i][1],dp[i-2][1]+A[i],dp[i-3][0]+A[i])
                    else:
                        dp[i][2]=max(dp[i][2],dp[i-2][2]+A[i],dp[i-3][1]+A[i],dp[i-4][0]+A[i])
print(max(dp[N-1]))

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
if N%2==0:
    dp=[[-float("inf") for _ in range(2)] for _ in range(N+10)]
    if N==2:
        print(max(A[0],A[1]))
    else:
        for i in range(N):
            if i==0:
                dp[i][0]=A[0]
            elif i==1:
                dp[i][1]=A[1]
            elif i==2:
                dp[i][0]=A[0]+A[2]
            else:
                for j in range(2):
                    if j==0:
                        dp[i][0]=max(dp[i][0],dp[i-2][0]+A[i])
                    elif j==1:
                        dp[i][1]=max(dp[i][1],dp[i-2][1]+A[i],dp[i-3][0]+A[i])
        print(max(dp[N-1]))
else:
    #print(A[0],A[1])
    dp=[[-float("inf") for _ in range(3)] for _ in range(N+10)]
    if N==3:
        print(max(A[0],A[1],A[2]))
    else:
        for i in range(N):
            if i<4:
                if i==0:
                    dp[i][0]=A[0]
                if i==1:
                    dp[i][1]=A[1]
                if i==2:
                    dp[i][2]=A[2]
                    dp[i][0]=A[0]+A[2]
                if i==3:
                    dp[i][1]=max(dp[1][1]+A[3],dp[0][0]+A[3])
            else:
                for j in range(3):
                    if j==0:#ここでも2こずつ規則よく飛ばすと決めた
                        dp[i][0]=max(dp[i][0],dp[i-2][0]+A[i])
                    elif j==1:#1回だけ無茶した
                        dp[i][1]=max(dp[i][1],dp[i-2][1]+A[i],dp[i-3][0]+A[i])
                    else:
                        dp[i][2]=max(dp[i][2],dp[i-2][2]+A[i],dp[i-3][1]+A[i],dp[i-4][0]+A[i])
        print(max(dp[N-1]))
N=int(input())
li = list(map(int,input().split()))
num=[0]*N
num_ans=[0]*N

for i in range(max(li)+1):
  num[i]=li.count(i)
  num_ans[i]=(num[i]*(num[i]-1))/2
ans=sum(num_ans)

for k in range(N):
  num_k = li.count(li[k])
  before=num_k*(num_k-1)/2
  after=(num_k-2)*(num_k-1)/2
  print(int(ans-before+after))

### FIXED CODE ###

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

d = {}
for a in A:
  if a in d:
    d[a] += 1
  else:
    d[a] = 1

s = 0
for k in d:
    s += d[k] * (d[k] - 1) // 2

for i in range(N):
    t = d[A[i]]
    print(s - t * (t - 1) // 2 + (t - 1) * (t - 2) // 2)
S = int(input())
h = S / 3600
m = S / 60
s = S % 60
print(h, m, s, sep = :)

### FIXED CODE ###

S = int(input())
h = S //3600
m = S%3600 //60
s = S%60
print(h,m,s,sep=':')
a,b=input()
print('H' if a==H & b==H or a==D & b==D else 'D')


### FIXED CODE ###

a,_,b=input()
print('H' if a==b else 'D')
# AOJ ITP1_10_A

import math

def floatinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = float(a[i])
    return a

def main():
    data = floatinput()
    a = data[0]; b = data[1]; C = data[2]
    S = a * b * 0.5 * math.cos(math.radians(C))
    c = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(C)))
    L = a + b + c
    h = b * math.sin(math.radians(C))
    print(S); print(L): print(h)

if __name__ == "__main__":
    main()


### FIXED CODE ###

# AOJ ITP1_10_A

import math

def floatinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = float(a[i])
    return a

def main():
    data = floatinput()
    a = data[0]; b = data[1]; C = data[2]
    S = a * b * 0.5 * math.sin(math.radians(C))
    c = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(C)))
    L = a + b + c
    h = b * math.sin(math.radians(C))
    print(S); print(L); print(h)

if __name__ == "__main__":
    main()
def solve():
    A, B, K = map(int, input().split())
    ans = list(range(A,B+1))
    ans = sorted((set(ans[:K] + ans[-K:])), key=ans.index)

    for a in ans:
        print(a)


if __name__ == "__main__":
    solve()

### FIXED CODE ###

def solve():
    A, B, K = map(int, input().split())
    for i in range(A, min(A+K, B+1)):
        print(i)
    for j in range(max(A+K, B-K+1), B+1):
        print(j)


if __name__ == "__main__":
    solve()
import numpy as np

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

print(lcm(A, B))


### FIXED CODE ###

import numpy as np

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

print(np.lcm(A, B))
a = int(input())
if a == 25:
    print("Christmas")
elif a == 24:
    print("Christmas Eve")
elif a == 23:
    print("Christmas Eve Eve")
    else:
        print("Christmas Eve Eve Eve")

### FIXED CODE ###

a = int(input())
if a == 25:
    print("Christmas")
elif a == 24:
    print("Christmas Eve")
elif a == 23:
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")
# -*- coding: utf-8 -*-
S = str(input());l = len(S);Str = ""
for num in range(l):
    if S[num] != "?":
        Str += S[num]
    else:
        if num == 0:
            Str += "D"
        else:
            if Str[num-1] == "P":
                Str += "D"
            else:
                if S[num+1] == "P":
                    Str += "D"
                else:
                    Str += "P"
print(Str)

### FIXED CODE ###

# -*- coding: utf-8 -*-
S = str(input());l = len(S);Str = ""
for num in range(l):
    if S[num] != "?":
        Str += S[num]
    else:
        Str += "D"
print(Str)
print("Yes" if sorted(int(input())) < sorted(int(input()))[::-1] else "No")

### FIXED CODE ###

print("Yes" if sorted((input())) < sorted((input()))[::-1] else "No")
n = int(input())
A = list(map(int, input().split()))
cnt = 0

for i, j in enumerate(A)
  if i + 1 != j:
    cnt +=1
if cnt <= 2:
  print('YES')
else:
  print('NO')
  

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
cnt = 0
 
for i, j in enumerate(A):
  if i + 1 != j:
    cnt +=1
if cnt <= 2:
  print('YES')
else:
  print('NO')
import queue
import copy

vx = [0,1,0,-1];
vy = [1,0,-1,0];
q = queue.Queue()

hw = input().split(' ');
h = int(hw[0]);
w = int(hw[1]);
s = [ [0]*w for i in range(h)];
for i in range(h) :
	si = input();
	for j in range(w) :
		s[i][j] = si[j];

s_alt = copy.deepcopy(s);
ans = 0;
for sy in range(h) :
	for sx in range(w) :
		s = copy.deepcopy(s_alt);
		q_a = [0]*2;
		q_a[0] = sy;
		q_a[1] = sx;
		q.put(q_a);
		s[sy][sx] = 0;
		while not q.empty() :
			q_a = q.get();
			for i in range(4):
				ny = q_a[0] + vy[i];
				nx = q_a[1] + vx[i];
				if ny >= 0 and ny < h and nx >= 0 and nx < w and s[ny][nx] == '.':
					s[ny][nx] = s[q_a[0]][q_a[1]] + 1;
					q_b = [0]*2;
					q_b[0] = ny;
					q_b[1] = nx;
					q.put(q_b);
		max_path = 0;
		for i in range(h) :
			for j in range(w) :
				if s[i][j] == '#' :
					continue;
				elif s[i][j] > max_path :
					max_path = s[i][j];
		if max_path > ans :
			ans = max_path;

print(ans);

### FIXED CODE ###

import queue
import copy

vx = [0,1,0,-1];
vy = [1,0,-1,0];
q = queue.Queue()

hw = input().split(' ');
h = int(hw[0]);
w = int(hw[1]);
s = [ [0]*w for i in range(h)];
for i in range(h) :
	si = input();
	for j in range(w) :
		s[i][j] = si[j];

s_alt = copy.deepcopy(s);
ans = 0;
for sy in range(h) :
	for sx in range(w) :
		s = copy.deepcopy(s_alt);
		if s[sy][sx] == '.' :
			q_a = [0]*2;
			q_a[0] = sy;
			q_a[1] = sx;
			q.put(q_a);
			s[sy][sx] = 0;
			while not q.empty() :
				q_a = q.get();
				for i in range(4):
					ny = q_a[0] + vy[i];
					nx = q_a[1] + vx[i];
					if ny >= 0 and ny < h and nx >= 0 and nx < w and s[ny][nx] == '.':
						s[ny][nx] = s[q_a[0]][q_a[1]] + 1;
						q_b = [0]*2;
						q_b[0] = ny;
						q_b[1] = nx;
						q.put(q_b);
			max_path = 0;
			for i in range(h) :
				for j in range(w) :
					if s[i][j] == '#' :
						continue;
					elif s[i][j] > max_path :
						max_path = s[i][j];
			if max_path > ans :
				ans = max_path;

print(ans);
n, m = map(int, input().split())
if n == 1:
    print(m - 2)
    return
if m == 1:
    print(n - 2)
    return
print((n - 2) * (m - 2))


### FIXED CODE ###

n, m = map(int, input().split())
if n == 1:
    if m == 1:
        ans = 1
    else:
        ans = m - 2
elif m == 1:
    ans = n - 2
else:
    ans = (n - 2) * (m - 2)
print(ans)
N,M = map(int, input())

# Mの約数dのうち、Nd <= Mとなるものの最大

divisors = []
for d in range(1, M+1):
    if d*d > M:
        break
    divisors.append(d)
    divisors.append(M//d)

ans = 1

for d in divisors:
    if N*d <= M:
        ans = d

print(ans)

### FIXED CODE ###

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

# Mの約数dのうち、Nd <= Mとなるものの最大

divisors = []
for d in range(1, M+1):
    if d*d > M:
        break
    if M%d == 0:
        divisors.append(d)
        divisors.append(M//d)

ans = 1

divisors.sort()

for d in divisors:
    if N*d <= M:
        ans = d

print(ans)
import math as m
from functools import reduce

n = int(input())
l = []


def f(a, b):
    return int(a * b / m.gcd(a, b))


for i in range(n):
    l.append(int(input()))
print(reduce(f, l))






### FIXED CODE ###

import math as m
from functools import reduce
n,T= int(input()),[]
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
for i in range(n):
    T.append(int(input()))
tmp = max(T)
for i in range(n):
    if tmp % T[i] != 0:
        tmp = T[i]//gcd(tmp, T[i])*tmp

print(tmp)
n, m = [int(i) for i in input().split()]
 
 
def countPattern(s, cnt):
    if s > 1:
        cnt = countPattern(s-2, cnt)
        cnt = countPattern(s-1, cnt)
        return cnt
    else:
        return cnt + 1
 
 
ans = 1
a_pre = -1
for mi in range(m):
    a = int(input())
    if a == a_pre:
        break
    elif a == a_pre + 1:
        ans = 0
    ans = ans * countPattern(a-a_pre-2, 0) % 1000000007
    a_pre = a
 
a = n + 1
ans = ans * countPattern(a - a_pre - 2, 0) % 1000000007
 
print(ans)

### FIXED CODE ###

n, m = [int(i) for i in input().split()]

b = [0 for i in range(n+1)]

for mi in range(m):
    b[int(input())] = 1
cnt = 0
s = [0 for i in range(n+1)]
s[0] = 1
if b[1] == 0:
    s[1] = 1
else:
    s[1] = 0
for ni in range(2,n+1):
    if b[ni] == 0:
        s[ni] = (s[ni-1] + s[ni-2]) % 1000000007
    else:
        s[ni] = 0
print(s[n])
import sys
N, M = map(int, input().split())

num = []
for i in range(N) :
  num.append([0])

sc = []
for i in range(M) :
  sc.append(list(map(int, input().split()))) 

ans = ""

for n in sc :
  if n[1] not in num[n[0]-1] :
    num[n[0]-1].append(n[1])

if N >= and [1, 0] in sc :
  print('-1')
  sys.exit()
elif N >= 2 and num[0] == [0] :
  num[0].append(1)

for m in num :
  if len(m) >= 3 :
    print('-1')
    sys.exit()

if len(num[0]) == 1 :
  print('-1')
  sys.exit()
else :
  for l in range(N) :
    ans = ans + str(max(num[l]))

print(ans)

### FIXED CODE ###

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

num = []
for i in range(N) :
  num.append([0])

sc = []
for i in range(M) :
  sc.append(list(map(int, input().split()))) 

ans = ""

for n in sc :
  if n[1] not in num[n[0]-1] :
    num[n[0]-1].append(n[1])

if N >= 2 and [1, 0] in sc :
  print('-1')
  sys.exit()
elif N == 1 and num[0] == [0] :
  print('0')
  sys.exit()  
elif N >= 2 and num[0] == [0] :
  num[0].append(1)

for m in num :
  if len(m) >= 3 :
    print('-1')
    sys.exit()

if len(num[0]) == 1 :
  print('-1')
  sys.exit()
else :
  for l in range(N) :
    ans = ans + str(max(num[l]))

print(ans)
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))
N, X = map(int. input().split())
M =[int(input()) for i in range(N)]
X -= sum(M)
M.sort()
n = N
while X > M[-1]:
  n += 1
  X -= M[-1]
print(n)

### FIXED CODE ###

N, X = map(int, input().split())
M =[int(input()) for i in range(N)]
X -= sum(M)
M.sort()
n = N
while X >= M[0]:
  n += 1
  X -= M[0]
print(n)