Harryxun/stf_run huggingface dataset:
from math import gcd

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

ans = 1
n = d
for i in range(2, d + 1):
    if n % i == 0:
        ans += 1
        while n % i == 0:
            n //= i
    if n < i * i:
        if 1 < n:
            ans += 1
        break
print(ans)

### FIXED CODE ###

from fractions import gcd

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

ans = 1
n = d
for i in range(2, d + 1):
    if n % i == 0:
        ans += 1
        while n % i == 0:
            n //= i
    if n < i * i:
        if 1 < n:
            ans += 1
        break
print(ans)
S,T = int().split()
A,B = map(int,input().split())
U = input()

if U == S:
  A = A - 1
else:
  B = B - 1
print(A,B)



### FIXED CODE ###

S,T = input().split()
A,B = map(int,input().split())
U = input()

if U == S:
  A = A - 1
else:
  B = B - 1
print(A,B)
N = int(input())
A = [int(input()) for _ in range(N)]

print("second" if all(a[i] % 2 == 0 for i in range(N)) else "first")


### FIXED CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]

print("second" if all(A[i] % 2 == 0 for i in range(N)) else "first")
x = input()
printf x**3

### FIXED CODE ###

n = int(raw_input())

print n**3
import sys
l, r = map(int, input().split())
m = 2019

if r - l + 1 >= 2019 or l == 0:
    print(0)
else:
    min = (l%m * (l+1)%m)%m
    for i in range(l, r):
        if i%m == 0:
            print(0)
            sys.exit()
        for j in range(i+1, r+1):
            else:
                if min > (i%m * j%m)%m:
                    min = (i%m * j%m)%m
print(min)


### FIXED CODE ###

import sys
l, r = map(int, input().split())
m = 2019
min = 2019

if r - l >= 2019:
    print(0)
else:
    l, r = l%m, r%m
    for i in range(l, r):
        for j in range(i+1, r+1):
            if min > (i * j)%m:
                min = (i * j)%m
    print(min)
# -*- coding: utf-8 -*-
import sys
import collections

def main():
	N, Q = map(int, input().split(" "))
	S = input()
	S = list(S)
	gorlm_num = [1] * len(S)
	
	skill = []
	for _ in range(Q):
		t, d = input().split(" ")
		#print(gorlm_num)
		ttmp = S.count(t)
		ttmp_sub = 0
		for _ in range(ttmp):
			try :
				tmpS = S[ttmp_sub+1:]
				ins = tmpS.index(t)
				ttmp_sub += ins
			except : a = "a"
			else : a = "a"
				
			#print(ins)
				
			tt = gorlm_num[ins]
			gorlm_num[ins] = 0
			if d == "R" and ins != len(S)-1:
				gorlm_num[ins+1] += tt
			if d == "L" and ins != 0:
				gorlm_num[ins-1] += tt
				
	ans = 0
	for i in gorlm_num:
		ans = ans + i
		
	print(ans)
	
if __name__ == "__main__":
	main()
	

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
	
def main():
	N, Q = map(int, input().split())
	S = "_" + input() + "_"
	
	TD = []
	for _ in range(Q):
		tmp = input().split(" ")
		t = tmp[0]
		d = tmp[1]
		TD.append((t, d))
		
	TD.reverse()
	gake_L = 0
	gake_R = N - 1 + 2
	
	for i, val in enumerate(TD):
		t, d = val
		
		if d == "R":
			if t == S[gake_R-1]:
				gake_R -= 1
			if t == S[gake_L]:
				gake_L -= 1
		
		if d == "L":
			if t == S[gake_R]:
				gake_R += 1
			if t == S[gake_L+1]:
				gake_L += 1
	
	print(max(0, gake_R-gake_L-1))
	
	
if __name__ == "__main__":
	main()
