Harryxun/stf_run huggingface dataset:
s = int(input())
l = s / 100
r = s % 100

if(1 <= l && <= 12):
    if(1 <= r && r <= 12):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if(1 <= r && r <= 12):
        print('YYMM')
    else:
        print('NA')

### FIXED CODE ###

s = int(input())
l = s / 100
r = s % 100

if(1 <= l and l <= 12):
    if(1 <= r and r <= 12):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if(1 <= r and r <= 12):
        print('YYMM')
    else:
        print('NA')
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
adj = [set() for _ in range(N)]
colors = dict()
ed = []
for i in range(N-1):
    a, b = map(lambda x: int(x)-1, input().split())
    adj[a].add(b)
    adj[b].add(a)
    colors[a*N + b] = 0
    ed.append([a, b])

col = max(len(v) for v in adj)
cand = set([v for v in range(1, col+1)])

s = -1
for i, a in enumerate(adj):
    if len(a) == col:
        s = i
        break

Q = [[s, -1]]
while Q:
    cur, prev = Q.pop()
    NG = colors[min(cur, prev)*N+max(cur, prev)]
    for nex, c in zip(adj[cur]-{prev}, cand-{NG}):
        colors[min(cur, nex)*N + max(cur, nex)] = c
        Q.append([nex, cur])
print(col)
for a, b in ed:
    print(colors[a*N + b])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
adj = [set() for _ in range(N)]
colors = dict()
ed = []
for i in range(N-1):
    a, b = map(lambda x: int(x)-1, input().split())
    adj[a].add(b)
    adj[b].add(a)
    ed.append([a, b])

col = max(len(v) for v in adj)

s = -1
for i, a in enumerate(adj):
    if len(a) == col:
        s = i
        break

Q = [[s, -1, -1]]
while Q:
    cur, prev, NG = Q.pop()
    c = 0
    for nex in adj[cur]:
        if nex == prev:
            continue
        else:
            c += 1
        if c == NG:
            c += 1
        colors[min(cur, nex)*N + max(cur, nex)] = c
        Q.append([nex, cur, c])
print(col)
for a, b in ed:
    print(colors[a*N + b])
N,M,K = map(int,input().split())
A_list=list(map(int,input().split()))
B_list=list(map(int,input().split()))

ans = 0

def dfs_A(n,m,t,c):
  global ans
  x = t+A_list[n]
  if x > K:
    if c > ans:
      ans = c
  elif x == K:
    if c+1 > ans:
      ans = c+1
  else:
    if n+1 <= N-1 and m <= M-1:
      dfs_A(n+1,m,x,c+1)
    if n <= N and m+1 <= M-1:
      dfs_B(n+1,m,x,c+1)

def dfs_B(n,m,t,c):
  global ans
  x = t+B_list[m]
  if x > K:
    if c > ans:
      ans =c
  elif x == K:
    if c+1 > ans:
      ans = c+1
  else:
    if n+1 <= N-1 and m <= M-1:
      dfs_A(n,m+1,x,c+1)
    if n <= N and m+1 <= M-1:
      dfs_B(n,m+1,x,c+1)

dfs_A(0,0,0,0)
dfs_B(0,0,0,0)
print(ans)

### 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 = 0
j = 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)
# 写経
# https://atcoder.jp/contests/m-solutions2020/submissions/15454214

import sys
import numpy as np
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
XYP = np.array(read().split(), np.int64)

def resolve():
	X, Y, P = XYP[::3], XYP[1::3], XYP[2::3]
	N = len(X)
	X_cost = np.empty((1 << N,N), np.int64)
	X_cost[0] = np.abs(X) * P
	for n in range(N):
		B = 1 << n
		X_cost[B:2 * B] = np.minimum(X_cost[:B], np.abs((X-X[n]) * P))
	#print(X_cost)
	Y_cost = np.empty((1 << N,N), np.int64)
	Y_cost[0] = np.abs(Y) * P
	for n in range(N):
		B = 1 << n
		Y_cost[B:2 * B] = np.minimum(Y_cost[:B], np.abs((Y-Y[n]) * P))
	#print(Y_cost)
	popcount = np.zeros(1 << N, np.int64)
	for n in range(N):
		popcount[1 << n:1 << n + 1] = popcount[:1 << n] + 1
	#print(popcount)

	INF = 10**18
	ans = np.full(N + 1, INF, np.int64)
	for s in range(1 << N):
		size = popcount[s]
		t = s
		#print("s" + str(s))
		#print("size" + str(size))
		while True:
			u = s ^ t
			#print("u" + str(u))
			#print("t" + str(t))
			cost = (np.minimum(X_cost[t], Y_cost[u])).sum()
			ans[size] = min(ans[size], cost)
			if t == 0:
				break
			t = (t - 1) & s
	for Ans in ans:
		print(Ans)

