Harryxun/stf_run huggingface dataset:
import sys
#input = sys.stdin.readline
from collections import deque
N, u, v = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
v-=1
u-=1
que = deque([v])
par = [-1]*N
depth = [-1]*N
depth[v] = 0
while que:
    i = que.popleft()
    d = depth[i]
    for nv in G[i]:
        if depth[nv]>=0:
            continue
        depth[nv] = d+1
        par[nv] = i
        que.append(nv)
d = depth[u]
now = u
m = 0
que = deque([now])
while que:
    i = que.pop()
    m = max(m, depth[i])
    for nv in G[i]:
        if depth[nv]<depth[i]:
            continue
        que.append(nv)
for i in range(d//2):
    pp = par[now]
    que = deque([p])
    while que:
        i = que.pop()
        m = max(m, depth[i])
        for nv in G[i]:
            if depth[nv]<depth[i] or nv == pp:
                continue
            que.append(nv)
    now = pp
print(m-1)
    






### FIXED CODE ###

import sys
#input = sys.stdin.readline
from collections import deque
N, u, v = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
v-=1
u-=1
que = deque([v])
par = [-1]*N
depth = [-1]*N
depth[v] = 0
while que:
    i = que.popleft()
    d = depth[i]
    for nv in G[i]:
        if depth[nv]>=0:
            continue
        depth[nv] = d+1
        par[nv] = i
        que.append(nv)
d = depth[u]
now = u
m = 0
que = deque([now])
while que:
    i = que.pop()
    m = max(m, depth[i])
    for nv in G[i]:
        if depth[nv]<depth[i]:
            continue
        que.append(nv)
for i in range(d//2):
    pp = par[now]
    que = deque([pp])
    while que:
        i = que.pop()
        m = max(m, depth[i])
        for nv in G[i]:
            if depth[nv]<depth[i] or nv == now:
                continue
            que.append(nv)
    now = pp
print(m-1)
from collections import defaultdict

from math import factorial

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

for num in nums:
    d[num] += 1

#print(d)

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

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

### FIXED CODE ###

import math

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

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

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

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

for num in numsB:
    tmp = d[num] - 1
#    if tmp >= 2:
#        hoge = factorial(tmp) / factorial(2) / factorial(tmp - 2)
    print(int(total - tmp))
n=int(input())
li=list(map(int,input().split()))
count=0
for i in range(1,n):
  if li[i] >= max(li[0:i])
    count +=1
print(count+1)

### FIXED CODE ###

n=int(input())
li=list(map(int,input().split()))
count=0
for i in range(1,n):
  if li[i] >= max(li[0:i]):
    count +=1
print(count+1)
N = int(input())
A = [list(map(int,input().split())) for i in range(N)]
dup = [i for i in set(A) if A.count(i) > 1]
if not dup:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

def has_duplicates(seq):
    return len(seq) != len(set(seq))
    
N = map(int,input())
A = list(map(int,input().split()))
print("NO" if has_duplicates(A) else "YES")
import math

n,x=map(int,input().split())
z=[]
y=[]
z=list(map(int, input().split()))

for i in range(n):
  y.append(abs(x-z[i]))

if n==1:
  print(y[0])
else:
  gcm=y[0]
  for i in range(n):
    gcm=math.gcd(gcm,y[i])
  print(gcm)


### FIXED CODE ###

import fractions

n,x=map(int,input().split())
z=[]
y=[]
z=list(map(int, input().split()))

for i in range(n):
  y.append(abs(x-z[i]))

if n==1:
  print(y[0])
else:
  gcm=y[0]
  for i in range(n):
    gcm=fractions.gcd(gcm,y[i])
  print(gcm)
n,m = [int(i) for i in input().split()]
a = list(map(int,input().split()))

match = [0,2,5,5,4,5,6,3,7,6]

dig = [0] * (n+1)

inf = 10**9


for i in range(1,n+1):
    lst = []
    for j in range(len(a)):
        num = a[j]
        mat = match[num]
        bef = i-mat
        if bef >= 0:
            lst.append(dig[bef])
        if lst:
            dig[i] = max(lst) + 1


ans = ""
def dp(i):
    if i == 0:
        return
    global ans
    maxi = 0
    for j in range(len(a)):
        num = a[j]
        mat = match[num]
        bef = i - mat
        if dig[bef] == dig[i]-1 and (dig[bef] > 0 or bef == 0):
            if num > maxi:
                maxi = num
                k = bef
    ans += str(maxi)
    dp(k)

dp(n)
print(ans)

### FIXED CODE ###

n,m = [int(i) for i in input().split()]
a = list(map(int,input().split()))

import sys
sys.setrecursionlimit(50000)

match = [0,2,5,5,4,5,6,3,7,6]

dig = [0] * (n+1)

inf = 10**9


for i in range(1, n + 1):
    lst = []
    for j in range(len(a)):
        num = a[j]
        mat = match[num]
        bef = i - mat
        if bef >= 0:
            if bef == 0:
                lst.append(dig[bef])
            else:
                if dig[bef] > 0:
                    lst.append(dig[bef])
        if lst:
            dig[i] = max(lst) + 1


ans = ""


def dp(i):
    k = -1
    if i == 0:
        return
    global ans
    maxi = 0
    for j in range(len(a)):
        num = a[j]
        mat = match[num]
        bef = i - mat
        if dig[i] == 1:
            if bef == 0:
                maxi = max(maxi, num)
                k = 0
        else:
            if bef >= 0:
                if dig[bef] == dig[i] - 1:
                    if num > maxi:
                        maxi = num
                        k = bef
    ans += str(maxi)
    if k >= 0:
        dp(k)


dp(n)
print(ans)
import sys

loops1 = 4
loops2 = 5
arg1 = 0
arg2 = 1

i=0
j=0

args = [input() for i in range(6)]


for i in range(arg1,loops1):
	for j in range(arg2,loops2):
		if (args[j] - args[i]) > args[5]:
			print(":(")
			sys.exit()
print("Yay!")
	           

### FIXED CODE ###

import sys

loops1 = 4
loops2 = 5
arg1 = 0
arg2 = 1

i=0
j=0

args = [int(input()) for i in range(6)]

for i in range(arg1,loops1):
	for j in range(arg2,loops2):
		if (args[j] - args[i]) > args[5]:
			print(":(")
			sys.exit()
print("Yay!")
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ans = int(0)

N, K = LI()
S = str(input())
S = S + "2"
d1 = []
d0 = []
k = S[0]
if k=="0":
    d1.append(0)
cou = int(1)
for i in range(N):
    if S[i]!=S[i+1]:
        if S[i]=="0":
            d0.append(cou)
        if S[i]=="1":
            d1.append(cou)
        cou = int(1)
    else:
        cou +=1

#print(d1)
#print(d0)

ansC = []
t = 2*K+1
newN = len(d1)
if len(d1)==1 or d0==[] or K>=N//2+1:
    ansC.append(N)

if newN!=len(d0):
    d0.append(0)
    d0.append(0)
sumd1 = [0]*(newN+t)
sumd0 = [0]*(newN+t)
for i in range(newN):
    sumd1[i+1] = d1[i]
    sumd0[i+1] = d0[i]
for i in range(newN+1):
    sumd1[i+1] += sumd1[i]
    sumd0[i+1] += sumd0[i]

#for i in range(max(newN-K+1,K)):
for i in range(newN-K+1):
    ans = (sumd1[i+K+1]-sumd1[i]) + (sumd0[i+K]-sumd0[i])
    ansC.append(ans)


print(max(ansC))
#print(ansC)
#print(sumd1)
#print(sumd0)

### FIXED CODE ###

import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ans = int(0)

N, K = LI()
S = str(input())
S = S + "2"
d1 = []
d0 = []
k = S[0]
if k=="0":
    d1.append(0)
cou = int(1)
for i in range(N):
    if S[i]!=S[i+1]:
        if S[i]=="0":
            d0.append(cou)
        if S[i]=="1":
            d1.append(cou)
        cou = int(1)
    else:
        cou +=1

#print(d1)
#print(d0)

ansC = []
t = 2*K+1
newN = len(d1)
if len(d1)==1 or d0==[] or K>=N//2+1:
    ansC.append(N)

if newN!=len(d0):
    d0.append(0)
    d0.append(0)
sumd1 = [0]*(newN+t+5)
sumd0 = [0]*(newN+t+5)
for i in range(newN):
    sumd1[i+1] = d1[i]
    sumd0[i+1] = d0[i]
for i in range(newN+1):
    sumd1[i+1] += sumd1[i]
    sumd0[i+1] += sumd0[i]

#for i in range(max(newN-K+1,K)):
if ansC==[] and (newN - K + 1)>=1:
    for i in range(newN - K + 1):
        ans = (sumd1[i + K + 1] - sumd1[i]) + (sumd0[i + K] - sumd0[i])
        ansC.append(ans)
else:
    ansC.append(N)
print(max(ansC))
N = int(input())

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


b = sorted(list(A))
dp = [0]*(max(A)+4)

m_a = max(A)
for i in b:
    dp[i] += 1
    if dp[i]==1 :
        for j in range(i*2, m_a,i):
            dp[j*i] +=100

print(dp.count(1))

### FIXED CODE ###

N = int(input())

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


b = sorted(list(A))
dp = [0]*(max(A)+1)

m_a = max(A)+1
for i in b:
    dp[i] += 1
    if dp[i]==1 :
        for j in range(i*2, m_a,i):
            dp[j] +=100

print(dp.count(1))
N,K=map(int,input().split())

num=[0]*(N+1)
for i in range(1,N+1):
    num[i%K]+=1
#print(num)
ans=0
for a in range(K):
    b=(K-a)%K#a=0なら0 a!=0ならk-aになる賢い手
    c=(K-a)%K
    if (b+c)%K!=0:
        continue
    else:
      	#print(a)
        ans+=num[a]*num[b]*num[c]
        #print(a,b,c)
print(ans)

### FIXED CODE ###

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

num=[0]*(max(N+1,K))
for i in range(1,N+1):
    num[i%K]+=1
#print(num)
ans=0
for a in range(K):
    b=(K-a)%K#a=0なら0 a!=0ならk-aになる賢い手
    c=(K-a)%K
    if (b+c)%K!=0:
        continue
    else:
      	#print(a)
        ans+=num[a]*num[b]*num[c]
        #print(a,b,c)
print(ans)
def gcd(a, b):
    while b: a, b = b, a % b
    return a
def isPrimeMR(n):
    d = n - 1
    d = d // (d & -d)
    L = [2]
    for a in L:
        t = d
        y = pow(a, t, n)
        if y == 1: continue
        while y != n - 1:
            y = (y * y) % n
            if y == 1 or t == n - 1: return 0
            t <<= 1
    return 1
def findFactorRho(n):
    m = 1 << n.bit_length() // 8
    for c in range(1, 99):
        f = lambda x: (x * x + c) % n
        y, r, q, g = 2, 1, 1, 1
        while g == 1:
            x = y
            for i in range(r):
                y = f(y)
            k = 0
            while k < r and g == 1:
                ys = y
                for i in range(min(m, r - k)):
                    y = f(y)
                    q = q * abs(x - y) % n
                g = gcd(q, n)
                k += m
            r <<= 1
        if g == n:
            g = 1
            while g == 1:
                ys = f(ys)
                g = gcd(abs(x - ys), n)
        if g < n:
            if isPrimeMR(g): return g
            elif isPrimeMR(n // g): return n // g
            return findFactorRho(g)
def primeFactor(n):
    i = 2
    ret = {}
    while i*i <= n:
        k = 0
        while n % i == 0:
            n //= i
            k += 1
        if k: ret[i] = k
        i += 1 + i % 2
        if i == 101 and n >= 2 ** 20:
            while n > 1:
                if isPrimeMR(n):
                    ret[n], n = 1, 1
                else:
                    rhoFlg = 1
                    j = findFactorRho(n)
                    k = 0
                    while n % j == 0:
                        n //= j
                        k += 1
                    ret[j] = k
    if n > 1:return {n} 
    return set(ret)
def main():
    n=int(input())
    a=list(map(int,input().split()))
    g=a[0]
    for i in a[1:]:g=gcd(g,i)
    if g!=1:
        print("not coprime")
        exit()
    ans=0
    s=set()
    for i in a:
        p=primeFactor(i)
        ans+=len(p)
        s|=p
    if ans!=len(s):print("setwise coprime")
    else:print("pairwise coprime")
if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
import math
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
D,T,S=MAP()
if T*S>=D:
  print("Yes")
else:
  print("No")
x=int(input().split())
a=x[0]
b=x[1]
print(str(a*b)+' '+str(2*(a+b)))

### FIXED CODE ###

a,b=list(map(int,input().split()))
print(str(a*b)+' '+str(2*(a+b)))
int(input(x))
print(x ** 3)

### FIXED CODE ###

x = int(input())
print(x ** 3)
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = min(a) + min(b)

for i in range(M):
    x, y, c = map(int, input().split())
    ans = min(ans, a[x-1] + a[y-1] - c)
print(ans)


### FIXED CODE ###

A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = min(a) + min(b)

for i in range(M):
    x, y, c = map(int, input().split())
    ans = min(ans, a[x-1] + b[y-1] - c)
print(ans)
def dfs(n,p,d):
    visited[n] = True
    dist[n] = d
    for (i,c) in A[n]:
        if i != p and not visited[i]:
            dfs(i,n,d+c)

N = int(input())
A = [[] for _ in range(N)]
for _ in range(N-1):
    a,b,c = map(int,input().split())
    A[a-1].append((b-1,c))
    A[b-1].append((a-1,c))
Q,K = map(int,input().split())
B = []
for _ in range(Q):
    x,y = map(int,input().split())
    B.append((x,y))

dist = [-1]*N
visited = [False]*N
dfs(K-1,N,0)

for (x,y) in B:
    print(dist[x-1]+dist[y-1])


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

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

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

cost = [-1]*N
def calc(i,c):
    # 指定の頂点までのコストを代入
    cost[i] = c
    # 頂点から移動できる頂点があれば
    for ni,nc in X[i]:
        # 初期状態のままなら計算
        if cost[ni] == -1:
            calc(ni,c+nc)

Q,K = map(int,input().split())
# 事前計算
calc(K-1,0)

for i in range(Q):
    x,y = map(int,input().split())
    print(cost[x-1]+cost[y-1])
def mapt(fn, *args):
    return list(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n, k = Input()
    if n % k == 0:
        print(0)
    else:
        max_n = math.ceil(k/n)
        min_n = math.floor(k/n)
        print(max_n - min_n)


main()

### FIXED CODE ###

def mapt(fn, *args):
    return list(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n, k = Input()
    if n % k == 0:
        print(0)
    else:
        print(1)


main()
a=input()
a=a.split()

n=1

for x in a:
  if n==int(x):
    n=n+1
  else:
    print(n)
    end


### FIXED CODE ###

import math
from collections import deque
from collections import defaultdict
import itertools as it
 
#自作関数群
def readInt():
 return int(input())
def readInts():
 return list(map(int, input().split()))
def readChar():
 return input()
def readChars():
 return input().split()
def factorization(n):
 res = []
 if n%2==0:
  res.append(2)
 for i in range(3,math.floor(n//2)+1,2):
  if n%i==0:
   c = 0
   for j in res:
    if i%j==0:
     c=1
   if c==0:
    res.append(i)
 return res
def fact2(n):
 p = factorization(n)
 res = []
 for i in p:
  c=0
  z=n
  while 1:
   if z%i==0:
    c+=1
    z/=i
   else:
    break
  res.append([i,c])
 return res
def fact(n):#階乗
 ans = 1
 m=n
 for _i in range(n-1):
  ans*=m
  m-=1
 return ans
def comb(n,r):#コンビネーション
 if n<r:
  return 0
 l = min(r,n-r)
 m=n
 u=1
 for _i in range(l):
  u*=m
  m-=1
 return u//fact(l)
def combmod(n,r,mod):
 return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
 r=copyQueue(q)
 ans=[0]*r.qsize()
 for i in range(r.qsize()-1,-1,-1):
  ans[i] = r.get()
 print(ans)
class UnionFind():
 def __init__(self, n):
  self.n = n
  self.parents = [-1]*n
 
 def find(self, x): # root
  if self.parents[x]<0:
   return x
  else:
   self.parents[x] = self.find(self.parents[x])
   return self.parents[x]
 
 def union(self,x,y):
  x = self.find(x)
  y = self.find(y)
 
  if x==y:
   return
 
  if self.parents[x]>self.parents[y]:
   x,y = y,x
 
  self.parents[x]+=self.parents[y]
  self.parents[y]=x
 
 def size(self,x):
  return -1*self.parents[self.find(x)]
 
 def same(self,x,y):
  return self.find(x)==self.find(y)
 
 def members(self,x): # much time
  root = self.find(x)
  return [i for i in range(self.n) if self.find(i)==root]
 
 def roots(self):
  return [i for i,x in enumerate(self.parents) if x<0]
 
 def group_count(self):
  return len(self.roots())
 
 def all_group_members(self):
  return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
 x = 1
 zero = "0"*n
 ans = []
 ans.append([0]*n)
 for i in range(2**n-1):
  ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
  x+=1
 return ans;
def arrsSum(a1,a2):
 for i in range(len(a1)):
  a1[i]+=a2[i]
 return a1
def maxValue(a,b,v):
 v2 = v
 for i in range(v2,-1,-1):
  for j in range(v2//a+1): #j:aの個数
   k = i-a*j
   if k%b==0:
    return i
 return -1
def copyQueue(q):
 nq = queue.Queue()
 n = q.qsize()
 for i in range(n):
  x = q.get()
  q.put(x)
  nq.put(x)
 return nq
def get_sieve_of_eratosthenes(n):
 #data = [2]
 data = [0,0,0]
 for i in range(3,n+1,2):
  data.append(i)
  data.append(0)
 for i in range(len(data)):
  interval = data[i]
  if interval!=0:
   for j in range(i+interval,n-1,interval):
    data[j] = 0
 #ans = [x for x in data if x!=0]
 ans = data[:]
 return ans
 
x = readInts()
 
for i in range(1,6):
 if x[i-1]!=i:
  print(i)
W,H,x,y,r = list(map(int,input().split())
if (r<=x<=W-r)&(r<=y<=H-y):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

W,H,x,y,r = list(map(int,input().split()))
if (r<=x<=W-r)&(r<=y<=H-r):
    print('Yes')
else:
    print('No')
from sys import stdin


def main():

    S = stdin.readline().rstrip()
    S_len = len(S)

    sum = 0
    s = S[0]
    x = 1

    while True:
        if len(s) == 1:
            if s == S[x]:
                s = s + S[x]
            else:
                sum += 1
                s = S[x]
        else:
            sum += 2
            x += 1
            s = S[x]
        x += 1

        if x >= S_len:
            sum += 1
            break

    print(sum)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import stdin


def main():

    S = stdin.readline().rstrip()
    S_len = len(S)

    sum = 0
    s = S[0]
    x = 1

    while True:
        if len(s) == 1:
            if s == S[x]:
                s = s + S[x]
            else:
                sum += 1
                s = S[x]
        else:
            sum += 2
            x += 1

            if x >= S_len:
                break
            s = S[x]
        x += 1

        if x >= S_len:
            sum += 1
            break

    print(sum)


if __name__ == "__main__":
    main()
N=int(input())
L=[]
n=0
while n <N+1 :
  A=int(input())
  if A in L:
    L.remove(A)
    n=n+1
  else:
    L.append(A)
    n=n+1
print(len(L))

### FIXED CODE ###

n = int(input())
s = set()
for i in range(n):
  a = input()
  if a in s:
    s.remove(a)
  else:
    s.add(a)
print(len(s))
n = int(input())

import math
for i in range(1, int(math.sqrt(n)) , 1):
    if n%i == 0:
        j = n//i
i = n//j

ans = i-1 + j-1
print(ans)

### FIXED CODE ###

n = int(input())

for i in range(1, int(n**(1/2))+2 , 1):
    if n%i == 0:
        j = n//i
i = n//j

ans = i-1 + j-1
print(ans)
n = input()
  n_max = -(1000000000)
  n_min = input()

  for i in range(0, n-1):
   R = input()
   if n_max < R - n_min:
    n_max = R - n_min
   if R < n_min:
    n_min = R

  print n_max

### FIXED CODE ###

n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9
  
for j in range(n-1):
  nums = int(raw_input())  
  diff = nums - minv
  if maxv < diff:
    maxv = diff
  if nums < minv:
    minv = nums
  
print maxv
N = int(raw_input())
lis = [None]*86
lis[0] = 2
lis[1] = 1
for i in xrange(84):
	lis[i+2] = lis[i-1] + lis[i]
print lis[N-1]

### FIXED CODE ###

N = int(raw_input())
lis = [None]*87
lis[0] = 2
lis[1] = 1
for i in xrange(85):
	lis[i+2] = lis[i+1] + lis[i]
print lis[N]
import sys
#sys.exit()
#sorted( ,reverse=True)
N = int(input())
#S,T = map(int, input().split())
#A = list(map(int, input().split()))
#print(N)
#print(S,T)
#print(A)
S = str(input())
r = S.count("R")
g = S.count("G")
b = S.count("B")
ans = (r*g*b)
#r2 = [i for i, x in enumerate(S) if x == 'R']
#g2 = [i for i, x in enumerate(S) if x == 'G']
#b2 = [i for i, x in enumerate(S) if x == 'B']
ans = (len(r2)*len(g2)*len(b2))
for i in range (N-2):
    for j in range (i+1,N-1):
        k = 2*j-i
        if k < N and S[i]!=S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -=1
                #print(r2[i],g2[j],b2[k])
print(ans)


### FIXED CODE ###

import sys
#sys.exit()
#sorted( ,reverse=True)
N = int(input())
S = str(input())
r = S.count("R")
g = S.count("G")
b = S.count("B")
ans = (r*g*b)
for i in range (N-2):
    for j in range (i+1,N-1):
        k = 2*j-i
        if k < N and S[i]!=S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -=1
                #print(r2[i],g2[j],b2[k])
print(ans)
s=input()
n=len(s)
ans=0
for i in range(n):
  for i in range(i,n)
  bubun=s[i:j+1]
  flag=True
  for c in bubun:
    if(c not in ['A','G','C','T']):
      flag = False
  if(flag):
    ans = max(ans,len(bubun))
print(ans)

### FIXED CODE ###

s = input()
n = len(s) # 文字列の長さを取得しておく

res = 0 # 条件になければ0
for i in range(n): # Sの部分文字列を全探索するループ：重複を許す（i==jの時は1文字の部分文字列になる）が入替を許さないループ
    for j in range(i, n):
        sub = s[i: j+1] # i文字目からからj文字目までの部分文字列

        flg = True
        for c in sub: # Python的for文
            if(c not in ['A', 'G', 'C', 'T']): flg = False # こちらも、in はこういう時便利です

        if(flg): res = max(res, len(sub)) # ACGT文字列の長さnumの最大値を保持する

print(res)
memo = {}

def solve(i, last_option):
	global a, b, c
	if (i, last_option) not in memo:
		if i == len(a):
			result = 0
		elif i == 0:
			result = max(a[i] + solve(i + 1, 1), b[i] + solve(i + 1, 2), c[i] + solve(i + 1, 3))
		else:
			if last_option == 1:
				result = max(b[i] + solve(i + 1, 2), c[i] + solve(i + 1, 3))
			elif last_option == 2:
				result = max(a[i] + solve(i + 1, 1), c[i] + solve(i + 1, 3))
			else:
				result = max(a[i] + solve(i + 1, 1), b[i] + solve(i + 1, 2))
		memo[(i, last_option)] = result
		return result
	else:
		return memo[(i, last_option)]

n = int(input())
a = [None for i in range(n)]
b = [None for i in range(n)]
c = [None for i in range(n)]
for i in range(n):
	a[i], b[i], c[i] = map(int, input().split())
print(solve(0, 4))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

memo = {}

def solve(i, last_option):
	global a, b, c
	if (i, last_option) not in memo:
		if i == len(a):
			result = 0
		elif i == 0:
			result = max(a[i] + solve(i + 1, 1), b[i] + solve(i + 1, 2), c[i] + solve(i + 1, 3))
		else:
			if last_option == 1:
				result = max(b[i] + solve(i + 1, 2), c[i] + solve(i + 1, 3))
			elif last_option == 2:
				result = max(a[i] + solve(i + 1, 1), c[i] + solve(i + 1, 3))
			else:
				result = max(a[i] + solve(i + 1, 1), b[i] + solve(i + 1, 2))
		memo[(i, last_option)] = result
		return result
	else:
		return memo[(i, last_option)]

n = int(input())
a = [None for i in range(n)]
b = [None for i in range(n)]
c = [None for i in range(n)]
for i in range(n):
	a[i], b[i], c[i] = map(int, input().split())
print(solve(0, 4))
import numpy as np
R = int(input())
print(R*2*np.pi)

### FIXED CODE ###

import numpy as np
R = int(input())
print(R*2*np.pi)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
  
N = int(input())
Nlist = make_divisions(N)
L = len(Nlist)
if L%2==0:
    print(Nlist[int(L/2)]+Nlist[int(L/2)-1]-2)
else:
    print(int(math.sqrt(N)*2-2)

### FIXED CODE ###

import math
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
N = int(input())
Nlist = make_divisors(N)
L = len(Nlist)
if L%2==0:
    print(Nlist[int(L/2)]+Nlist[int(L/2)-1]-2)
else:
    print(int(math.sqrt(N)*2-2))