import math
A,B=map(int,input().split())
Amin=A/0.08
Amax=(A+1)/0.08
Bmin=B/0.1
Bmax=(B+1)/0.1
print(Amin,Amax,Bmin,Bmax)
a=[]
b=[]
c=[]
"""
if int(Amin)==Amin:
    p=Amin
else:
    p=int(Amin)+1

if int(Bmin)==Bmin:
    q=Bmin
else:
    q=int(Bmin)+1
"""
p=int(Amin+1)
q=int(Bmin+1)
while p<=Amax:
    a.append(p)
    p+=1
while q<=Bmax:
    b.append(q)
    q+=1
for i in range(len(a)):
    if a[i] in b:
        c.append(a[i])
for i in range(len(b)):
    if b[i] in a:
        c.append(b[i])
print(min(c))


### FIXED CODE ###

import math
A,B=map(int,input().split())
Amin=A/0.08
Amax=(A+1)/0.08
Bmin=B/0.1
Bmax=(B+1)/0.1


if Amax<=Bmin or Bmax<=Amin:
    print(-1)
else:
  a=math.ceil(Amin)
  b=math.ceil(Bmin)
  if a<Bmax or b<Amax:
    print(max(a,b))
  else:
    print(-1)
N,K = map(int,input().split())
S = input()
N = len(S)
flag = int(S[0])
S_1 = [len(x) for x in S.split('0') if len(x) is not 0]
S_0 = [len(x) for x in S.split('1') if len(x) is not 0]

count = 0
for i in range(len(S_0)-K+1):
  if flag == 0:
    if i == 0:
      tmp = 0
    else:
      tmp = S_1[i-1]
    for j in range(i,i+K):
      if j == len(S_1):
        tmp += S_0[j]
      else:
        tmp += (S_0[j] + S_1[j])
  else:
    tmp = S_1[i+K]
    for j in range(i,i+K):
      tmp += (S_1[j] + S_0[j])
    
  if tmp > count:
    count = tmp
    
if len(S_0) == 0:
  print(S_1[0])
elif len(S_1) == 0:
  print(S_0[0])
else:
  print(count)

### FIXED CODE ###

#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate

def main():
    N, K = map(int, input().split())
    S = input()
    nums = []
    # 1の個数、0の個数を交互に記録していく
    if S[0] == '0': nums.append(0)
    i = 0
    while i < N:
        j = i
        while j < N and S[i]==S[j]:
            j += 1
        nums.append(j-i)
        i = j
    if S[-1] == '0': nums.append(0)
    # print(nums)
    nums = [0] + list(accumulate(nums))
    # print(nums)
    ans = 0
    
    for i in range(0,len(nums),2):
        # print(i)
        ans = max(ans,nums[min(i+2*K+1,len(nums)-1)]-nums[i])
    print(ans)
        

if __name__ == "__main__":
    main()
import math
A, B = map(int, input().split())
ans = int(A*B/math.gcd(A,B))
print(ans)

### FIXED CODE ###

import fractions
A, B = map(int, input().split())
ans = A*B//fractions.gcd(A,B)
print(ans)
S=str(input())

if S.count('R')==0
  print(0)
if S.count('R')==1
  print(1)
if S.count('R')==2 and moji.count('RR')!=1
  print(1)
if S.count('RR')==1
  print(2)
if S.count('RRR')==1
  print(3)
  

### FIXED CODE ###

S=str(input())
 
if S.count('R')==0:
  print(0)
if S.count('R')==1 :
  print(1)
if S.count('R')==2 and not S.count('RR') ==1:
  print(1)
if S.count('RR')==1 and not S.count('RRR')==1:
  print(2)
if S.count('RRR')==1:
  print(3)
#!/usr/bin/env python3
import sys
from functools import lru_cache

@lru_cache(maxsize=None)
def g(N, K):
    if N == K == 0:
        return tuple()
    if K < 0 or N <= 0:
        return None
    # ノードの周りにi個のノードを生やす
    t = 0
    for i in range(1, N+1):
        # ノードをi個足すとcomb(i,2)個の最短距離2の頂点対ができる
        t += i
        # 足したノードの内の1つから更にノードを生やす
        res = g(N-i, K-t)
        if res is not None:
            return res + (i,)
    return None

