Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3
abcbdab
bdcaba
abc
abc
abc
bc

output:
4
3
2

"""
import sys


def lcs(A, B):
    m, n = len(A), len(B)
    count_list = tuple([[0] * (n + 1) for _ in range(m + 1)])

    for i in range(1, m + 1):
        for j in range(1, n + 1):
            if A[i - 1] == B[j - 1]:
                count_list[i][j] = count_list[i - 1][j - 1] + 1
            else:
                count_list[i][j] = max(count_list[i - 1][j], count_list[i][j - 1])

    return count_list[m][n]


def lcs_recursive(A, B, m, n):
    if m == 0 or n == 0:
        return 0
    elif A[m - 1] == B[n - 1]:
        return 1 + lcs_recursive(A, B, m - 1, n - 1)
    else:
        return max(lcs_recursive(A, B, m, n - 1), lcs_recursive(A, B, m - 1, n))


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    pair_num = int(_input[0])

    word_list = _input[1:]
    # assert len(word_list) == 2 * pair_num
    # for k in range(0, len(word_list), 2):
    #     print(lcs(word_list[k].strip(), word_list[k + 1].strip()))

    for pair in zip(word_list[::2], word_list[1::2]):
        w1, w2 = map(lambda x: x.strip(), pair)
        l1, l2 = len(w1), len(w2)
        print(lcs_recursive(w1, w2, l1, l2))

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
input:
3
abcbdab
bdcaba
abc
abc
abc
bc

output:
4
3
2

"""
import sys


def lcs(A, B):
    m, n = len(A), len(B)
    count_list = [[0] * (n + 1) for _ in range(m + 1)]

    for i in range(1, m + 1):
        for j in range(1, n + 1):
            if A[i - 1] == B[j - 1]:
                count_list[i][j] = count_list[i - 1][j - 1] + 1
            elif count_list[i - 1][j] >= count_list[i][j - 1]:
                count_list[i][j] = count_list[i - 1][j]
            else:
                count_list[i][j] = count_list[i][j - 1]

    return count_list[m][n]


def lcs_better(A, B):
    costs = [0]
    for c in B:
        for index in range(len(costs) - 1, -1, -1):
            # print(costs, index + 1)
            x_findex_index = A.find(c, costs[index])
            if x_findex_index != -1:
                if index + 1 < len(costs):
                    costs[index + 1] = min(costs[index + 1], x_findex_index + 1)
                else:
                    costs.append(x_findex_index + 1)
    return len(costs) - 1


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    pair_num = int(_input[0])

    word_list = _input[1:]
    # assert len(word_list) == 2 * pair_num
    for k in range(0, len(word_list), 2):
        print(lcs_better(word_list[k].strip(), word_list[k + 1].strip()))
import sys
input = sys.stdin.readline
h,w,n = map(int,input().split())
r,c = map(int,input().split())
sd = {'L':0,'R':0,'U':0,'D':0}
td = {'L':0,'R':0,'U':0,'D':0}
s = input()
t = input()
ans = 'YES'
for i in range(n):
  sd[s[i]] += 1
  if max(1,r-td['D'])+sd['U'] > h or min(h,r+td['U'])-sd['D'] < 1 or max(1,c-td['L'])+sd['R'] > w or min(w,c+td['R'])-sd['L'] < 1:
    ans = 'NO'
    break
  td[t[i]] += 1
print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline

h,w = map(int,input().split())
c = []
for i in range(h):
  a = input()
  c.append(a)
  
from collections import deque

