Harryxun/stf_run huggingface dataset:
from collections import Counter
import sys
def zur(z, xx):
    c = 0
    k = 0
    for i in range(z):
        k += 1
        i += 1
        if i not in xx:
            c += 1
        if c == z:
            return k

def xxxxx(z, xx):
    if z not in xx:
        return z
    while True:
        z -= 1
        if z == 0:
            print(-1)
            sys.exit()
        if z not in xx:
            return z

i = input()
xs = [int(x) for x in input().strip().split(" ")]
xp = {}

for i, x in enumerate(xs):
    i = i+1
    if x > i:
        print(-1)
        sys.exit()
    if x not in xp:
        xp[x] = list()
    xp[x].append(i)

x = max(xs)
last = len(xs)
xo = []
xx = set()

while True:
    if x == 0:
        break
    nxx = set()
    if x in xp:
        for i in xp[x]:
            xxx = zur(x + last - i, xx)
            xo.append((xxx, x))
            nxx.add(xxx)
        last -= len(xp[x])
    xx = nxx | xx
    x -= 1

for i, x in sorted(xo, key=lambda x:x[0]):
    print(x)


### FIXED CODE ###

from collections import Counter
import sys
def zur(z, xx):
    c = 0
    k = 0
    i = 0
    while True:
        i += 1
        if i in xx:
            c += 1
        else:
            k += 1
        if k == z:
            return z + c

def xxxxx(z, xx):
    if z not in xx:
        return z
    while True:
        z -= 1
        if z == 0:
            print(-1)
            sys.exit()
        if z not in xx:
            return z

def mkxp(xs):
    xp = {}
    for i, x in enumerate(xs):
        i = i+1
        if x > i:
            print(-1)
            sys.exit()
        if x not in xp:
            xp[x] = list()
        xp[x].append(i)
    return xp

i = input()
xs = [int(x) for x in input().strip().split(" ")]
xp = mkxp(xs)


x = max(xs)
xo = []
xx = set()

while True:
    last = len(xs)
    if x == 0:
        break
    nxx = set()
    if x in xp:
        for i in xp[x]:
            xxx = zur(x + last - i, xx)
            xo.append((xxx, x))
            nxx.add(xxx)
        last -= len(xp[x])
    xx = nxx | xx
    xs = [int(i) for i in xs if i != x]
    xp = mkxp(xs)
    x -= 1

for i, x in sorted(xo, key=lambda x:x[0]):
    print(x)
N,M=map(int, input().split())
a=[int(i) for i in input().split()]
a.sort()
'''
for i in range(M):
    B,C=map(int, input().split())
    for j in range(B):
        if a[j]<C:
            a[j]=C   
    a.sort()

print(sum(a))
'''
for i in range(M):
    B,C=map(int, input().split())
    j=0
    while j<B:
        if a[j]>C:
            break
        a[j]=C
        j+=1
    a.sort()
    print(a)

print(sum(a))


### FIXED CODE ###

N,M = map(int, input().split())
a = [int(i) for i in input().split()]
c = [[int(i) for i in input().split()] for j in range(M)]

a.sort()
c2=sorted(c,key=lambda x:(-int(x[1])))

d = []
for i in range(M):
    for j in range(c2[i][0]):
        d.append(c2[i][1])
        if len(d) == N:
            break
    else:
        continue
    break

i = 0
while a[i] < d[i]:
    a[i] = d[i]
    i += 1
    if i == N or i == len(d):
        break

print(sum(a))
import math

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

print(len(d))
print(d[n-1])

ans = -1

d_count = [0] * (max(d)+1)
for i in range(n):
  d_count[d[i]] += 1

if d[0] != 0 or d_count[0] != 1:
  print(0)
  exit()

ans = 1
for i in range(1,len(d_count)-1):
  ans = ans *  math.pow(d_count[i], d_count[i+1])
  ans = ans % 998244353

ans = ans % 998244353

print(int(ans))

### FIXED CODE ###

import math

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

ans = -1

d_count = [0] * (max(d)+1)
for i in range(n):
  d_count[d[i]] += 1

