Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python3
#abc126 e

N,M = list(map(int,input().split()))
XYZ = [list(map(int,input().split())) for _ in range(M)]

G = [[] for _ in range(N)]

for i in XYZ:
    G[i[0]-1].append(i[1])
    G[i[1]-1].append(i[0])

check = [False for _ in range(N)]#各頂点を訪問したかどうか
def DFS(G,s):
    check[s-1] = True
    for i in G[s-1]:
        if not check[i-1]:
            DFS(G,i)
    return
ans = 0
for i in range(1,N+1):
    if not check[i-1]:
        DFS(G,i)
        ans += 1
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
#abc126 e

import sys
sys.setrecursionlimit(1000000)
N,M = list(map(int,input().split()))
XYZ = [list(map(int,input().split())) for _ in range(M)]

G = [[] for _ in range(N)]

for i in XYZ:
    G[i[0]-1].append(i[1])
    G[i[1]-1].append(i[0])

check = [False for _ in range(N)]#各頂点を訪問したかどうか

def DFS(G,s):
    check[s-1] = True
    for i in G[s-1]:
        if not check[i-1]:
            DFS(G,i)
ans = 0
for i in range(N):
    if not check[i]:
        DFS(G,i+1)
        ans += 1
print(ans)
N = int(input())
A = list(map(int,input().split()))

x = 1
y = 10**18

for i in A:
  x = x*i  

if (x>y) :
    print(-1)
else:
    print(x)


### FIXED CODE ###

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

print(A*B)
a , b, x = map(int,input().split())

if x >= 1000000000:
    print(10**9)
else:
    for n in range(1,10**9):
        l = len(str(n))
        if x <= a * n + b * l:
            ans = n - 1
            break
    print(ans)

### FIXED CODE ###

s = str(input())

if s == 'SUN':
    print(7)
elif s == 'MON':
    print(6)
elif s == 'TUE':
    print(5)
elif s == 'WED':
    print(4)
elif s == 'THU':
    print(3)
elif s == 'FRI':
    print(2)
elif s == 'SAT':
    print(1)
N, M = map(int, input().split())
A = list(map(int, input().split()))

# 数字kに対するマッチ必要本数を返す
def num(k):
    costs = [2, 5, 5, 4, 5, 6, 3, 7, 6]
    return costs[k-1]

# 動的計画法
# dp(i) := i本の最大桁数(i = 0,1,...,N)
# constructor
inf = 1000
dp = [-inf for _ in range(N+1)]
dp[0] = 0

costs = [num(k) for k in A]
for i in range(1, N+1):
    for cost in costs:
        if i - cost < 0:
            pass
        else:
            temp = dp[i - cost] + 1
            dp[i] = max(dp[i], temp)

ans = ''
many = N
for _ in range(dp[N]): # 各桁
    for k in sorted(A, reverse=True):
        if dp[many - num(k)] == dp[many] - 1:
            ans += str(k)
            many -= num(k)
            break
        else:
            pass

print(ans)


### FIXED CODE ###

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

# 数字kに対するマッチ必要本数を返す
def num(k):
    costs = [2, 5, 5, 4, 5, 6, 3, 7, 6]
    return costs[k-1]

# 動的計画法
# dp(i) := i本の最大桁数(i = 0,1,...,N)
# constructor
inf = 1000
# -infに設定しないと数字の選択時にミスる
dp = [-inf for _ in range(N+1)]
dp[0] = 0

cost_list = [num(k) for k in A]
for i in range(1, N+1):
    for cost in cost_list:
        if i - cost < 0:
            pass
        else:
            temp = dp[i - cost] + 1
            dp[i] = max(dp[i], temp)

ans = ''
many = N
for d in range(dp[N]): # 各桁
    for k in sorted(A, reverse=True):
        if many - num(k) < 0:
            pass
        else:
            if dp[many - num(k)] == dp[many] - 1:
                ans += str(k)
                many -= num(k)
                break
            else:
                pass

print(int(ans))
s = input()
l = len(s)
for i in range(l-2):
  temp = s[i]
  if s[i+1]==temp:
    print(str(i+1)+" "+str(i+2))
    quit()
  if s[i+2]==temp:
    print(str(i+1)+" "+str(i+3))
    quit()