if sys.argv[-1] == 'ONLINE_JUDGE':
	import numba
	from numba.pycc import CC
	i8 = numba.int64
	cc = CC('my_module')
 
	def cc_export(f, signature):
		cc.export(f.__name__, signature)(f)
		return numba.njit(f)
 
	resolve = cc_export(resolve, (i8[:], ))
	cc.compile()
 
from my_module import resolve

resolve()


### FIXED CODE ###

# 写経
# https://atcoder.jp/contests/m-solutions2020/submissions/15454214

import sys
import numpy as np
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def resolve(XYP):
	X, Y, P = XYP[::3], XYP[1::3], XYP[2::3]
	N = len(X)
	X_cost = np.empty((1 << N,N), np.int64)
	X_cost[0] = np.abs(X) * P
	for n in range(N):
		B = 1 << n
		X_cost[B:2 * B] = np.minimum(X_cost[:B], np.abs((X-X[n]) * P))
	#print(X_cost)
	Y_cost = np.empty((1 << N,N), np.int64)
	Y_cost[0] = np.abs(Y) * P
	for n in range(N):
		B = 1 << n
		Y_cost[B:2 * B] = np.minimum(Y_cost[:B], np.abs((Y-Y[n]) * P))
	#print(Y_cost)
	popcount = np.zeros(1 << N, np.int64)
	for n in range(N):
		popcount[1 << n:1 << n + 1] = popcount[:1 << n] + 1
	#print(popcount)

	INF = 10**18
	ans = np.full(N + 1, INF, np.int64)
	for s in range(1 << N):
		size = popcount[s]
		t = s
		#print("s" + str(s))
		#print("size" + str(size))
		while True:
			u = s ^ t
			#print("u" + str(u))
			#print("t" + str(t))
			cost = (np.minimum(X_cost[t], Y_cost[u])).sum()
			ans[size] = min(ans[size], cost)
			if t == 0:
				break
			t = (t - 1) & s
	return ans 

if sys.argv[-1] == 'ONLINE_JUDGE':
	import numba
	from numba.pycc import CC
	i8 = numba.int64
	cc = CC('my_module')
 
	def cc_export(f, signature):
		cc.export(f.__name__, signature)(f)
		return numba.njit(f)
 
	resolve = cc_export(resolve, (i8[:], ))
	cc.compile()
 
from my_module import resolve

N = int(readline())
XYP = np.array(read().split(), np.int64)

ans = resolve(XYP)
print('\n'.join(map(str, ans.tolist())))
s = input()

for i in range(0,len(s),2):
    if s[i]=='h' and s[i+1]=='i':
        continue
    else:
        print('No');exit()
print('Yes')

### FIXED CODE ###

s = input()

if len(s)%2!=0:
    print('No');exit()
for i in range(0,len(s),2):
    if s[i]=='h' and s[i+1]=='i':
        continue
    else:
        print('No');exit()
print('Yes')
import math

N = int(input())
A = input().split()

max_gcd = 0
for i in range(N-1):
  for j in range(i+1, N):
    tmp = math.gcd(int(A[i]), int(A[j]))
    if max_gcd < tmp:
      max_gcd = tmp

print(max_gcd)

### FIXED CODE ###

import fractions as math

n = int(input()) # 入力データの個数
a = list(map(int, input().split())) # 入力データ
 
l = [a[0] for _ in range(n+2)] # データの左端を初期値として追加
r = [a[-1] for _ in range(n+2)] # データの右端を初期値として追加
 
for i in range(n): # データのどこを置き換えるか
    l[i+1] = math.gcd(l[i], a[i]) # 置きかえる部分より左の最大公約数と置きかえる部分の最大公約数を更新する
    r[-(i+2)] = math.gcd(r[-(i+1)], a[-(i+1)]) # 置きかえる部分より右の最大公約数と置きかえる+1の最大公約数を更新する 
l[0] = r[0] = l[-1] = r[-1] = 0 # 初期値形に0を入れていく
 