def f(N, K):
    '''
    >>> f(5, 3)
    (1, 1, 1, 0)
    >>> f(5, 8) # return None
    >>> f(3, 1)
    (1, 0)
    >>> f(4, 2)
    (1, 1, 0)
    >>> f(4, 3)
    (2, 0)
    >>> f(5, 4)
    (2, 1, 0)
    >>> f(5, 6)
    (3, 0)
    '''
    # 始め、ノードは1つあった
    n = N - 1
    t = 0
    for i in range(1, N):
        # ノードをi個生やすとcomb(i-1,2)個の最短距離2の頂点対ができる
        t += i - 1
        # 足したノードの内の1つから更にノードを生やす
        res = g(n-i, K-t)
        if res is not None:
            return res + (i-1,)
    return res

def solve(N: int, K: int):
    from itertools import count
    edges = []
    res = f(N, K)
    if res is None:
        print(-1)
        return
    edges = []
    for i in range(len(res)):
        edges.append((i+1, i+2))
    c = count(len(res)+1)
    for p, n in enumerate(res, 1):
        for _ in range(n-1):
            edges((p, next(c)))
    print(len(edges))
    for u, v in edges:
        print(u, v)




# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    test()
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

def solve(N: int, K: int):
    k = (N - 1) * (N - 2) // 2
    if k < K:
        return None
    edges = [(1, i) for i in range(2, N+1)]
    def f():
        for i in range(2, N+1):
            for j in range(i+1, N+1):
                yield i, j
    it = f()
    while k > K:
        edges.append(next(it))
        k -= 1
    return edges

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    edges = solve(N, K)
    if edges:
        print(len(edges))
        for e in edges:
            print(*e)
    else:
        print(-1)

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    test()
    main()
A,B,C=input().split()

if A[2]==B[0] and B[2]==C[0]:
    print('YES')
else :
    print('NO')

### FIXED CODE ###

A,B,C=input().split()

if A[-1]==B[0] and B[-1]==C[0]:
    print('YES')
else :
    print('NO')
n=int(input())
a=[input() for i in range(n)]
s=0
for i in raneg(n-1):
    if a[i][-1]!=a[i+1][0]:
        s+=1
a.sort()
for i in raneg(n-1):
    if a[i]==a[i+1]:
        s+=1
if s==0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n=int(input())
a=[input() for i in range(n)]
s=0
for i in range(n-1):
    if a[i][-1]!=a[i+1][0]:
        s+=1
a.sort()
for i in range(n-1):
    if a[i]==a[i+1]:
        s+=1
if s==0:
    print("Yes")
else:
    print("No")
a,b = map(int, input().split())
List = list(map(int, input().split()))
c = sum(List)
List = sorted(List)[::-1]
d = List(b-1)
if d < c/4/b:
	print("No")
else:
	print("Yes")

### FIXED CODE ###

a,b = map(int, input().split())
List = list(map(int, input().split()))
c = sum(List)
List = sorted(List)[::-1]
d = List[b-1]
if d < c/4/b:
	print("No")
else:
	print("Yes")
a,b=map(int,input().split())
grid=[["."]*(a+2)]+[list("."+input()+".")for i in range(b)]+[["."]*(a+2)]
for s in range(1,1+a):
    for t in range(1,1+b):
        if grid[s][t]=="#" and all([grid[s+x][t+y]=="."for x,y in ([0,-1],[0,1],[1,0],[-1,0])]):
            print("No")
            exit()
print("Yes")

### FIXED CODE ###

a,b=map(int,input().split());print(a-(b<a))
import collections

n=int(input())
b=[[0,0,0]]
a=[int(i) for i in input().split()]

def my_index(l, x):
    if x in l:
        return l.index(x)
    else:
        return -1

