Harryxun/stf_run huggingface dataset:
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
 
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline  #危険！基本オフにしろ！
def cmb(n, r):
    if n-r<0:
        return 0
    return factorial(n) // factorial(r) // factorial(n - r)
 
def main():
    n,W=map(int,input().split())
    d=defaultdict(int)
    d[0]=0
    for i in range(n):
        w,v=map(int,input().split())
        for k,j in d.items():
            if k+w<=W:
                d[k+w]=max(d[k+w],j+v)
#    print(d)
    print(max(d.values()))
if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import *

N,W=map(int,input().split())
d=defaultdict(int)
d[0]=0
for i in range(N):
    w,v=map(int,input().split())
    c=d.copy()
    for p,q in c.items():
        if p+w<=W:
            d[p+w]=max(d[p+w],q+v)
print(max(d.values()))
N = int(input())
S = input()

def z_algo(S):
    N = len(S)
    A = [0] * N
    i = 1
    j = 0
    l = len(S)
    A[0] = l

    while i < l:
        while i+j < l and S[j] == S[i+j]:
            j += 1
        if not j:
            i += 1
            continue
        k = 1
        while min(l-i, j-A[k]) > k:
            A[i+k] = A[k]
            k += 1
        i += k
        j -= k
    return A

ans = 0
for i in range(N):
    s = S[i:]
    tmp = z_algo(s)
    for i in range(1, len(tmp)+1):
        if tmp[i] > i:
            tmp[i] = 0
    if len(tmp) >= 2:
        ans = max(ans, max(tmp[1:]))
print(ans)



### FIXED CODE ###

n = int(input())
s = input()
 
max_len = 0
j = 0
 
for i in range(n):
    while j < n and s[i:j] in s[j:]:
        j += 1
    max_len = max(max_len,j-i-1)
 
print(max_len)
N,M = map(int,input().split())
s,c = [map(int,input()) for i in range(M)]
l = []
first = []
second = []
third = []
for i in range(M):
  if s[i] == 1:
    first.append(c[i])
  elif s[i] == 2:
    second.append(c[i])
  elif s[i] == 3:
    third.append(c[i])
if first == []:
  print(-1)
elif second == []:
  second.append(0)
elif third == []:
  third.append(0)
l.append(min(first))
l.append(min(second))
l.append(min(third))
l = ''.join(str(n) for n in l)
print(l)

### FIXED CODE ###

N,M = map(int,input().split())
sc=[list(map(int,input().split()))for _ in range(M)]
ans = -1
for i in range(1000):
  s = str(i)
  if len(s) == N:
    flg = 0
    for a,b in sc:
      if int(s[a-1]) != b:
        flg = 1
    if flg == 0:
      ans = i
      break
print(ans)
a,b,c = map(int,input())

if a+b >= c:
  print("yes")
else:
  print("no")


### FIXED CODE ###

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

if a+b >= c:
  print("Yes")
else:
  print("No")
import sys
from itertools import accumulate
import operator as op
input = sys.stdin.readline

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

a = list(accumulate(A,op.add))
b = list(accumulate(B,op.add))

ans = 0
j = m-1
for i in range(n):
    if a[i]>k:
        break
    while b[j]>k-a[i]:
        j-=1
    ans=max(ans,i+j+2)
print(ans)


### FIXED CODE ###

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

a, b = [0], [0]
for i in range(N):
	a.append(a[i] + A[i])
for i in range(M):
	b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
	if a[i] > K:
		break
	while b[j] > K - a[i]:
		j -= 1
	ans = max(ans, i + j)
print(ans)
X, N = map(int, input().split())
L = list(map(int, input().split()))

if len(L) == 0:
    print(X)
    exit()

list = [0 for _ in range(len(L))]
for i in range(len(L)):
    list[i] = abs(X - L[i])
list = sorted(list)

if min(list) != 0:
    print(X)
    eixt()
else:
    num = 1
    cnt = 0
    for i in range(1, len(list)):
        if list[i] != num:
            break
        cnt += 1
        if cnt == 2:
            cnt = 0
            num += 1
