Harryxun/stf_run huggingface dataset:
import collections
n=int(input())
a=list(map(int,input().split()))
b=collections.Counter(a)
c=list(b.items())
d=[]
e=[]
for i in range(len(c)):
  if c[i][1]>3:
    d.append(int(c[i][0]))
  elif c[i][1]>1:
    e.append(int(c[i][0]))
d.sort(reverse=True)
e.sort(reverse=True)
if len(d)<1 and len(e)<2:
  print(0)
else:
  print(max(d[0]**2,e[0]*e[1]))
    


### FIXED CODE ###

import collections
n=int(input())
a=map(int,input().split())
b=list(collections.Counter(a).items())
lst=[]
Lst=[]
for i in range(len(b)):
  if b[i][1]>1:
    lst.append(int(b[i][0]))  
    if b[i][1]>3:
      Lst.append(int(b[i][0]))
if len(lst)<2 and len(Lst)==0:
  print(0)
else:
  if len(lst)==1:
    Lst.sort(reverse=True)
    print(Lst[0]**2)
  else:
    if len(Lst)>0:
      lst.sort(reverse=True)
      Lst.sort(reverse=True)
      print(max(lst[0]*lst[1],Lst[0]**2))     
    else:
      lst.sort(reverse=True)
      print(lst[0]*lst[1])
