Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-

# 関数定義
def dfs(now_p, visited, comb_p, p_num):
    # N頂点と同じ数のルートを通ったら有効なパスとして1を返す
    if len(visited) == p_num:
        return 1

    ans = 0

    # now_pの検索
    for tmp_p in comb_p:
        if tmp_p[0] == now_p and tmp_p[1] not in visited:
            # visitedのtmp
            tmp_visited = visited[:]
            tmp_visited.append(tmp_p[1])
            #print(*tmp_visited)
            # 次の頂点
            next_p = tmp_p[1]
            #print('next_p: ', next_p)
            # comb_pのtmp
            tmp_comb = comb_p[:]
            tmp_comb.remove(tmp_p)
            # 往復対象の削除
            tmp_p_r = [tmp_p[1], tmp_p[0]]
            tmp_comb.remove(tmp_p_r)
            #print(*tmp_comb)
            # dfsの再起呼び出し
            ans += dfs(next_p, tmp_visited, tmp_comb, p_num)

    return ans

## 入力読み取り
N, M = map(int, input().split())
a_b = []
tmp = []
tmp_r = []

# 辺読み取り
for i in range(N):
    tmp = list(map(int, input().split()))
    tmp_r = [tmp[1], tmp[0]]
    a_b.append(tmp)
    a_b.append(tmp_r)

visited = [1]

# 再起関数の実施
pass_num = dfs(1, visited, a_b, N)
print(pass_num)

### FIXED CODE ###

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

# 関数定義
def dfs(now_p, visited, comb_p, p_num):
    # N頂点と同じ数のルートを通ったら有効なパスとして1を返す
    if len(visited) == p_num:
        return 1

    ans = 0

    # now_pの検索
    for tmp_p in comb_p:
        if tmp_p[0] == now_p and tmp_p[1] not in visited:
            # visitedのtmp
            tmp_visited = visited[:]
            tmp_visited.append(tmp_p[1])
            #print(*tmp_visited)
            # 次の頂点
            next_p = tmp_p[1]
            #print('next_p: ', next_p)
            # comb_pのtmp
            tmp_comb = comb_p[:]
            tmp_comb.remove(tmp_p)
            # 往復対象の削除
            tmp_p_r = [tmp_p[1], tmp_p[0]]
            tmp_comb.remove(tmp_p_r)
            #print(*tmp_comb)
            # dfsの再起呼び出し
            ans += dfs(next_p, tmp_visited, tmp_comb, p_num)

    return ans

## 入力読み取り
N, M = map(int, input().split())
a_b = []
tmp = []
tmp_r = []

# 辺読み取り
for i in range(M):
    tmp = list(map(int, input().split()))
    tmp_r = [tmp[1], tmp[0]]
    a_b.append(tmp)
    a_b.append(tmp_r)

visited = [1]