if cnt == 0:
    print(X - num)
else:
    if X + num in L:
        print(X - num)
    else:
        print(X + num)


### FIXED CODE ###

X, N = map(int, input().split())
L = list(map(int, input().split()))

if len(L) == 0:
    print(X)
    exit()

list = [0 for _ in range(len(L))]
for i in range(len(L)):
    list[i] = abs(X - L[i])
list = sorted(list)

if min(list) != 0:
    print(X)
    exit()
else:
    num = 1
    cnt = 0
    for i in range(1, len(list)):
        if list[i] != num:
            break
        cnt += 1
        if cnt == 2:
            cnt = 0
            num += 1
if cnt == 0:
    print(X - num)
else:
    if X + num in L:
        print(X - num)
    else:
        print(X + num)
# coding: utf-8
# Your code here!
def dfs(num,hiyo):
    ans[num]=hiyo
    for to,cos in way[num]:
        if ans[to]==-1:
            dfs(to,hiyo+cos)
    
    return 

N=int(input())

way=[[] for i in range(N)]
ans=[-1]*N

for _ in range(N-1):
    u,v,w=map(int,input().split())
    u-=1
    v-=1
    way[u].append([v,w])
    way[v].append([u,w])

#lis.sort(key=lambda x:(x[0],x[1]))

dfs(0,0)
#print(ans)
for item in ans:
    print(item%2)

### FIXED CODE ###

# coding: utf-8
# Your code here!
import sys
 
sys.setrecursionlimit(10**7)

def dfs(num,hiyo):
    ans[num]=hiyo
    for to,cos in way[num]:
        if ans[to]==-1:
            dfs(to,hiyo+cos)
    
    return 

N=int(input())

way=[[] for i in range(N)]
ans=[-1]*N

for _ in range(N-1):
    u,v,w=map(int,input().split())
    u-=1
    v-=1
    way[u].append([v,w])
    way[v].append([u,w])

#lis.sort(key=lambda x:(x[0],x[1]))

dfs(0,0)
#print(ans)
for item in ans:
    print(item%2)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N=one_int()

temp = factorization(N)
temp = sorted(temp, key= lambda x: x[0])

output_set = []
output = [ output_set + [t[0]]*t[1] for t in temp ]


count = 0
for i in output:
    temp = len(i)
    sums = 0
    for t in range(1,temp+1):
        sums += t
        if temp >= sums:
            count += 1

print(count)

### FIXED CODE ###

def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N=one_int()

temp = factorization(N)
temp = sorted(temp, key= lambda x: x[0])

# temp = [[2,9]]



output_set = []
output = [ output_set + [t[0]]*t[1] for t in temp ]

count = 0
for i in output:
    temp = len(i)
    sums = 0
    for t in range(1,temp+1):
        sums += t
        if temp >= sums:
            count += 1

if N==1:
    print(0)
else:
    print(count)
N = int(input())
lst = list(map(int, input().split()))
mid = N/2 - 1
lst = sorted(lst)
if lst[mid] == lst[mid+1]:
    print(0)
elif lst[mid] < lst[mid+1]:
    print(lst[mid+1]-lst[mid]+1)

### FIXED CODE ###

N = int(input())
lst = list(map(int, input().split()))
mid = int(N/2 - 1)
lst = sorted(lst)
if lst[mid] == lst[mid+1]:
    print(0)
elif lst[mid] < lst[mid+1]:
    print(lst[mid+1]-lst[mid])
