Harryxun/stf_run huggingface dataset:
import sys
import math

from decimal import *

def solve(A: int, B: float):
    # a = Decimal(A)
    # b = Decimal(B)
    print(math.floor(Decimal(a * b)))
    return
    # if len(str(B)) == 3:
    #     if str(B)[2] == 0:
    #         print(math.floor(a*b))
    #         return
    #     ans = A * int(str(B)[0])
    #     ans += Decimal(a * int(str(B)[2]) / 10)
    #     print(math.floor(ans))
    #     return

    # if len(str(B)) == 4:
    #     ans = A * int(str(B)[0])
    #     ans += Decimal(A * int(str(B)[2]) / 10)
    #     ans += Decimal(A * int(str(B)[3]) / 100)
    #     print(math.floor(ans))
    #     return
    # return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = float(next(tokens))  # type: float
    solve(A, B)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import math

from decimal import *

def solve(A: int, B: float):
    a = Decimal(A)
    b = Decimal(B)
    # print(math.floor(a * b))
    # return
    if len(str(B)) == 3:
        if str(B)[2] == 0:
            print(math.floor(a*b))
            return
        ans = A * int(str(B)[0])
        ans += Decimal(a * int(str(B)[2]) / 10)
        print(math.floor(ans))
        return

    if len(str(B)) == 4:
        ans = A * int(str(B)[0])
        ans += Decimal(A * int(str(B)[2]) / 10)
        ans += Decimal(A * int(str(B)[3]) / 100)
        print(math.floor(ans))
        return
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = float(next(tokens))  # type: float
    solve(A, B)

if __name__ == '__main__':
    main()
a,b=int(input()
print(max(a+b,a+a-1,b+b-1))

### FIXED CODE ###

a,b=map(int,input().split())
print(max(a+b,a+a-1,b+b-1))
import math


def solve():
    a, b, c, d = map(int, input().split())
    lcm = c * d // math.gcd(c, d)
    num_b = b - b // c - b // d + b // lcm
    num_a = a - 1 - (a - 1) // c - (a - 1) // d + (a - 1) // lcm
    return num_b - num_a


if __name__ == "__main__":
    print(solve())


### FIXED CODE ###

def solve():
    s = input()
    return "Bad" if any([s[i] == s[i + 1] for i in range(len(s) - 1)]) else "Good"


if __name__ == "__main__":
    print(solve())
n = int(input())
a = list(map(int,input().split(' ')))
ans = 0
for i in range(n):
    if i ==0 and a[0]==1:
        a[0],a[1] = a[1],a[0]
        ans += 1
        continue
    if i+1 == a[i] and i+1 != a[i+1] and i <n:
        a[i],a[i+1] = a[i+1],a[i]
        ans += 1
    if  i+1 ==a[i] and i+1 != a[i-1]:
        a[i-1],a[i] = a[i],a[i-1]
        ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split(' ')))
ans = 0
for i in range(n):
    if i ==0 and a[0]==1:
        a[0],a[1] = a[1],a[0]
        ans += 1
        continue
    if i<n-1 and i+1 == a[i] and i+2 ==a[i+1]:
        a[i],a[i+1]  = a[i+1],a[i]
        ans += 1
    if i+1 ==a[i] and i+1 != a[i-1]:
        a[i-1],a[i] = a[i],a[i-1]
        ans += 1
print(ans)
print(min([int(input()) for _ in [0]*int(input())],key=lambda x:x[0]+x[1]))

### FIXED CODE ###

n=int(input())
ans=10**100
for i in range(n):
  t=sum(list(map(int,input().split())))
  ans=min(ans,t)
print(ans)
n = int(input())
a = (int(num) for num in input().split())
ans = "APPROVED"
for i in range(n):
  if a[i] % 2 == 0 and a[i] % 3 != 0 and a[i] % 5 != 0:
    ans = "DENIED"
print(ans)

### FIXED CODE ###