if d[0] != 0 or d_count[0] != 1:
  print(0)
  exit()

ans = 1
for i in range(1,len(d_count)-1):
  for j in range(d_count[i+1]):
    ans = ans * d_count[i]
    ans = ans % 998244353

ans = ans % 998244353

print(int(ans))
n=input()
print(n//3)


### FIXED CODE ###

n=int(input())
print(n//3)
n = int(input())
x = [int(x) for x in input().split()]

ans = []

for i in range(x[0], x[-1] + 1):
    tmp = 0
    for j in x:
        tmp += (j - i) ** 2
    ans.append(tmp)

print(min(ans))

### FIXED CODE ###

n = int(input())
x = [int(x) for x in input().split()]

ans = []

for i in range(1, 101):
    tmp = 0
    for j in x:
        tmp += (j - i) ** 2
    ans.append(tmp)

print(min(ans))
# -*- coding: utf-8 -*-

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

pairCounter=0
for i in range(N):
  if A[i] < 0:
    continue
  for b in range(9):
    pair=2**b - A[i]
    if pair < 1:
      continue
    #print(pair)
    if A.count(pair) >0:
      A[i] = -1
      A[A.index(pair)] = -1
      pairCounter+=1
      break

print(pairCounter)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import collections

N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
c=collections.Counter(A)

pairCounter=0

beki=29
nibeki=2**beki

for i in range(N):
  target = A[i]
  if c[target] < 1:
    continue
  c[target]-= 1

  while (nibeki > target):
    beki-=1
    nibeki=2**beki

  pair = nibeki * 2 - target
  if pair in c.keys() and c[pair] > 0:
    c[pair]-= 1
    pairCounter+=1

print(pairCounter)
n=int(input())
a=[int(input()) for i in range(n)]
if len(a)==len(set(a)):
  print('Yes')
else:
  print('No')
  

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
A=set(a)
if len(a)==len(A):
  print('YES')
else:
  print('NO')
import math
inputs = [int(s) for s in input().split()]
a = inputs[0]
b = inputs[1]
c = inputs[2]
d = inputs[3]
count = 0
minCD = min(c, d)
maxCD = max(c, d)

x0 = b-a+1
x1 = b//minCD - (a-1)//minCD
x2 = b//maxCD - (a-1)//maxCD
lcm = minCD * maxCD // math.gcd(minCD, maxCD)
x3 = b//lcm - (a-1)//lcm
print(x0, x1, x2, x3)
if maxCD % minCD == 0:
    print(x0-x1)
else:
    print(x0-(x1+x2-x3))


### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
inputs = [int(s) for s in input().split()]
a = inputs[0]
b = inputs[1]
c = inputs[2]
d = inputs[3]
count = 0
minCD = min(c, d)
maxCD = max(c, d)

x0 = b-a+1
x1 = b//minCD - (a-1)//minCD
x2 = b//maxCD - (a-1)//maxCD
lcm = minCD * maxCD // gcd(minCD, maxCD)
x3 = b//lcm - (a-1)//lcm
if maxCD % minCD == 0:
    print(x0-x1)
else:
    print(x0-(x1+x2-x3))
N=int(input())
S=0
A=list(map(int,input().split()))
for i in range(N):S+=1/i
print(1/S)


### FIXED CODE ###

N=int(input())
S=0
A=list(map(int,input().split()))
for i in A:S+=1/i
print(1/S)
a=input().strip()
x=len(a)
c=0
for i in range(x+1):
  if a[i]!=a[n-1-i]:
    c+=1
print(c)

### FIXED CODE ###

a=input().strip()
x=len(a)
x1=x//2
c=0
for i in range(x1):
  if a[i]!=a[x-1-i]:
    c+=1
    
print(c)
N,M = map(int,input().split())
a=[]
for i in range(N):
  x = input().split()
  y = int(x[0])
  z = x[1:y+1]
  w = list(map(int,z))
  a.append(w)
b = []
for l in range(1:M+1):
  for j in range(N-1):
    if l in a[j] and l in a[j+1]:
      b.append(l)
    else:
      b = b
cnt=0
for k in range(1:M+1):
  n = b.count(k)
  if n==N-1:
    cnt +=1
print(cnt)
    
  
    
    
       
    


### FIXED CODE ###

N,M = map(int,input().split())
a=[]
for i in range(N):
  x = input().split()
  z = x[1:]
  a += list(map(int,z))
cnt=0
for k in range(1,M+1):
  n = a.count(k)
  if n==N:
    cnt +=1
  else:
    cnt = cnt
print(cnt)
# -*- coding: utf-8 -*-

# Input#
# n = int(input())
n, tar_w = map(int, input().split())

w = [-1]
v = [-1]

memo = [[-1] * (tar_w + 1) for i in range(n + 1)]

for i in range(tar_w + 1):
    memo[0][i] = 0


def dp(n, tar_w):
    if memo[n][tar_w] == -1:
        if tar_w < w[n]:
            memo[n][tar_w] = dp(n - 1, tar_w)
        else:
            memo[n][tar_w] = max(dp(n - 1, tar_w), dp(n - 1, tar_w - w[n]) + v[n])
    return memo[n][tar_w]


for i in range(n):
    w_in, v_in = list(map(int, input().split()))
    w.append(w_in)
    v.append(v_in)


ans = dp(n, tar_w)

print("{}".format(ans))


### FIXED CODE ###

# -*- coding: utf-8 -*-
INF = float("inf")
# Input#
# n = int(input())
n, tar_w = map(int, input().split())

w = [-1]
v = [-1]
value_max = 0
for i in range(n):
    w_in, v_in = list(map(int, input().split()))
    w.append(w_in)
    v.append(v_in)
    value_max += v_in


memo = [[-1] * (value_max + 1) for i in range(n + 1)]

for i in range(n + 1):
    memo[i][0] = v[i]

for i in range(value_max + 1):
    memo[0][i] = INF


def dp(i, value):
    if memo[i][value] == -1:
        if value > v[i]:
            rest = dp(i - 1, value - v[i])
            if rest == INF:
                tar = INF
            else:
                tar = rest + w[i]
            memo[i][value] = min(dp(i - 1, value), tar)
        else:
            memo[i][value] = min(dp(i - 1, value), w[i])
    return memo[i][value]


ans = -1
OK_MAX = 0
NG_MIN = value_max + 1

while OK_MAX + 1 != NG_MIN:
    i = int((OK_MAX + NG_MIN) / 2)
    ans_tmp = dp(n, i)
    if ans_tmp <= tar_w:
        OK_MAX = i
    else:
        NG_MIN = i

ans = OK_MAX

print("{}".format(ans))
import sys
from functools import lru_cache

INF = sys.maxsize

N = int(input().strip())
h = [int(x) for x in input().split()]

@lru_cache(maxsize = 100000)
def solve(i):
  if i >= N - 1:
    return 0
  return min(    
    solve(i + 1) + abs(h[i] - h[i + 1]) if i + 1 < N else INF,
    solve(i + 2) + abs(h[i] - h[i + 2]) if i + 2 < N else INF
  )
  

print(solve(0))

### FIXED CODE ###

import sys
from functools import lru_cache

sys.setrecursionlimit(10**6)

INF = sys.maxsize

N = int(input().strip())
h = [int(x) for x in input().split()]

@lru_cache()
def solve(i):
  if i >= N - 1:
    return 0
  return min(    
    solve(i + 1) + abs(h[i] - h[i + 1]) if i + 1 < N else INF,
    solve(i + 2) + abs(h[i] - h[i + 2]) if i + 2 < N else INF
  )
  
print(solve(0))
F=lambda*m:max(len(str(x))for x in m)
N=int(input())
print(min(F(x,N//x)for x in range(1,int(N**.5)+1)if N%x))

### FIXED CODE ###

F=lambda*m:max(len(str(x))for x in m)
N=int(input())
print(min(F(x,N//x)for x in range(1,int(N**.5)+1)if N%x==0))
import collections
N = int(input())
a = list(map(int, input().split()))
cand = collections.Counter(a)
cand_list = cand.most_common(len(set(a)))
ans = 0
n = min(len(a),5)
for i in range(n):
  num = cand_list[i][0]
  count = cand[num]
  if num + 1 in a:
    count += cand[num + 1]
  if num - 1 in a:
    count += cand[num - 1]
  if ans < count:
    ans = count

print(ans)

### FIXED CODE ###

import collections
N = int(input())
a = list(map(int, input().split()))
cand = collections.Counter(a)
cand_list = cand.most_common(len(set(a)))
ans = 0
for i in range(len(set(a))):
  num = cand_list[i][0]
  count = cand[num] + cand[num + 1] + cand[num - 1]
  ans = max(ans,count)

print(ans)
H, W = map(int, input().split())
t=[[j for j in input()] for h in range(H)]
h = [False for i in range(H)]
w = [False for i in range(H)]
for i,v in enumerate(t):
    h[i] = v.count('#') != 0
for i, v in enumerate(list(map(list, zip(*t)))):
    w[i] = v.count('#') != 0

for i,x in enumerate(h):
    end=''
    for j,y in enumerate(w):
        if x and y:
            print(t[i][j],end='')
            end='\n'
    print(end=end)

### FIXED CODE ###

H, W = map(int, input().split())
m = []
for i in range(H):
    r = list(input())
    if r == ['.'] * W:continue
    m.append(r)

k = []
for i in range(W):
    if [m[j][i] for j in range(len(m))] == ['.'] * len(m):
        k.append(i)

ans = []    
for r in m:
    t = []
    for i,l in enumerate(r):
        if  not i in k:
            t.append(l)
    ans.append(t)
for l in ans:
    print(''.join(l))
S = input()
if S = ' SUN ':
	print(7)
elif S = ' MON ':
	print(6)
elif S = ' TUE ':
	print(5)
elif S = ' WED ':
	print(4)
elif S = ' THU ':
	print(3)
elif S = ' FRI ':
	print(2)
elif S = ' SAT ':
	print(1)
else:
  print(-1)

### FIXED CODE ###

S = input()
if S == 'SUN':
	print(7)
elif S == 'MON':
	print(6)
elif S == 'TUE':
	print(5)
elif S == 'WED':
	print(4)
elif S == 'THU':
	print(3)
elif S == 'FRI':
	print(2)
elif S == 'SAT':
	print(1)
else:
  print(-1)
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for i in range(X, Y+1):
  if X < i <= Y and max(x) < i <= min(y):
    print("No War")
    exit(1)
print("War")
             


### FIXED CODE ###

N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for i in range(X, Y+1):
  if X < i <= Y and max(x) < i <= min(y):
    print("No War")
    exit()
print("War")
n = int(input())
lst = list(map(int,input().split()))

m = -1 #m=1:増加、m=2:減少
if n==1 or n==2:
    print(1)
else:
    cnt = 0
    num = lst[0]
    mode = 0
    for i in range(1,n):
        if mode==0:　# 待機
            if lst[i]==num:
                continue            
            elif lst[i] > num:
                mode = 1 # 増加
            elif lst[i] < num:
                mode = 2 # 減少
        elif mode == 1:
            if lst[i] < num:
                cnt += 1
                mode = 0
        elif mode == 2:
            if lst[i] > num:
                cnt += 1
                mode = 0
        num = lst[i]
    print(cnt + 1)

### FIXED CODE ###

n = int(input())
lst = list(map(int,input().split()))
if n==1 or n==2:
    print(1)
else:
    cnt = 0
    num = lst[0]
    mode = 0
    for i in range(1,n):
        if mode==0:
            if lst[i]==num:
                continue            
            elif lst[i] > num:
                mode = 1
            elif lst[i] < num:
                mode = 2
        elif mode == 1:
            if lst[i] < num:
                cnt += 1
                mode = 0
        elif mode == 2:
            if lst[i] > num:
                cnt += 1
                mode = 0
        num = lst[i]
    print(cnt + 1)
# -*- coding: utf-8 -*-
n, k = map(int, input().split())

divisor = int(10 ** 9 + 7)

max_degree = max(n - k + 1, k - 1)
fact = [1 for _ in range(max_degree + 1)]
for i in range(1, max_degree + 1):
    fact[i] = fact[i - 1] * i


def calc_combination(n, k):
    if k == 0:
        return 1
    div = fact[k] * fact[n - k]
    return fact[n] // div


for i in range(1, k + 1):
    red_patterns = calc_combination(n - k + 1, i)
    if red_patterns > divisor:
        red_patterns %= divisor
    blue_patterns = calc_combination(k - 1, i - 1)
    if blue_patterns > divisor:
        blue_patterns %= divisor

    ans = red_patterns * blue_patterns
    if ans > divisor:
        ans %= divisor

    print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
n, k = map(int, input().split())

mod = int(10 ** 9 + 7)


def comb(n, k):
    res = 1
    for i in range(k):
        res *= n - i
    for i in range(k):
        res //= k - i
    return res

for i in range(1, k + 1):
    if i > n - k + 1:
        print(0)
    else:
        print(comb(k - 1, i - 1) * comb(n - k + 1, i) % mod)
import numpy as np
n= int(input())
m = np.zeros((3,2))
sum1 = 0
for i in range(n):
    m[i] = list(map(int,input().split()))
for j in range(n-1):
    for k in range(j+1,n):
        sum1 = sum1 + ((m[j][0] - m[k][0])**2 + (m[j][1]-m[k][1])**2)**(1/2)


ans = 0
mul =1
for l in range(n):
    mul *= n-l
ans = (sum1*(2**(n-1)))/mul
print(ans)



### FIXED CODE ###

import numpy as np
n= int(input())
m = np.zeros((n,2))
sum1 = 0
count =0
for i in range(n):
    m[i] = list(map(int,input().split()))
for j in range(n):
    for k in range(j+1,n):
        sum1 = sum1 + ((m[j][0] - m[k][0])**2 + (m[j][1]-m[k][1])**2)**(1/2)
        count +=1

ans = 0

mul =1
for l in range(n):
    mul *= n-l
po =0
if n ==2:
    po = 1
elif n ==3:
    po =2
else:
    for m in range(n):
        po += m

ans = sum1*(n-1)/count
print(ans)
# coding: utf-8
line = input()
list = ["A","T","G","C"]
if line == list[0]:
    print(list[1])
elif line == list[1]:
    print(list[0])
elif line == list[2]:
    print(list[3])
else:
    print(list[4])

### FIXED CODE ###

# coding: utf-8
line = input()
list = ["A","T","G","C"]
if line == list[0]:
    print(list[1])
elif line == list[1]:
    print(list[0])
elif line == list[2]:
    print(list[3])
else:
    print(list[2])
a = int(input())

aa = list(map(int,input().split()))

for i in range(1,a):
  aa[i] += a[i-1]
  
su = 10**20

for i in range(a):
  su = min(su,abs(aa[a-1]-2*aa[i]))
print(su)

### FIXED CODE ###

a = int(input())

aa = list(map(int,input().split()))

for i in range(1,a):
  aa[i] += aa[i-1]
  
su = 10**20

for i in range(a-1):
  su = min(su,abs(aa[a-1]-2*aa[i]))
print(su)
N = int(input())
*h, = map(int, input().split())
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
	dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
	if i < N - 2:
		dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print(dp[N - 1])
B – Frog 2

### FIXED CODE ###

N = int(input())
*h, = map(int, input().split())
dp = [float("inf") for _ in range(N)]
dp[0] = 0
for i in range(N - 1):
	dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
	if i < N - 2:
		dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))
print(dp[N - 1])
import sys
sys.setrecursionlimit(10**6)

N,K=map(int,input().split())
height_list=list(map(int,input().split()))
score_list=[ 0, abs(height_list[0]-height_list[1]) ]



for i in range(2,N):
    tmp_list = []
    for k in range(K):
        tmp_list.append(abs(height_list[i]-height_list[i-k-1])+score_list[i-k-1])
    score_list.append(min(tmp_list))

print(score_list[N-1])



### FIXED CODE ###

import sys
import numpy as np
# inputを高速化する。
input = sys.stdin.readline
n, k = map(int, input().split())
h = [int(i) for i in input().split()]
# dpの配列を作る。
dp = np.zeros(n, dtype=int)
# hの配列を作る。
h = np.array(h)
for i in range(1, n):
    # start は負になることはない。
    start = max(0, i-k)
    # 行列として足し算できるのでforを使う必要がない。
    dp[i] = min(dp[start: i] + np.abs(h[i] - h[start: i]))
print(dp[n-1])
n, m = map(int,input().split())
a = [-1]
for i in range(m):
    ai = int(input())
    a.append(ai)
a.append(n+1)

def factorial(x):
  if x == 0:
    return 1
  else:
    return x * factorial(x-1)

def C(x,y):
    return factorial(x)//(factorial(x-y)*factorial(y))

def f(x):
    if x == 0:
        return 1
    else:
        ret = 0
        for i in range(x//2+1):
            ret += C(x-i,i)
        return ret

b = []
for i in range(m+1):
    b.append(a[i+1]-a[i]-2)

ans = 1
if -1 in b:
    print(0)
else:
    for j in b:
        ans *= (f(j)%1000000007)
    print(ans%1000000007)

### FIXED CODE ###

n, m = map(int,input().split())
dp = [1]*(n+1)
a = []
for i in range(m):
    ai = int(input())
    a.append(ai)

for i in a:
    dp[i] = 0

for i in range(2,n+1):
    if dp[i] != 0:
        dp[i] = (dp[i-1] + dp[i-2]) % (10**9+7)

print(dp[n])
f=lambda A,x,B,C:(A*x+B)%C
while 1:
    N,A,B,C,X=map(int,raw_input().split())
    if not N and not A and not B and not C and not X:break
    Y=list(map(int,raw_input().split()))
    T=X
    c=[[] for _ in range(N)]

    sl=0
    for i in range(10005):
        if T==Y[sl]:
            sl+=1
            if sl==N:break
        T=f(A,T,B,C)
    if i>10000:i=-1
    print(i)



### FIXED CODE ###

f=lambda A,x,B,C:(A*x+B)%C
while 1:
    N,A,B,C,X=map(int,input().split())
    if not N and not A and not B and not C and not X:break
    Y=list(map(int,input().split()))
    T=X
    c=[[] for _ in range(N)]

    sl=0
    for i in range(10005):
        if T==Y[sl]:
            sl+=1
            if sl==N:break
        T=f(A,T,B,C)
    if i>10000:i=-1
    print(i)
N, K = map(int, input().split())
R = N - K
mod = pow(10, 9) + 7

fact = [0] * N
inv = [0] * N
inv_cal = [0] * N

fact[:2] = [1, 1]
inv[1] = 1
inv_cal[:2] = [1, 1]

for i in range(2, N):
    fact[i] = fact[i-1] * i % mod
    inv[i] = mod - (mod // i) * inv[mod % i] % mod
    inv_cal[i] = inv_cal[i-1] * inv[i] % mod

def comb(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fact[n] * (inv_cal[k] * inv_cal[n-k] % mod) % mod

for k in range(1, K+1):
    if R+1 < k:
        print(0)
        continue
    print(comb(R+1, k) * comb(K-1, k-1) % mod)

### FIXED CODE ###

N, K = map(int, input().split())
R = N - K
mod = pow(10, 9) + 7

fact = [0] * 2001
inv = [0] * 2001
inv_cal = [0] * 2001

fact[:2] = [1, 1]
inv[1] = 1
inv_cal[:2] = [1, 1]

for i in range(2, 2001):
    fact[i] = fact[i-1] * i % mod
    inv[i] = mod - (mod // i) * inv[mod % i] % mod
    inv_cal[i] = inv_cal[i-1] * inv[i] % mod

def comb(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fact[n] * (inv_cal[k] * inv_cal[n-k] % mod) % mod

for k in range(1, K+1):
    if R+1 >= k:
        print(comb(R+1, k) * comb(K-1, k-1) % mod)
    else:
        print(0)
N, i = map(int, intput().split())
print(N-i+1)

### FIXED CODE ###

N, i = map(int, input().split())
print(N-i+1)
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>

#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int h[n];
  for (int i = 0; i < n; i++) {
    int cur;
    cin >> cur;
    h[i] = cur;
  }
  int minCosts[n];
  minCosts[0] = 0;
  minCosts[1] = abs(h[1]-h[0]);
  for (int i = 2; i < n; i++) {
    minCosts[i] = min(abs(h[i]-h[i-2])+minCosts[i-2], abs(h[i]-h[i-1])+minCosts[i-1]);
  }
  cout << minCosts[n-1] << "\n";
  return 0;
}

### FIXED CODE ###

def main():
    n = int(input())
    arr = [int(e) for e in input().split()]
    t = [float('inf')] * (n + 1)
    t[0] = 0
    t[1] = 0 
    t[2] = abs(arr[1] - arr[0])
    for i in range(3, n + 1):
        l1 = t[i - 1] + abs(arr[i - 2] - arr[i - 1])
        l2 = t[i - 2] + abs(arr[i - 3] - arr[i - 1])
        t[i] = min(l1, l2)
    print(t[n])
    return 0


if __name__ == '__main__':
    main()
N = int(input())
S = str(input())

if N % 2 == 0:
    T = S[:N/2]
    if S == T + T:
        print('Yes')
    else:
        print('No')
else:
    print('No')


### FIXED CODE ###

N = int(input())
S = str(input())

if N % 2 == 0:
    T = S[:int(N/2)]
    if S == T + T:
        print('Yes')
    else:
      print('No')
else:
    print('No')
n = int(input())
a = [int(i) for i in input().split()]

minv = -1
count = 0
s = 0
for i in range(n):
    if a[i] < 0:
        s += -a[i]
        if minv > -a[i] or minv == -1:
            minv = -a[i]
        count += 1
    else:
        s += a[i]
        if minv > a[i] or minv == -1:
            minv = a[i]

print(s)
if count % 2 == 1:
    s += 2*(-minv)

print(s)


### FIXED CODE ###

a,b,t = [int(i) for i in input().split()]

ans = (t + 0.5) // a * b
print(int(ans))
X = input('input the place in coding contest: ')
Y = input('input the place in robot maneuver: ')

totalAmount = 0
first = 300000
second = 200000
third = 100000
extraPrice = 400000
rejected = 0

if X == 1:
    if Y == 1:
        totalAmount = first + first + extraPrice
    elif Y == 2:
        totalAmount = first + second
    elif Y == 3:
        totalAmount = first + third
    elif Y < 1 or Y > 3:
        totalAmount = first
elif X == 2:
    if Y == 1:
        totalAmount = second + first
    elif Y == 2:
        totalAmount = second + second
    elif Y == 3:
        totalAmount = second + third
    elif Y < 1 or Y > 3:
        totalAmount = second
elif X == 3:
    if Y == 1:
        totalAmount = third + first
    elif Y == 2:
        totalAmount = third + second
    elif Y == 3:
        totalAmount = third + third
    elif Y < 1 or Y > 3:
        totalAmount = third
elif X < 1 or X > 3:
    if Y == 1:
        totalAmount = first
    elif Y == 2:
        totalAmount = second
    elif Y == 3:
        totalAmount = third
    elif Y < 1 or Y > 3:
        totalAmount = rejected
print(totalAmount)

### FIXED CODE ###

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

totalAmount = 0
first = 300000
second = 200000
third = 100000
extraPrice = 400000


if X == 1:
    totalAmount = first
    pass
elif X == 2:
    totalAmount = second
    pass
elif X == 3:
    totalAmount = third
    pass
elif X < 1 or X > 3:
    totalAmount = 0
    pass

if Y == 1:
    totalAmount = totalAmount + first
    pass
elif Y == 2:
    totalAmount = totalAmount + second
    pass
elif Y == 3:
    totalAmount = totalAmount + third
    pass
elif Y < 1 or Y > 3:
    totalAmount = totalAmount + 0
    pass

if X == 1 and Y == 1:
    totalAmount = totalAmount + extraPrice

print(totalAmount)