H,A = map(int,input().split())
print(H//A if H%A=0 else H//A+1)

### FIXED CODE ###

H,A = map(int,input().split())
print(H//A if H%A==0 else H//A+1)
s=input()
n=len(s)
t=int(input())
if t==1:
    print(s)
    exit()
ans=set()
for l in range(n-1):
    for r in range(l+1,n+1):
        ans.add(s[l:min(l+t,r)])
aa=list(ans)
aa.sort()
print(aa[t-1])

### FIXED CODE ###

s = input()
l = len(s)
k = int(input())
A = set()
for i in range(l):
    for j in range(1, 6):
        if i+j <= l:
            A.add(s[i:i+j])
ANS = sorted(A)
print(ANS[k-1])
from decimal import Decimal
n=int(input())
n=Decimal(n)
if n%9==0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n=int(input())
l=[int(x) for x in list(str(n))]
result=sum(l)
if result%9==0:
  print('Yes')
else:
  print('No')
def cns(ls,m,sm):
    global n, s
    count = 0
    if m == n:
        if sm == s: return 1
        else:       return 0
    elif s-mx(9-m) <= sm <= s:
        for i in range(9-m+1):
            rls = ls[:]
            k = rls.pop(i)
            count += cns(rls,m+1,sm+(m+1)*k)
        return count
    else: return 0

def mx(n):
    if n == 0: return 0
    else:      return (n+1)*n + mx(n-1)

ls = [0,1,2,3,4,5,6,7,8,9]
while True:
    n, s = map(int, raw_input().split())
    if s > mx(n): print 0
    else:         print cns(ls,0,0)

### FIXED CODE ###

def mxmn(ls,m):
	global n
	s1,s2 = 0, 0
	for i in range(m):
		s1 += (n-i)*ls[-i-1]
		s2 += (n-i)*ls[i]
	return s1,s2

def f(ls,m,s):
	global n
	count = 0
	if m > 0:
		mx,mn = mxmn(ls,m)
		if mx < s or mn > s: return 0
		elif mx == s or mn == s: return 1
		for i in range(len(ls)):
			lls = ls[:]
			a = (n-m+1)*lls.pop(i)
			if s-a < 0:	break
			else: count += f(lls,m-1,s-a)
		return count
	else:
		return 1 if s == 0 else 0
			
ls = [i for i in range(10)]
while True:
	try:
		n,s = map(int, raw_input().split())
		print f(ls,n,s)
	except:
		break
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
x=a+v*t
y=b+w*t
if x>=y:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

n=input()
b=n[:3]
print(b)
N,K = list(map(int, input().split()))
A = list(map(int, input().split()))
r = 0
if K <= N:
    current = 0
    for i in K:
        current = A[current-1]
    print(current)
else:
    isReturn = [0]*(N)
    step = 1
    current = 1
    isReturn[current-1] = step
    for i in range(N):
        current = A[current-1]
        step += 1
        if isReturn[current-1] == 0:
            isReturn[current-1] = step
        else:
            r = step - isReturn[current-1]
            break
    
    t = (K-step) % r
    for i in range(t+1):
        current = A[current-1]
        
    print(current)
    
    
                
            
    
    
                
            


### FIXED CODE ###

N,K = list(map(int, input().split()))
A = list(map(int, input().split()))
r = 0
if K <= N:
    current = 1
    for i in range(K):
        current = A[current-1]
    print(current)
else:
    isReturn = [0 for i in range(N)]
    step = 1
    current = 1
    isReturn[current-1] = step
    for i in range(N):
        current = A[current-1]
        step += 1
        if isReturn[current-1] == 0:
            isReturn[current-1] = step
        else:
            r = step - isReturn[current-1]
            break
    
    t = ((K-step) % r) + 1
    for i in range(t):
        current = A[current-1]
        
    print(current)
N=int(input())
a=eval(input().replace(' ','*'))
print('-1' if a>10**18 else a)

### FIXED CODE ###

_=input()
A=sorted(list(map(int,input().split())))
B=1
for a in A:
    B*=a
    if B>10**18:
        B=-1
        break
print(B)
H,M=map(int,input().split())
if H==1:
  print("1")
elif M==1:
  print("1")
else:
  if H*M%2==0:
  	print(H*M//2)
  else:
  	print((H*M)//2+1)


### FIXED CODE ###

a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(a[K-1])
while True:
    h,w = map(int, input().split())
    if h==w==0:break
    for y in range(h):
        for x in range(1,w+1):
            if ((x+y)%2)==0:prnt('#',end())
            else print('.',end())
        print()
    print()

### FIXED CODE ###

while 1:
    h,w = map(int, input().split())
    if h==w==0:break
    for y in range(h):
        for x in range(w):
            if (x+y)%2==0:print('#',end='')
            if (x+y)%2==1: print('.',end='')
        print()
    print()
n,k = map(int,input().split())
P = list(map(int,input().split()))
C = list(map(int,input().split()))

def solve(start):
    loopcnt = 0
    loopsum = 0
    reached = [0]*n
    scoremax = [-10**20]
    scoresum = 0
    ans = 0
    now = start
    while True:
        reached[now] = 1
        nxt = P[now]-1
        loopcnt += 1
        loopsum += C[now]
        scoresum += C[now]
        scoremax.append(max(scoremax[-1], scoresum))
        if reached[nxt]:break
        now = nxt
    if loopsum < 0 or loopcnt > k:
        ans = max(scoremax[1:k])
    else:
        ans = max(loopsum * (k//loopcnt) + scoremax[k%loopcnt],-10**20)#,max(scoremax[1:]))
    return ans #- C[start]
ans = -10**20
for i in range(n):
    ans = max(ans, solve(i))
    # print(solve(i))

print(ans)


### FIXED CODE ###

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


def solve(start):
    loop = []
    llen = 0
    lsum = 0
    reach = [0]*n

    now = start
    while True:
        nxt = P[now]-1
        loop.append(now)
        llen += 1
        lsum += C[now]
        reach[now] = 1
        if reach[nxt]:
            break
        now = nxt
    
    if lsum <= 0 or llen >= k:
        res = -10 ** 20
        s = 0
        now = start
        for i in range(min(llen, k)):
            s += C[now]
            res = max(res, s)
            now = P[now]-1
        return res
    else:
        s = lsum * (k // llen)
        now = start
        for i in range(k % llen):
            s += C[now]
            now = P[now]-1
        j = loop.index(now)
        res = -10**20
        for i in range(llen):
            j -= 1
            res = max(res, s)
            s -= C[loop[j]]
        return res


def solver():
    ans = -10 ** 20
    for i in range(n):
        ans = max(ans, solve(i))
    return ans


print(solver())
import math
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = 1
c = 0
key = 1
key1 = 1
l = []
while key == 1:
    if a[0] % b == 0:
        b *= 2
        c += 1
    else:
        b //= 2
        c -= 0
        key = 0
for i in range(n):
    if a[i] % b == 0:
        if (a[i]//b) % 2 == 0:
            key1 = 0
            break
        else:
            l.append(a[i]//b)
    else:
        key1 = 0
        break
if key1 == 0 or c == 0:
    print(0)
else:
    d = l[0]
    for i in range(1,n):
        d = d* l[i]// math.gcd(d,l[i])
    d = d*b//2
    if (m//d)%2 == 0:
        print((m//d)//2)
    else:
        print((m//d)//2+1)

### FIXED CODE ###

import fractions
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = 1
c = 0
key = 1
key1 = 1
l = []
while key == 1:
    if a[0] % b == 0:
        b *= 2
        c += 1
    else:
        b //= 2
        c -= 0
        key = 0
for i in range(n):
    if a[i] % b == 0:
        if (a[i]//b) % 2 == 0:
            key1 = 0
            break
        else:
            l.append(a[i]//b)
    else:
        key1 = 0
        break
if key1 == 0 or c == 0:
    print(0)
else:
    d = l[0]
    for i in range(1,n):
        d = d*l[i]// fractions.gcd(d,l[i])
        if m < d:
            break
    d = d*b//2
    if (m//d)%2 == 0:
        print((m//d)//2)
    else:
        print((m//d)//2+1)
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n):
    if i == n - 1 and i + 1 == p[i]:
        count += 1
    if i + 1 == p[i]:
        tmp = p[i]
        p[i] = p[i+1]
        p[i+1] = tmp
        count += 1
print(count)


### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n):
    if i == n - 1 and i + 1 == p[i]:
        count += 1
    elif i + 1 == p[i]:
        tmp = p[i]
        p[i] = p[i+1]
        p[i+1] = tmp
        count += 1
print(count)
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
takashi=0
for m,i in enumerate(a):
    takashi+=b[i-1]
    if 0<m<n:
        if abs(a[m]-a[m-1])==1:
            takashi+=c[a[m-1]-1]
print(takashi)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
takashi=b[a[0]-1]
for i in range(1,n):
    takashi+=b[a[i]-1]
    if a[i]-a[i-1]==1:
        takashi+=c[a[i-1]-1]

print(takashi)
# https://atcoder.jp/contests/tenka1-2017/tasks/tenka1_2017_c
# 式をこねくり回せ

N = int(input())

from itertools import product

for n, h in product(range(1, 3501), range(1, 3501)):
    if (4 / N - 1 / h - 1 / n) <= 0:
        continue
    bunbo = (4 * n * h - N * n - N * h)
    w = (N * h * n) / bunbo
    if w.is_integer():
        print(n, h, int(w))
        exit()


### FIXED CODE ###

# https://atcoder.jp/contests/tenka1-2017/tasks/tenka1_2017_c
# 式をこねくり回せ

N = int(input())

from itertools import product

for n, h in product(range(1, 3501), range(1, 3501)):
    bunbo = (4 * n * h - N * n - N * h)
    if bunbo <= 0:
        continue
    w = (N * h * n) / bunbo
    if w.is_integer():
        print(n, h, int(w))
        exit()
n,m = map(int,input().split())
l_max=0
r_min=n 
for i in range(n):
  l,r = map(int,input().split())
  l_max = max(l_max,l)
  r_min = min(r_min,r)
print(r_min - l_max)

### FIXED CODE ###

n,m = map(int,input().split())
l_max=1
r_min=10**5 
for i in range(m):
  l,r = map(int,input().split())
  l_max = max(l_max,l)
  r_min = min(r_min,r)
ans = r_min - l_max + 1
print(ans if ans >= 0 else 0 )
n,k=map(int,input().split())
h=list(map(int,input().split()))
ans=0
for i in h:
    if h>=k:
        ans+=1
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
h=list(map(int,input().split()))
ans=0
for i in h:
    if i>=k:
        ans+=1
print(ans)
n = int(input())
x = sorted(list(map(int,input().split())))
li = []
cost = 0
for i in range(x[0],x[-1],1):
    cost = 0
    for b in x:
        cost += (b-i)**2
    li.append(cost)
print(min(li))




### FIXED CODE ###

n = int(input())
x = sorted(list(map(int,input().split())))
li = []
cost = 0
for i in range(x[0],x[-1]+1,1):
    cost = 0
    for b in x:
        cost += (b-i)**2
    li.append(cost)
print(min(li))
if __name__ == '__main__':
    N = int(input())
    C = list(input())
    cnt = 0
    red_cnt = 0
    B = sorted(C)
    for c in B:
        if c == 'R':
            red_cnt += 1
        else:
            break
    for i in range(red_cnt+1):
        if C[i] == 'W':
            for j in range(red_cnt, N):
                if C[j] == 'R':
                    C[i] = 'R'
                    C[j] = 'W'
                    cnt += 1
                    red_cnt = j+1
    print(cnt)

### FIXED CODE ###

if __name__ == '__main__':
    N = int(input())
    C = list(input())
    cnt = 0
    red_cnt = 0
    for c in C:
        if c == 'R':
            red_cnt += 1

    for i in range(red_cnt):
        if C[i] == 'W':
            for j in range(red_cnt, N):
                if C[j] == 'R':
                    C[i] = 'R'
                    C[j] = 'W'
                    cnt += 1
                    red_cnt = j+1
    print(cnt)
s=input()
s1=input()
c=0;
for i in range(len(s1)):
  if(s1[i]!=s[i]):
    c++;
print(c)

### FIXED CODE ###

s=input()
s1=input()
c=0;
for i in range(len(s1)):
  if(s1[i]!=s[i]):
    c+=1;
print(c)
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    def gcd(x,y):
    r = x%y
    if r==0:
        return y
    return gcd(y, r)

    n, k =map(int, input().split())
    a = list(map(int, input().split()))
    a.sort(reverse=True)
    c = a[0]
    for i in range(n):
        c = gcd(a[i], c)
    if k%c == 0:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')
    

    
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    def gcd(x,y):
        r = x%y
        if r==0:
            return y
        return gcd(y, r)

    n, k =map(int, input().split())
    a = list(map(int, input().split()))
    a.sort(reverse=True)
    c = a[0]
    for i in range(n):
        c = gcd(a[i], c)
    if k%c == 0 and k <= a[0]:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')
    

    
if __name__ == '__main__':
    main()
class Edge():
	def __init__(self, v, w):
		self._v = v
		self._w = w
	def v(self):
		return self._v
	def w(self):
		return self._w

def dfs(v, g, colors, color = 0):
	colors[v] = color
	if not len(g[v]):
		return
	for nv in g[v]:
		if colors[nv.v()] != -1:
			continue
		nc = color if nv.w() % 2 == 0 else 1 - color
		dfs(nv.v(), g, colors, nc)

def resolve():
	n = int(input())
	colors = [-1]*n
	g = [list() for _ in range(n)]
	for _ in range(n-1):
		u, v, w = map(int, input().split())
		g[v-1].append(Edge(u-1, w))
		g[u-1].append(Edge(v-1, w))
	for i in range(n):
		if colors[i] != -1:
			continue
		dfs(i, g, colors)
	for c in colors:
		print(c)
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(100**4)

class Edge():
	def __init__(self, v, w):
		self._v = v
		self._w = w
	def v(self):
		return self._v
	def w(self):
		return self._w

def dfs(v, g, colors, color = 0):
	colors[v] = color
	if not len(g[v]):
		return
	for nv in g[v]:
		if colors[nv.v()] != -1:
			continue
		nc = color if nv.w() % 2 == 0 else 1 - color
		dfs(nv.v(), g, colors, nc)

def resolve():
	n = int(input())
	colors = [-1]*n
	g = [list() for _ in range(n)]
	for _ in range(n-1):
		u, v, w = map(int, input().split())
		g[v-1].append(Edge(u-1, w))
		g[u-1].append(Edge(v-1, w))
	for i in range(n):
		if colors[i] != -1:
			continue
		dfs(i, g, colors)
	for c in colors:
		print(c)
resolve()
inp=input()
if inp[2]==inp[3] and inp[4]==inp[5]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import sys
X=input()
n=len(X)
if n%2==0:
    print("No")
    sys.exit()
ans="No"
def check(s): 
    return s == s[::-1] 
ans="No"
if check(X):
    if check(X[0:int((n-1)/2)]):
        if check(X[int(((n+3)/2)-1):]):
            ans="Yes"
print(ans)
import sys
# import numpy as np 
 
def main():
    a, b = map(int, sys.stdin.read().split())
 
    if 0 < a:
        ans = 'Positive'
    elif 0 <= b:
        ans = 'Zero'
    else:
        if (b - a + 1) % 2 == 0:
            ans = 'Positive'
        else:
            ans = 'Negative'
    
    print(ans)
 
if __name__ == '__main__':
    main(

### FIXED CODE ###

import sys
# import numpy as np 
 
def main():
    a, b = map(int, sys.stdin.read().split())
 
    if 0 < a:
        ans = 'Positive'
    elif 0 <= b:
        ans = 'Zero'
    else:
        if (b - a + 1) % 2 == 0:
            ans = 'Positive'
        else:
            ans = 'Negative'
    
    print(ans)
 
if __name__ == '__main__':
    main()
def main():
    n = int(input())
    l = list(map(int, input().split()))

    max_l = max(l)
    exc_l = l.remove(max_l)

    sum_exc_l = sum(exc_l)

    if max_l < sum_exc_l:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n = int(input())
    l = list(map(int, input().split()))

    max_l = max(l)
    l.remove(max_l)

    sum_exc_l = sum(l)

    if max_l < sum_exc_l:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()
list = list(map(input().split(), int))
print(max([list[0]*2-1,list[0]+list[1],list[1]*2-1]))

### FIXED CODE ###

list = list(map(int, input().split()))
print(max([list[0]*2-1,list[0]+list[1],list[1]*2-1]))