for i in range(n):
    k=b[-1].index(a[i])
    if k==-1:
        print(0)
        break
    c=[]
    for j in range(3):
        if j==k:
            c.append(b[-1][j]+1)
        else:
            c.append(b[-1][j])
    b.append(c)
else:
    x=1
    for i in range(n):
        x=x*b[i].count(a[i])%1000000007
    print(x)


### FIXED CODE ###

import collections

n=int(input())
b=[[0,0,0]]
a=[int(i) for i in input().split()]

def my_index(l, x):
    if x in l:
        return l.index(x)
    else:
        return -1

for i in range(n):
    k=my_index(b[-1],a[i])
    if k==-1:
        print(0)
        break
    c=[]
    for j in range(3):
        if j==k:
            c.append(b[-1][j]+1)
        else:
            c.append(b[-1][j])
    b.append(c)
else:
    x=1
    for i in range(n):
        x=x*b[i].count(a[i])%1000000007
    print(x)
def getMinCost(arr,i,k):
    if i <= 0: return 0
    mins = float("inf")
    for j in range(1,k+1):
        if j <= i:
            mins = min(mins,abs(arr[i]-arr[i-j]) + getMinCost(arr,i-j,k))
    return mins

n,k = map(int,input().split())
arr = [int(i) for i in input().split()]
print(getMinCost(arr,len(arr)-1,k))


### FIXED CODE ###

n,k = map(int,input().split())
arr = [int(i) for i in input().split()]
dp = [float("inf")] * n
dp[0] = 0
for i in range(n):
    for j in range(i+1,i+k+1):
        if j < n:
            dp[j] = min(dp[j],abs(arr[i]-arr[j]) + dp[i])
print(dp[n-1])
l = map(int,input().split());print(max(l[0]*l[1],l[2]*l[3]))

### FIXED CODE ###

a,b,c,d=map(int,input().split());print(max(a*b,c*d))
a, p = map(int, input().split())
 (a*3+p)//2
 

### FIXED CODE ###