if s[i+1]==s[i+2]:
  print(str(i+2)+ " "+str(i+3))
  quit()
print("-1 -1")

### FIXED CODE ###

s = input()
l = len(s)
for i in range(l-2):
  temp = s[i]
  if s[i+1]==temp:
    print(str(i+1)+" "+str(i+2))
    quit()
  if s[i+2]==temp:
    print(str(i+1)+" "+str(i+3))
    quit()
    
if s[-1]==s[-2]:
  print(str(l-1)+ " "+str(l))
  quit()
print("-1 -1")
import math
import sys
from copy import copy
import numpy as np
from collections import defaultdict, deque, Counter 
from itertools import accumulate, product, permutations,combinations, combinations_with_replacement
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd

max_value = 1000000000
min_value = -1000000000
sys.setrecursionlimit(max_value)

n = int(input())
s = list(input())

count = 0


if s[0] == 'W' or s[-1] == 'W':
    print(0)
    sys.exit()

LR_list = ['' for i in range(2*n)]
LR_list[0] = 'L'

for i in range(1,len(LR_list)):
    if s[i] == s[i-1]:
        if LR_list[i-1] == 'R':
            LR_list[i] = 'L'
        else:
            LR_list[i] = 'R'
    else:
        if LR_list[i-1] == 'R':
            LR_list[i] = 'R'
        else:
            LR_list[i] = 'L'

values = []

if LR_list.count('L') != LR_list.count('R'):
    print(0)
    sys.exit()
for i in range(len(LR_list)):
    if LR_list[i] == 'R':
        values.append(li-ri)
        li = LR_list[:i].count('L')
        ri = LR_list[:i].count('R')
print(np.array(values).prod()*math.factorial(n))

### FIXED CODE ###

import math
import sys
from copy import copy
import numpy as np
from collections import defaultdict, deque, Counter 
from itertools import accumulate, product, permutations,combinations, combinations_with_replacement
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd

max_value = 1000000000
min_value = -1000000000
sys.setrecursionlimit(max_value)

n = int(input())
s = list(input())

count = 0


if s[0] == 'W' or s[-1] == 'W':
    print(0)
    sys.exit()

LR_list = ['' for i in range(2*n)]
LR_list[0] = 'L'

for i in range(1,len(LR_list)):
    if s[i] == s[i-1]:
        if LR_list[i-1] == 'R':
            LR_list[i] = 'L'
        else:
            LR_list[i] = 'R'
    else:
        if LR_list[i-1] == 'R':
            LR_list[i] = 'R'
        else:
            LR_list[i] = 'L'

values = []

if LR_list.count('L') != LR_list.count('R'):
    print(0)
    sys.exit()


li = 0
ri = 0
for i in range(len(LR_list)):
    if i != 0:
        if LR_list[i-1] == 'L':
            li += 1
        elif LR_list[i-1] == 'R':
            ri += 1
    if LR_list[i] == 'R':
        values.append(li-ri)
value = 1
for i in range(len(values)):
    value = value * values[i] % (10**9+7)
for i in range(2,n+1):
    value = value * i %(10**9+7)
print(value)
n = int(input())
a, b = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
for i in range(n):
    if p[i] > a:
        key1 = i-1
        break
for i in range(key1+1,n):
    if p[i] > b:
        key2 = i-1
        break
print(min(key1+1,key2-key1,len(p)-1-key2))

### FIXED CODE ###

n = int(input())
a, b = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
key1 = 0
key2 = n-1
for i in range(n):
    if p[i] > a:
        key1 = i-1
        break
for i in range(key1+1,n):
    if p[i] > b:
        key2 = i-1
        break
print(min(key1+1,key2-key1,len(p)-1-key2))
n = int(input())
a = list(map(int, input().split()))
d = [None]*(n+1)**2
def judge(l,r):
  if l >= r:
    return a[l]
  v = l + r*(n+1)
  if d[v] is not None: return d[v]
  d[v] = min(a[l] - judge(l+1,r), a[r] - judge(l,r-1))
  return d[v]

