Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys
import numpy as np

INF = float('inf')


def solve(N: int, x: "List[int]", y: "List[int]"):
    def distance(x1, y1, x2, y2):
        return np.linalg.norm(np.array([x1, y1]) - np.array([x2, y2]))

    l = [[distance(x[i], y[i], x[j], y[j]) if j >
          i else 0 for j in range(N)] for i in range(N - 1)]

    return np.average([sum(l[r[i]][r[i+1]] if r[i] < r[i+1] else l[r[i+1]][r[i]] for i in range(N-1))
                       for r in its.permutations(range(N))])


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    print(f'{solve(N, x, y)}')


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def solve(r: int):
    return r*r


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    r = int(next(tokens))  # type: int
    print(f'{solve(r)}')


if __name__ == '__main__':
    main()
s = input()
if s.sort() == "abc":
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s = list(input())
if "".join(sorted(s)) == "abc":
  print("Yes")
else:
  print("No")
array = input().split()
if (array.count(5) == 2 and array.count(7) == 1):
  print "YES"
else
  print "NO"

### FIXED CODE ###

array = input().split()
if (array.count('5') == 2 and array.count('7')  == 1):
  print("YES")
else:
  print("NO")
input()
a=1
b=map(int,inpit().split())
for i in b:
  a*=i
if a>10^18:
  a=-1
print(a)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
if 0 in l:
  print(0)
else:
  a=1
  for i in l:
    a=a*i
    if a>10**18:
      print(-1)
      exit()
  print(a)
N=int(input())
L=tuple(map(int,input().split()))
l=[0]*1001
g=[0]*1001
for i in L:
    l[i]+=1
for i in range(1,1001):
    g[i]=g[i-1]+l[i]
a=0
for i in range(1,999):
    for j in range(i+1,1000):
        a+=l[i]*l[j]*(g[min(i+j-1,1000)]-g[j])
for i in range(1,1001):
    if l[i]>1:
        t=l[i]*(l[i]-1)//2
        for j in range(1,i):
            a+=t*l[j]
        if l[i]>2:
            a+=t*(l[i]-2)//3
        for j in range(i+1,min(1001,l[i*2])):
            a+=t*l[j]
print(a)

### FIXED CODE ###

N=input()
L=tuple(map(int,input().split()))
l=[0]*1001
g=[0]*1001
for i in L:
    l[i]+=1
for i in range(1,1001):
    g[i]=g[i-1]+l[i]
a=0
for i in range(1,999):
    for j in range(i+1,1000):
        a+=l[i]*l[j]*(g[min(i+j-1,1000)]-g[j])
for i in range(1,1001):
    if l[i]>1:
        t=l[i]*(l[i]-1)//2
        for j in range(1,i):
            a+=t*l[j]
        if l[i]>2:
            a+=t*(l[i]-2)//3
        for j in range(i+1,min(1001,i*2)):
            a+=t*l[j]
print(a)
import numpy as np

N = int(input())
A = []

for _ in range(N):
    A.append(int(input()))
    
a = max(A)
b =  sorted(set(A))[-2]
    
'''
for i in range(N):
    if A[i] > a:
        b = a
        a = A[i]
    elif A[i] < a and A[i] > b:
        b = A[i]
'''

for i in range(N):
    if A[i] < a:
        print(a)
    else:
        print(b)

### FIXED CODE ###


r = int(input())
print(3*r*r)
n=input()
if (s[0]==7 or s[1]==7 or s[2]==7):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n=input()
if (n[0]=='7' or n[1]=='7' or n[2]=='7'):
    print("Yes")
else:
    print("No")
S = input()
T = list(input())

change = []
flag = 0

for i in range(len(S)):
  if S[0] == T[i]:
    for j in range(len(S) - i):
      change.append(T[j+i])
    for k in range(i):
      change.append(T[k])
      
for check in range(len(S)):
  if S[check] != change[check]:
    flag = 1

if flag == 1:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

Spr = input()
T = list(input())
S = list(Spr)

change = ""
ok = 0