ans = [math.gcd(l[i], r[i+2]) for i in range(n)] # 最大公約数のセットを改めて配列へ
print(max(ans)) # 最大公約数を出力
n=int(input())
p = list(map(int, input().split()))
count=0
for i in range (n-2):
	if p[i]>p[i+1]>p[i+2] or p[i+2]>p[i+1]>p[i]:
    	count=count+1
print(count)



### FIXED CODE ###


n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n - 2):
	if p[i] < p[i + 1] < p[i + 2] or p[i + 2] < p[i + 1] < p[i]:
		ans += 1
print(ans)
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    b=sorted(del a[i])
    print(b[n//2])

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=sorted(a)
c=b[n//2]
d=b[n//2-1]
for i in range(n):
    print(c if a[i]<=d else d)
import numpy as np

def search(now,r,dist,ans):
    if len(r)==0:
        return ans
    min_=float('inf')
    for i,x in enumerate(r):
        if i < len(r)-1:
            min_=min(min_,search(x,r[:i]+r[i+1:],dist,ans+dist[now][x]))
        else:
            min_=min(min_, search(x,r[:i],dist,ans+dist[now][x]))
    return min_

N,M,R=list(map(int,input().split()))
r=list(map(int,input().split()))
r=[x-1 for x in r]
dist=[[float('inf') for _ in range(N)] for _ in range(N)]
for i in range(M):
    A,B,C=list(map(int,input().split()))
    dist[A-1][B-1]=C
    dist[B-1][A-1]=C
for i in range(N):
    dist[i][i]=0
dist=np.array(dist)

ans=float('inf')
for i in range(N):
    for j in range(N):
        dist[i][j]=min(dist[i]+dist[j])

ans=float('inf')
for i,x in enumerate(r):
    if i < len(r)-1:
        ans=min(ans, search(x,r[:i]+r[i+1:],dist,0))
    else:
        ans=min(ans, search(x,r[:i],dist,0))
print(ans//1)

### FIXED CODE ###

N=int(input())
ans=0
dic={}
for i in range(N):
    a=int(input())
    if dic.get(a,0)==0:
        ans+=1
        dic[a]=1
    else:
        ans-=1
        dic[a]=0
print(ans)
l = int(input())
if l[0] = l[2]:
    print("Yes")
else:
    print("No")
    
    

### FIXED CODE ###

l = str(input())
if l[0] == l[2]:
    print("Yes")
else:
    print("No")
import sys
import operator

n, m = map(int, input().split())

a = [int(x) for x in sys.stdin.readline().rstrip().split()]
a.sort()

cards = [[int(x) for x in sys.stdin.readline().rstrip().split()] for _ in range(m)]
cards.sort(key=operator.itemgetter(1), reverse=True)

a_idx = 0
a_len = len(a)

for b, c in cards:
    if c <= a[a_idx] or a_idx == a_len:
        break
    for b_idx in range(b):
        if c <= a[a_idx]:
            break
        else:
            a[a_idx] = c
            a_idx += 1

print(sum(a))


### FIXED CODE ###

import sys
import operator

n, m = map(int, input().split())

a = [int(x) for x in sys.stdin.readline().rstrip().split()]
a.sort()

cards = [[int(x) for x in sys.stdin.readline().rstrip().split()] for _ in range(m)]
cards.sort(key=operator.itemgetter(1), reverse=True)

a_idx = 0
a_len = len(a)

for i in range(len(cards)):
    for j in range(cards[i][0]):
        if a_idx == a_len or a[a_idx] >= cards[i][1]:
            break
        else:
            a[a_idx] = cards[i][1]
            a_idx += 1

print(sum(a))
s = input().split()
int(''.join(s)) % 4 == 0:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

s = input().split()
if int(''.join(s)) % 4 == 0:
  print("YES")
else:
  print("NO")
import numpy as np
n = int(input())
cnt = [0 for i in range(1000000)]

for i in range(n):
  cnt[int(input())-1] += 1
  
print( (np.array(cnt) % 2).sum())

### FIXED CODE ###

from collections import Counter
n = int(input())
a = Counter([int(input()) for i in range(n)])

cnt = 0
for k, v in a.items():
  if v % 2 == 1:
    cnt += 1
print(cnt)
= [[0 for x in range(1)]for y in range(3)]
one_count = 0
two_count = 0
three_count = 0
four_count = 0
for i in range(3):
     A[i] = [int(x) for x in input().split()]

     if(A[i][0]==1 or A[i][1]==1):
         one_count += 1
     if(A[i][0]==2 or A[i][1]==2):
         two_count += 1
     if(A[i][0]==3 or A[i][1]==3):
         three_count += 1
     if(A[i][0]==4 or A[i][1]==4):
         four_count += 1

if(one_count >= 3 or two_count >= 3 or three_count >= 3 or four_count >= 3):
    print("NO")
else:
    print("YES")



### FIXED CODE ###

A = [[0 for x in range(1)]for y in range(3)]
one_count = 0
two_count = 0
three_count = 0
four_count = 0
for i in range(3):
     A[i] = [int(x) for x in input().split()]

     if(A[i][0]==1 or A[i][1]==1):
         one_count += 1
     if(A[i][0]==2 or A[i][1]==2):
         two_count += 1
     if(A[i][0]==3 or A[i][1]==3):
         three_count += 1
     if(A[i][0]==4 or A[i][1]==4):
         four_count += 1

if(one_count >= 3 or two_count >= 3 or three_count >= 3 or four_count >= 3):
    print("NO")
else:
    print("YES")
a,b,c,d=[x for x in input()]
op='+-'
for op1 in op:
  for op2 in op:
    for op3 in op:
      ans=A+op1+B+op2+C+op3+D
      if eval(ans)==7:
        print('{}=7'.format(ans))
        sys.exit()
      else:
        pass

### FIXED CODE ###

import sys
a,b,c,d=[x for x in input()]
op='+-'
for op1 in op:
  for op2 in op:
    for op3 in op:
      ans=a+op1+b+op2+c+op3+d
      if eval(ans)==7:
        print('{}=7'.format(ans))
        sys.exit()
      else:
        pass
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N-1)]
c = list(map(int, input().split()))
c.sort()
edge = [[] for _ in range(N)]
for a, b in ab:
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
ans = 0
count = 0
anse = [None for _ in range(N)]
def dfs(v, p):
    global ans
    global count
    if p != -1:
        ans += min(c[count], c[count+1])
        anse[p-1] = c[count]
        anse[v-1] = c[count+1]
        count += 1
    for nv in edge[v]:
        if nv == p:
            continue
        dfs(nv, v)
dfs(0, -1)
print(ans)
print(" ".join(map(str, anse)))

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N-1)]
c = list(map(int, input().split()))

if N == 1:
    print(0)
    print(c[0])
    exit()

c.sort(reverse = True)
edge = [[] for _ in range(N)]
for a, b in ab:
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

def dfs(v, p):
    global ans
    global count
    if p != -1:
        anse[v] = c[count+1]
        ans += min(anse[v], anse[p])
        count += 1
    for nv in edge[v]:
        if nv == p:
            continue
        dfs(nv, v)

#search = [i for i, e in enumerate(edge) if len(e) == 1]
search = [0]
res = 0
rese = [None for _ in range(N)]
for i in search:
    count = 0
    ans = 0
    anse = [None for _ in range(N)]
    anse[i] = c[0]
    dfs(i, -1)
    if res < ans:
        res = ans
        rese = anse
print(res)
print(" ".join(map(str, rese)))
a,b,c=map(int,input().split())
s='Yes'
z=0

if a<c:
    if b<c:
        z=1

if a>c:
    if b>c:
        z=1

if z=1:
    print('Yes')
else:
    print('No')



### FIXED CODE ###

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

if a<b:
    if a<c:
        if b>c:
            z=1
else:
    if a>c:
        if b<c:
            z=1

if z==1:
    print('Yes')
else:
    print('No')
arr = list(input())
down = list()
areas = list()
 
for i, el in enumerate(arr):
    if el == "\\":
        down.append(i)
    elif el == "/" and not len(down) == 0:
        start_ind = down.pop()
        area = i - start_ind
        while len(areas) > 0 and areas[-1][0] > start_ind:
            area += areas.pop()[1]
        areas.append((start_ind, area))
    # print("LOOP: {}".format(i))
    # print("DOWN INDICES")
    # print(down)
    # print("AREAS")
    # print(areas)
    # print()
 
areas = [areas[i][1] for i in range(len(areas))]
print(sum(areas))
if len(areas) == 0:
    print("0")
else:
    print(len(areas), " ".join(map(str,areas)))


### FIXED CODE ###

arr = list(input())
down = list()
areas = list()

for i, el in enumerate(arr):
    if el == "\\":
        down.append(i)
    elif el == "/" and not len(down) == 0:
        start_ind = down.pop()
        area = i - start_ind
        while len(areas) > 0 and areas[-1][0] > start_ind:
            area += areas.pop()[1]
        areas.append((start_ind, area))

areas = [areas[i][1] for i in range(len(areas))]
print(sum(areas))
print(str(len(areas)) + " " + " ".join(map(str,areas)) if not len(areas) == 0  else "0")
from itertools import combinations

N, A, B, C = map(int, input().split())
S = [input() for _ in range(N)]

cnt = {'A': A, 'B': B, 'C': C}

def out(T):
    now = {'A': 0, 'B': 0, 'C': 0}
    for s in T:
        now[s] += 1

    ans = []
    for i, s in enumerate(S):
        if min(now.values()) < 0:
            return False
        if now[s[0]] > now[s[1]]:
            ans.append(s[1])
            now[s[0]] -= 1
            now[s[1]] += 1
            continue
        if now[s[0]] < now[s[1]]:
            ans.append(s[0])
            now[s[0]] += 1
            now[s[1]] -= 1
            continue
        if i == N - 1:
            ans.append(s[0])
            continue
        nx = S[i + 1]
        if nx == s:
            ans.append(s[0])
            now[s[0]] += 1
            now[s[1]] -= 1
            continue
        k = list(set(list(s)) & set(list(nx)))
        k = k[0]
        ans.append(k)
        now[k] += 1
        k = s.replace(k, '')
        now[k] -= 1

    if min(now.values()) < 0:
        return []
    return ans

for s in combinations(['', '', 'A', 'B', 'C'], r=3):
    s = ''.join(s)

    for t in s:
        if cnt[t] == 0:
            break
    else:
        ans = out(s)
        if len(ans) == 0:
            continue
        print('Yes')
        print(*ans, sep='\n')
        exit()

print('No')


### FIXED CODE ###

from itertools import combinations

N, A, B, C = map(int, input().split())
S = [input() for _ in range(N)]

cnt = {'A': A, 'B': B, 'C': C}

def out(T):
    now = {'A': A, 'B': B, 'C': C}

    ans = []
    for i, s in enumerate(S):
        u, v = s[0], s[1]
        if now[u] == now[v] == 0:
            return []
        if now[u] > now[v]:
            ans.append(v)
            now[u] -= 1
            now[v] += 1
            continue
        if now[u] < now[v]:
            ans.append(u)
            now[u] += 1
            now[v] -= 1
            continue
        if i == N - 1:
            ans.append(u)
            continue

        nx = S[i + 1]
        if u in nx:
            ans.append(u)
            now[u] += 1
            now[v] -= 1
            continue
        if v in nx:
            ans.append(v)
            now[v] += 1
            now[u] -= 1
            continue

    return ans

ans = out('')
if len(ans) == 0:
    print('No')
    exit()
print('Yes')
print(*ans, sep='\n')

# for s in combinations(['', '', 'A', 'B', 'C'], r=3):
#     s = ''.join(s)
#     for t in s:
#         if cnt[t] == 0:
#             break
#     else:
#         ans = out(s)
#         if len(ans) == 0:
#             continue
#         print('Yes')
#         print(*ans, sep='\n')
#         exit()

# print('No')
N = input()
A = list(map(str, input().split()))
B=[]
C=[]
l=[]
m=[]
i=0
for a in range(int(N)):
    if int(A[a])%2==0:
       B.append(A[a])
       i=i+1
for a in range(int(i)):
    if not int(B[a])%3==0 or int(B[a])%5==0:
       C=1
    else:
       C=0
if C==1:
   print("DENIED")
else:
   print("APPROVED")

### FIXED CODE ###

A = list(map(str, input().split()))
m=set(A)
s=len(m)
if s==2:
  print('Yes')
else:
  print('No')
n,k=map(int,input().split())
v=[0 for _ in range(n)]
w=[0 for _ in range(n)]
for i in range(n):
	w[i],v[i] = map(int,input().split())
 
dp = [[0 for i in range(k+1)] for j in range(n+1)]
 
for i in range(n):
	for j in range(k+1):
		if j-w[i] < 0:
			dp[i+1][j] = dp[i][j]
		else:
			dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])