a, p = map(int, input().split())
print((a*3+p)//2)
a,b=map(str,input().split())
n=int(a+b)
for i in range(0,110):
  if i**2==a:
    print('Yes')
   	exit()
print('No')
  

### FIXED CODE ###

a,b=map(str,input().split())
n=int(a+b)
for i in range(0,1000):
    if i**2==n:
        print('Yes')
        exit()
print('No')
from math import factorial

N = int(input())
nums = list(map(int, input().split()))
d = dict()

for num in nums:
    if num not in d:
        d[num] = 1
    else:
        d[num] += 1

total = 0
for i in d:
    n = d[i]
    if n == 2:
        total += 1
    elif n > 2:
        total += factorial(n) / factorial(2) / factorial(n - 2)

for num in nums:
    tmp = d[num] - 1
#    if tmp >= 2:
#        hoge = factorial(tmp) / factorial(2) / factorial(tmp - 2)
    print(total - tmp)


### FIXED CODE ###

import math

N = int(input())
nums = list(map(int, input().split()))
numsB = nums[:]
d = dict()

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for num in nums:
    if num not in d:
        d[num] = 1
    else:
        d[num] += 1

total = 0
for i in d:
    n = d[i]
    if n == 2:
        total += 1
    elif n > 2:
        total += combinations_count(n, 2)

for num in numsB:
    tmp = d[num] - 1
#    if tmp >= 2:
#        hoge = factorial(tmp) / factorial(2) / factorial(tmp - 2)
    print(int(total - tmp))
n,a,b=map(int,raw_input().split())
ab=a+b
s=list(raw_input())
p=0
r=[]
ro=0
for i in range(n):
    if s[i]=="a" and p<ab:
        r.append("Yes")
        p+=1
    elif s[i]=="b" and p<ab and ro<b:
        ro+=1
        p+=1
        r.append("Yes")
    elif s[i]=="c":
        r.append("No")
    else:
        r.append("No")
for i in range(n):
    print(r[i])


### FIXED CODE ###

s=list(raw_input())
c=list("CODEFESTIVAL2016")
t=0
for i in range(16):
    if s[i]!=c[i]:
        t+=1
print(t)
N,K=map(int,input().split())
alist=list(map(int,input().split()))
#print(alist)

def num_cut(x):
  ret=0
  for a in alist:
    ret+=-(-(a-x)//x)
  return ret

#for i in range(1,max(alist)):
#  print(i,num_cut(i))

l=1
r=max(alist)+1
while l<=r:
  mid=(l+r)//2
  #print(l,mid,r)
  
  if num_cut(mid-1)>K and num_cut(mid)<=K:
    print(mid)
    break
  elif num_cut(mid)<=K:
    r=mid
  else:
    l=mid

### FIXED CODE ###

N,K=map(int,input().split())
alist=list(map(int,input().split()))
#print(alist)

def num_cut(x):
  if x==0:
    return float("inf")
  
  ret=0
  for a in alist:
    ret+=-(-(a-x)//x)
  return ret

#for i in range(1,max(alist)):
#  print(i,num_cut(i))

l=1
r=max(alist)+1
while l<=r:
  mid=(l+r)//2
  #print(l,mid,r)
  
  if num_cut(mid-1)>K and num_cut(mid)<=K:
    print(mid)
    break
  elif num_cut(mid)<=K:
    r=mid
  else:
    l=mid
n=int(input())
c=[0]*10
for i in range(1:10):
    c[i]=(int(n**(1/i)))**i
    if c[i]>0:
        c[i]=0
print(max(c))

### FIXED CODE ###

x = int(input())
a =[1]
c = 1
n = 2
while c <= 33:
    n = 2
    c += 1
    while c**n<=1000:
        a.append(c**n)
        n += 1
for i in range(len(a)):
    if a[i] > x:
        a[i] = -1000
    else:
        a[i] -= x
print(a[a.index(max(a))]+x)
INPUT = list(map(int, input().split()))

N = INPUT[0]
X = INPUT[1]

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

count = 0

i = 0
value = 0
while(i <= N):
    if(value <= X):
        count += 1
        value += L[i]
    i += 1
print(count)

### FIXED CODE ###

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

N = INPUT[0]
X = INPUT[1]

L = list(map(int, input().split()))
count = 0

vvv = 0
i = 0
while(vvv <= X):
    count += 1
    if(i >= N):
        break
    vvv += L[i]
    i += 1

print(count)
n, k = map(int, input().split())

num = list(map(int, input().split()))
t = [-1] * n
count = 0
s = 1

while t[s - 1] == -1:
  if count == k:
    break

  t[s - 1] = count
  count += 1
  s = num[s - 1]
else:
  z = (k - t[s - 1]) % (count - t[s - 1])
  s = t.index(t[s - 1] + z + 1)
print(s)


### FIXED CODE ###

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

t_zero = [-1] * N

t = 0
a = 1

while t_zero[a-1] == -1:
  if t == K:
    break
  t_zero[a-1] = t
  t += 1
  a = A[a-1]
else:
  k = (K - t_zero[a-1]) % (t - t_zero[a-1])
  a = t_zero.index(t_zero[a-1] + k) + 1
print(a)
T = input()
S = []
if T[0] == "?" and T[1]=="D":
    S.append("P")
else:
    S.append(T[0])
for n in range(1,len(T)-1):
    if T[n] == "?" and S[n-1] == "P":
        S.append("D")
    elif T[n] == "?" and T[n+1] == "P":
        S.append("D")
    elif T[n] == "?":
        S.append("P")
    else:
        S.append(T[n])
if S[len(S)-1]=="P":
    S.append("D")
else:
    S.append("P")
print("".join(S))

### FIXED CODE ###

T = input()
S = []
for n in range(0,len(T)):
    if T[n] == "?":
        S.append("D")
    else:
        S.append(T[n])
print("".join(S))
import collections
N = int(input())
A = [int(_) for _ in input().split()]


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


d = collections.defaultdict(int)
for a in A:
    for x in prime_factorize(a):
        d[x] += 1
e = max(d.values())
if e == 1:
    ans = 'pairwise coprime'
elif e == N:
    ans = 'not coprime'
else:
    ans = 'setwise coprime'
print(ans)


### FIXED CODE ###

import collections
N = int(input())
A = [int(_) for _ in input().split()]


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


d = collections.defaultdict(int)
for a in A:
    for x in prime_factorize(a):
        d[x] += 1
if len(d):
    e = max(d.values())
if len(d) == 0 or e == 1:
    ans = 'pairwise coprime'
elif e == N:
    ans = 'not coprime'
else:
    ans = 'setwise coprime'
print(ans)
N = int(input())
A = list(map(int,input().split()))

import collections
import math

dicA = collections.Counter(A)

total = 0
for x in list(dicA.values()):
  total += math.factorial(x) // (math.factorial(x - 2)*2)

for i in range(N):
  print(total - dicA[A[i]] +1)
  

### FIXED CODE ###

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

import collections
import math

dicA = collections.Counter(A)

total = 0
for x in list(dicA.values()):
  if x != 1:
    total += math.factorial(x) // (math.factorial(x - 2)*2)

for i in range(N):
  print(total - dicA[A[i]] +1)
s = list(map(int, input().split()))
sort(s)
if s == [5, 7, 7]:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

s = list(map(int, input().split()))
s.sort()
if s == [5, 5, 7]:
  print("YES")
else:
  print("NO")
import sys

a, b, k = map(int, input().split())
l = []

for i in range(1, max(a,b)):
    if a%i == 0 and b%i == 0:
        l.append(i)
if l == []:
  print(1)
  sys.exit()
l.sort(reverse=True)
print(l[k-1])

### FIXED CODE ###

import sys

a, b, k = map(int, input().split())
l = []

for i in range(1, max(a,b)+1):
    if a%i == 0 and b%i == 0:
        l.append(i)
if l == []:
    print(1)
    sys.exit()
l.sort(reverse=True)
print(l[k-1])
A = []
n = int(raw_input())
stack = []
for i in range(n):
	A.append(raw_input())

for i in A:
	if "insert" in i:
		stack.insert(0, i[7:])
	elif "delete " in i:
		stack.remove(i[7:])
	elif "deleteFirst" in i:
		stack.pop(0)
	elif "deleteLast" in i:
		stack.pop()
print " ".join(stack)

### FIXED CODE ###

from collections import deque
n = int(raw_input())
stack = deque()
for i in range(n):
	i = raw_input()
	if "insert" in i:
		stack.appendleft(int(i[7:]))
	elif "delete " in i:
		if int(i[7:]) in stack:
		    stack.remove(int(i[7:]))
	elif "deleteFirst" in i:
		stack.popleft()
	elif "deleteLast" in i:
		stack.pop()
print " ".join(map(str, stack))
from heapq import heappush,heappop
h,w=map(int,input().split())
sx,sy=map(int,input().split())
sx-=1
sy-=1
gx,gy=map(int,input().split())
gx-=1
gy-=1
g=[list(input()) for _ in range(h)]
v=[[0 for j in range(w)] for i in range(h)]
v2=[[0 for j in range(w)] for i in range(h)]
q=[]
heappush(q,[0,sx,sy])
while q:
    c,x,y=heappop(q)
    if x==gx and y==gy:
        print(c)
        exit()
    if v[x][y]==1:
        continue
    v[x][y]=1
    for a in range(-2,3):
        for b in range(-2,3):
            if a==b==0:
                continue
            if a*b==0 and abs(a+b)==1:
                nx=x+a
                ny=y+b
                if 0<=nx<h and 0<=ny<w and g[nx][ny]=='.' and v[nx][ny]==0:
                    heappush(q,[c,nx,ny])
                continue
            nx=x+a
            ny=y+b
            if 0<=nx<h and 0<=ny<w and g[nx][ny]=='.' and v[nx][ny]==0 and v2[nx][ny]==0:
                heappush(q,[c+1,nx,ny])
                v2[nx][ny]=1
print(-1)

### FIXED CODE ###

import bisect
h,w,m=map(int,input().split())
hl=[0]*h
wl=[0]*w
s=[]
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    hl[a]+=1
    wl[b]+=1
    s.append([a,b])
mh=max(hl)
mw=max(wl)
hh=[]
ww=[]
for i in range(h):
    if hl[i]==mh:
        hh.append(i)
for i in range(w):
    if wl[i]==mw:
        ww.append(i)
f=0
for a,b in s:
    hi=bisect.bisect_left(hh,a)
    wi=bisect.bisect_left(ww,b)
    if hi!=len(hh) and hh[hi]==a and wi!=len(ww) and ww[wi]==b:
        f+=1
if len(hh)*len(ww)>f:
    print(mh+mw)
else:
    print(mh+mw-1)
s = input()
h = s//3600
m = (s-h*3600)//60
sec = (s-h*3600)%60 
print(+ ":" + ":" +)

### FIXED CODE ###

s = int(input())
print(str(s//3600) + ":" + str((s%3600)//60) + ":" + str(s%60))
D=input(int())
T=input(int())
S=input(int())

if S*T >=D:
  print('Yes)
else:
        print('No')

### FIXED CODE ###

D,T,S = input().split()

D = int(D)
T = int(T)
S = int(S)


if S*T >=D:
  print('Yes')
else:
  print('No')
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0
for i in range(0,n+1):
  if a[i] > b[i]:
    c = c + b[i]
  elif a[i] <= b[i]:
    c = c + a[i]
    b[i] = b[i] - a[i]
    if b[i] < a[i+1]:
      c = c + b[i]
      a[i+1] = a[i+1] - b[i]
    else:
      c = c + a[i+1]
      a[i+1] = 0
print(c)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0
for i in range(0,n):
  if a[i] > b[i]:
    c = c + b[i]
  elif a[i] <= b[i]:
    c = c + a[i]
    b[i] = b[i] - a[i]
    if b[i] < a[i+1]:
      c = c + b[i]
      a[i+1] = a[i+1] - b[i]
    else:
      c = c + a[i+1]
      a[i+1] = 0
print(c)
N, M, K = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

max_num = 0


def dfs(curr_a, curr_b, choice, time_required, count):
    global max_num
    if choice == 0:
        if curr_a >= N - 1:
            if max_num < count:
                max_num = count
            return
        else:
            curr_a += 1
            time_required += a[curr_a]
    else:
        if curr_b >= M - 1:
            if max_num < count:
                max_num = count
            return
        else:
            curr_b += 1
            time_required += b[curr_b]
    if time_required > K:
        if max_num < count:
            max_num = count
        return
    count += 1
    if max_num < count:
        max_num = count
    dfs(curr_a, curr_b, 0, time_required, count)
    dfs(curr_a, curr_b, 1, time_required, count)

curr_a = -1
curr_b = -1
time_required = 0
count = 0
dfs(curr_a, curr_b, 0, time_required, count)
curr_a = -1
curr_b = -1
time_required = 0
count = 0
dfs(curr_a, curr_b, 1, time_required, count)

print(max_num)

### FIXED CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)
a,b=input().split()
c,d=input().split()
print((a-c)*(b-d))

### FIXED CODE ###

a,b=input().split()
c,d=input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
print((a-c)*(b-d))
a,b = map(int, input().split())
import math
lcm = a * b / math.gcd(a, b)
print(int(lcm))

### FIXED CODE ###

import fractions
A, B = map(int, input().split())
print(A*B//fractions.gcd(A, B))