n = int(input())
a = [int(num) for num in input().split()]
ans = "APPROVED"
for i in range(n):
  if a[i] % 2 == 0 and a[i] % 3 != 0 and a[i] % 5 != 0:
    ans = "DENIED"
print(ans)
n = int(input())
ans = n
for i in range(0,int(n**0.5)):
  if n % i == 0:
    j = target // i
    if (i+j-2) < ans:
      ans = i+j-2
print(ans)

### FIXED CODE ###

n=int(input())
ans=n
for i in range(int(n**0.5),0,-1):
    if n%i==0:
        ans=n//i+i-2
        break
print(ans)
n,m = map(int,input().split())
s = str(input())
t = str(input())
a = 0
def get_gcd(a, b):
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    else:
        return get_gcd(b, a % b)
def get_lcm(a, b, gcd):
    lcm = a * b // gcd
    return lcm
saisyou = get_lcm(n,m,get_gcd(n,m))
ans = 0
if saisyou == n or saisyou == m:
    print(-1)
else:
    for l in range(saisyou,100000,saisyou):
        num = 0
        xlis = []
        ylis = []
        for i in range(min(n,m)):
            xlis.append(1+(l/n)*i+1)
            ylis.append(1+(l/m)*i+1)
        yset = set(ylis)
        xset = set(xlis)
        renketu = set(yset + xset)
        if len(yset) + len(xset) == renketu:
            ans = l
            break
    print(ans)    

### FIXED CODE ###

n,m = map(int,input().split())
s = str(input())
t = str(input())
def get_gcd(a, b): #最大公約数を求める関数
    if a < b:
        a, b = b, a
    if a % b == 0:
        return b
    else:
        return get_gcd(b, a % b)
def get_lcm(a, b, gcd): #みたまんまそういうやつです
    lcm = a * b // gcd
    return lcm
