Harryxun/stf_run huggingface dataset:
import itertools


def main():
  n = int(input())
  p = [tuple(map(int, input().split())) for _ in range(n)]
  c = {}

  if n == 1:
    print(1)
    return

  raise NotImplementedError()
  for i, j in itertools.combinations(range(len(p)), 2):
    d = (p[j][0] - p[i][0], p[j][1] - p[i][1])

    if d not in c:
      c[d] = 1
    else:
      c[d] += 1

  print(len(p) - max(c.values()))


if __name__ == '__main__':
  main()


### FIXED CODE ###

import itertools


def main():
  n = int(input())
  p = [tuple(map(int, input().split())) for _ in range(n)]
  c = {}

  if n == 1:
    print(1)
    return

  for i, j in itertools.product(range(len(p)), repeat=2):
    if i == j:
      continue

    d = (p[j][0] - p[i][0], p[j][1] - p[i][1])

    if d not in c:
      c[d] = 1
    else:
      c[d] += 1

  print(len(p) - max(c.values()))


if __name__ == '__main__':
  main()
import statistics
import math

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

B = []
C = []
D = []
E = []
ureshimi = []
k = 0
l = 0

for i in range(N-3):
    BC = A[0 : i + 2]
    s = 0
    for j in range(k, i + 2):
        s += BC[j]
        if s + BC[j + 1] > sum(BC) / 2:
            k = j
            if BC[j + 1] / 2 >= sum(BC) / 2 - s:
                B = BC[0 : j + 1]
                C = BC[j + 1 : i + 2]
            else:
                B = BC[0 : j + 2]
                C = BC[j + 2 : i + 2]
            break
    DE = A[i + 2 : N + 1]
    s = sum(DE[0:l - i + 1 ])
    for j in range(l - i + 1 , N - i - 2):
        if j == N - i - 3:
            l = j + i 
            D = DE[0 : j ]
            E = DE[j  : N - i]
            break
        elif s + DE[j ] > sum(DE) / 2:
            l = j + i
            if DE[j ] / 2 >= sum(DE) / 2 - s:
                D = DE[0 : j ]
                E = DE[j : N - i]
            else:
                D = DE[0 : j + 1]
                E = DE[j + 1 : N - i]
            break
        s += DE[j]
    print(BC, DE, B, C, D, E)
    ureshimi.append(max(sum(B), sum(C), sum(D), sum(E)) - min(sum(B), sum(C), sum(D), sum(E)))



print(min(ureshimi))

### FIXED CODE ###

import statistics
import math

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


ureshimi = []
k = 0
l = 2

B = 0
C = 0
D = 0
E = 0

sumBC = sum(A[0:2])
sumDE = sum(A) - sumBC

for i in range(2, N - 1):
    for j in range(k, i):
        if j == i - 1:
            k = j
            C = sumBC - B
            break
        elif B + A[j] >= sumBC / 2:
            if sumBC / 2 - B  > A[j] / 2:
                B += A[j]
                k = j + 1
                C = sumBC - B
                break
            else:
                k = j
                C = sumBC - B
                break
        B += A[j]
    for j in range(l, N):
        if j == N - 1:
            l = j
            E = sumDE - D
            break
        elif D + A[j] >= sumDE / 2:
            if sumDE / 2 - D > A[j] / 2:
                D += A[j]
                l = j + 1
                E = sumDE - D
                break
            else:
                l = j
                E = sumDE - D
                break
        D += A[j]
    ureshimi.append(max([B, C, D, E]) - min([B, C, D, E]))
    sumBC += A[i]
    sumDE -= A[i]
    D -= A[i]
        

print(min(ureshimi))
from collections import Counter

n, k = [int(item) for item in input().split()]
a = [int(item) for item in input().split()]
OVER_RUN = n*k

cnt = [-1] * (2 * 10**5 + 10)
transition = [[-1] * n for _ in range(64)]
transition[0] = [0 for _ in range(1,n+1)]
for i, item in enumerate(a + a):
    if cnt[item] == -1:
        cnt[item] = i
        continue
    if cnt[item] < n:
        transition[1][cnt[item]] = i+1 - cnt[item]
    cnt[item] = i