for i in range(len(S)):
  if S[0] == T[i]:
    for j in range(len(S) - i):
      change += T[j+i]
    for k in range(i):
      change += T[k]
    if Spr == change:
      if ok == 0:
      	print("Yes")
      	ok = 1
    change = ""

if i == len(S) - 1 and ok == 0:
  print("No")
input(A),split(B)
print(A-2*B)

### FIXED CODE ###

A,B=map(int,input().split())
s=A-2*B
if s<0:
  print(0)
else:
  print(s)
counter = 1
while true:
    x = input()
    if x == 0 : 
    break
    print("Case {}: {}".format(counter,input()))



### FIXED CODE ###

ans = []
for i, x in enumerate(open(0).readlines()):
    ans.append("Case %d: %s" % (i+1, x))
open(1,'w').writelines(ans[:-1])
N = int(input())
s_cnt = []
for i in range(N):
    cnt = {}
    s = input()
    for si in s:
        if si in cnt:
            cnt[si] += 1
        else:
            cnt[si] = 1
    s_cnt.append(cnt)
#from collections import defaultdict
#min_ = defaultdict(int)
min_ = {}
for i in s_cnt:
    for j in i:
        if j not in s_cnt[0] or j not in s_cnt[1] or j not in s_cnt[2]:
            continue
        if j not in min_:
            min_[j] = i[j]
        else:
            min_[j] = min(min_[j], i[j])
string = ''
for i in min_:
    #list_.append(i * min_[i])
    string += i * min_[i]
s = sorted(string)
print(''.join(s))

### FIXED CODE ###

N = int(input())
s_cnt = []
for i in range(N):
    cnt = {}
    s = input()
    for si in s:
        if si in cnt:
            cnt[si] += 1
        else:
            cnt[si] = 1
    s_cnt.append(cnt)
min_ = {}
for i in s_cnt:
    for j in i:
        if any([j not in s_cnt[k] for k in range(N)]):
               continue
        if j not in min_:
            min_[j] = i[j]
        else:
            min_[j] = min(min_[j], i[j])
string = ''
for i in min_:
    #list_.append(i * min_[i])
    string += i * min_[i]