print(judge(0,n-1))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
dp = [[None]*n for _ in range(n)]
for d in range(n):
  for l in range(n-d):
    r = l + d
    if d:
      dp[l][r] = max(a[l] - dp[l+1][r], a[r] - dp[l][r-1])
    else:
      dp[l][r] = a[l]
print(dp[0][n-1])
a,b,c,d = map(int,input())

if abs(a-c) <= d:
  print('Yes')
elif (abs(a-b) <= d) && (abs(b-c) <= d):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

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

if abs(a-c) <= d:
  print('Yes')
elif (abs(a-b) <= d) and (abs(b-c) <= d):
  print('Yes')
else:
  print('No')
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    def popcount(n):
        cnt = 0
        for b in range(5):
            cnt += (n >> b) & 1
        return cnt

    n = int(input())
    X = input()
    one = X.count("1")

    for i in range(n):
        x = list(X)
        cnt = one + 1 if x[i] == "0" else one - 1
        x[i] = "1" if x[i] == "0" else "0"
        x = int("".join(x), 2)
        res = 0
        while x:
            if res != 0:
                cnt = popcount(x)
            x %= cnt
            res += 1
        print(res)


if __name__ == '__main__':
    resolve()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    X = input()
    cnt_init = X.count("1")
    x = int(X, 2)
    a = x % (cnt_init + 1)
    if cnt_init - 1 != 0:
        b = x % (cnt_init - 1)

    for i in range(n):
        if X[i] == "0":
            cnt = cnt_init + 1
            y = (a + pow(2, n - i - 1, cnt)) % cnt
        else:
            cnt = cnt_init - 1
            if cnt == 0:
                print(0)
                continue
            y = (b - pow(2, n - i - 1, cnt)) % cnt

        res = 1
        while y:
            cnt = bin(y).count("1")
            y %= cnt
            res += 1
        print(res)


if __name__ == '__main__':
    resolve()
while True:
    H,W=[int(x) for x in input().split()]
    if H == 0 and W == 0:
        break
    for a in range (H):
        if a == 0 or a == H-1:
            print("#"*W)
        else:
            print("#" + "."*(W-2) + "#")
    print('')


### FIXED CODE ###

while True:
    H,W=[int(x) for x in input().split()]
    if H == 0 and W == 0:
        break
    for a in range (H):
        if a == 0 or a == H-1:
            print("#"*W)
        else:
            print("#" + "."*(W-2) + "#")
    print('')
N = int(input())
S = input()
counter = 0
for i in range(0,N):
    if(S[i] == "A"):
        if(S[i+1] == "B"):
            if(S[i+2] == "C"):
                counter += 1
                
print(counter)

### FIXED CODE ###

N = int(input())
S = input()
counter = 0
for i in range(0,N-2):
    if(S[i] == "A"):
        if(S[i+1] == "B"):
            if(S[i+2] == "C"):
                counter += 1
                
print(counter)
data = input().split()
N = int(data[0])
T = int(data[1])
c = []
t = []
i = 0
j = 0
while i < N:
  sc = input().split()
  c.append(int(sc[0]))
  t.append(int(sc[1]))
  i += 1

mn = min(t)
if mn > T:
  print("TLE")
else:
  mn = c[0]
  while j < N:
    if t[j] <= T:
      
      if mn > c[j]:
        mn = c[j]
        ind = j
        
    j += 1

  print(c[ind])
 
  
  

### FIXED CODE ###

data = input().split()
N = int(data[0])
T = int(data[1])
c = []
t = []
i = 0
j = 0
while i < N:
  sc = input().split()
  c.append(int(sc[0]))
  t.append(int(sc[1]))
  i += 1

mn = min(t)
if mn > T:
  print("TLE")
else:
  mn = c[0]
  while j < N:
    if t[j] <= T:
      
      if mn >= c[j]:
        mn = c[j]
        ind = j
        
    j += 1

  print(c[ind])