for i in range(2,64):
    for j in range(n): 
        walk = transition[i-1][j] + transition[i-1][(transition[i-1][j] + j) % n]
        if walk > OVER_RUN:
            transition[i][j] = OVER_RUN
        else:
            transition[i][j] = walk

step = 0
step_mod = 0
while True:
    itr = 63
    while transition[itr][step_mod] + step >= OVER_RUN:
        itr -= 1
    step += transition[itr][step_mod]
    step_mod = step % n
    if itr == 0:
        break

# Simulation
target = a[step_mod:]
ans = []
cnt = Counter()
for item in target:
    if cnt[item] > 0:
        while True:
            p = ans.pop()
            if p == item:
                break
    else:
        cnt[item] += 1
        ans.append(item)
print(" ".join([str(item) for item in ans]))

### FIXED CODE ###

from collections import Counter

n, k = [int(item) for item in input().split()]
a = [int(item) for item in input().split()]
OVER_RUN = n*k

cnt = [-1] * (2 * 10**5 + 10)
transition = [[-1] * n for _ in range(58)]
transition[0] = [0 for _ in range(1,n+1)]
for i, item in enumerate(a + a):
    if cnt[item] == -1:
        cnt[item] = i
        continue
    if cnt[item] < n:
        transition[1][cnt[item]] = i+1 - cnt[item]
    cnt[item] = i

for i in range(2,58):
    for j in range(n): 
        walk = transition[i-1][j] + transition[i-1][(transition[i-1][j] + j) % n]
        if walk > OVER_RUN:
            transition[i][j] = OVER_RUN
        else:
            transition[i][j] = walk

step = 0
step_mod = 0
while True:
    itr = 57 
    while transition[itr][step_mod] + step >= OVER_RUN:
        itr -= 1
    step += transition[itr][step_mod]
    step_mod = step % n
    if itr == 0:
        break

# Simulation
target = a[step_mod:]
ans = []
cnt = Counter()
for item in target:
    if cnt[item] > 0:
        while True:
            p = ans.pop()
            cnt[p] -= 1
            if p == item or not p:
                break
    else:
        cnt[item] += 1
        ans.append(item)
print(" ".join([str(item) for item in ans]))
print((int(input())+1)*n//2)

### FIXED CODE ###

n=int(input())
cnt=0
for x in range(1,n+1):
  cnt+=x
print(cnt)
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(x)]
cand[0]=1
for i in range(2,log_x+1):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x+1]))

### FIXED CODE ###

import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(1001)]
cand[0]=1
for i in range(2,1000):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x+1]))
N = int(input())

print((10 ** N - 2 * 9 ** N + 8 ** N % (10 ** 9 + 7))

### FIXED CODE ###

print(abs(int(input())-1))
# -*- coding: utf-8 -*-

#整数値入力 1文字の入力
def input_one_number():
    return int(input())

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)

def calc_gcd_list(l):
    gcd = l[0]
    for i in range(1, N):
        gcd = gcd(gcd, l[i])
    return gcd

def calc_lcm_list(l):
    lcm = l[0]
    for i in range(1, N):
        lcm = lcm * l[i] // gcd(lcm, l[i])
    return lcm