d = [[-1] * w for i in range(h)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

que = deque([])
for i in range(h):
  for j in range(w):
    if c[i][j] == '#':
      que.append((i,j,0))
      d[i][j] = 0

ans = 0
while que:
  p = que.popleft()
  for i in range(4):
      nw = p[1] + dx[i]
      nh = p[0] + dy[i]
      if 0 <= nw < w and 0 <= nh < h and d[nh][nw]==-1:
          que.append((nh,nw,p[2]+1))
          d[nh][nw] = p[2]+1
          ans = max(ans,p[2]+1)

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

ans = 0
def walk(cur, visited):
    global ans
    tmp = visited + [cur]
    if len(tmp) == N:
        ans += 1
    for nex in g[cur]:
        if nex not in tmp:
            walk(nex, tmp)
walk(1, [])
print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
g = [[]for _ in range(n + 1)]
for _ in range(m):
    a, b = map(int, input().split())
    g[a].append(b) 
    g[b].append(a)

ret = 0
def walk(node, visited):
    global ret
    tmp = visited + [node]
    if len(tmp) == n:
        ret += 1 
    for nd in g[node]:
        if nd not in tmp:
            walk(nd, tmp)
walk(1, [])
print(ret)
n = int(input())
import math
import random
s = [1 for i in range(55555+1)]
s[0], s[1] = 0, 0
for i in range(2, int(math.sqrt(55555))+1):
    if s[i] != 0:
        for j in range(i*2, 55555, i):
            s[j] = 0
prime = []
for i in range(55555+1):
    if s[i] == 1:
        prime.append(i)

def is_prime(q):
    q = abs(q)
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False
    return pow(2, q - 1, q) == 1








while True:
    a = random.sample(prime, n)
    count = 0
    while True:
        b = random.sample(a, 5)
        if is_prime(sum(b)):
            break
        else:
            count += 1
        if count > 30:
            ans = ''
            for i in a:
                ans += str(i) + ' '
            print(ans[:-1])
            # print(sum(a))
            # print(is_prime(sum(a)))
            quit()

            

### FIXED CODE ###

a, b = map(int, input().split())
if a>b:
    print(a-1)
else :
    print(a)
n = int(input())                                                                    s = input()                                                                                                                                                             print(s.count('ABC'))

### FIXED CODE ###

n = int(input())
s = input()                                                                                                                                                             
print(s.count('ABC'))
N=int(input())

if  N%2=1
    print(N//2+1/N)

else  print(1/2)

### FIXED CODE ###

N=int(input())

if  N%2==1:
    print((N//2+1)/N)

else:
    print(1/2)
#import math
import fractions
from functools import reduce
N,M= [int(i) for i in input().split()]
n = [int(i) for i in input().split()]
#print(n)
n=sorted(set(n),reverse = True)
#print(n)
#c=len(n)


def lcm_b(a, b):
        #print("base",a,b)
        return (a * b) // math.gcd(a, b)

def lcm_o():
        global n
        return reduce(lcm_b, n,1)

def chk(v):
        global n
        for i in range(30):
                #print(i,v)
                if v%(2**i) == 1:break
                v = v//2
        t=2**(i-1)
        for j in range(len(n)):
                if n[j] % t == 0 and (n[j] / t) % 2 == 1:
                        n[j] = int(n[j]/t)
                else: return 0
        return i-1
c = chk(n[-1]) 
if  c != 0:
        #print(n)
        v = lcm_o()*(2**(c-1))
        #print(v)
        if v > M:
                print(0) 
        else:
                v = M//v
                print((v+1)//2 if v%2 == 1 else v//2)
        
else: print(0)

### FIXED CODE ###

import fractions
from functools import reduce
N,M= [int(i) for i in input().split()]
n = [int(i) for i in input().split()]
#print(n)
n=sorted(set(n),reverse = True)
bs = n[0]
#print(n)
#c=len(n)
 
 
def lcm_b(a, b):
        #print("base",a,b)
        return (a * b) // fractions.gcd(a, b)
 
def lcm_o():
        global n
        return reduce(lcm_b, n)
 
def chk(v):
        global n
        for i in range(1,30):
                if v%2 == 1:break
                v = v//2
        t=2**(i-1)
        for j in range(len(n)):
                if n[j] % t == 0 and (n[j] / t) % 2 == 1:
                        n[j] = int(n[j]/t)
                else: return 0
        return i-1
 
if len(n) > 1:
        
        c = chk(n[-1])
        
        if  c != 0:
                v = lcm_o()*(2**(c-1))
                
                if v > M:
                        print(0) 
                else:
                        v = M//v
                        if v%2==1: v+=1
                        print(int(v//2))
        
        else: print(0)
elif len(n)==1:
        v = int(bs*0.5)
        v = M//v
        if v%2==1: v+=1
        print(int(v//2))
while(1):
    hit = 0
    blow = 0
    a = input().split(' ')
    b = input().split(' ')
    for a_, b_ in zip(a, b):
        if a_ == b_:
            hit += 1
        elif a_ in b:
            blow += 1
    print(hit, blow)



### FIXED CODE ###

import sys

a = []
for line in sys.stdin:
    a.append(line.strip())
ita = iter(a)

for a, b in zip(ita, ita):
    hit = 0
    blow = 0
    a = a.split(' ')
    b = b.split(' ')
    for a_, b_ in zip(a, b):
        if a_ == b_:
            hit += 1
        elif a_ in b:
            blow += 1
    print(hit, blow)
N=int(input())
A=[int(x)for x in input().split()]
B=[]
if N%2==0:
    for i in range((N//2)):
        B.append(2*i+1)
        B.append(2*i+1)
    if sorted(A)==sorted(B):
        ans0=pow(2,(N/2))
        
        ans=ans0%(10**9+7)
    else:
        ans=0
else:
    B.append(0)
    for i in range(1,((N-1)//2)+1):
        B.append(2*i)
        B.append(2*i)
    if sorted(A)==sorted(B):
        ans0=pow(2,(N-1)/2)
        ans=ans0%(10**9+7)
    else:
        ans=0
print(int(ans))
 

### FIXED CODE ###

mod = 10**9 + 7
n = int(input())
a = sorted(list(map(int,input().split())))
 
if n % 2 == 0:
  for i in range(n//2):
    if not a[2*i] == a[2*i+1] == 2*i+1:
      print(0)
      exit()
else:
  if a[0] != 0:
    print(0)
    exit()
  for i in range(n//2):
    if not a[2*i+1] == a[2*i+2] == 2*i+2:
      print(0)
      exit()
print(pow(2, n//2) % mod)
import sys

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

for _ in range(m):
  sc.append(list(map(int,input().split())))

sc.sort()

if sc[0][0] == 1 and sc[0][1] == 0:
  print('-1')
  sys.exit()

num = 0
while len(sc) > num+1:
  if sc[num][0] == sc[num+1][0]:
    if sc[num][1] == sc[num+1][1]:
      del sc[num]
      num = 0
      continue
    else:
      print('-1')
      sys.exit()
  num += 1

ans = [0 for _ in range(n)]
for i in range(len(sc)):
  ans[sc[i][0]-1] = sc[i][1]

res = ''
for i in range(len(ans)):
  res = res + str(ans[i])

print(res)


### FIXED CODE ###

import sys

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

if m == 0 and n == 1:
  print(0)
  sys.exit()
elif m == 0 and n != 1:
  print(10**n // 10)
  sys.exit()


for _ in range(m):
  sc.append(list(map(int,input().split())))

sc.sort()

if n == 1:
  tmp = 0
  for i in range(m):
    if sc[i][0] == 1 and sc[i][1] == 0:
      tmp += 1
    if tmp == m:
      print(0)
      sys.exit()

if sc[0][0] == 1 and sc[0][1] == 0:
  print('-1')
  sys.exit()

ans = [-1 for _ in range(n)]
for i in range(m):
  if ans[sc[i][0]-1] == -1:
    ans[sc[i][0]-1] = sc[i][1]
  else:
    if ans[sc[i][0]-1] != sc[i][1]:
      print('-1')
      sys.exit()

res = ''
if ans[0] == -1:
  ans[0] = 1
for i in range(n):
  if ans[i] == -1:
    ans[i] = 0
  res = res + str(ans[i])

print(res)
result = [0]*3
while True:
    a, b, c = sorted(map(int, input().split()))
    if a + b <= c:
        #print(sum(result),*result)
    flag = a ** 2 + b ** 2 - c*c
    if flag == 0:
        result[0] +=1
    elif flag >0:
        result[1] += 1
    else:
        result[2] += 1


### FIXED CODE ###

result = [0]*3
while True:
    a, b, c = sorted(map(int, input().split()))
    if a + b <= c:
        print(sum(result),*result)
        break
    flag = a ** 2 + b ** 2 - c*c
    if flag == 0:
        result[0] +=1
    elif flag >0:
        result[1] += 1
    else:
        result[2] += 1
a,b = int(input().split())
wa = a + b
sa = a - b
seki = a * b
list = [wa,sa,seki]
print(max(list))

### FIXED CODE ###

a,b = map(int,input().split())
wa = a + b
sa = a - b
seki = a * b
list = [wa,sa,seki]
print(max(list))
s = input()
n = len(s)
up = []
down = []
for i in range(1,n):
  if s[i] != s[i-1]:
    if s[i] == 'L':
      down.append(i)
    else:
      up.append(i)
ans = [0 for _ in range(n)]
try:
  top = up[0]
except:
  top = n
bottom = down[0]
count = 0
for i in range(n):
  diff = i - bottom
  if diff % 2 == 0:
    ans[bottom] += 1
  else:
    ans[bottom-1] += 1
  #print(ans)
  if i+1 == top:
    count += 1
    try:
      top = up[count]
    except:
      pass
    bottom = down[count]
print(' '.join(map(str,ans)))

### FIXED CODE ###

s = input()
n = len(s)
up = []
down = []
parity = 0
for i in range(1,n):
  if s[i] != s[i-1]:
    if parity == 0:
      down.append(i)
    else:
      up.append(i)
    parity = 1 - parity
ans = [0 for i in range(n)]
#print(up,down)
for i in range(n):
  if s[i] == 'R':
    diff = down[0] - i
    if diff % 2 == 1:
      ans[down[0]-1] += 1
    else:
      ans[down[0]] += 1
  else:
    diff = i - down[0]
    if diff % 2 == 1:
      ans[down[0]-1] += 1
    else:
      ans[down[0]] += 1
  if up != []:
    if i+1 == up[0]:
      del down[0]
      del up[0]
ANS = list(map(str,ans))
print(' '.join(ANS))
i = int(input())
if i >= 1 and 100 >= i and i % 2 == 0:  
  s = input()
if i == len(s) and s.isalpha() and s.islower():  
  t_0 = s[0]
  t_1 = s[i/2]
	for j in range(1, i/2):
	  t_0 = t_0 + s[j]
    for k in range(i/2 + 1, i):
      t_1 = t_1 + s[k]
  if t_0 == t_1:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

i = int(input()) 
s = input()
if i >= 1 and 100 >= i and i % 2 == 0 and i == len(s) and s.isalpha() and s.islower():
  n = (int)(i/2)
  t_0 = s[0]
  t_1 = s[n]
  for j in range(1, n):
    t_0 += s[j]
  for k in range(n + 1, i):
    t_1 += s[k]
  if t_0 == t_1:
    print("Yes")
  else:
    print("No")
else:
  print("No")
a,b,c=map(int,input().split())
print(a,b,c.sort())

### FIXED CODE ###

a,b,c=map(int,input().split())
d=sorted([a,b,c])
print ("{0} {1} {2}".format(d[0],d[1],d[2]))
from operator import itemgetter
from collections import Counter
def main():
    va = []
    vb = []
    n = int(input())
    *v, = map(int, input().split())
    for i in range(len(v)):
        if i % 2 == 0:
            va.append(v[i])
        else:
            vb.append(v[i])
    a1 = Counter(va).most_common()
    a2 = Counter(vb).most_common()
    how_many_a1 = a1[0][1]
    how_many_a2 = a2[0][1]
    if a1[0][0] != a2[0][0]:
        print(n - how_many_a1 - how_many_a2)
    else:
        if (len(va) - how_many_a1) + (len(vb) - how_many_a2[0][1])  > (len(vb) - how_many_a2) + (len(va) - how_many_a1[0][1]):
            print((len(vb) - how_many_a2) + (len(va) - how_many_a1[0][1]))
        else:
            print((len(va) - how_many_a1) + (len(vb) - how_many_a2[0][1]))
main()


### FIXED CODE ###

from operator import itemgetter
from collections import Counter
def main():
    va = []
    vb = []
    n = int(input())
    *v, = map(int, input().split())
    for i in range(len(v)):
        if i % 2 == 0:
            va.append(v[i])
        else:
            vb.append(v[i])
    a1 = Counter(va).most_common()
    a2 = Counter(vb).most_common()
    how_many_a1 = a1[0][1]
    how_many_a2 = a2[0][1]
    if a1[0][0] != a2[0][0]:
        print(n - how_many_a1 - how_many_a2)
    else:
        if len(a1) == 1 and len(a2) == 1:
            print(int(n/2))
        elif len(a1) == 1:
            print(len(vb) - a2[1][1])
        elif  len(a2) == 1:
            print(len(va) - how_many_a1)
        elif (len(va) - how_many_a1) + (len(vb) - a2[1][1])  > (len(vb) - how_many_a2) + (len(va) - a1[1][1]):
            print((len(vb) - how_many_a2) + (len(va) - a1[1][1]))
        else:
            print((len(va) - how_many_a1) + (len(vb) - a2[1][1]))
main()
from sys import stdin
import collections

def main():
  N = int(input())
  
  xlist=[]
  ylist=[]
  for i in range(N):
    x, y = map(int, stdin.readline().rstrip().split())
    xlist.append(x)
    ylist.append(y)
    
  tupleList=[]
  for i in range(N):
    for j in range(N):
      if i < j:
        tupleList.append((xlist[i] - xlist[j], ylist[i] - ylist[j]))
        
  c = collections.Counter(tupleList)
  print(N-c[max(c)])   

main()



### FIXED CODE ###

from sys import stdin

N=int(input())
xlist=[]
ylist=[]
dict = {}
for i in range(N):
  x, y = map(int, stdin.readline().rstrip().split())
  xlist.append(x)
  ylist.append(y)

for i in range(N):
  for j in range(N):
    if i != j:
      tupleStr=str(xlist[i] - xlist[j])+","+str(ylist[i] - ylist[j])
      if tupleStr in dict:
        dict[tupleStr]+=1
      else:
        dict[tupleStr]=1

maxNum=0
for val in dict.values():
  maxNum = max(maxNum, val)

print(N-maxNum)
import math
N = int(input())

nlist=[""]*N

for i in range(N):
    t=str(input())
    t = ''.join(sorted(t))
    nlist[i] = t

sum=0
tsum=1
nlist=sorted(nlist)
tmpStr=nlist[0]
for i in range(1,N):
    if(tmpStr==nlist[i]):
        tsum+=1
    else:
        tmpStr=nlist[i]
        if(tsum!=1):
                sum+=math.factorial(tsum)/2
                tsum=1
if(tsum!=1):
        tmpStr=nlist[i]
        sum+=math.factorial(tsum)/2
        
print(int(sum))


### FIXED CODE ###

import math
N = int(input())

nlist=[""]*N
d={}
for i in range(N):
    t=str(input())
    t=''.join(sorted(t))
    if d.get(t,None)==None:
        d[t]=1
    else:
        d[t]+=1 
ans=0

#print(d.keys(),d.values())
for i in d.values():
    ans += i*(i-1)/2
print(int(ans))
w,h,n=MI()
rect=[0,w,0,h]
for i in range(n):
    a,b,c=MI()
    if c<=2:
        rect[c-1]=a
    else:
        rect[c-1]=b
#print(rect)
print(max(0,rect[3]-rect[2])*max(0,rect[1]-rect[0]))

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

w,h,n=MI()
rect=[0,w,0,h]
for i in range(n):
    a,b,c=MI()
    if c==1:
        rect[0]=max(a,rect[0])
    elif c==2:
        rect[1]=min(a,rect[1])
    elif c==3:
        rect[2]=max(b,rect[2])
    else:
        rect[3]=min(b,rect[3])
print(max(0,rect[3]-rect[2])*max(0,rect[1]-rect[0]))
import heapq
import copy
  
N = int(input())
ab = [[] * (N + 1) for i in range(N + 1)]
E = [0] * (N - 1)
for i in range(N - 1):
  a, b = map(int, input().split())
  ab[a].append(b)
  ab[b].append(a)
  E[i] = [a, b]
#print(ab)

#xとyを根とする部分木の頂点の数を求める
size = [1] * (N + 1)
def dfs_depandsize(tree,v,p):
    for x in tree[v]:
        if x == p:
            continue
        size[v] += dfs_depandsize(tree,x,v)
    return size[v]
dfs_depandsize(ab, 1, -1)
print(size)

#print(dfs(2, 3))
#(1 - (1/ 2) ** c) * (1 - (1/ 2) ** (N - c)) + 1
#上式を辺ごとに全て足し合わせたものがSの頂点の個数の期待値
#そこからN / 2を引けば求める期待値
#逆元を考える必要があるため、分母と分子に分けて考える

t = 2 ** N#分母
s = 0#分子
for i in range(N - 1):
  c = min(size[E[i][0]], size[E[i][1]])
  #print(c)
  s += (2 ** N + 1 - 2 ** (N - c) - 2 ** c) 
  
#辺の個数を数えたので、それに2 ** Nを足して、頂点の個数にする
#-1は空グラフをケア
s += 2 ** N - 1  
s -= N * 2 ** (N - 1)

#逆元計算
p = 10 ** 9 + 7
t_inv = pow(t, p-2, p)
ans = t_inv * s % p
print(ans)
  
    
    
    
    
    
    
  
  

### FIXED CODE ###

#解説方針#解法1
#https://qiita.com/ZhangChaoran/items/71fab0e4b8647a93d3a0
from collections import deque
from heapq import heappop, heappush
#標準入力
N = int(input())
MOD = 10 ** 9 + 7
L = [[] for i in range(N + 1)] #dfs用
for i in range(N - 1):
  a, b = map(int, input().split())
  L[a].append(b)
  L[b].append(a)

#木の探索
parent = [0] * (N + 1)
order = []
stack = [1]
while stack:
    x = stack.pop()
    order.append(x)  # 行きがけ順探索リスト
    for y in L[x]:
        if y == parent[x]:
            continue
        parent[y] = x  # 親ノードを記録
        stack.append(y)
#print(order, parent)

half = pow(2, MOD - 2, MOD)
power_inv = [1] * (N + 1)#2 ** N の逆元の集合
size = [1] * (N + 1)
for i, v in enumerate(order[::-1], 1):#iが1から
    p = parent[v]
    x = size[v]  # vの子孫ノード数（自分も含む）をとる
    size[p] += x  # 親にノード数を加算
    power_inv[i] = power_inv[i - 1] * half % MOD  # [1, 1/2, 1/4, ...]
#print(size)
# 辺iがSに含まれるための必要十分条件による辺の個数の期待値 
# (1 - (1/2) ** i)(1 - (1/2) ** (N - i))を展開して計算
# 根である1の頂点以外は、ある頂点とその親を結ぶ辺を考えた際
# i と N - i個の頂点に別れるので,size[2:]でOK
ans = sum((1 - power_inv[i] - power_inv[N - i] + power_inv[N]) %
          MOD for i in size[2:])  
#ans = sum((1 - (1/2) ** i- (1/2) ** (N - i) + (1/2) ** N) for i in size[2:])  
#print(ans)
ans += 1  # 木の頂点の個数は辺の個数+1
# -「すべての辺が含まれない、つまり空グラフの場合の誤加算」-N/2
ans -= power_inv[N] + N * power_inv[1]  
#ans -= N * power_inv[1]  
ans %= MOD

print(ans)
x, y = map(int, input().split())

print(max(x, y) + max(max(x, y)-1, min(x,y))

### FIXED CODE ###

x, y = map(int, input().split())

print(max(x, y) + max(max(x, y)-1, min(x,y)))
def main():
	
	from collections import deque
	n,m = map(int,input().split())
	graph = [[] for _ in range(n+1)]
	
	for i in range(m):
		a,b = map(int, input().split())
		graph[a].append(b)
		graph[b].append(a)

	dist = [-1] * (n+1)
	dist[0] = 0
	dist[1] = 0

	d = deque()
	d.append(1)

	while d:
		v = d.popleft()
		for i in graph[v]:
			if dist[i] != -1:
				continue
			dist[i] = dist[v] + 1
			d.append(i)

	if graph[1] == '':
		print("No")
	else:
		for i in range(2,n+1):
			print(dist(i))
	


if __name__ == '__main__':
	main()

### FIXED CODE ###

def main():
	
	from collections import deque
	n,m = map(int, input().split())
	graph = [[] for _ in range(n+1)]

	for i in range(m):
		a, b = map(int, input().split())
		graph[a].append(b)
		graph[b].append(a)
	d = deque()
	dist = [-1] * (n+1)
	dist[0] = 0
	dist[1] = 0
	d.append(1)

	while d:
		v = d.popleft()
		for i in graph[v]:
			if dist[i] != -1:
				continue
			dist[i] = dist[v] + 1
			d.append(i)

	if graph[1] == "":
		print("No")
	else:
		print("Yes")
		for i in range(2,n+1):
			for g in graph[i]:
				if dist[g] == dist[i]-1:
					print(g)
					break


if __name__ == '__main__':
	main()
N = int(input())
# v = [list(map(int, input().split())) for _ in range(N-1)]

edge = [[] for _ in range(N)]

for i in range(N-1):
    v1, v2, w = map(int, input().split())
    edge[v1-1].append((v2-1, w))
    edge[v2-1].append((v1-1, w))

color = [-1 for _ in range(N)]
color[0] = 1

def dfs(x):
    for v, w in edge[x]:
        if color[v] == -1:
            color[v] = (w + color[x])%2
            dfs(v)



dfs(0)
print(color)

### FIXED CODE ###

import sys
input=sys.stdin.buffer.readline
sys.setrecursionlimit(10**9)
n=int(input())
edges=[[] for i in range(n)]
for i in range(n-1):
    a,s,w=map(int,input().split())
    edges[a-1].append([s-1,w]);edges[s-1].append([a-1,w])
colors=[-1]*n
colors[0]=1
def dfs(now):
    for to,cost in edges[now]:
        if colors[to]==-1:
            colors[to]=(cost+colors[now])%2
            dfs(to)

dfs(0)
print(*colors,sep="\n")
n = input()
for i in range(3):
    if n[i] == 1:
        n[i] = 9
    else:
        n[i] = 1
        
print(n)

### FIXED CODE ###

n=int(input())
print(1110-n)
h,w,k=map(int,input().split())
c=''
for i in range(h):
    c+=input()
# print(c)
# row_dot_cnt=[c.count() for _ in range(h)]
# col_dot_cnt=[0]*w
ans=0
for i in range(2**h): # 行
    i_bin=format(i,'06b')
    for j in range(2**w): # 列
        j_bin=format(j,'06b')
        cnt=0
        # print(i_bin,j_bin)
        for s in range(h):
            if i_bin[5-s]=='0':
                for t in range(w):
                    if j_bin[5-t]=='0' and c[s*h+t]=='#':
                        # print(s,t)
                        cnt+=1
        if cnt==k:
            ans+=1
            # print(f'        {cnt}   {ans}')
print(ans)


### FIXED CODE ###

h,w,k=map(int,input().split())
c=''
for i in range(h):
    c+=input()
# print(c)
# row_dot_cnt=[c.count() for _ in range(h)]
# col_dot_cnt=[0]*w
ans=0
for i in range(2**h): # 行
    i_bin=format(i,'06b')
    for j in range(2**w): # 列
        j_bin=format(j,'06b')
        cnt=0
        # print(i_bin,j_bin)
        for s in range(h):
            if i_bin[5-s]=='0':
                for t in range(w):
                    if j_bin[5-t]=='0' and c[s*w+t]=='#':
                        # print(s,t)
                        cnt+=1
        if cnt==k:
            ans+=1
            # print(f'        {cnt}   {ans}')
print(ans)