n=int(input())
k=int(input())
x=list(map(int,input().split())
ans=0
for i in range (n):
	if abs(x[i])>abs(x[i]-k):
		ans+=abs(x[i]-k)*2
    else:
       ans+=x[i]*2
print(ans)

### FIXED CODE ###

n=int(input())
k=int(input())
x=list(map(int,input().split()))
ans=0
for i in range (n):
    if abs(x[i])>abs(x[i]-k):
	    ans+=abs(x[i]-k)*2
    else:
        ans+=x[i]*2
print(ans)
N, K = map(int, input().split())
S = str(input())
max = N-1
cnt = 0

if (S[0] == "R") & (S[1] == "R"):
    cnt += 1
if (S[N-1] =="L") & (S[N-2]=="L"):
    cnt += 1
for i in range(1, N-1):
    if S[i] == "L":
        if S[i-1] == "L":
            cnt += 1
    if S[i] == "R":
        if S[i+1] == "R":
            cnt += 1

if (cnt + K*2) > max:
    print(max)
else:
    print(cnt + K*2)

### FIXED CODE ###

N, K = map(int, input().split())
S = str(input())
max = N-1
cnt = 0
if N == 1:
    print(0)
    exit()
    
if (S[0] == "R") & (S[1] == "R"):
    cnt += 1
if (S[N-1] =="L") & (S[N-2]=="L"):
    cnt += 1
for i in range(1, N-1):
    if S[i] == "L":
        if S[i-1] == "L":
            cnt += 1
    if S[i] == "R":
        if S[i+1] == "R":
            cnt += 1

if (cnt + K*2) > max:
    print(max)
else:
    print(cnt + K*2)
def solve():
  from itertools import accumulate
  from sys import stdin
  
  f_i = stdin
  N, K = map(int, f_i.readline().split())
  A = map(int, f_i.readline().split())
  A = (a % K for a in A)
  S = [0] + list(accumulate(A))
  rec = dict(zip(range(K), [0] * K))
  rec[0] = 1
  
  ans = 0
  for j in range(1, N + 1):
    d = (S[j] - j) % K
    ans += rec[d]
    rec[d] += 1
    i = j - K + 1
    if i >= 0:
      d = (S[i] - i) % K
      rec[d] -= 1
  
  print(ans)

solve()  

### FIXED CODE ###

def solve():
  from itertools import accumulate
  from sys import stdin
  
  f_i = stdin
  N, K = map(int, f_i.readline().split())
  A = map(int, f_i.readline().split())
  S = accumulate(a - 1 for a in A)
  S = (0, ) + tuple(s % K for s in S)
  
  rec = {}
  ans = 0
  for j, S_j in enumerate(S):
    if j >= K:
      rec[S[j-K]] -= 1
    if S_j in rec:
      ans += rec[S_j]
      rec[S_j] += 1
    else:
      rec[S_j] =1
  
  print(ans)

solve()
a, b = map(int, input().split)
if (a * b) % 2 != 0:
  print('Odd')
else:
  print('Even')

### FIXED CODE ###

a, b = map(int, input().split())
if (a * b) % 2 != 0:
  print('Odd')
else:
  print('Even')
from numpy import array,lcm
n = input()
a = array([int(e) for e in input().split()])
m = lcm.reduce(a) - 1
sum = 0

for i in range(len(a)):
    sum += m%a[i]

print(sum)

### FIXED CODE ###

from functools import reduce
from fractions import gcd

n = input()
a = list(map(int,input().split()))
gd = reduce(gcd,a)
m = reduce(lambda a,b: a*b,a)//gd -1
sum = sum(map(lambda x: m%x,a))

print(int(sum))
N, K = map(int,input().split())
a = [0] + list(map(int,input().split()))

journey = [1]

for i in range(N):
    nxt = a[journey[-1]]
    journey.append(nxt)

if K < N:
    print(journey[K])
    exit()

loop_start = N-1
loop_end   = N

finished = False
for i in range(1,N):
    for j in range(i+1,N+1):
        if journey[i] == journey[j]:
            loop_start = i
            loop_end   = j
            finished = True
            break
    if finished:
        break

period = loop_end - loop_start

ans = K % period
while ans < period:
  ans += period

print(journey[ans])


### FIXED CODE ###

N, K = map(int,input().split())
a = [0] + list(map(int,input().split()))

journey = [1]

for i in range(2*N+1000):
    nxt = a[journey[-1]]
    journey.append(nxt)

if K <= N:
    print(journey[K])
    exit()

loop_start = N-1
loop_end   = N
 
while(journey[loop_start] != journey[loop_end]):
    loop_start -= 1
    
period = loop_end - loop_start

K %= period
while K < N:
  K += period

print(journey[K])
N=int(input())
l=list(map(int,input().split()))

a='Yes'
if N>1:
  for i in range(N-1):
    if l[i]=l[i+1]:
      continue
    elif l[i]<l[i+1]:
      l[i+1]-=1
    else:
      a='No'
    
print(a)

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
 
before = 0
result = 'Yes'
for i in range(len(h)):
    if i == 0:
        before = h[i] - 1
    else:
        if before < h[i]:
            before = h[i] - 1
        elif before == h[i]:
            before = h[i]
        else:
            result = 'No'
print(result)
a = int(input())
b = int(input())
ans = 1 if 1 not in (a, b) else 2 if not in (a, b) else 3
print(ans)

### FIXED CODE ###

a, b = int(input()), int(input())
ans = 1 if 1 not in (a, b) else 2 if 2 not in (a, b) else 3
print(ans)
import math

def prime(n):
    for i in range(2, int(n/2)+1):
        if  n % i == 0:
            return False
    return True

num_prime = []
k = 0
while True:
    n = input()
    if n == '\x04':
        break
    if prime(int(n)):
        if not int(n) in num_prime:
            k += 1
            num_prime.append(int(n))

print(k)

### FIXED CODE ###

import math

def prime(n):
    for i in range(2, int(math.sqrt(n))+1):
        if  n % i == 0:
            return False
    return True

num_prime = []
k = 0
while True:
    try:
        n = input()
    except:
        break
    if prime(int(n)):
        if not int(n) in num_prime:
            k += 1
            num_prime.append(int(n))

print(k)
s = list(input()) #sys.stdin.readlineは最後が改行
k = int(input())

now = 0

while k>0 and now<len(s):
    tmp = ord('z')-ord(s[now])+1
    if tmp<=k:
        s[now] = 'a'
        k -= tmp
        now+=1
    else:
        now+=1

if k>0:
    s[-1] = chr(ord(s[-1])+k )

print(*s,sep='')


### FIXED CODE ###

s = list(input()) #sys.stdin.readlineは最後が改行
k = int(input())

now = 0

while k>0 and now<len(s):
    if s[now]=='a':
        now+=1
        continue
    tmp = ord('z')-ord(s[now])+1
    if tmp<=k:
        s[now] = 'a'
        k -= tmp
        now+=1
    else:
        now+=1

if k>0:
    s[-1] = chr(ord(s[-1])+k%26 )

print(*s,sep='')
o = input()
e = input()
s = ""

for i in range(len(o)+len(e)):
  if i%2==0:
    s+=a[i//2]
  else:
    s+=b[i//2]

print(s)


### FIXED CODE ###

from math import floor
a = input()
b = input()
c = ""

for i in range(len(a)+len(b)):
  if i%2==0:
    c+=a[floor(0.5*i)]
  else:
    c+=b[floor(0.5*i)]
else:
  print(c)
import numpy as np
lst = []
nums = []
for _ in range(3):
    l = []
    l = list(map(int, input().split()))
    lst.append(l)
    lst = np.array(lst)
n = int(input())
for _ in range(n):
    nums.append(int(input()))

for h in range(3):
    for w in range(3):
        if array[h][w] in nums:
            array[h][w] = 0

i = 0
for h in range(3):
    if sum(array[:, h]) == 0:
        i = 1
for w in range(3):
    if sum(array[w]) == 0:
        i = 1
if sum(np.diag(np.fliplr(array))) == 0:
    i = 1
if sum(np.diag(array)) == 0:
    i = 1

if i == 1:
    print("Yes")
else:
    print('No')

### FIXED CODE ###

import numpy as np
lst = []
nums = []
for _ in range(3):
    l = []
    l = list(map(int, input().split()))
    lst.append(l)
    array = np.array(lst)
 
n = int(input())
for _ in range(n):
    nums.append(int(input()))

for h in range(3):
    for w in range(3):
        if array[h][w] in nums:
            array[h][w] = 0

i = 0
for h in range(3):
    if sum(array[:, h]) == 0:
        i = 1
for w in range(3):
    if sum(array[w]) == 0:
        i = 1
if sum(np.diag(np.fliplr(array))) == 0:
    i = 1
if sum(np.diag(array)) == 0:
    i = 1

if i == 1:
    print("Yes")
else:
    print('No')
n=int(input())
t=tuple(map(int,input().split()))
while True:
  if t[0]!=0:
    print(0)
    break
  m=max(t)
  a=tuple(t.count(i) for i in range(m+1))
  if a[0]!=1:
    print(0)
    break
  s=1
  for i in range(m):
    s=(s*(a[i]**a[i+1]))%998244353
  print(s)
  break

### FIXED CODE ###

n=int(input())
print((n-1)//2)
MOD = 1000000007
N, K = map(int,input().split())
G = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

def dfs(K, G, now, parent):
    can_use_color_num = K-2
    if parent == -1:
        can_use_color_num = K-1
    if K < len(G[now]):
        return 0
    else:
        case_num = 1
        for e in G[now]:
            if e == parent:
                continue
            case_num *= can_use_color_num
            can_use_color_num -= 1
            case_num %= MOD
        for e in G[now]:
            if e == parent:
                continue
            case_num *= dfs(K, G, e, now)
            case_num %= MOD
        return case_num

ans = K * dfs(K, G, 0, -1)
print(ans % MOD)

### FIXED CODE ###

MOD = 1000000007
N, K = map(int,input().split())
G = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append(b)
    G[b].append(a)

C = [False for _ in range(N)]
F = [0]
C[0] = True
r = K
while F:
    n = F.pop()
    if n == 0:
        c = K-1
    else:
        c = K-2
    for e in G[n]:
        if C[e]:
            continue
        C[e] = True
        r = (r * c) % MOD
        c -= 1
        F.append(e)

print(r)
n=int(input())
a=sorted(list(map(int,input().split())))
ans=1
cnt=[0]*(10**5)
for i in range(n):
    cnt[a[i]]+=1
for i in range(n):
    tmp=cnt[a[i]]+cnt[a[i]+1]+cnt[a[i]+2]
    ans=max(tmp,ans)
print(ans)

### FIXED CODE ###

n=int(input())
a=sorted(list(map(int,input().split())))
ans=1
cnt=[0]*(10**5+2)#a[i]+2
for i in range(n):
    cnt[a[i]]+=1
for i in range(n):
    tmp=cnt[a[i]]+cnt[a[i]+1]+cnt[a[i]+2]
    ans=max(tmp,ans)
print(ans)
if __name__ =='__main__':
    N ＝ raw_input()
    A = raw_input()
    ans = N**2 - A
    return N-A

### FIXED CODE ###

if __name__ =='__main__':
    N = int(input())
    A = int(input())
    ans = N**2-A
    print(ans)
import bisect,collections,copy,heapq,itertools,math,string
import sys
 
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b = M()
ans = lcm(a, b)
print(ans)

### FIXED CODE ###

import bisect,collections,copy,heapq,itertools,math,string
import sys
import fractions
 
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
 
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b = M()
ans = lcm(a, b)
print(ans)
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, M = map(int, input().split())
if N == 1 or N == 0:
    guu = 0
else:
    guu = combinations_count(N, 2)
if M == 1 or N == 0:
    kisu = 0
else:
    kisu = combinations_count(M, 2)
print(guu + kisu)

### FIXED CODE ###

import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, M = map(int, input().split())
if N == 1 or N == 0:
    guu = 0
else:
    guu = combinations_count(N, 2)
if M == 1 or M == 0:
    kisu = 0
else:
    kisu = combinations_count(M, 2)
print(guu + kisu)