print(dp[n][k])

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
val1 = [0 for _ in range(n)]
val2 = [0 for _ in range(n)]
val = [0 for _ in range(n)]
for i in range(n):
	if i + 1 <= n - 1:
		val1[i] = abs(h[i] - h[i + 1])
	if i + 2 <= n - 1:
		val2[i] = abs(h[i] - h[i + 2])
for i in range(n):
	if i-2 >= 0:
		val[i] = min([val[i-1]+val1[i-1], val[i-2]+val2[i-2]])
	elif i-1 >= 0:
		val[i] = val[i-1]+val1[i-1]
print(val[n-1])
figure=input()
math=input()
flg=False
 
figure=figure.split(' ')
if math[3]>math[4]:
  print('a')
  flg=True
  
for i in range(len(math)-1):
  if math[i]=='#' and math[i+1]=='#':
    print('No')
    exit()
    
  if flg and i<int(figure[4])-1 and math[i]=='.' and math[i+1]=='.' and math[i+2]=='.':
    flg=False

if not flg:
	print('Yes')
else:
  print('No')

### FIXED CODE ###

figure=input()
math=input()
flg=False
 
figure=figure.split(' ')
if figure[3]>figure[4]:
  flg=True
  
for i in range(max(int(figure[3]),int(figure[4]))-1):
  if math[i]=='#' and math[i+1]=='#':
    if i>int(figure[1]) and i<int(figure[3])-1 or i>int(figure[2]) and i<int(figure[4])-1:
    	print('No')
    	exit()
    
  if flg and i>=int(figure[2])-2 and i<int(figure[4])-1 and math[i]=='.' and math[i+1]=='.' and math[i+2]=='.':
    flg=False