s = sorted(string)
print(''.join(s))
n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
lst = [0] * (a_max + 1)
cnt = 0
for i in a:
    if lst[i] > 1:  # 配列中のカウントが2以上なら以降の処理を省略
        continue
    for j in range(a_max // i + 1):  # Aiの倍数にインクリメント(配列の上限はa[-1])
        lst[i * j] += 1
    lst[1::i] += 1
for i in a:
    if lst[i] == 1:
        cnt += 1
print(cnt)

### FIXED CODE ###

import numpy as np

n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
lst = [0] * (a_max + 1)
cnt = 0
# if len(a) <= 1:
#     print(0)
# else:
for i in a:
    if lst[i] > 1:  # 配列中のカウントが2以上なら以降の処理を省略
        continue
    for j in range(a_max // i + 1):  # Aiの倍数にインクリメント(配列の上限はa[-1])
        lst[i * j] += 1
    # lst[1::i] += 1
for i in a:
    if lst[i] == 1:
        cnt += 1
print(cnt)
n = int(input())
a = [[] for i in range(n)]; b = [-1]*n; b[0] = 0
for i in range(n-1):
    u, v, w = map(int, input().split())
    a[u-1].append([v-1, w]); a[v-1].append([u-1, w])
def dfs(A, k):
    for i in A[k]:
        if b[i[0]] == -1:
            b[i[0]] = b[k]+i[1]
            dfs(A, i[0])
dfs(a, 0)
for i in b:
    print(0) if i%2 == 0 else print(1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(500*500)
n = int(input())
a = [[] for _ in range(n)]; b = [-1]*n; b[0] = 0
for i in range(n-1):
    u, v, w = map(int, input().split())
    a[u-1].append([v-1, w]); a[v-1].append([u-1, w])
def dfs(A, k):
    for i in A[k]:
        if b[i[0]] == -1:
            b[i[0]] = b[k]+i[1]
            dfs(A, i[0])
dfs(a, 0)
for i in b:
    print(0) if i%2 == 0 else print(1)
N,Q = map(int,input().split())
ablist = [[] for _ in range(N)]
anslist = [0 for i in range(N)]

for i in range(N-1):
    a,b = map(int,input().split())
    ablist[a-1].append(b-1)
    ablist[b-1].append(a-1)

pxlist = [list(map(int,input().split())) for _ in range(Q)]

for p,x in pxlist:
    anslist[p-1] += x

def dfs(nownode,oya=-1):
    for nextnode in ablist[nownode]:
        if oya == nextnode:
            continue
        anslist[nextnode] += anslist[nownode]
        dfs(nextnode,nownode)
dfs(0,-1)
print(*anslist)

### FIXED CODE ###

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

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

T = [[]for i in range(N)]

for i in range(N-1):
    a, b = map(int, input().split())
    T[a-1].append(b-1)
    T[b-1].append(a-1)

X = [0 for i in range(N)]
for i in range(Q):
    p, x = map(int, input().split())
    X[p-1] += x

# def dfs(x, p):
#     for j in T[x]:
#         if j == p:
#             continue
#         X[j] += X[x]
#         dfs(j, x)
def dfs(nownode,oya=-1):
    for nextnode in T[nownode]:
        if oya == nextnode:
            continue
        X[nextnode] += X[nownode]
        dfs(nextnode,nownode)

dfs(0, -1)

print(*X)
N = int(input())
A = [int(x) for x in input().split()]

for i in N:
  if A[i]==0:
    return i

### FIXED CODE ###

A = [int(x) for x in input().split()]
N = int(len(A))

for i in range(N):
  if A[i]-0==0:
    print(i+1)
H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())

import queue, itertools

dxy = ((1,0), (-1,0), (0,1), (0,-1))
ans = 0
for s, t in itertools.product(range(H), range(W)):
    if S[s[0]][s[1]] == '#' or S[t[0]][t[1]] == '#': continue
    
    q = queue.Queue()
    seen = [[0]*W for _ in range(H)]
    dist = [[0]*W for _ in range(H)]     

    q.put(s)
    while not q.empty():
        v = q.get()
        x, y = v[1], v[0]
        seen[y][x] = 1
        for dx, dy in dxy:
            nx, ny = x+dx, y+dy
            if nx<0 or ny<0 or nx>=W or ny>=H or S[ny][nx] == '#' or seen[ny][nx] == 1: continue
            dist[ny][nx] = dist[y][x] + 1
            q.put((ny, nx))
    
    ans = max(ans, max(map(max, dist)))

print(ans)

### FIXED CODE ###

H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())

import queue, itertools

dxy = ((1,0), (-1,0), (0,1), (0,-1))
ans = 0
for s in itertools.product(range(H), range(W)):
    if S[s[0]][s[1]] == '#': continue
    
    q = queue.Queue()
    dist = [[-1]*W for _ in range(H)]     

    q.put(s)
    dist[s[0]][s[1]] = 0
    while not q.empty():
        y, x = q.get()         
        for dx, dy in dxy:
            nx, ny = x+dx, y+dy
            if nx<0 or ny<0 or nx>=W or ny>=H or S[ny][nx] == '#' or dist[ny][nx] >= 0: 
                continue
            dist[ny][nx] = dist[y][x] + 1
            q.put((ny, nx))
    
    ans = max(ans, max(map(max, dist)))

print(ans)
n,m = list(map(int,input().split()));
a = list(map(int,input().split()));

a.sort(reverse = True);

i = 0;
while a[i] >= sum(a)/(4*m) and i < n:
    i += 1;

if i >= m :
    print('Yes');
else :
    print('No');

### FIXED CODE ###

n,m = list(map(int,input().split()));
a = list(map(int,input().split()));

ans = 0;
for i in range(n) :
    if a[i] >= sum(a)/(4*m):
        ans += 1;

if ans >= m :
    print('Yes');
else :
    print('No');
import math
a,b,c,d = map(int,input().split())
dev = b- a +1
if dev % c==0:
    count = dev//c
else:
    if ((a%c)+(b%c)) < c:
        count = dev//c +1
    else:
        count = dev//c

if dev % d==0:
    count += dev//d
else:
    if ((a%d)+(b%d)) < d:
        count += dev//d +1
    else:
        count += dev//d

def lcm(c,d):
    return (c*d)//(math.gcd(c,d))
da = lcm(c,d)
if dev % (da)==0:
    count -= int(dev/(da))
else:
    if ((a%c)+(b%c)) < (da):
        count -= int(dev/(da)) 
    else:
        count -= int(dev/(da))
print(int(dev-count))

### FIXED CODE ###

import fractions
a,b,c,d = map(int,input().split())
dev = b- a +1

def count_q(a,b,m):
    if a%m==0:
        q = b//m -a//m +1
    else:
        q = b//m - a//m
    return q


def lcm(c,d):
    return (c*d)//(fractions.gcd(c,d))

da = lcm(c,d)

qc = count_q(a,b,c)
qd = count_q(a,b,d)
qe = count_q(a,b,da)
ans = (b-a+1)-(qc+qd-qe)
print(ans)
n,k=raw_input().split()
u=sorted({chr(x)for x in range(48,59)}-set(raw_input().split()))
n=list(n)
for i,d in enumerate(n):
 if d not in u:
  n[i:]=[next(e for e in u if e>d)]+[u[0]]*(len(n)-i-1)
  for j in range(i-1,-1,-1):
   if n[j+1]!=':':break
   n[j:j+2]=[next(e for e in u if e>n[j+1]),u[0]]
  else:
   if n[0]==':':n=[u[1 if'1'>u[0]else 0]]+[u[0]]*len(n)
print"".join(n)

### FIXED CODE ###

n,k=raw_input().split();u=sorted({chr(x)for x in range(48,59)}-set(raw_input().split()));z=u[0];n=list(n)
for i,d in enumerate(n):
 if d in u:continue
 n[i:]=[next(e for e in u if e>d)]+[z]*(len(n)-i-1)
 for j in range(i-1,-1,-1):
  if n[j+1]<':':break
  n[j:j+2]=[next(e for e in u if e>n[j]),z]
 else:
  if n[0]>'9':n=[u[1 if'1'>z else 0]]+[z]*len(n)
print"".join(n)
N = input()
a = [input().split() for i in range(N)]
print(a[::-1])

### FIXED CODE ###

n = int(input())
print(" ".join(input().split()[::-1]))
import numpy as np

N ,M= map(int,input().split())
l=list(map(int,input().split()))
n0 = 2**int(np.ceil(np.log2(2*(max(l)+1) - 1)))

A = np.zeros(n0)
#B=np.zeros(n0)
#l=list(map(int,input().split()))

for i in range(N):
    A[l[i]]+=1
   # B[i]=l[i]

C = np.fft.ifft( np.fft.fft(A)*np.fft.fft(A) )
ans=0
j=1
q=[]
for ci in np.real(C[:2*(max(l)+1)- 1] + 0.5):
    #ans+=int(ci)*j
    q.append([int(ci),j])
    j+=1
q.reverse()
z=0
j=0
while z<M:
    ans+=q[j][0]*q[j][1]
    j+=1
    z+=q[j][0]
ans-=(z-M)*q[j-1][1]
print(ans)


### FIXED CODE ###

import numpy as np

N ,M= map(int,input().split())
l=list(map(int,input().split()))
n0 = 2**int(np.ceil(np.log2(2*(max(l))-1)))

A = np.zeros(n0)
#B=np.zeros(n0)
#l=list(map(int,input().split()))

for i in range(N):
    A[l[i]-1]+=1
   # B[i]=l[i]

C = np.fft.ifft( np.fft.fft(A)*np.fft.fft(A) )
ans=0
j=2
q=[]
for ci in np.real(C[:2*(max(l))-1] + 0.5):
    #ans+=int(ci)*j
    q.append([int(ci),j])
    j+=1
q.reverse()
#print(q)
z=0
j=0
while z<M:
    ans+=q[j][0]*q[j][1]
    z+=q[j][0]
    j+=1
ans-=(z-M)*q[j-1][1]
print(ans)
while True:
    n, x = [int(i) for i in input().split()]

    if n == x == 0:
        break

    count = 0:
    for s in range(1, n // 2 + 1):
        for e in range(n, n // 2, -1):
            m = x - s - e
            if m != s and m != e and m > s and m < e and m <= n:
                count += 1
                
    print(count)

### FIXED CODE ###

while True:
    n, x = [int(i) for i in input().split()]

    if n == x == 0:
        break

    count = 0
    for s in range(1, n - 1):
        for m in range(s + 1, n):
            for e in range(m + 1, n + 1):
                if x == s+m+e:
                    count += 1

    print(count)
sec = input()

hms = [0]*3
for i in range(3):
    tmp = int(sec % 60)
    hms[i] = tmp
    input = int((sec-tmp)/60)

hms.reverse()

print(str(hms[0])+':'+str(hms[1])+':'+str(hms[2]))

### FIXED CODE ###

sec = int(input())

hms = [0]*3
for i in range(3):
    tmp = int(sec % 60)
    hms[i] = tmp
    sec = int((sec-tmp)/60)

hms.reverse()

print(str(hms[0])+':'+str(hms[1])+':'+str(hms[2]))
def search(a, num, i):
  nxt = a[num]
  if(nxt == 1):
    return i
  elif(i >= len(a)):
    return -1
  else:
    return search(a, nxt, i+1)

n = int(input())
a = [ int(input())-1 for _ in range(n)]
print(search(a, 0, 1))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
def search(arr, num, i):
  nxt = arr[num]
  if(nxt == 1):
    return i
  elif(i >= len(arr)):
    return -1
  else:
    return search(arr, nxt, i+1)

n = int(input())
a = [ int(input()) - 1 for _ in range(n)]
print(search(a, 0, 1))
n, k = map(int,input().split())
x = list(map(int,input().split()))
time = 10**9

for i in range(n - k + 1):
    x_k = [ x[i], x_k[i+k-1] ]
    #print(x_k)
    
    if x_k[0] >= 0:
        t = x_k[1]
            
    elif x_k[1] <= 0:
        t = -x_k[0]
    
    else:
        t = min(-x_k[0] + x_k[1] *2,-x_k[0] * 2 + x_k[1])

    time = min(t, time)
    
print(time)


### FIXED CODE ###

nk = list(map(int, input().split()))
n = nk[0]
k = nk[1]
x = list(map(int, input().split()))
min_d = 10 ** 9
for i in range(n - k + 1):
    max_i = x[i + k - 1]
    min_i = x[i]
    if max_i <= 0:
        min_d_i = - min_i
    elif min_i >= 0:
        min_d_i = max_i
    else:
        min_d_i = min(- min_i + 2 * max_i, -2 * min_i + max_i)
    if min_d_i < min_d:
            min_d = min_d_i
print(min_d)
n,k=map(int,input().split())

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

l=[1]
di={}
di[1]=1

for i in a:
    b=a[l[-1]-1]
    if b in di:
        x=b
        break
    l.append(b)
    di[b]=1
t1=0
for j in l:
    if j==x:
        break
    else:
        aa+=1

t2=len(l)-t1
if k<=t1:
    print(l[k])

else:
    aa=(k-t1)%t2
    print(l[t1+aa])


### FIXED CODE ###

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

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

l=[1]
di={}
di[1]=1

for i in a:
    b=a[l[-1]-1]
    if b in di:
        x=b
        break
    l.append(b)
    di[b]=1
aa=0
for j in l:
    if j==x:
        break
    else:
        aa+=1

bb=len(l)-aa
if k<=aa:
    print(l[k])

else:
    cc=(k-aa)%bb
    print(l[aa+cc])
# -*- coding: utf-8 -*-
"""
Created on Sun Mar  3 19:52:57 2019

@author: Yamazaki Kenichi
"""

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

def comb2(N):
    return N*(N-1)//2
ans = [int(comb2(N))]
A = [-1 for i in range(N+1)]
B = [[] for i in range(N+1)]
T=[[-1,-1,-1] for i in range(N+1)]
def p(u):
    return T[u][0]
def ch(u):
    return T[u][1]
def root(u):
    if p(u) == -1:
        return u
    else:
        return pn(p(u))
def leef(u):
    if ch(u) == -1:
        return u
    else:
        return cn(ch(u))
def pn(u):
    if p(u) == -1:
        return 0
    else:
        return pn(p(u))+1
def cn(u):
    if ch(u) == -1:
        return 0
    else:
        return cn(ch(u)) +1
def al(u):
    return T[u][2]
k = 0
bb.reverse()
for c in bb:
    if ans[-1] == 0:
        ans.append(0)
        continue
    if al(c[0]) == -1 and al(c[1]) ==-1:
        T[c[0]][2],T[c[1]][2] = 1,1
        T[c[0]][1] = c[1]
        T[c[1]][0] = c[0]
        ans.append(ans[-1]-1)
    elif al(c[0]) != -1 and al(c[1]) ==-1:
        T[c[1]][2] = 1
        res = pn(c[0])+1+cn(c[0])
        tmp = leef(c[0])
        T[tmp][1] = c[1]
        T[c[1]][0] = tmp
        ans.append(ans[-1]-res)
    elif al(c[0]) == -1 and al(c[1]) !=-1:
        T[c[0]][2] = 1
        res = pn(c[1])+1+cn(c[1])
        tmp = leef(c[1])
        T[tmp][1] = c[0]
        T[c[0]][0] = tmp
        ans.append(ans[-1]-res)
    else:
        res = (pn(c[0])+1+cn(c[0])) + (pn(c[1])+1+cn(c[1]))
        tmp = leef(c[0])
        tmp2 = root(c[1])
        T[tmp][1] = tmp2
        T[tmp2][0] = tmp
        ans.append(ans[-1]-res)
for i in range(M):
    print(ans[-i-2])

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Wed Mar  6 14:59:59 2019

@author: Yamazaki Kenichi
"""

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

def comb2(N):
    return N*(N-1)//2
ans = [int(comb2(N))]
bb.reverse()

T = [[-1,1] for i in range(N+1)]
def p(u):
    return T[u][0]
def findset(u):
    if p(u) == -1:
        return u
    else:
        T[u][0] = findset(p(u))
        return T[u][0]
def unite(u,v):
    if findset(u) == findset(v):
        return    
    if T[findset(u)][1] >= T[findset(v)][1]:
        T[findset(u)][1] += T[findset(v)][1]
        T[findset(v)][0] = findset(u)
    else:
        T[findset(v)][1] += T[findset(u)][1]
        T[findset(u)][0] = findset(v)
        
for c in bb:
    if findset(c[0]) != findset(c[1]):
        res1 = T[findset(c[0])][1]
        res2 = T[findset(c[1])][1]
        unite(c[0],c[1])
        ans.append(ans[-1]-res1*res2)
    else:
        ans.append(ans[-1])
for i in range(M):
    print(ans[-i-2])
import math
a, b = map(int,input().split())
ans = (a * b) / math.gcd(a,b)
print(int(ans))

### FIXED CODE ###

import fractions
a, b = map(int,input().split())
ans = (a * b) / fractions.gcd(a,b)
print(int(ans))
M_1, D_1 = map(int,input().split())
M_2, D_2 = map(int,input().split())

if = M_1 =! M_2:
  print('1')
else:
  print('0')

### FIXED CODE ###

M_1, D_1 = map(int,input().split())
M_2, D_2 = map(int,input().split())

if M_1 != M_2:
  print('1')
else:
  print('0')
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]
#まず,足場k+1番目までについて,それぞれ最小コスト入れる
for i in range(k):
  dp.append(abs(h[i+1]-h[0]))

#k+2番目以降について,それぞれ最小コストを求める
for i in range(k+1,n):
  #最小のものの候補配列を作る
  temp=[]
  for j in range(k):
    temp.append(abs(h[i]-h[i-j-1])+dp[i-j-1])
  dp.append(min(temp))

print(dp[n-1])

### FIXED CODE ###

n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]
#まず,足場k+1番目までについて,それぞれ最小コスト入れる
if n>k-1:
  for i in range(k):
    dp.append(abs(h[i+1]-h[0]))
else:
  print(abs(h[n-1]-h[0]))
  exit()


#k+2番目以降について,それぞれ最小コストを求める
for i in range(k+1,n):
  #最小のものの候補配列を作る
  temp=[]
  for j in range(k):
    temp.append(abs(h[i]-h[i-j-1])+dp[i-j-1])
  dp.append(min(temp))

print(dp[n-1])
x,y= list(map(int, input().split()))
if x%y==0:
    print(0)
else:
    print(min((x%y),(y-(x%y)))

### FIXED CODE ###

x,y= list(map(int, input().split()))
if x%y==0:
    print(0)
else:
    z=min((x%y),(y-(x%y)))
    print(z)
h, w = map(int, input().split())
s = []
a = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
	ss = input()
	s.append(ss)
	b = 0
	for j,k in enumerate(ss):
		if k == "#":
			b = 0
			a[i][j] == 0
		else:
			b += 1
			a[i][j] = b
	mx = 0
	for j in range(w-1,-1,-1):
		if a[i][j] == 0:
			mx = 0
			continue
		else:
			mx = max(a[i][j],mx)
			a[i][j] = mx

c = [[0 for i in range(h)] for j in range(w)]
for i in range(w):
	v = ""
	b = 0
	for j in range(h):
		v += s[j][i]
	for j,k in enumerate(v):
		if k == "#":
			b = 0
			c[i][j] == 0
		else:
			b += 1
			c[i][j] = b
	mx = 0
	for j in range(h-1,-1,-1):
		if c[i][j] == 0:
			mx = 0
			continue
		else:
			mx = max(c[i][j],mx)
			c[i][j] = mx

wk = 0
ans = 0
for i in range(h):
	for j in range(w):
		wk = a[i][j] + c[j][i] -1
		ans = max(ans,wk)
print (ans)

### FIXED CODE ###

a = list(map(int, input().split()))
a.sort()
print (a[0] + a[1])
K,N=map(int, input().split())
A=list(map(int, input().split()))
K=[]
for i in range(N):
  if i==N-1:
    K.append((K-A[i])+A[1])
  else:
    K.append(A[i+1]-A[i])

print(N-max(K))

### FIXED CODE ###

K,N=map(int, input().split())
A=list(map(int, input().split()))
C=[]
for i in range(N):
  if i==N-1:
    C.append((K-A[i])+A[0])
  else:
    C.append(A[i+1]-A[i])

print(K-max(C))
import math
N = int(input())
v = math.sqrt(N)
pritn(int(v)*int(v))

### FIXED CODE ###

import math
n = int(input())
v = int(math.sqrt(n))
print(v*v)
import itertools
N = int(input())

ans = [0]*(10**4)
for i1 in range(1, 40):
    i2 = i1+1
    i3 = i1+2
    L = list(itertools.combinations_with_replacement((i1, i2, i3), 3))
    for i in L:
        i = list(i)
        x = i[0]
        y = i[1]
        z = i[2]
        n = (x**2)+(y**2)+(z**2)+(x*y)+(y*z)+(z*x)
        if n >= 10**4:
            break
        if len(list(set(i))) == 1:
            ans[n] += 1
        if len(list(set(i))) == 2:
            ans[n] += 3
        if len(list(set(i))) == 3:
            ans[n] += 6
        
for k in range(1, N+1):
    print(ans[k])

### FIXED CODE ###

n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v = i*i+j*j+k*k+i*j+j*k+k*i
            if v<10050:
                ans[v]+=1
for i in range(n):
    print(ans[i+1])
data = input()
q = int(input())
for _ in range(q):
    op = list(map(str,input().split()))
    a = int(op[1])
    b = int(op[2]) + 1
    if(op[0] == "print"):
        print(data[a:b])
    elif(op[0] == "reverse"):
        data = data[:a] + data[a:b][::-1] + data[:b]
    elif(op[0] == "replace"):
        data = data[:a] + q + data[b:]


### FIXED CODE ###

s=input()
for _ in range(int(input())):
    o=input().split()
    a,b=map(int,o[1:3]);b+=1
    c=o[0][2]
    if c=='p':s=s[:a]+o[3]+s[b:]
    elif c=='i':print(s[a:b])
    elif c=='v':s=s[:a]+s[a:b][::-1]+s[b:]