# 再起関数の実施
pass_num = dfs(1, visited, a_b, N)
print(pass_num)
ソースコード
from fractions import gcd
n=int(input())
g=gcd(2,n)
print(2*n//g)

### FIXED CODE ###

from fractions import gcd

n=int(input())
g=gcd(2,n)
print(2*n//g)
H,W=map(int, input().split())
if H ==0 and W ==0:
    break
else:
    for i in range(0,H):
        for j in range (0,W):
            print("#", end="")
        print("")

### FIXED CODE ###

while True:
    H,W=map(int, input().split())
    if H ==0 and W ==0:
        break
    else:
        for i in range(0,H):
            for j in range (0,W):
                print("#", end="")
            print("")
        print("")
n = input()
k = int(input())
dp = [[[0 for i in range(len(n)+1)] for i in range(2)] for i in range(len(n)+1)]
dp[0][0][0] = 1
for a in range(len(n)):
  for b in range(2):
    for c in range(len(n)):
      for i in range(10):
        if b ==1:
          if i != 0:
            dp[a+1][1][c+1] += dp[a][1][c]
          else:
            dp[a+1][1][c] += dp[a][1][c]
        else:
          if int(n[a]) > i and i ==0:
            dp[a+1][1][c] += dp[a][0][c]
          if int(n[a]) > i and i != 0:
            dp[a+1][1][c+1] += dp[a][0][c]
          if int(n[a]) == i and i ==0:
            dp[a+1][0][c] += dp[a][0][c]
          if int(n[a]) == i and i !=0:
            dp[a+1][0][c+1] += dp[a][0][c]
if len(n) == 1:
	print(int(n))  
else:
  print(dp[-1][0][k] + dp[-1][1][k])


### FIXED CODE ###

n,k = map(int,input().split())
gcd_num = [0 for i in range(k+1)]
c = 10**9 + 7
ans = 0
for i in range(k,0,-1):
  x = k//i
  #gcd = xを満たす何組あるかのあまりを計算
  #あまりを取らないとオーバーフローする
  gcd_num[i] = pow(x,n,c)
  #重複するのを取り除く
  for j in range(2,x+1):
    gcd_num[i] -= gcd_num[i * j]
  #最後にgcdの大きさによる重み付けする
  ans += gcd_num[i] * i
  
print(ans%c)
N,K = map(int,input().split())
P = list(map(int,input().split()))
dp = []*N+1
dp[0] = 0
for i in range(N):
    ans = max(P[i]//0 for j in range(P[i])+P[i+1]//0 for j in range(P[i+1])+P[i+2]//0 for j in range(P[i+2]))
print(ans)

### FIXED CODE ###

N,K = map(int,input().split())
P = list(map(int,input().split()))
for i in range(N):
  P[i] = (P[i]+1)/2
now = sum(P[:K])
ans = now
for j in range(N-K):
  now = now - P[j] + P[j+K]
  ans = max(ans,now)
print(ans)
n,m = map(int,input().split())
ans = [0 for _ in range(n+1)]
for i in range(m):
  l,r = map(int,input().split())
  ans[l] += 1
  ans[r+1] += -1
  
from itertools import accumulate
ans = list(accumulate(ans))
count = 0
for a in ans:
  if a == n:
    count +=1
print(count)

### FIXED CODE ###

n,m = map(int,input().split())
ans = [0 for _ in range(n+2)]
for i in range(m):
  l,r = map(int,input().split())
  ans[l] += 1
  ans[r+1] += -1
  
from itertools import accumulate
ans = list(accumulate(ans))
count = 0
for a in ans:
  if a == m:
    count +=1
print(count)
a, b = map(int,raw_input().split())

if a>b:
  print 'a > b'
else if a<b:
  print 'a < b'
else:
  print 'a == b'

### FIXED CODE ###

a,b=map(int,raw_input().split())

if a>b:
  print 'a > b'
elif a<b:
  print 'a < b'
else:
  print 'a == b'
# -*- coding: utf-8 -*-

import math

A, B, K = (int(i) for i in input().split())

gcd_num = math.gcd(A, B)

if K==1:
    print(gcd_num)
    exit()

yakusuu_array = []
for i in range(1,gcd_num):
    if gcd_num % i == 0:
        yakusuu_array.append(i)
        yakusuu_array.sort(reverse=True)

print(yakusuu_array[K-2])

### FIXED CODE ###

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

import fractions

A, B, K = (int(i) for i in input().split())

gcd_num = fractions.gcd(A, B)

if K==1:
    print(gcd_num)
    exit()

yakusuu_array = []
for i in range(1,gcd_num):
    if gcd_num % i == 0:
        yakusuu_array.append(i)
        yakusuu_array.sort(reverse=True)

print(yakusuu_array[K-2])
N = int(input())
A = list(map(int,input().split()))

if N%2 == 0:
    sum1 = sum(A[x*2] for x in range(N//2))
    sum2 = sum(A)-sum1
    print(max(sum1,sum2))
    exit()

DP = [0,0,0]
m = N//2*2
for i in range(0,m,2):
    DP[0] += A[i]
    DP[1] += A[i+1]
    DP[2] += A[i+2]

    DP[1] = max(DP[0],DP[1])
    DP[2] = max(DP[1],DP[2])

print(DP[3])


### FIXED CODE ###

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

DP = [0,0,0]
m = N//2*2
if N%2 == 0:
    for i in range(0,m,2):
        DP[0] += A[i]
        DP[1] += A[i+1]
        DP[1] = max(DP[0],DP[1])

    print(DP[1])

else:
    for i in range(0,m,2):
        DP[0] += A[i]
        DP[1] += A[i+1]
        DP[2] += A[i+2]

        DP[1] = max(DP[0],DP[1])
        DP[2] = max(DP[1],DP[2])

    print(DP[2])
if S == 'ABC':
    print('ARC')
elif S== 'ARC':
    print('ABC')
else:
    print(' ')


### FIXED CODE ###

s = input()
a = ["ABC", "ARC"]
print(a[(a.index(s)+1)%len(a)])
# 整数の入力
A = int(input())
cnt = 0
for i in range(1, A):
  for j in range(1, A):
    x = str(i)
    y = str(j)

    first_x = x[0]
    last_x = x[-1]
    first_y = y[0]
    last_y = y[-1]
    
    if(first_x ==  last_y and last_x == first_y):
      cnt = cnt + 1
      continue
      
print(cnt)

### FIXED CODE ###

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

if(N == M):
  print('Yes')
else:
  print('No')
n=int(input())
s=input()
a=[]
for i in range(1,n-1):
    s1=set(s[:i])
    s2=set(s[i:])
    a.append(len(s1&s2))
print(max(a))

### FIXED CODE ###

n=int(input())
s=input()
a=[]
for i in range(1,n):
    s1=set(s[:i])
    s2=set(s[i:])
    a.append(len(s1&s2))
print(max(a))
t=1
# t=int(input())
for _ in range(t):
    from bisect import bisect_left
    n,k=map(int,input().split())
    a=sorted(list(map(int,input().split())))
    m=bisect_left(a,0)
    MOD=10**9+7
    ans=1
    if m==0 or (m==n and k%2==1):
        for i in a[-k:]:
            ans=(ans*i)%MOD
    elif m==n and k%2==0:
        for i in a[:k]:
            ans=(ans*i)%MOD
    else:
        ans=1
        l,r=0,-1
        lm=a[0]*a[1]
        rm=a[-1]*a[-2]
        for i in range(k//2):
            if lm>=rm:
                ans*=lm%MOD
                l+=2
                if l<=n-2:
                    lm=a[l]*a[l+1]
            else:
                ans*=rm%MOD
                r-=2
                if 1<=n+r:
                    rm=a[r]*a[r-1]
            ans%=MOD
        if k%2==1:
            ans*=a[r]
            ans%=MOD
    print(ans)

### FIXED CODE ###

import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# import numpy as np
sys.setrecursionlimit(int(pow(10,6)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("out.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]

# @lru_cache(None)

t=1
# t=int(input())
for _ in range(t):
    n=L()[0]
    if n%1000==0:
        print(0)
        exit()

    print(1000-n%1000)
# n, k: 数値　s: 文字列　が与えられる
    # k文字目を入れ替えよ

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

    # dic = {"A":"a", "B":"b", "C":"c"}

    # キーとなる文字　文字列のインデックスは0から
    # s[k-1]


    # 小文字にする表現がある 下記なら1発
    print(s[:k-1] + s[k-i].lower() + s[k-1:])

    # [開始インデックス:終了インデックス] 数値は　より大　と　未満
    # print(s[:k-1] + dic.get(s[k-1]) + s[k-1:])

### FIXED CODE ###

n, k = map(int, input().split())
s = input()
print(s[:k-1] + s[k-1].lower() + s[k:])
n=int(input())
A=input()
B=input()
C=input()

As=list(map(int,A.split(' ')))
Bs=list(map(int,B.split(' ')))
Cs=list(map(int,C.split(' ')))
total=0
for i in range(0,n):
    if As[i]-As[i-1]==1 and i!=0:
        total=total+Cs[As[i]-1]
    else:
        total=total+Bs[As[i]-1]
print(total)

### FIXED CODE ###

n=int(input())
A=input()
B=input()
C=input()

As=list(map(int,A.split(' ')))
Bs=list(map(int,B.split(' ')))
Cs=list(map(int,C.split(' ')))
total=0
for i in range(0,n):
    if As[i]-As[i-1]==1 and i!=0:
        total=total+Cs[As[i]-2]
    total=total+Bs[As[i]-1]
print(total)
a=int(input())%1000
if a=0:
  print(0)
else:
  print(1000-a)

### FIXED CODE ###

a=int(input())%1000
if a==0:
  print(0)
else:
  print(1000-a)
date = map(int,input().split('/'))
print('TBD' if data[0]>=2019 and data[1]*30+data[2]>=150 else 'Heisei') 

### FIXED CODE ###

date =list(map(int,input().split('/')))
print('TBD' if date[1]*31+date[2]>=155 else 'Heisei')
NN = 19
NN = 5
X = [0] * ((1<<NN+1)-1)
 
def popcount(x):
    x -= (x >> 1) & 0x55555555
    x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f
    x += x >> 8
    x += x >> 16
    return x & 0x3f

def update(a, x):
    i = (1<<NN) - 1 + a
    X[i] = x
    while True:
        i = (i-1) // 2
        X[i] = X[2*i+1] | X[2*i+2]
        if i == 0:
            break

def rangeor(a, b):
    l = a + (1<<NN)
    r = b + (1<<NN)
    x = 0
    while l < r:
        if l%2:
            x |= X[l-1]
            l += 1
        if r%2:
            r -= 1
            x |= X[r-1]
        l >>= 1
        r >>= 1
    return x

N = int(input())
A = [ord(a) - 97 for a in input()]
for i, a in enumerate(A):
    X[(1<<NN) + i] = 1 << a
for i in range((1<<NN)-1)[::-1]:
    X[i] = X[i*2+1] | X[i*2+2]

Q = int(input())
for _ in range(Q):
    a, b, c = input().rstrip().split()
    if a == "1":
        b = int(b)
        c = ord(c) - 97
        update(b, 1<<c)
    else:
        b, c = int(b), int(c)
        print(popcount(rangeor(b, c+1)))
        print([i for i in range(26) if rangeor(b, c+1)>>i & 1])

### FIXED CODE ###

N = int(input())
A = [ord(a) - 97 for a in input()]
NN = 19
BIT=[[0]*(2**NN+1) for _ in range(26)]
 
def addbit(t, i, x):
    while i <= 2**NN:
        BIT[t][i] += x
        i += i & (-i)

def getsum(t, i):
    ret = 0
    while i != 0:
        ret += BIT[t][i]
        i -= i&(-i)
    return ret

for i, a in enumerate(A):
    BIT[a][i+1] += 1

for t in range(26):
    B = [0] * (2**NN+1)
    for i in range(1<<NN):
        B[i+1] = B[i] + BIT[t][i]
    for i in range(1<<NN):
        BIT[t][i] = B[i] - B[i - (i & (-i))]

Q = int(input())
for _ in range(Q):
    a, b, c = input().rstrip().split()
    if a == "1":
        b = int(b)
        c = ord(c) - 97
        t = A[b-1]
        addbit(t, b+1, -1)
        addbit(c, b+1, 1)
        A[b-1] = c
    else:
        b, c = int(b), int(c)
        s = 0
        for t in range(26):
            s += 1 if getsum(t, c+1) - getsum(t, b) else 0
        print(s)
n,q=map(int,input().split())
s=list(input())
#print(s)
i=0
a=[]
while i!=len(s):
    if s[i]=="C" and a1==1:

        a.append(1)
    elif s[i]=="A":
        a.append(0)
        a1=1
    else:
        a1=0
        a.append(0)
    i=i+1
#print(a)
i=0
while i!=q:
    l,r=map(int,input().split())
    i=i+1
    s=a[l:r]
    #print(s)
    print(s.count(1))

### FIXED CODE ###

n,q=map(int,input().split())
s=list(input())
#print(s)
i=1
a=[0]
x=0
while i!=n:
    if s[i-1]=="A":
        if s[i]=="C":
            x=x+1
    i=i+1
    a.append(x)

#print(a)
i=0
while i!=q:
  try:
    l,r=map(int,input().split())
    i=i+1
    s=a[r-1]-a[l-1]
    print(s)
  except:
      break
import sys

def insertionSort( nums, n, g ):
	global cnt
	i = g
	while i < n:
		v = nums[i]
		j = i - g
		while 0 <= j and v < nums[j]:
			nums[ j+g ] = nums[j]
			j -= g
			cnt += 1
		nums[ j+g ] = v
		i += 1
		
def shellSort( nums, n ):
	g = []
	val =0
	for i in range( n ):
		val = 3*val+1
		if  n < val:
			break
		g.append( val )
	
	g.reverse( )
	m = len( g )
	print( m )
	print( " ".join( map( str, g ) ) )
	for i in range( m ):
		insertionSort( nums, n, g[i] )
    
n = int( sys.stdin.readline( ) )
nums = []
for i in range( n ):
	nums.append( int( sys.stdin.readline( ) ) )

cnt = 0
shellSort( nums, n )
print( cnt )
print( "\n".join( map( str, nums ) ) )

### FIXED CODE ###

import sys
 
def insertionSort( nums, n, g ):
    cnt = 0
    i = g
    while i < n:
        v = nums[i]
        j = i - g
        while 0 <= j and v < nums[j]:
            nums[ j+g ] = nums[j]
            j -= g
            cnt += 1
        nums[ j+g ] = v
        i += 1
    return cnt
         
def shellSort( nums, n ):
    g = []
    val = 1
    while val <= n:
        g.append( val )
        val = 3*val+1
     
    g.reverse( )
    m = len( g )
    print( m )
    print( " ".join( map( str, g ) ) )
    cnt = 0
    for i in range( m ):
        cnt += insertionSort( nums, n, g[i] )
    print( cnt )
     
n = int( sys.stdin.readline( ) )
nums = []
for i in range( n ):
    nums.append( int( sys.stdin.readline( ) ) )
 
shellSort( nums, n )
print( "\n".join( map( str, nums ) ) )
print("ARC" if int(input) > 1200 else "ABC")


### FIXED CODE ###

print("ARC" if int(input()) >= 1200 else "ABC")
N = int(input())
arr =  [int(i) for i in input().split()] 

count = 0
while(True):
    for i in range(N):
        if arr[i] % 2 == 0:
            arr[i] = arr[i] / 2
            if i == 2:
                count += 1
        else:
            break
    else:
        continue
    break
        
        

print(count)


### FIXED CODE ###


a = input()

count = 0
for i in a:
    if i == '1':
        count += 1
print(count)
A,B,C,D = map(int,input().split())
import math
lcm = int( C*D / ( math.gcd(C,D) ) )

first_c = ( A - 1) // C
first_d = ( A - 1) // D
first_cd = ( A - 1) // lcm 
first = ( A - 1 ) - ( first_c + first_d - first_cd )

end_c = B // C
end_d = B // D
end_cd = B // lcm 
end_ = B - ( end_c + end_d - end_cd )

print(end_ - first)

### FIXED CODE ###

A,B,C,D = map(int,input().split())
import fractions
lcm = int( C*D / ( fractions.gcd(C,D) ) )

first_c = ( A - 1) // C
first_d = ( A - 1) // D
first_cd = ( A - 1) // lcm 
first = ( A - 1 ) - ( first_c + first_d - first_cd )

end_c = B // C
end_d = B // D
end_cd = B // lcm 
end_ = B - ( end_c + end_d - end_cd )

print(end_ - first)
N = str(N)
N = N[-1]

hon = [str(n) for n in list([2,4,5,7,9])]
pon = [str(n) for n in list([0,1,6,8])]
bon = ["3"]

if N in hon:
  print('hon')
elif N in pon:
  print("pon")
elif N in bon:
  print("bon") 
else:
  print("booom")

### FIXED CODE ###

N = (input())
N = N[-1]

hon = [str(n) for n in list([2,4,5,7,9])]
pon = [str(n) for n in list([0,1,6,8])]
bon = ["3"]

if N in hon:
  print('hon')
elif N in pon:
  print("pon")
elif N in bon:
  print("bon") 
else:
  print("booom")
1 2 3

### FIXED CODE ###

a = list(map(int, input().split()))
print(str(a[2])+' '+str(a[0])+' '+str(a[1]))
S = input(int)


print(S//3600)
print(':')
print(S//60%60)
print(':')
print(S%60)



### FIXED CODE ###

S = int(input())


print(f'{S//3600}:{S//60%60}:{S%60}')
#T=(0,0,...,0)
#に変換するためのコストの2^N倍
N=int(input())
c=sorted([int(i) for i in input().split()])
mod=10**9+7
ans=0
for k in range(N):
    a1=pow(2,N-2,mod)
    a2=(N-k+1)
    tmp=(a1*a2)%mod
    ans+=(c[k]*tmp)%mod
    ans%=mod
    #print(k,tmp)
ans=ans*pow(2,N,mod)
ans%=mod
print(ans)


### FIXED CODE ###

#T=(0,0,...,0)
#に変換するためのコストの2^N倍
N=int(input())
c=sorted([int(i) for i in input().split()])
mod=10**9+7
if N==1:
    print((2*c[0])%mod)
    exit()
ans=0
for k in range(N):
    a1=pow(2,N-2,mod)
    a2=(N-k+1)
    tmp=(a1*a2)%mod
    ans+=(c[k]*tmp)%mod
    ans%=mod
    #print(k,tmp)
ans=ans*pow(2,N,mod)
ans%=mod
print(ans)
# coding: utf-8

N = input()
print(N*(N-1) / 2)

### FIXED CODE ###

N = int(input())

print(N*(N-1) // 2)
N = int(input())

xyh = []
for _ in range(N):
    x, y, h = map(int, input().split())
    xyh.append((x, y, h))

# print(xyh)

# h = max(H - |x - Cx| - |y - Cy|, 0)

'''
  0 1 2 3
0
1     5
2   5   5
3     5

   99 100
0 192
1 191 192
'''


def f():
    for tx in range(101):
        for ty in range(101):
            th = xyh[0][2] + abs(xyh[0][0] - tx) + abs(xyh[0][1] - ty)
            if all(h == max(th - abs(tx - x) - abs(ty - y), 0) for x, y, h in xyh):
                return tx, ty, th
print(*f())


### FIXED CODE ###

N = int(input())

xyh = []
for _ in range(N):
    x, y, h = map(int, input().split())
    if h != 0:
        xx, yy, hh = x, y, h
    xyh.append((x, y, h))

# print(xyh)

# h = max(H - |x - Cx| - |y - Cy|, 0)

'''
  0 1 2 3
0
1     5
2   5   5
3     5

   99 100
0 192
1 191 192
'''


def f():
    for tx in range(101):
        for ty in range(101):
            th = hh + abs(xx - tx) + abs(yy - ty)
            if all(h == max(th - abs(tx - x) - abs(ty - y), 0) for x, y, h in xyh):
                return tx, ty, th

print(*f())
a, b = input.split()

if (a=="H"and b=="H")or(a=="D" and b=="D"):
    print("H")
else:
    print("D")

### FIXED CODE ###

a, b = input().split()

if (a=="H"and b=="H")or(a=="D" and b=="D"):
    print("H")
else:
    print("D")
"""D."""

import sys

#def input() -> str:  # noqa: A001
#    """Input."""
#    return sys.stdin.readline()[:-1]


class UnionFindTree:
    """Union-find."""

    def __init__(self, n: int) -> None:
        """Init."""
        self.n = n
        self.parent = [-1] * n

    def find_root(self, x: int) -> int:
        """Find root."""
        parent = self.parent[x]
        if parent < 0:
            return x
        return self.find_root(parent)

    def union(self, x: int, y: int) -> None:
        """Unite two trees."""
        x_root = self.find_root(x)
        y_root = self.find_root(y)

        if x_root == y_root:
            return

        if x_root > y_root:
            x_root, y_root = y_root, x_root

        self.parent[x_root] += self.parent[y_root]
        self.parent[y_root] = x_root

    def get_size(self, x: int) -> int:
        """Get size."""
        return self.parent[self.find_root(x)] * -1

    def is_same(self, x: int, y: int) -> bool:
        """Is same group."""
        return self.find_root(x) == self.find_root(y)


n, m = map(int, input().split(' '))

tree = UnionFindTree(n)

for _ in range(m):
    a, b = map(int, input().split(' '))
    tree.union(a - 1, b - 1)

ans = 0

for i in range(n):
    ans = max(ans, tree.get_size(i))

print(ans)


### FIXED CODE ###

"""D."""

import sys

#def input() -> str:  # noqa: A001
#    """Input."""
#    return sys.stdin.readline()[:-1]


class UnionFindTree:
    """Union-find."""

    def __init__(self, n: int) -> None:
        """Init."""
        self.n = n
        self.rank = [-1] * n

    def find_root(self, x: int) -> int:
        """Find root."""

        if self.rank[x] < 0:
            return x

        self.rank[x] = self.find_root(self.rank[x])
        return self.rank[x]

    def union(self, x: int, y: int) -> None:
        """Unite two trees."""
        x_root = self.find_root(x)
        y_root = self.find_root(y)

        if x_root == y_root:
            return

        if x_root > y_root:
            x_root, y_root = y_root, x_root

        self.rank[x_root] += self.rank[y_root]
        self.rank[y_root] = x_root

    def get_size(self, x: int) -> int:
        """Get size."""
        return self.rank[self.find_root(x)] * -1

    def is_same(self, x: int, y: int) -> bool:
        """Is same group."""
        return self.find_root(x) == self.find_root(y)


n, m = map(int, input().split(' '))

tree = UnionFindTree(n)

for _ in range(m):
    a, b = map(int, input().split(' '))
    tree.union(a - 1, b - 1)

ans = 0

for i in range(n):
    ans = max(ans, tree.get_size(i))

print(ans)
s = input()
alpha = [0]*26
for i in range(len(s)):
	alpha[ord(s[i]) - ord('a') ] += 1
if alpha['k' - 'a'] == 1:
	alpha['i' - 'a'] == 1:
		alpha['h' - 'a'] == 1:
			alpha['b' - 'a'] == 1:
				alpha['r' - 'a'] == 1:
					print("YES")
else:
	print("NO")

### FIXED CODE ###

s = input()
alpha = [0]*26
l = []
l.append('KIHBR')
l.append('AKIHBR')
l.append('KIHABR')
l.append('KIHBAR')
l.append('KIHBRA')

l.append('AKIHABR')
l.append('AKIHBAR')
l.append('AKIHBRA')
l.append('KIHABAR')
l.append('KIHABRA')
l.append('KIHBARA')
l.append('AKIHABAR')
l.append('KIHABARA')
l.append('AKIHBARA')
l.append('AKIHABRA')
l.append('AKIHABARA')
if s in l:
    print("YES")
else:
    print("NO")
R,G,B,N = map(int,input().split())
ans = 0
for r in range(N//R+1):
    for g in range((N-R*r)//G+1):
        if (N-R*r+G*g)%B == 0:
            ans += 1
print(ans)


### FIXED CODE ###

N,K = map(int,input().split())
print(N-(K-1))
n = int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())

now = a[0]
cnt = 0

while now != 2:
    cnt += 1
    now = a[now-1]
    if cnt >= n:
        print(-1)
        exit()
    fp.append(now)

if now == 2:
    cnt += 1

print(cnt)

### FIXED CODE ###

n = int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())

now = a[0]
cnt = 0

while cnt <= n:
    cnt += 1
    if now == 2:
        print(cnt)
        exit()
    now = a[now-1]

print(-1)
n = input()

fizz = []
buzz = []
fizzbuzz = []
other = []
for i in range(n):
    if (i % 3 != 0) & (i % 5 != 0):
        other.append(i)

b = 0
for i in range(len(other)):
    b += other[i]

print(b)

### FIXED CODE ###

a = str(input())

if "7" in a:
  print("Yes")
else:
  print("No")
n,m = map(int,input().split())
l = [tuple(map(int,input().split())) for _ in range(m)]
d = [list() for _ in range(n)]
for x in l:
  d[x[0]-1].append(x[1])
for r in d:
  r.sort()
for x in l:
  p = x[0]
  y = d[x[0]-1].index(x[1]) + 1
  print("{:06}{:06}".format(p,y)

### FIXED CODE ###

n,m = map(int,input().split())
l = [tuple(map(int,input().split())) for _ in range(m)]
d = [list() for _ in range(n)]
dic = [dict() for _ in range(n)]
for x in l:
  d[x[0]-1].append(x[1])
for r in range(n):
  d[r].sort()
  dic[r] = dict(zip(d[r],range(1,len(d[r])+1)))
for x in l:
  p = x[0]
  y = dic[x[0]-1][x[1]]
  print("{:06}{:06}".format(p,y))
a, b = int(input().split())

if a >= b:
    k = max(a-1, b)
    print(a+k)

else:
    k = max(a, b-1)
    print(b+k)

### FIXED CODE ###

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

if a >= b:
    print(a + max(a-1, b))

else:
    print(b + max(a, b-1))