lcm = get_lcm(n,m,get_gcd(n,m)) #lcmはn,m最小公倍数
lcm2 = get_lcm(lcm/n,lcm/m,get_gcd(lcm/n,lcm/m)) #lcm２はlcm/nとlcm/mの最小公倍数
ans = 0
for i in range(int(lcm//lcm2)):
    if s[int(i*lcm2//(lcm/n))] == t[int(i*lcm2//(lcm/m))]:
        pass
    else:
        ans = 1
        break
if ans == 1:
    print(-1)
else:
    print(lcm)
import sys
import math
lines = sys.stdin.readlines()
line1 = lines.pop(0).split(' ')
#print(line1)
N = int(line1[0])
M = int(line1[1])

#print(N)
#print(M)

str = [0] * N
ans = []
flg = 0
flg2 = 0
for i in range(M):
  line = lines.pop(0).split(' ')
#  print(line)
  s = int(line[0])
  c = int(line[1])
#  print(s)
#  print(c)
  str[s-1] = c
#  print('str = ')
#  print(str)
  one = int(str[0])
  if N == 3:
    ret = one*100 + int(str[1])*10 + int(str[2])
    if int(str[1])>0:
      flg = 1
    else:
      flg = 2

    if int(str[2])>0:
      flg2 = 1
    else:
      flg2 = 2
  elif N == 2:
    ret = one*10 + int(str[1])
    if int(str[1]) > 0:
      flg = 1
    else:
      flg = 2
  else:
    ret = one
  ans.append(ret)

#print(ans)

for obj in ans[:]:
  if (obj / (10**(N-1))) < 1 and N > 1:
    ans.remove(obj)
    
  if N == 2:
    if flg == 1:
      a = obj % 10
      if a == 0:
#        print('リムーブ')
        ans.remove(obj)

  elif N == 3:
    if flg == 1 and flg2 ==1:
      print('リムーブ候補')
      print(obj)
      if obj % 100 == 0:
#        print('リムーブ')
        ans.remove(obj)
      elif math.floor(obj/10)  % 10 == 0:
#        print('リムーブ')
        ans.remove(obj)
    elif flg == 1 and flg2 ==0:
      if obj % 100 == 0:
        ans.remove(obj)
    elif flg == 0 and flg2 ==1:
#      print('リムーブ候補')
#      print(obj)
      b = obj % 10
#      print(b)
      if b == 0:
#        print('リムーブ')
        ans.remove(obj)

if not ans:
  print('-1')
else:
#  print(ans)
  print(min(ans))


### FIXED CODE ###

import math
print(math.ceil(int(input()) / 2))
n, k = map(int, input().split())
S = input()
start =[]
end = []
if S[0] == "0":
    start.appned(0)
else:
    end.append(0)
for i in range(n):
    if S[i:i+2] == "10":
        start.append(i+1)
    elif S[i:i+2] == "01":
        end.append(i+1)
if len(start) <= k:
    print(len(S))
else:
    start.append(len(S))
    ans = []
    for i in range(len(start) - k):
        ans.append(start[i + k] - end[i])
    print(max(ans))

### FIXED CODE ###

n, k = map(int, input().split())
S = input()
start =[]
end = [0]
if S[0] == "0":
    start.append(0)
for i in range(n):
    if S[i:i+2] == "10":
        start.append(i+1)
    elif S[i:i+2] == "01":
        end.append(i+1)

if len(start) <= k:
    print(len(S))
else:
    start.append(len(S))
    ans = []
    for i in range(len(start) - k):
        ans.append(start[i + k] - end[i])
    print(max(ans))
n=int(input())
s=list(input())
ans=s.count('R')*s.count('G')*s.count('B')
for i in range(n):
   if s[i]=='R':
       s[i]=1
   elif s[i]=='G':
       s[i]
   elif s[i]=='B':
       s[i]=4
for i in range(n):
   for j in range(i+1,n):
     k=2*j-i
     if k>=n:
       continue
     if s[i]+s[j]+s[k]==7:
         ans-=1
print(ans)

### FIXED CODE ###

n=int(input())
s=list(input())
ans=s.count('R')*s.count('G')*s.count('B')
for i in range(n):
  if s[i]=='R':
    s[i]=1
  elif s[i]=='G':
    s[i]=2
  elif s[i]=='B':
    s[i]=4
for i in range(n):
   for j in range(i+1,n):
      k=2*j-i
      if k>=n:
        continue
      if s[i]+s[j]+s[k]==7:
        ans-=1
print(ans)
#!/usr/bin/env python

n, y = map(int, input().split())
# print(n, y)

found = False
for i in range(n+1):
    for j in range(n+1):
        for k in range(n+1):
            if 10000 * i + 5000 * j + 1000 * k == y and i + j + k == n:
                found = True
                print(f"{i} {j} {k}")
                break
        if found:
            break
    if found:
        break

if not found:
    print("-1 -1 -1")


### FIXED CODE ###

#!/usr/bin/env python

n, y = map(int, input().split())
# print(n, y)

found = False
for i in range(n+1):
    for j in range(n+1):
        if i + j > n:
            break
        k = n - (i + j)
        if 10000 * i + 5000 * j + 1000 * k == y and i + j + k == n:
            found = True
            print("{} {} {}".format(i, j, k))
            break
    if found:
        break

if not found:
    print("-1 -1 -1")
import sys
import numpy as np
from collections import deque

n = int(input())


color_ls = {i:None for i in range(n)}
_map = np.zeros((n, n))
already = set()
for i in range(n-1):
    u, v, w = [int(i) for i in sys.stdin.readline().split()]
    u -= 1
    v -= 1
    if i == 0:
        root = u
    _map[u][v] = w
    _map[v][u] = w
    already.update({u, v})
color_ls[root] = 0
cur = root
already.clear()
que = deque()
while True:
    candidate = np.nonzero(_map[cur])[0]
    for cand in candidate:
        if cand in already:
            continue
        already.add(cand)
        que.append(cand)
        if _map[cur][cand] % 2 == 0:
            color_ls[cand] = 0 if color_ls[cur] == 0 else 1
        else:
            color_ls[cand] = 1 if color_ls[cur] == 0 else 0
    if len(que) == 0:
        break
    cur = que.popleft()

for i in range(n):
    print(color_ls[i])

### FIXED CODE ###

import sys
from collections import deque

n = int(input())

color_ls = {i: None for i in range(n)}
dict_map = {i : [] for i in range(n)}
already = set()
for i in range(n - 1):
    u, v, w = [int(i) for i in sys.stdin.readline().split()]
    u -= 1
    v -= 1
    if i == 0:
        root = u
    dict_map[u].append([v, w])
    dict_map[v].append([u, w])
    already.update({u, v})
color_ls[root] = 0
cur = root
already.clear()
que = deque()
while True:
    candidate = dict_map[cur]
    for cand, w in candidate:
        if cand in already:
            continue
        already.add(cand)
        que.append(cand)
        if w % 2 == 0:
            color_ls[cand] = 0 if color_ls[cur] == 0 else 1
        else:
            color_ls[cand] = 1 if color_ls[cur] == 0 else 0
    if len(que) == 0 or len(already) == n:
        break
    cur = que.popleft()

for i in range(n):
    print(color_ls[i])
def lam(x,mod):
	ans=1
	for i in range(1,x+1):
		ans*=i
        ans%=mod
	return ans
n,m=map(int,input().split())
n,m=min(n,m),max(n,m)
mod=10**9+7
if n<m-1:
	print(0)
	exit()
if n+1==m:
	print(lam(n,mod)*lam(m,mod)%mod)
else:
	print(2*(lam(n,mod)**2)


### FIXED CODE ###

def lam(x,mo):
	ans=1
	for i in range(1,x+1):
		ans*=i
		ans%=mo
	return ans
n,m=map(int,input().split())
n,m=min(n,m),max(n,m)
mod=10**9+7
if n<m-1:
	print(0)
	exit()
if n+1==m:
	print(lam(n,mod)*lam(m,mod)%mod)
else:
	print(2*(lam(n,mod)**2)%mod)
w,h,x,y = map(int, input().split())
ans_1 = w*h/2
ans_2 = 0
if (x==w/2) and (h == y/2):
    ans_2 = 1
print("".join(map(str, ans_1,ans_2)))

### FIXED CODE ###

w,h,x,y = map(int, input().split())
ans_1 = w*h/2
ans_2 = 0
if (x==(w/2)) and (y == (h/2)):
    ans_2 = 1
print(" ".join(map(str, [ans_1,ans_2])))
n = int(input())
a = list(map(int, input().split()))

if n == 3 and a[0] ^ a[1] == a[2]:
  print("Yes")
elif n >= 4 and set(a) = {0}:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

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

st = set(a)
lst = list(st)

if n == 3 and a[0] ^ a[1] == a[2]:
  print("Yes")
elif n  >= 4 and st == {0}:
  print("Yes")
elif n % 3 == 0 and len(st) == 2 and a.count(0) == n /3:
  print("Yes")
elif n % 3 == 0 and len(st) == 3 and lst[0] ^ lst[1] == lst[2] and a.count(lst[0]) == n /3 and a.count(lst[1]) == n/3:
  print("Yes")
else:
  print("No")
import math
N,X=map(int,input().split())
x=list(map(int,input().split()))
L=sorted(x+[X])
def GCD(LIST):
	if len(LIST)==2:
		return math.gcd(LIST[0],LIST[1])
	else:
		return GCD([math.gcd(LIST[0],LIST[1])]+LIST[2::])
if N==1:
	print(abs(X-x[0]))
else:
	LL=[L[i+1]-L[i] for i in range(N)]
	print(GCD(LL))

### FIXED CODE ###

from functools import reduce
N,X=map(int,input().split())
x=list(map(int,input().split()))
L=x+[X]
if N==1:
	print(abs(X-x[0]))
else:
	LL=[abs(L[i+1]-L[i]) for i in range(N)]
	def gcd(a,b):
		while b>0:
			a,b=b,a%b
		return a
	print(reduce(gcd,LL))
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

//
var (
	N int
	M int
	R int
	r []int
	d [][]int
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func fillInts(a []int, x int) {
	for i := 0; i < len(a); i++ {
		a[i] = x
	}
}

func warshallFloyd(n int, d [][]int) {
	for k := 0; k < n; k++ {
		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				d[i][j] = min(d[i][j], d[i][k]+d[k][j])
			}
		}
	}
}

func swap(a []int, i int, j int) {
	x, y := a[i], a[j]
	a[i], a[j] = y, x
}

func permtationsImpl(a []int, i int, f func(a []int)) {
	if i == len(a)-1 {
		f(a)
		return
	}
	permtationsImpl(a, i+1, f)
	for j := i + 1; j < len(a); j++ {
		swap(a, i, j)
		permtationsImpl(a, i+1, f)
		swap(a, i, j)
	}
}

func permtations(a []int, f func(a []int)) {
	permtationsImpl(a, 0, f)
}

func main() {
	defer flush()

	N = readInt()
	M = readInt()
	R = readInt()
	r = make([]int, R)
	for i := 0; i < R; i++ {
		r[i] = readInt()
	}

	d = make([][]int, N+1)
	for i := 0; i < N+1; i++ {
		d[i] = make([]int, N+1)
		fillInts(d[i], math.MaxInt32)
		d[i][i] = 0
	}

	for i := 0; i < M; i++ {
		A := readInt()
		B := readInt()
		C := readInt()
		d[A][B] = C
		d[B][A] = C
	}
	warshallFloyd(N+1, d)

	result := math.MaxInt64
	permtations(r, func(a []int) {
		t := 0
		for i := 0; i < R-1; i++ {
			t += d[a[i]][a[i+1]]
		}
		result = min(result, t)
	})
	println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}

var stdoutWriter = bufio.NewWriter(os.Stdout)

func flush() {
	stdoutWriter.Flush()
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdoutWriter, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdoutWriter, args...)
}


### FIXED CODE ###

from itertools import permutations


def warshall_floyd(n, d):
    for i in range(n):
        for j in range(n):
            for k in range(n):
                d[j][k] = min(d[j][k], d[j][i] + d[i][k])


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

d = [[1000000000] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
    A, B, C = map(int, input().split())
    d[A][B] = C
    d[B][A] = C
warshall_floyd(N + 1, d)

result = 1000000000
for p in permutations(r):
    t = 0
    for i in range(R - 1):
        t += d[p[i]][p[i + 1]]
    result = min(result, t)
print(result)
# coding: utf-8
# Here your code !
import sys
from collections import deque
n = int(input())
output = []
for i in range(n):
    order,data =input().split() 
    if order == "insert":
        output.append(int(data))
    elif order == "deleteFirst":
        output.pop()
    elif order == "deleteLast":
        output.popleft()
    elif order == "delete":
        try:
            output.remove(int(data))
        except:
            pass
output.reverse()
print(" ".join(map(str,output)))

### FIXED CODE ###

import sys
from collections import deque
n = int(sys.stdin.readline())
lines = sys.stdin.readlines()
 
Q = deque()
for i in range(n):
    command = lines[i].split()
    if command[0] == "insert":
        Q.appendleft(command[1])
    elif command[0] == "deleteFirst":
        Q.popleft()
    elif command[0] == "deleteLast":
        Q.pop()
    elif command[0] == "delete":
        try:
            Q.remove(command[1])
        except:
            pass
print(" ".join(Q))
import functools

def sign(x):
    if x>0:
        return 1
    elif x==0:
        return 0
    else:
        return -1
    
def multiply(x,y):
    ans = x*y
    if ans>=10**9+7:
        ans %= 10**9+7
    return ans

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

if A[-1]<0 and K%2==1:
    combi = A[-K:]
    answer =  functools.reduce(multiply,map(abs,combi[:-1]))
    answer *= combi[-1]
    answer %= 10**9+7
else:
    signs = 1
    i,j = 0,0
    for _ in range(K):
        if abs(A[i]) > abs(A[N-j-1]):
            signs *= sign(A[i])
            i += 1
            
        else:
            signs *= sign(A[N-j-1])
            j += 1
    combi = A[N-j:] + A[:i]
    del A[N-j:]
    del A[:i]
    combi = combi[::-1]     
       
    if signs == -1:
        if combi[-1] <0:
            del combi[0]
            combi.append(A[-1])
        else:
            if A[0]>0:
                del combi[0]
                combi.append(A[-1])
            elif A[0]<0 and A[-1] >0:
                if combi[0]*A[0] > combi[-1]*A[-1]:
                    del combi[-1]
                    combi.insert(0,A[0])
                else:
                    del combi[0]
                    combi.append(A[-1])
            else:
                del combi[-1]
                combi.insert(0,A[0]) 

    answer =  functools.reduce(multiply,map(abs,combi))
print(answer)

### FIXED CODE ###

import functools

def sign(x):
    if x>0:
        return 1
    elif x==0:
        return 0
    else:
        return -1
    
def multiply(x,y):
    ans = x*y
    if ans>=10**9+7 or ans<0:
        ans %= (10**9+7)
    return ans

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

if (A[-1]<0 and K%2==1):
    combi = A[-K:]
    if K >1:
        answer =  functools.reduce(multiply,combi)

elif K == N:
    answer = functools.reduce(multiply,A)
    
else:
    signs = 1
    i,j = 0,0
    for _ in range(K):
        if abs(A[i]) > abs(A[N-j-1]):
            signs *= sign(A[i])
            i += 1
            
        else:
            signs *= sign(A[N-j-1])
            j += 1
    combi = A[N-j:] + A[:i]
    del A[N-j:]
    del A[:i]
    combi = combi[::-1]     
       
    if signs == -1:
        if A:
            if combi[-1]<0:
                del combi[0]
                combi.append(A[-1])
            elif A[0]>=0:
                del combi[0]
                combi.append(A[-1])
            elif A[0]<0 and A[-1] >0:
                if combi[0]*A[0] > combi[-1]*A[-1]:
                    del combi[-1]
                    combi.insert(0,A[0])
                else:
                    del combi[0]
                    combi.append(A[-1])
            elif A[-1] <= 0:
                del combi[-1]
                combi.insert(0,A[0]) 
                
    answer =  functools.reduce(multiply,combi)
print(answer)
A,B,C,D =map(int, input().split())
import math
lcm = C * D // math.gcd(C, D)
E = B - (B // C + B // D - B // lcm)
F = (A-1) - ((A-1) // C + (A-1) // D - (A-1) // lcm)
result = E-F
print(result)

### FIXED CODE ###

A,B,C,D =map(int, input().split())
import fractions
lcm = C * D // fractions.gcd(C, D)
E = B - (B // C + B // D - B // lcm)
F = (A-1) - ((A-1) // C + (A-1) // D - (A-1) // lcm)
result = E-F
print(result)
N, M = map(int, input().split())
class uft:
  def __init__(self, N):
    self.__N = N
    self.__arr = [-1] * (N + 1)
  def fp(self, x):
    if self.__arr[x] < 0:
      return x
    else:
      self.__arr[x] = self.fp(self.__arr[x])
      return self.__arr[x]
  def add(self, x, y):
    if x > y:
      x, y = y, x
    px = self.fp(x)
    py = self.fp(y)
    self.__arr[px] += self.__arr[py]
    self.__arr[py] = px
  def groups(self):
    ret = -1
    for i in self.__arr:
      if i < 0:
        ret += 1
    return ret
UFT = uft(N)
for i in range(M):
  A, B = map(int, input().split())
  UFT.add(A,B)
print(UFT.groups() -1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(int(1e9))

class uft:
  def __init__(self, N):
    self.__N = N
    self.__arr = [-1] * (N + 1)
  def fp(self, x):
    if self.__arr[x] < 0:
      return x
    else:
      self.__arr[x] = self.fp(self.__arr[x])
      return self.__arr[x]
  def add(self, x, y):
    px = self.fp(x)
    py = self.fp(y)
    if px > py:
      px, py = py, px
    if px == py:
      return 1
    self.__arr[px] += self.__arr[py]
    self.__arr[py] = px
  def groups(self):
    ret = -1
    for i in self.__arr:
      if i < 0:
        ret += 1
    return ret
  def show_arr(self):
    print(self.__arr)
  
N, M = map(int, input().split()) 
UFT = uft(N)

for i in range(M):
  A, B = map(int, input().split())
  UFT.add(A,B)
print(UFT.groups() -1)
int N
float sum = 0
N = input() 
for i in range(N)
	s = input()
	sum = (float)1/s
print(sum)

### FIXED CODE ###

sum = 0.00
s = 0 
N = int(input()) 
numlist = list(input().split())
for i in range(N):
	s = int(numlist[i])
	sum = sum+(1/s)
print(1/sum)
s=input()
x,y=map(int,input().split())
X,Y=[],[]
ct,dir,ss=0,1,1
for i in range(len(s)):
  if s[i]=="F":
    ct+=1
    if i==len(s)-1:
      if dir==1:
        X.append(ct)
      else:
        Y.append(ct)
  else:
    if ss==1:
      x-=ct
      ct,dir,ss=0,0,0
    elif dir==1:
      X.append(ct)
      ct,dir=0,0
    else:
      Y.append(ct)
      ct,dir=0,1

def chk(Z,z):
  tot,nz=sum(Z),len(Z)
  if tot==0:
    if z==0:
      return True
    else:
      return False
  else:
    DP=[[False]*(2*tot+1) for _ in range(nz+1)]
    DP[0][tot]=True
    for i in range(nz):
      zz=Z[i]
      for j in range(2*tot+1):
        if j+zz<2*tot+1:
          DP[i+1][j]=DP[i][j+zz]
        elif j-zz>=0:
          DP[i+1][j]=DP[i][j-zz]
    return DP[nz][z+tot]

if chk(X,x) and chk(Y,y):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s=input()
x,y=map(int,input().split())
ct=0
XY=[]
for i in range(len(s)):
  if s[i]=="F":
    ct+=1
  else:
    XY.append(ct)
    ct=0
XY.append(ct)
x-=XY[0]
X=XY[2::2]
Y=XY[1::2]


def chk(Z,z):
  tot,nz=sum(Z),len(Z)
  if tot==0:
    if z==0:
      return True
    else:
      return False
  elif abs(z)>tot:
    return False
  else:
    DP=[[False]*(2*tot+1) for _ in range(nz+1)]
    DP[0][tot]=True
    for i in range(nz):
      zz=Z[i]
      for j in range(2*tot+1):
        if j+zz<2*tot+1 and DP[i][j+zz]==True:
          DP[i+1][j]=True
        if j-zz>=0 and DP[i][j-zz]==True:
          DP[i+1][j]=True
    return DP[nz][z+tot]

if chk(X,x) and chk(Y,y):
  print("Yes")
else:
  print("No")
X = int(input())
x = int(X**0.5)
num = []
for b in range(2,x+1) :
    p = 2
    while b**p <= X :
        p += 1
    num.append(b**(p-1))
print(max(num))

### FIXED CODE ###

X = int(input())
x = int(X**0.5)
num = []
if X <= 3 :
    print(1)
else :
    for b in range(2,x+1) :
        p = 2
        while b**p <= X :
            p += 1
        num.append(b**(p-1))
    print(max(num))
S = list(input().split())
T = list(input().split())

ans =  0
for i in range(3):
    if S[i] == T[i]:
        ans += 1

print(ans)

### FIXED CODE ###

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

ans =  0
for i in range(3):
    if S[i] == T[i]:
        ans += 1

print(ans)