if not flg:
	print('Yes')
else:
  print('No')
from math import gcd
a, b = map(int, input().split())

print(a*b//gcd(a,b))


### FIXED CODE ###

a, b = map(int, input().split())
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

print((a*b)//gcd(a,b))
A = int(input())
B = int(input())
C = int(input())

if B != C:
	surplus = A - B
	ans = C - surplus 
	print(ans)
else:
	print(0)

### FIXED CODE ###


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

ans = c - (a - b)
if ans < 0:
	ans = 0
print(ans)
英小文字からなる文字列S,Tが与えられます。Sを回転させてTに一致させられるか判定してください。
すなわち、以下の操作を任意の回数繰り返してSをTに一致させられるか判定してください。
操作:S=S1S2...S|S|のとき、SをS|S|S1S2...S|S|−1に変更する
ここで、|X|は文字列Xの長さを表します。
"""

s = input()
t = input()
# s,tをリストにする
s = list(s)
t = list(t)

# 変数count,judgementに0を代入
count = 0
judgment = 0

# sの長さだけ順番入れ替えを繰り返し
while count <= len(s)+1:
    item = s.pop()
    s.insert(0,item)
    if s == t:
        # s==tになったらjudgmentでカウントアップ
        judgment += 1
    # 回数をカウントアップ
    count +=1

# 一回もs==tになってなければNo
if judgment == 0:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

s = input()
t = input()

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

count = 0
judgment = 0

while count <= len(s):
    count +=1
    item = s.pop()
    s.insert(0,item)
    if s == t:
        judgment += 1

if judgment == 0:
    print("No")
else:
    print("Yes")
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
m = sum(B)
for t in range(N-1):
    if a[t] + 1 == a[t + 1]:
        m += C[a[t] - 1]
print(m)
         

### FIXED CODE ###

N=int(input())
n= N*N*N
print(n)
def resolve():
    num, long = list(input().split())
    string = sorted([input for i in range(num)])
    print(*string, sep="")

if __name__ == '__main__':
    resolve()

### FIXED CODE ###

n, l = map(int,input().split())
li = sorted([input() for i in range(n)])
print(*li, sep="")
import math

N = int(input())
lis_all = []
lis_pat = []
lis_num = []

count = 0
for i in range(N):
    lis_S = list(str(input()))
    lis_S.sort()
    if lis_S not in lis_all:
        lis_pat.append(lis_S)
    lis_all.append(lis_S)

ans = 0
for i in lis_pat:
    if lis_all.count(i) != 1:
        ans += math.factorial(lis_all.count(i))/2
   
print(int(ans))
    

### FIXED CODE ###

import sys
input = sys.stdin.readline
 
N=int(input())
dic={}
sum=0
for i in range(N):
    s=list(input())
    s.sort()
    s = "".join(s)
    if s in dic:
        sum+=dic[s]
        dic[s]+=1
    else:
        dic[s]=1
print(sum)
a,b,c,d = map(int,raw_input().split())
if a*b >= c*d:
    print a*b
else:
    print c*d

### FIXED CODE ###

a,b,c,d = map(int,raw_input().split())
if a*b >= c*d:
    print a*b
else:
    print c*d