N = input_one_number()
lstA = input_multiple_number_as_list()
lcm = calc_lcm_list(lstA)
pow = 10**9 +7
print(sum(lcm//a for a in lstA)%pow)


### FIXED CODE ###

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

#整数値入力 1文字の入力
def input_one_number():
    return int(input())

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

#整数値龍力　複数の入力(配列)
def input_multiple_number_as_list():
    return list(map(int, input().split()))

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)

def calc_gcd_list(l):
    gcd = l[0]
    for i in range(1, N):
        gcd = gcd(gcd, l[i])
    return gcd

def calc_lcm_list(l):
    lcm = 1
    for i in l:
        lcm = lcm * i // gcd(lcm, i)
    return lcm


N = input_one_number()
lstA = input_multiple_number_as_list()
lcm = calc_lcm_list(lstA)
pow = 10**9 +7
print(sum(lcm//a for a in lstA)%pow)
import math
from functools import reduce
import random
import sys


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

tmpgcd = list()
for i in range(2):
    sample = random.choices(a, k=2)
    tmpgcd.append(math.gcd(sample[0], sample[1]))

# print('hey')

tmpgcd = sorted(tmpgcd)
mini = tmpgcd[1]
# print(mini, tmpgcd)
result = 0
for i in range(mini, -1, -1):
    tmp = [x % i for x in a]
    tmp = [x for x in tmp if x != 0]
    if len(tmp) <= 1:
        result = i
        break

print(result)

### FIXED CODE ###

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)


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

l = [0]*(n+2)
r = [0]*(n+2)
m = [0]*(n+2)

for i in range(n+1):
    j = n-i
    if i == 0:  # j = n
        l[i] = 0
        r[j+1] = 0
    else:
        l[i] = gcd(l[i-1], a[i-1])
        r[j] = gcd(r[j+1], a[j])

m = [gcd(l[i], r[i+1]) for i in range(n+1)]

print(max(m))
#!/usr/bin/env python3

N = int(input())
L = input().split()
L_num = []

for i in range(len(L)):
    L_num.append(int(L[i]))

L_num.sort()

total = 0
for j in range(len(L) - 1):
    total += L_num[j]

if total <= L_num[N-1]:
    print("No")
else:
    print("Yes")




### FIXED CODE ###

#!/usr/bin/env python3

T, X = map(int,input().split())

print(T/X)
S = str(int(input()))
if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print('Bad')
else:
    print('Good')

### FIXED CODE ###

S = str(input())
if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    print('Bad')
else:
    print('Good')
a,b=map(int,input().split())
print('Yes' if a%500<=b else 'No')

### FIXED CODE ###

a=int(input())
b=int(input())
print('Yes' if a%500<=b else 'No')
n=str(input())
l=len(n)
ans=0
while(l>0):
  if l%2==1 and l==len(n):
    ans+=n-10**(l-1)+1
  elif l%2==1:
    ans+=9*10**(l-1)
  l-=1
print(ans)

### FIXED CODE ###

n=str(input())
l=len(n)
ans=0
while(l>0):
  if l%2==1 and l==len(n):
    ans+=int(n)-10**(l-1)+1
  elif l%2==1:
    ans+=9*10**(l-1)
  l-=1
print(ans)
H,W = map(int,input().split())
grid = [["#"]*(W+2) for i in range(H+2)]
for i in range(H):
    s = input()
    for j in range(W):
        grid[i+1][j+1] = s[j]
ans = 0
def dfs(i = 1,j = 1):
    if (i,j) == (H,W):
        global ans
        ans += 1
        return
    if grid[i+1][j] == ".":
        dfs(i+1,j)
    if grid[i][j+1] == ".":
        dfs(i,j+1)
dfs()
ans %= 10**9 + 7   
print(ans)

### FIXED CODE ###

H,W = map(int,input().split())
grid = [["#"]*(W+2) for i in range(H+2)]
for i in range(H):
    s = input()
    for j in range(W):
        grid[i+1][j+1] = s[j]
dp = [[0]*(W+2) for i in range(H+2)]
dp[1][1] = 1
for i in range(H):
    for j in range(W):
        if (i,j) == (0,0):
            continue
        dp[i+1][j+1] = 0
        if grid[i+1][j] == ".":
            dp[i+1][j+1] += dp[i+1][j]
        if grid[i][j+1] == ".":
            dp[i+1][j+1] += dp[i][j+1]
ans = dp[H][W] % (10**9 + 7)   
print(ans)
s=list(str(input()))

ans=[]
for i in s:
  if i=='1':
    ans.append('1')
  elif i=='0':
    ans.insert(0,'0')
  else:
    ans.pop(-1)

print(''.join(ans))

### FIXED CODE ###

s=list(str(input()))

ans=[]
for i in s:
  if i=='1':
    ans.append('1')
  elif i=='0':
    ans.append('0')
  else:
    if ans:
      ans.pop(-1)
    else:
      continue

print(''.join(ans))
from collections import Counter
n = int(input())
k = n//2
a = list(map(int,input().split()))
b = c = []
for i in range(k):
  b.append(a[2*i])
  c.append(a[2*i+1])
p = Counter(b).most_common()
q = Counter(c).most_common()
s, t = p[0], q[0]
if s[0]!=t[0]:
  ans = n - s[1]-t[1]
else:
  if p[1][1] >= q[1][1]:
    ans = n - t[1]-p[1][1]
  else:
    ans = n - s[1] - q[1][1]
print(ans)

### FIXED CODE ###

from collections import Counter
n = int(input())
k = n//2
a = list(map(int, input().split()))
p = []
q = []
for i in range(k):
    p.append(a[2*i])
    q.append(a[2*i+1])
s = Counter(p).most_common()
t = Counter(q).most_common()
u, v = len(s), len(t)
ans = 0
if s[0][0] == t[0][0]:
    if u == 1 and v == 1:
        ans = k
    elif u == 1:
        ans = k - t[1][1]
    elif v == 1:
        ans = k - s[1][1]
    else:
        comp = max(s[1][1], t[1][1])
        ans = n - s[0][1] - comp
else:
    ans = n - s[0][1] - t[0][1]
print(ans)
N, M = map(int, input().split())

lst_edge = [[] for _ in range(N)]
for i in range(M):
    x, y = map(int, input().split())
    lst_edge[x-1].append(y-1)

dp = [-1] * N

# rec(v) 頂点vを始点としたとき有効パスの長さの最大値
def rec(v):
    #print(dp, v)
    if dp[v] != -1:
        return dp[v] # 既に更新済み

    ans = 0
    lst_nv = lst_edge[v]
    for nv in lst_nv:
        ans = max(ans, rec(nv) + 1)
    dp[v] = ans # メモしながらリターン
    return dp[v]

ans_memo = 0
for i in range(N):
    ans_memo = max(ans_memo, rec(i))

print(ans_memo)

### FIXED CODE ###

import sys
# 許容する再帰処理の回数を変更
sys.setrecursionlimit(10**5+10)
# input処理を高速化する
input = sys.stdin.readline

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

lst_edge = [[] for _ in range(N)]
for i in range(M):
    x, y = map(int, input().split())
    lst_edge[x-1].append(y-1)

dp = [-1] * N

# rec(v) 頂点vを始点としたとき有効パスの長さの最大値
def rec(v):
    #print(dp, v)
    if dp[v] != -1:
        return dp[v] # 既に更新済み

    ans = 0
    lst_nv = lst_edge[v]
    for nv in lst_nv:
        ans = max(ans, rec(nv) + 1)
    dp[v] = ans # メモしながらリターン
    return dp[v]

ans_memo = 0
for i in range(N):
    ans_memo = max(ans_memo, rec(i))

print(ans_memo)
x,n=map(int,input().split())
if n==0:
    print(x)
else:
    P=list(map(int,input().split()))
    N=[i for i in range(1,101)]

    for p in P:
        N.pop(N.index(p))

    L=[]
    for a in N:
        l=abs(a-x)
        L.append(l)
    
    m=L.index(min(L))
    print(N[m])

### FIXED CODE ###

x,n=map(int,input().split())
if n==0:
    print(x)
else:
    P=list(map(int,input().split()))
    N=[i for i in range(0,102)]

    for p in P:
        N.pop(N.index(p))

    L=[]
    for a in N:
        l=abs(a-x)
        L.append(l)
    
    m=L.index(min(L))
    print(N[m])
import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump(*objects):
    print(*objects, file=sys.stderr)


N = int(input())
A = [0] + list(map(int, input().split())) + [0]
# dump(N, A)
B = cp.deepcopy(A)
C = cp.deepcopy(A)
for i in range(1, len(A)):
    # dump(i)
    B[i] = B[i-1] + abs(A[i]-A[i-1])
for i in range(len(A)-2, -1, step=-1):
    # dump(i)
    C[i] = C[i+1] + abs(A[i]-A[i+1])
# dump(A, B, C)
for i in range(1, N+1):
    # dump(i, B[i-1] + B[N+1] - B[i+1] + abs(A[i-1]-A[i+1]))
    print(B[i-1] + C[i+1] + abs(A[i-1]-A[i+1]))

exit(0)


### FIXED CODE ###

import itertools as it
import collections as col
import heapq as hq
import sys
import copy as cp
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def dump(*objects):
    print(*objects, file=sys.stderr)


N = int(input())
A = [0] + list(map(int, input().split())) + [0]
# dump(N, A)
B = cp.deepcopy(A)
C = cp.deepcopy(A)
for i in range(1, len(A)):
    # dump(i)
    B[i] = B[i-1] + abs(A[i]-A[i-1])
for i in range(len(A)-2, -1, step=-1):
    # dump(i)
    C[i] = C[i+1] + abs(A[i]-A[i+1])
# dump(A, B, C)
for i in range(1, N+1):
    # dump(i, B[i-1] + B[N+1] - B[i+1] + abs(A[i-1]-A[i+1]))
    print(B[i-1] + C[i+1] + abs(A[i-1]-A[i+1]))

exit(0)
n = int(input())
a = list(map(int,input().split()))
odd = 0
for i in range(n):
    if a[i]%2==1:
        odd+=1
if odd%2==0:
    print('YES')
else:
    pritn('NO')

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
odd = 0
for i in range(n):
    if a[i]%2==1:
        odd+=1
if odd==0 or odd%2==0:
    print('YES')
else:
    print('NO')
k, n = map(int, input().split())
home_positions = list(map(int, input().split()))


def max_distance_homes(homes):
    max_distance = 0
    for i in range(len(homes) - 1):
        distance = homes[i + 1] - homes[i]
        if max_distance < distance:
            max_distance = distance
    distance = k + homes[0] - homes[-1]
    if max_distance < distance:
        max_distance = distance
    return max_distance


print(k - max_distance_homes(home_positions))

### FIXED CODE ###

inp = input()
print('Yes' if inp[2] == inp[3] and inp[4] == inp[5] else 'No')
import copy

N = int(input())
An = list(map(int, input().split()))
for n in range(N):
    An[n] -= (n+1)

An.sort()

if (N % 2 == 0):
    cent = An[N//2 - 1] + An[N//2] // 2
else:
    cent = An[(N-1)//2]

ans = sum(An) - N * cent

print(ans)



### FIXED CODE ###

N = int(input())

if (N % 2 == 0):
    print(N)
else:
    print(2*N)
x,y=map(int,input().split())
m={1:300000,2:200000,3:100000}
ans=m[x]+m[y]
if x==y:
    ans+=400000
print(ans)

### FIXED CODE ###

x,y=map(int,input().split())
m={1:300000,2:200000,3:100000}
ans=0
if x<=3:
   ans=m[x]
if y<=3:
    ans+=m[y]
if x==y and y==1:
    ans+=400000
print(ans)
N,K,M = input().split()
N = int(N)
K = int(K)
M = int(N)
print(N)
A = input().split()
print(A)
A = [int(s) for s in A]
print(A)
AN = M * N - sum(A)
if (AN <= K) and (AN >= 0):
	print (AN)
elif AN < 0:
	print (0)
else:
	print ('-1')

### FIXED CODE ###

a = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
C = input()
if (C != 'z') and (C in a):
	i = a.index(C)
	print (a[i+1])
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,i,j;
    cin>>n;
    for(i=1;i<=9;i++)
    {
        for(j=1;j<=9;j++)
        {
            if(i*j==n)
            {
                cout<<"Yes";
            }
            
        }
    }
    cout<<"No";
    return 0;
}

### FIXED CODE ###

n=int(input())
z="No"
for i in range(1,10):
    if n%i==0 and n/i<=9:
        z="Yes"
print(z)
N=int(input())

G=[[] for i in range(N)]
res=[0]*N
def dfs(v,p,c):
  res[v]=c
  for nv,w in G[v]:
    if nv==p:
      continue
    if (w & 1):
      dfs(nv,v,1-c)
    else:
      dfs(nv,v,c)
 
for i in range(N-1):
  u,v,w=map(int,input().split())
  u-=1
  v-=1
  G[u].append((v,w))
  G[v].append((u,w))
dfs(0,-1,0)
for i in range(N):
  print(res[i])

### FIXED CODE ###

N=int(input())
G=[[] for i in range(N)]
for i in range(N-1):
    u,v,w=map(int,input().split())
    u,v=u-1,v-1
    G[u].append((v,w))
    G[v].append((u,w))
reached=[0]*N
stack=[0]
reached[0]=[1]
res=[-1]*N
res[0]=0
while(stack):
    v=stack.pop()
    for nv,w in G[v]:
        if reached[nv]:
            continue
        if w & 1:
            res[nv]=1-res[v]
        else:
            res[nv]=res[v]
        stack.append(nv)
        reached[nv]=1
for i in res:
    print(i)
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, sX, mod = mapint()

X = sX
s = set()
s.add(X)
s_loop = set()
ans = X
loop = 0
loops = []
for i in range(min(10**5*2+10, N-1)):
    X = pow(X, 2, mod)
    if X in s:
        if X in s_loop:
            break
        loop += X
        s_loop.add(X)
        loops.append(X)
    s.add(X)
    ans += X

rest = N-i-2
if rest:
    if not len(s_loop):
        s_loop.append(X)
    ans += (rest//len(s_loop))*loop
    amari = rest%len(s_loop)+1
    for i in range(amari):
        ans += loops[i]
    print(ans)
else:
    print(ans)

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, sX, mod = mapint()

X = sX
s = set()
s.add(X)
s_loop = set()
ans = X
loop = 0
loops = []
i = -1
for i in range(min(10**5*2+10, N-1)):
    X = pow(X, 2, mod)
    if X in s:
        if X in s_loop:
            loops.append(X)
            break
        loop += X
        s_loop.add(X)
        loops.append(X)
    s.add(X)
    ans += X

rest = N-i-2
if rest:
    ans += (rest//len(s_loop))*loop
    amari = rest%len(s_loop)+1
    for i in range(amari):
        ans += loops[i]
    print(ans)
else:
    print(ans)
def ans(n, x):
	if x == 0:
		return 0
	if x < 2 ** (n + 1) - 1:
		return ans(n - 1, x - 1)
	if x == 2 ** (n + 1) - 1:
		return 2 ** n
	return 2 ** n + ans(n - 1, x - 2 ** (n + 1) + 1)
N, X = map(int, input().split())
print(ans(N, X))

### FIXED CODE ###

def ans(n, x):
	if n < 0:
		return 0
	if x < 1:
		return 0
	if x < 2 ** (n + 1) - 1:
		return ans(n - 1, x - 1)
	if x == 2 ** (n + 1) - 1:
		return 2 ** n
	return 2 ** n + ans(n - 1, x - 2 ** (n + 1) + 1)
N, X = map(int, input().split())
print(ans(N, X))
A,B = map(int,input().split())
if A > B:
    print(int(A) + int(A) - 1)
elif B > A:
    print(int(B) + int(B) - 1)
else A = B:
    print(int(A) + int(A))

### FIXED CODE ###

A, B = map(int,input().split())
if A > B:
    print(int(A) + int(A) - 1)
elif B > A:
    print(int(B) + int(B) - 1)
else:
    print(int(A) + int(A))
N=input()
print(sum([int(a) for a in input().split()])-N)

### FIXED CODE ###

input()
print(sum([int(a)-1 for a in input().split()]))
N,K=[int(i) for i in input().split()]
X=[int(i) for i in input().split()]
m=10**5
for i in range(N-K+1):
    m=min(m,x[K-1+i]-x[i]+min(abs(x[K-1+i]),abs(x[i])))

print(m)

### FIXED CODE ###

N,K=[int(i) for i in input().split()]
X=[int(i) for i in input().split()]
m=10**9
for i in range(N-K+1):
    m=min(m,X[K-1+i]-X[i]+min(abs(X[K-1+i]),abs(X[i])))

print(m)
import numpy as np
 
N = int(input())
A_list = map(int, input().split())
 
# [活発度, もとの番号] のリストを降順に並べる
A_list = [[A, index] for index, A in enumerate(A_list)]
A_list.sort(reverse=True)
 
# print(A_list)
 
dp = np.zeros((N+2, N+2), int)
# print(dp)
for left in range(0, N):
    for right in range(0, N - left):
        # print(f'left, righte: { left, right }')
        # print(A_list[left + right - 1][0])
        activity = A_list[left + right][0]
        distance_from_left = A_list[left + right][1] - left
        # print(f'distance_from_left: { distance_from_left }')
        distance_from_right = (N - 1 - right) - A_list[left + right][1]
        # print(f'distance_from_right: { distance_from_right }')
        dp[left + 1][right]\
            = max(dp[left + 1][right],
                  dp[left][right] + activity * distance_from_left)
        dp[left][right + 1]\
            = max(dp[left][right + 1],
                  dp[left][right] + activity * distance_from_right)
        # print('dp---')
        # print(dp)
        # print('---dp')
# print(dp)
print(np.max(dp))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
table = []
 
for i, a in enumerate(A):
    table.append([a,i])
table.sort()
 
# DP[i][j] 左端に i 個, 右端に j 個貪欲に詰めたときのうれしさ
DP = [[0 for i in range(N+1)] for j in range(N+1)]
for i in range(1,N+1):
    # i 人目 table[i-1] の幼児を移動させる
    baby, pos = table.pop()
    
    DP[i][0] = DP[i-1][0] + baby * abs(pos-i+1)
    DP[0][i] = DP[0][i-1] + baby * abs(pos-(N-i))
    for x in range(1,i):
        y = i - x
 
        #左端に置く場合と右端に置く場合でmax
        DP[x][y] = max(DP[x-1][y] + baby * abs(pos-x+1),\
                     DP[x][y-1] + baby * abs(pos-(N-y)))
 
ans = 0
for i in range(N+1):
    ans = max(ans, DP[i][N-i])
print(ans)
n,m = map(int,input().split())
for i in range(h):
  q = input()
  print(q)
  print(q)

### FIXED CODE ###

n,m = map(int,input().split())
for i in range(n):
  q = input()
  print(q)
  print(q)
import math
N = int(input())
p = N
t = 0
for num in range(2,int(math.sqrt(N))+1):
    d = 1
    while N % num**d ==0:
        N //= num**d
        t += 1
        d += 1
if(t==0 and P != 1):
    t = 1
print(t)


### FIXED CODE ###

import math
N = int(input())
t = 0
p = N
tmp = int(math.sqrt(N)) + 1
for num in range(2,tmp):
    d = 1
    while N % num**d ==0:
        N //= num**d
        t += 1
        d += 1
    if(N % num == 0):
        while N % num == 0:
            N //= num
if (N != 1):
    t+=1
if(t==0 and p != 1):
    t = 1
print(t)
import math
n,m=map(int,input().split())
s=input()
t=input()
c=0
g=math.gcd(n,m)
x=n*m//(math.gcd(n,m))
for k in range(g):
    if s[int(k*n/g)]==t[int(k*m/g)]:
        continue
    else:
        c=-1
        break
       
if c==-1:
    print(c)            
                        
else:
    print(x)
    

### FIXED CODE ###

def gcd(a,b):
    if b:
        return gcd(b,a%b)
    else:
        return a    

n,m=map(int,input().split())
s=input()
t=input()
c=0
g=gcd(n,m)
x=n*m//(gcd(n,m))
for k in range(g):
    if s[int(k*n/g)]==t[int(k*m/g)]:
        continue
    else:
        c=-1
        break
       
if c==-1:
    print(c)            
                        
else:
    print(x)