i=0
while True:
    i=i+1
    Indata = int(input())
    print("Case" +str(i) + ": " + str(Indata)
    if Indata == 0:
        break
    



### FIXED CODE ###

i=0
while True:
    Indata = int(input())
    if Indata == 0:
        break
    else:
        i=i+1
        print("Case " +str(i) + ": " + str(Indata))
def nroot(a, n, x=1.0, eps=1e-15):
    x = np.sqrt(a)
    while abs(a - x**n) > eps:
        x = ( (n-1)*x + a/(x**(n-1)) ) / n
    return x
a,b,c = map(int, input().split())


if nroot(a,2) + nroot(b,2) < nroot(c,2) :
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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


if  c-a-b >0 and (c-a-b)*(c-a-b) > 4*a*b :
    print("Yes")
else:
    print("No")
import math
x, y = (int(x) for x in input().split())

print((x * y) // math.gcd(x, y))

### FIXED CODE ###

import fractions
x, y = (int(x) for x in input().split())

print(int((x * y) / fractions.gcd(x, y)))
n, l = map(int, input().split())
if l>=0:
	print(int(n**2/2+l*n-n/2-l))
if l<0 and n-1<l:
  	print(int(n**2/2+l*n-n/2))
else:
  	print(int((n**2/2)+l*n-n/2-l-n+1))

### FIXED CODE ###

S = input()
if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
	print('Bad')
else:
  	print('Good')
n = int(input())
x = [int(x) for x in list(input())]
lx = len(x)-1

# memo = [0]*(n+1)

# for val in range(1, n+1):
#     tmp = val
#     cnt = 0
#     while tmp > 0:
#         if tmp & 1:
#             cnt += 1
#             tmp = (tmp-1)//2
#         else:
#             tmp = tmp//2
#     memo[val] = memo[val % cnt] + 1


x_cnt = 0
for i, y in enumerate(x):
    if y == 1:
        x_cnt += 1

aa = x_cnt + 1
bb = x_cnt - 1

a = [1 % aa]
b = [1 % bb]

for _ in range(n-1):
    a.append(a[-1]*2 % aa)
    b.append(b[-1]*2 % bb)

a = a[::-1]
b = b[::-1]

x_ps = 0
x_ng = 0
for i, val in enumerate(x):
    if val == 1:
        x_ps += a[i]
        x_ng += b[i]

for i in range(n):
    ans = 0
    if x[i] == 0:
        cnt = x_cnt + 1
        val = (x_ps + a[i]) % cnt
    else:
        cnt = x_cnt - 1
        if cnt == 0:
            print(ans)
            continue
        val = (x_ng - b[i]) % cnt

    tmp = val
    cnt = 0
    while tmp > 0:
        if tmp & 1:
            cnt += 1
            tmp = (tmp-1) // 2
        else:
            tmp = tmp // 2

    ans += 1
    while val > 0:
        ans += 1
        val = val % cnt
        tmp = val % cnt
        cnt = 0
        while tmp > 0:
            if tmp & 1:
                cnt += 1
                tmp = (tmp-1) // 2
            else:
                tmp = tmp // 2
    print(ans)


### FIXED CODE ###

n = int(input())
x = [int(x) for x in list(input())]

x_cnt = 0
for i, y in enumerate(x):
    if y == 1:
        x_cnt += 1

aa = x_cnt + 1
bb = x_cnt - 1

a = [1 % aa]
if bb > 0:
    b = [1 % bb]
else:
    bb = 1
    b = [0]

for _ in range(n-1):
    a.append(a[-1]*2 % aa)
    b.append(b[-1]*2 % bb)

a = a[::-1]
b = b[::-1]

x_ps = 0
x_ng = 0
for i, val in enumerate(x):
    if val == 1:
        x_ps += a[i]
        x_ng += b[i]

for i in range(n):
    ans = 0
    if x[i] == 0:
        cnt = x_cnt + 1
        val = (x_ps + a[i]) % cnt
    else:
        cnt = x_cnt - 1
        if cnt == 0:
            print(ans)
            continue
        val = (x_ng - b[i]) % cnt
    ans += 1

    tmp = val
    cnt = 0
    while tmp > 0:
        if tmp & 1:
            cnt += 1
            tmp = (tmp-1) // 2
        else:
            tmp = tmp // 2

    if cnt == 0:
        print(ans)
        continue

    while val > 0:
        ans += 1
        val = val % cnt
        tmp = val % cnt
        cnt = 0
        while tmp > 0:
            if tmp & 1:
                cnt += 1
                tmp = (tmp-1) // 2
            else:
                tmp = tmp // 2
    print(ans)
N, K = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]

result = [a for j in range(b) for a, b in A]
print(result[K+1])

"""
result = []
for a, b in A:
  for j in range(b):
    result.append(a)
print(result[K-1])
"""

### FIXED CODE ###

N, K = map(int,input().split())
A = sorted([list(map(int,input().split())) for _ in range(N)])

cnt = 0
for a in A:
  if(cnt < K-a[1]):
    cnt += a[1]
  else:
    print(a[0])
    break
"""
unk buriburi
"""
import math
n,k = map(int,input().split())
def com(x,y):
  return(math.factorial(x)/math.factorial(x-y)*math.factorial(y))

for i in range(1,k-1):
  t = int(com(n,n-k+i)%(10**9+7))
  print(t)

### FIXED CODE ###

import math
 
def combination_count(n,k):
    if k > n or k < 0:
        return 0
    if n == 0 or k == 0:
        return 1
    
    s = math.factorial(n)
    t = math.factorial(k)
    u = math.factorial(n-k)
    
    return s//(t*u)
    
n,k = map(int,input().split())
 
mod = 10**9 + 7
 
for i in range(1,k+1):
    x = combination_count(n-k+1,i) * combination_count(k-1, i-1)
    print(x%mod)
n=int(raw_input())
l=list(map(int, raw_input().split()))
for i in range(1,n+1):
    l[0:i]=sorted(l[0:i])
    print *l

### FIXED CODE ###

n=int(input())
l=list(map(int, input().split()))
for i in range(1,n+1):
    l[0:i]=sorted(l[0:i])
    print(*l)
# -*- coding: utf-8 -*-

s = input()
s_list = list(s)
s_len = len(s_list)

hag = 0

for i in range(s_len//2):
  if s_list[i] != s_list[(s_len-1)-i]:
    s_list[s_len-i] = s_list[i]
    hag += 1
  
print(hag)

### FIXED CODE ###

# -*- coding: utf-8 -*-

s = input()
s_list = list(s)
s_len = len(s_list)

hag = 0

for i in range(s_len//2):
  if s_list[i] != s_list[(s_len-1)-i]:
    s_list[(s_len-1)-i] = s_list[i]
    hag += 1
  
print(hag)
N, M, K = map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
time = 0
books = 0
A.append(200001)
B.append(200002)

while time <= K:
    if A[0] < B[0]:
        time += A.pop(0)
    elif B[0] < A[0]:
        time += B.pop(0)
    elif B[0] == A[0]:
        if B[1] > A[1]:
            time += A.pop(0)
        else:
            time += B.pop(0)
    books += 1
if books == 0:
    print(0)
else:
    print(books - 1)

### FIXED CODE ###

a = int(input())
print(a+(a*a)+(a*a*a))
x,y=int(map,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
print("Yes" if x in a and y in a or x in b and y in b or x==2 and y==2 else "No")

### FIXED CODE ###

x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
print("Yes" if x in a and y in a or x in b and y in b or x==2 and y==2 else "No")
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = 0
cnt = 0

while d <= x:
    d = d + l[cnt]
    cnt += 1

print(cnt)


### FIXED CODE ###

n, x = map(int, input().split())
l = list(map(int, input().split()))
d = 0
cnt = 1

for i in range(n):
    d += l[i]
    if d > x:
        break
    else:
        cnt += 1

print(cnt)
def main():
    n = int(input())
    s = input()s
    if n % 2 == 0:
        s1 = s[:(n//2)]
        s2 = s[n//2:]
        if s1 == s2:
            print("Yes")
        else:
            print("No")
    else:
        print("No")



if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n = int(input())
    s = input()
    if n % 2 == 0:
        s1 = s[:(n//2)]
        s2 = s[n//2:]
        if s1 == s2:
            print("Yes")
        else:
            print("No")
    else:
        print("No")



if __name__ == "__main__":
    main()
s=str(input())

if s[0] == "L" or s[2] == "L" or s[1] == "R" or s[3] =="R":
    print("No")
else:
    print("Yes")

### FIXED CODE ###

import sys

s=str(input())

for i in range(len(s)):
    if i%2==0 and s[i]=="L":
        print("No")
        sys.exit(0)
    elif i%2==1 and s[i]=="R":
        print("No")
        sys.exit(0)

print("Yes")
def main():
    N=int(input())
    X=[]
    U=[]
    for i in range(N):
        x,u=input().split()
        x=int(x)
        X.append(x)
        U.append(u)

    count=0
    for i in range(N):
        if U[i]=="JPY":
            count+=X[i]
        else:
            count+=380000*X[i]
    print(count)
if __name__=="__main__":
    main()

### FIXED CODE ###

def main():
    N=int(input())
    X=[]
    U=[]
    for i in range(N):
        x,u=input().split()
        x=float(x)
        X.append(x)
        U.append(u)

    count=0
    for i in range(N):
        if U[i]=="JPY":
            count+=X[i]
        else:
            count+=380000*X[i]
    print(count)
if __name__=="__main__":
    main()
import math
N = int(input())
min = math.inf
for i in range(1, 1000000):
    if N % i == 0:
        val = i + int(N / i) - 2
    if min > val:
        min = val

print(min)

### FIXED CODE ###

N = int(input())
min = 10000000000001
for i in range(1, 1000001):
    if N % i == 0:
        val = i + int(N / i) - 2
    if min > val:
        min = val

print(min)
import fractions
a,b = map(int,input().split())
def lcm(x,y):
    return (x*y)//fractions.gcd(x,y)
print(lcm(a,b))

### FIXED CODE ###

A = input()
B = input()
ans = '123'
ans = ans.replace(A,'').replace(B,'')
print(ans)
a = [int(input()) for i in range(5)]

a_one = [i % 10 for i in a if i % 10 != 0]
a_aaa = [i for i in a if i % 10 != 0]
a_aa = [i // 10 * 10 + 10 for i in a if i % 10 != 0]
a_two = [i for i in a if i % 10 == 0]
a_last = a_one.index(min(a_one))

ans = 0

for i in range(len(a_aa)):
    if i == a_last:
        continue
    else:
        ans += a_aa[i]

for i in a_two:
    ans += i

ans += a_aaa[a_last]
print(ans)

### FIXED CODE ###

A = [int(input()) for i in range(5)]
B = [a - a % 10 + 10 if a % 10 != 0 else a for a in A]
diff = [(b - a) for a, b in zip(A, B)]

print(sum(B)-max(diff))
x,y,z=list(map(int,input().split()))
a=x
b=y
c=z
print(c a b)

### FIXED CODE ###

x,y,z=list(map(int,input().split()))
print(z,x,y)
# ABC133D - Rain Flows into Dams
def main():
    # X_0 = sum(A) - 2 * sum(A[1::2]), X_i = 2Ai - X_{i-1}
    N, *A = map(int, open(0).read().split())
    X = [0] * N
    cur = sum(A) - 2 * sum(A[1::2])
    X[0] = cur
    for i, a in enumerate(A[:-1], 1):
        X[i] = a * 2 - cur
        cur = X[i]
    print(" ".join(map(str, ans)))


if __name__ == "__main__":
    main()

### FIXED CODE ###

# ABC133D - Rain Flows into Dams
def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    X = [0] * N
    cur = sum(A) - 2 * sum(A[1::2])
    X[0] = cur
    for i, a in enumerate(A[:-1], 1):
        X[i] = a * 2 - cur
        cur = X[i]
    print(*X)
    


if __name__ == "__main__":
    main()
N = int(input())
A = list(map(int, input().split()))
A.sort()
i = 0
while True:
    x = A[i]
    u = 0
    flag = True
    for j in range(i+1,N):
        j -= u
        if x == A[j]:
            flag = False
        if A[j]%x == 0:
            A.pop(j)
            N -= 1
            u += 1
        if j == N-1:
            break
    if flag == False:
        A.pop(i)
        N -= 1
        u += 1
    if i == N-1:
        break
    i += 1
print(len(A))

### FIXED CODE ###

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

INF = 10**6

A.sort()
check = [False] + [True]*(INF)

setA = list(set(A))
length = len(setA)
for i in range(length):
    x = setA[i]
    for j in range(2, int(INF/x)+1):
        check[x*j] = False

prev = 0
count = 0
flag = False #重複チェック
for i in range(N):
    x = A[i]
    if check[x]:
        if x != prev:
            count += 1
            flag = True
        elif flag:
            count -= 1
            flag = False
        prev = x
print(count)
n, m = map(int, input().split())
s_li_ = []
c_li_ = []

for _ in range(m):
  s, c = map(int, input().split())
  s_li_.append(s)
  c_li_.append(c)

def func(n, m, s_li, c_li):
  if m==0:
    return -1
  
  if n==1:
    if (s_li[0]==1) & (c_li[0]==0):
      return 0
  
  for i in range(10**(n-1), 10**n):
    cnt = 0
    for s, c in zip(s_li, c_li):
      if str(i)[s-1] == str(c):
        cnt+=1
    if cnt==len(m):
      return i
    
  return -1

print(func(n, m, s_li_, c_li_))

### FIXED CODE ###

n, m = map(int, input().split())
s_li_ = []
c_li_ = []

for _ in range(m):
  s, c = map(int, input().split())
  s_li_.append(s)
  c_li_.append(c)

def func(n, m, s_li, c_li):
  if m==0:
    if n==1:
      return 0
    else:
      return 10**(n-1)
  
  if n==1:
    if (s_li[0]==1) & (c_li[0]==0):
      return 0
  
  for i in range(10**(n-1), 10**n):
    cnt = 0
    for s, c in zip(s_li, c_li):
      if str(i)[s-1] == str(c):
        cnt+=1
    if cnt==m:
      return i
    
  return -1

print(func(n, m, s_li_, c_li_))
n = input()

if n%2 == 0:
  print(n/2)
else:
  print((n+1)/2)

### FIXED CODE ###

n = int(input())

if n%2:
  print((n+1)//2)
else:
  print(n//2)
if b="A":
  return{"T"}
elif b="T":
  return{"A"}
elif b="G":
  return{"C"}
else:
  return{"G"}

### FIXED CODE ###

def change(x):
  if x == "A":
    return("T")
  elif x == "T":
    return("A")
  elif x == "C":
    return("G")
  elif x == "G":
    return("C")
  
b = input()
print(change(b))
num_input = [input() for i in range(2)]
x = int(num_input[0].split()[0])
n = int(num_input[0].split()[1])

num_list = [int(n) for n in num_input[1].split()]
num_list.sort()

ans=x

if n!=0 and n!=1 and n!=100:
    if x in num_list:
        index=num_list.index(x)

        value_left=x-1
        value_right=x+1

        if index!=0:
            index_left=index-1
        if index!=n:
            index_right=index+1
        
        if index==0:
            ans=x-1
        elif index==n:
            if num_list[index_right-1]!=x-1:
                ans=x+1
        else:
            for i in range(n):
                if num_list[index_left]!=value_left:
                    ans=value_left
                    break
                elif num_list[index_right]!=value_right:
                    ans=value_right
                    break
                if index_left!=0:
                    index_left=index_left-1
                if index_right!=n-1:
                    index_right=index_right+1
                value_left=value_left-1
                value_right=value_right+1

if n==1:
    ans=x-1

if n==100:
    if x<=50:
        ans=0
    if x>50:
        ans=101

print(ans)


### FIXED CODE ###

num_input = [input() for i in range(2)]
x = int(num_input[0].split()[0])
n = int(num_input[0].split()[1])

num_list = [int(n) for n in num_input[1].split()]
num_list.sort()

ans=x

if n!=0 and n!=1 and n!=100:
    if x in num_list:
        index=num_list.index(x)

        value_left=x-1
        value_right=x+1

        if index!=0:
            index_left=index-1
        if index!=n-1:
            index_right=index+1
        
        if index==0:
            ans=x-1
        elif index==n-1:
            if num_list[index-1]==x-1:
                ans=x+1
            else:
                ans=x-1
        else:
            for i in range(n):
                if num_list[index_left]!=value_left:
                    ans=value_left
                    break
                elif num_list[index_right]!=value_right:
                    ans=value_right
                    break
                if index_left!=0:
                    index_left=index_left-1
                if index_right!=n:
                    index_right=index_right+1
                value_left=value_left-1
                value_right=value_right+1

if n==1:
    ans=x-1

if n==100:
    if x<=50:
        ans=0
    if x>50:
        ans=101

print(ans)
import numpy as np
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k=np.array(list(Counter(a).keys()))
t=np.array(list(Counter(a).values()))
l=np.ones(len(t))
for i in range(n):
  s=np.copy(t)
  s[int(np.where(k==a[i])[0])]-=1
  print(int(sum(s*(s-l)//2)))

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
k = [0]*n
for i in a:
  k[i-1]+=1
g = 0
for i in range(n):
  g+=((k[i]*(k[i]-1))//2)
for i in a:
  print(g+1-k[i-1])
N = int(input())

lastnum = N % 10

if lastnum in [0,1,6,8]
print("pon")

elif lastnum in [2,4,5,7,9]
print("hon")

else:
print("bon")


### FIXED CODE ###

def solve(n):
    p = n % 10
    if p in [2,4,5,7,9]:
        return "hon"
    elif p in [0,1,6,8]:
        return "pon"
    else:
        return "bon"

n = int(input())
print(solve(n))
a=input()
list=["Sunny","Cloudy","Rainy"]
if a=list[0]:
  print(list[1])
elif a=list[1]:
  print(list[2])
else:
  print(list[0])


### FIXED CODE ###

a=input()
if a=="Sunny":
  print("Cloudy")
elif a=="Cloudy":
  print("Rainy")
else:
  print("Sunny")
line_num = int(raw_input())
for n in range(line_num):
	a = raw_input()
	b = raw_input()
	ov = 0
	if len(a) > 80 or len(b) > 80:
		print 'overflow'
		ov = 1
	filled_a, filled_b = a.zfill(80), b.zfill(80)
	rlist_a = map(int,list(filled_a)[::-1])
	rlist_b = map(int,list(filled_b)[::-1])
	rlist_sum = []
	for n in range(80):
		rlist_sum.append(rlist_a[n]+rlist_b[n])
	for n in range(79):
		if rlist_sum[n] > 9:
			rlist_sum[n] -= 10
			rlist_sum[n+1] += 1
	if rlist_sum[79] > 9:
		if ov < 1:
			print 'overflow'
	else
		list_sum = []
		f = 0
		for n in rlist_sum[::-1]:
			if f > 0:
				list_sum.append(n)
			else:
				if n > 0:
					f = 1
					list_sum.append(n)
		print ''.join(map(str,list_sum))

### FIXED CODE ###

line_num = int(raw_input())
for n in range(line_num):
	a = raw_input()
	b = raw_input()
	if len(a) > 80 or len(b) > 80:
		print 'overflow'
	else:
		filled_a, filled_b = a.zfill(80), b.zfill(80)
		rlist_a = map(int,list(filled_a)[::-1])
		rlist_b = map(int,list(filled_b)[::-1])
		rlist_sum = []
		for n in range(80):
			rlist_sum.append(rlist_a[n]+rlist_b[n])
		for n in range(79):
			if rlist_sum[n] > 9:
				rlist_sum[n] -= 10
				rlist_sum[n+1] += 1
		if rlist_sum[79] > 9:
			print 'overflow'
		else:
			list_sum = []
			f = 0
			for n in rlist_sum[::-1]:
				if f > 0:
					list_sum.append(n)
				else:
					if n > 0:
						f = 1
						list_sum.append(n)
			ans = ''.join(map(str,list_sum))
			if len(ans) < 1:
				print '0'
			else:
				print ans
a,op,b = input().split()

if op="+":
  print(int(a)+int(b))
elif op="-":
  print(int(a)-int(b))

### FIXED CODE ###

a,op,b = input().split()

if op=="+":
  print(int(a)+int(b))
elif op=="-":
  print(int(a)-int(b))
n, w = map(int, input().split())
goods = [list(map(int, input().split())) for _ in range(n)]
dp = [[0] * (w + 1) for _ in range(n + 1)]
for i in range(n):
    for j in range(w + 1):
        if 0 <= j - goods[i][0]:
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j - goods[i][0]] + goods[i][1])
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
print(dp[n][w])


### FIXED CODE ###

n, w = map(int, input().split())
goods = [list(map(int, input().split())) for _ in range(n)]
dp = [[float("INF")] * (10 ** 5 + 1) for _ in range(n + 1)]
dp[0][0] = 0

for i in range(n):
    for j in range(10 ** 5 + 1):
        if 0 <= j - goods[i][1]:
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - goods[i][1]] + goods[i][0])
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])


M = 0
for i in range(10 ** 5 + 1):
    if dp[n][i] <= w:
        M = i
print(M)
x = int(input())
p = x // 11
q = x % 11
if q = 0 :
    ans = 2 * p
elif q <= 6 :
    ans = 2 * p + 1
else :
    ans = 2 * p + 2
print(ans)

### FIXED CODE ###

x = int(input())
p = x // 11
q = x % 11
if q == 0 :
    ans = 2 * p
elif q <= 6 :
    ans = 2 * p + 1
else :
    ans = 2 * p + 2
print(ans)
A, B = map(int, input().split())

common_divisors = []
for n in range(1, int(max(A, B) ** 0.5) + 1):
    if (A % n == 0) & (B % n == 0):
        common_divisors.append(n)


# ある自然数未満までのエラトステネスの篩をつくる
def mark(s, x):
    for i in range(x + x, len(s), x):
        s[i] = False


def eratosthenes(n):
    s = [True] * n
    for x in range(2, int(n ** 0.5) + 1):
        if s[x]: mark(s, x)
    return [i for i in range(0, n) if s[i] and i > 1]


Primes = eratosthenes(max(A, B) + 1)
Primes_set = set(Primes)

ans = 0
for cd in common_divisors:
    if cd in Primes_set:
        ans += 1

print(ans + 1)


### FIXED CODE ###

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

common_divisors = []
for n in range(1, int(min(A, B) ** 0.5) + 1):
    if (A % n == 0) & (B % n == 0):
        common_divisors.append(n)

    if A % n == 0:
        x = A // n
        if B % x == 0:
            common_divisors.append(x)


# ある自然数の素数判定
def is_prime(n):
    if n == 1:
        return False

    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            return False
    else:
        return True


ans = 0
for cd in common_divisors:
    ans += is_prime(cd)

print(ans + 1)
N = int(input())
adj = [[] for _ in range(N+1)]
for e in range(1,N):
  a,b = map(int, input().split())
  adj[a].append((b,e))
  adj[b].append((a,e))

#print(adj)

col_num = max([len(ad) for ad in adj])
edge_color = [0]*N
visited = [False]*(N+1)

def dfs(v,e):
  visited[v] = True
  #print(v,e,edge_color)
  col_lis = [i for i in range(1,col_num+1)]
  if e != 0:
    col_lis.remove(edge_color[e])
  for w,f in adj[v]:
    if visited[w]==False:
      #continue
    #if edge_color[e] == 0:
    #print(col_lis)
      edge_color[f] = col_lis.pop(0)
      dfs(w,f)
  return None
#print(col_num)
dfs(2,0)

print(col_num)
for i in range(1,N):
  print(edge_color[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)

N = int(input())
adj = [[] for _ in range(N+1)]
for e in range(1,N):
  a,b = map(int, input().split())
  adj[a].append((b,e))
  adj[b].append((a,e))

#print(adj)

col_num = max([len(ad) for ad in adj])
edge_color = [0]*N
visited = [False]*(N+1)

def dfs(v,c=-1):
  #print(v,e,edge_color)
  #col_lis = [i for i in range(1,col_num+1)]
  #if e >0:
    #col_lis.remove(edge_color[e])
  color = 1
  for w,f in adj[v]:
    if visited[w]==False:
      visited[v] = True
      if c==color: color+=1
      edge_color[f] = color
      dfs(w,color)
      color+=1

dfs(1)

print(col_num)
for i in range(1,N):
  print(edge_color[i])
A,B,K = map(int, input().split())

AB = range(A,B+1)

tail = len(AB)

for i in range(K):
    print(AB[i])

for i in range(tail - K, tail):
    print(AB[i])



### FIXED CODE ###

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

AB = range(A,B+1)
tail = len(AB)
AB_L = set(AB[0:min(K,tail)])
AB_R = set(AB[max(0,tail-K):tail])
AB_SL = sorted(AB_L | AB_R)

for ab in AB_SL:
    print(ab)
N,K,X,Y = [input() for i in range(4)]

if N <= K:
    print(N * K)
else:
    S = N * K
    s = N * (N - K)
    S += s
    print(S)

### FIXED CODE ###

N,K,X,Y = [int(input()) for i in range(4)]

if N <= K:
    print(N * X)
else:
    S = K * X #最初の宿泊金額
    p = N - K #残りの日数
    s = p * Y #残りの宿泊金額
    S += s #足す
    print(S)
x = list(map(int,input().split())
for i in range(5):
	if x[i] == 0:
         print(i+1)
        

### FIXED CODE ###

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

if a == 0:
  print(1)
elif b == 0:
  print(2)
elif c == 0:
  print(3)
elif d == 0:
  print(4)
elif e == 0:
  print(5)
x = int(input())
n = list(map(int,input().split()))
​
a = min(n)
b = max(n)
c = sum(n)
​
print(a,b,c)


### FIXED CODE ###

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

a = min(k)
b = max(k)
c = sum(k)

print(a,b,c)
a=int(input())
b=int(input())
c=b*2
if a-c>0:
  print(a-c)
else:
  print("0")

### FIXED CODE ###

A,B=map(int,input().split())
c=A-2*B
print(max(0,c))