peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
X, N = map(int, input().split())
P = list(map(int, input().split()))
differ=[]

if N == 0:
    print(X)
else:
    for i in range(0,102):
        if i not in P:
            differ.append(abs(X - i))
        else:
            differ.append(1000)
    ans = differ.index(min(differ))
    print(differ)
    print(ans)
# Judge status: Accepted
S = input()

if S == "ABC":
  print("ARC")
else:
  print("ABC")
# Judge status: Wrong Answer
N = int(input())
list_A=[]
list_B=[]
list_AB=[]
for i in range(N):
	A, B = map(int,input().split())
	list_A.append(A)
	list_B.append(B)
	list_AB.append([list_A[i],list_B[i]])
sort_AB =sorted(list_AB, key=lambda x: x[1])
u=[]
def _judge_(k):
	for j in range(N-1):
		if k[j][0]>k[j][1]:
			return print("No")
		else:
			u.append(k[j][0])
			if sum(u)+k[j+1][0]>k[j+1][1]:
				return print("No")
	return print("Yes")

_judge_(sort_AB)
# Judge status: Wrong Answer
N, A, B = map(int, input().split())
ans = 0

for i in range(1,N+1):
    if B >= i >= A:
        ans += i
    elif i < B:
        break

print(ans)
# Judge status: Accepted
n = int(input())

if n %2 == 1:
    print(0)
else:
    res = 0
    p = 10
    for _ in range(30):
        res += n//p
        p = p*5
        #print(p)

    print(res)
# Judge status: Wrong Answer
import numpy as np

N=int(input())

A=[int(N) for N in input().split()]
ans=np.prod(A)


if ans > 10**18:
	print(-1)
	
else:
	print(ans)
# Judge status: Wrong Answer
s = input()

k = s[::-1]

print(k)

for i in range(len(s)):
    if s[i]=='Z':
        z_num = i 
    if k[i]=='A':
        a_num = i

ans = a_num + z_num + 2 - len(s)

print(ans)
# Judge status: Accepted
K = int(input())

def dfs(val, digit, all):

    all.append(val)

    if digit == 10:
        return

    for i in range(-1, 2):
        add = val % 10 + i
        if 0 <= add <= 9:
            dfs(val*10 + add, digit+1, all)

all = []

for i in range(1, 10):
    dfs(i, 1, all)

all.sort()

print(all[K-1])
# Judge status: Accepted
f=lambda:map(int,input().split());n,m=f();c=0
for a,b in sorted(list(f())for _ in range(n)):t=min(b,m);c+=a*t;m-=t
print(c)
# Judge status: Wrong Answer
n = int(input())
AS = list(map(int,input().split()))
AS.sort()
BS = list(map(int,input().split()))
BS.sort()
CS = list(map(int,input().split()))
CS.sort()
import bisect
AB  = [0 for _ in range(n)]
BC  = [0 for _ in range(n)]
a = 0
for b in range(n):
  AB[b] = bisect.bisect_left(AS,BS[b])
  
for b in range(n):
  BC[b] = n-bisect.bisect_left(CS,BS[b])

ans = 0
for i in range(n):
  ans += AB[b] * BC[b]
print(ans)
# Judge status: Wrong Answer
s = input()
n = int(s)

cards = []

v = input().split()
for i in range(n):
    cards.append(v[i])

v = sorted(v,reverse=True)

alice_array = []
bob_array = []

for i in range(len(v)):
    if i % 2 == 0:
        alice_array.append(v[i])
    else:
        bob_array.append(v[i])

sum_alice = 0
sum_bob = 0
for i in range(len(alice_array)):
    sum_alice += int(alice_array[i])

for i in range(len(bob_array)):
    sum_bob += int(bob_array[i])

answer = sum_alice - sum_bob
print(answer)
# Judge status: Accepted
def read_ints():
    return map(int, input().split(' '))


n, x, t = read_ints()
print(((n - 1) // x + 1) * t)
# Judge status: Wrong Answer
n, k = map(int, input().split())
a = [0] * n
b = [0] * n
arr = []
for i in range(n):
    a[i], b[i] = map(int, input().split())
# print(a, b)
for i in range(n):
    for _ in range(b[i]):
        arr.append(a[i])
answer = arr[k-1]
# print(arr)
print(answer)
# Judge status: Accepted
from collections import defaultdict
 
n = int(input())
a = list(map(int, input().split()))
q = int(input())
 
total = sum(a)
 
numbers = defaultdict(int)
 
for item in a:
    numbers[item] += 1
    
for i in range(q):
    b, c = map(int, input().split())
    taken = numbers[b]
    total -= numbers[b]*b
    numbers[c] += numbers[b]
    numbers[b] = 0
    total += taken*c
    print(total)
# Judge status: Accepted
import sys
n = int(input())
for i in range(26):
  if (n - 4 * i ) % 7 or n - 4 * i < 0:
    continue
  else:
    print("Yes")
    sys.exit()
print("No")
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from fractions import gcd

n, x = map(int, readline().split())
xx = list(map(int, readline().split()))
gcd_ans = abs(x - xx[0])
for i in range(1, n):
    gcd_ans = gcd(gcd_ans, abs(x - xx[i]))
print(gcd_ans)
# Judge status: Accepted
class A:

    def solve(self):
        [a, b, c] = sorted([int(x) for x in input().split(" ")])
        if a == 5 and b == 5 and c == 7:
            print("YES")
        else:
            print("NO")

A().solve()
# Judge status: Accepted
#!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
if n == 0:
    print([-1, 1][a[0] == 1])
    exit()
if a[0] > 0:
    print(-1)
    exit()
s = sum(a)
ans = 1
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n):
    dp[i + 1] = min(s, 2 * dp[i])
    ans += dp[i + 1]
    dp[i + 1] -= a[i + 1]
    s -= a[i + 1]
    if dp[i] <= 0:
        print(-1)
        exit()
if dp[-1] < 0:
    print(-1)
    exit()
print(ans)
# Judge status: Wrong Answer
from sys import stdin

n, k, s = map(int, stdin.readline().rstrip().split())
flag = 0
ans = 1
for i in range(n):
    print(ans)
    if flag < k:
        ans = s - ans
        flag += 1
    else:
        ans = s + 1
# Judge status: Accepted
import sys
from collections import Counter

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    _ = int(rl())
    c = rl().rstrip()
    
    counter = Counter(c)
    red = counter['R']
    white = counter['W']
    
    red -= c[:red].count('R')
    white -= c[-white:].count('W')
    print(min(red, white))


if __name__ == '__main__':
    solve()
# Judge status: Wrong Answer
L,R=[int(x) for x in input().strip().split()]

ans=10**9+1


for i in range(L%2019,R%2019+1):
  for j in range(L%2019,R%2019+1):
    if i<j:
      ans=min((i*j)%2019,ans)

print(ans)
# Judge status: Accepted
(N,),*sp = [s.split() for s in open(0)]

sp = [(s,-int(p),i+1) for i,(s,p) in enumerate(sp)]

for _,_,i in sorted(sp):
    print(i)
# Judge status: Wrong Answer
a,b=map(int,input().split())
s=input()
if len(s) != a+b+1:
    print('No')
else:
    if s[a] != '-':
        print('No')
    else:
        print('Yes')
# Judge status: Accepted
import numpy as np

n = int(input())
a = np.array(list(map(int, input().split()))) * (-1)
a.sort()
print(-1 * (sum(a[0::2]) - sum(a[1::2])))
# Judge status: Wrong Answer
n = input()
l = list(map(int,input().split()))
l.sort()

if len(l) == len(set(l)):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n=int(input())

def make_divisors(n):
    divisors = [0,0]
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors[0]=(i)
            divisors[1]=(n//i)
    return divisors

a=make_divisors(n)
print(a[0]+a[1]-2)
# Judge status: Wrong Answer
N = int(input())
S = list(input())

count = [(0, 0)]
for i in range(1, N + 1):
    if S[i - 1] == 'E':
        count.append((count[-1][0] + 1, count[-1][1]))
    else:
        count.append((count[-1][0], count[-1][1] + 1))

# print('count', count)
ans = 10**6
for i in range(N):
    e1, w1 = count[i]
    e2, w2 = count[-1]
    v = w1 + (e2 - e1)
    # print('v', v)
    ans = min(ans, v)
print(ans)
# Judge status: Wrong Answer
import math
N,X = map(int,input().split())
x = list(map(int,input().split()))

print(math.gcd(min(x)-X,max(x)-X))
# Judge status: Accepted
A, B, C = map(int, input().split())

if B + C > A:
    print(C-(A-B))
else:
    print(0)
# Judge status: Wrong Answer
P, Q, R = map(int, input().split())

list_m = [P+Q,R+Q,P+R,Q+R,R+P,Q+P]

min = 100
for i in range(0,len(list_m)):
    if min > int(list_m[i]):
        min = list_m[i]

print(min)
# Judge status: Accepted
def solve(string):
    n, *a = map(int, string.split())
    a = [_a % 2 == 1 or _a % 6 == 0 or _a % 10 == 0 for _a in a]
    return "APPROVED" if all(a) else "DENIED"


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
# Judge status: Wrong Answer
N=input()

if N in "7":
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a = [int(input()) for i in range(6)]

f = True

for i in range(5):
    if a[4] - a[0] > a[5]:
        f = False

if f:
    print('Yay!')
else:
    print(':(')
# Judge status: Wrong Answer
def main():
    n = int(input())
    result = True
    used = {str(input()): 0}
    for order in range(1,n):
        word = str(input())
        if word in used or list(used.keys())[order - 1][-1] != word[0]:
            result = False
            print('No')
            break
        else:
            used.setdefault(word,0)
    if result:
        print('Yes')
        
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
#coding: utf-8
#coding: utf-8
N, M = map(int, input().split())
H = list(map(int, input().split()))
d = {i:H[i-1] for i in range(1, N+1)}
for i in range(M):
    a, b = map(int, input().split())
    d[a] = max(d[a], H[b-1])
    d[b] = max(d[b], H[a-1])
ans = 0
# print(d.values())
for i in range(N):
    if d[i+1] == H[i]:
        ans += 1
print(ans)
# Judge status: Wrong Answer
s = input()
k = int(input())
s = [i for i in s]
for i,v in enumerate(s):
    if v == 'a':
        break
    if k <= 0:
        break
    if ord('z') - ord(v) + 1 <= k:
        s[i] = 'a'
        k -= ord('z') - ord(v) + 1
k %= 26
s[-1] = chr(ord(s[-1])+k)
print(''.join(s))
# Judge status: Wrong Answer
import math

def maxdigit(N):
    digit=len(str(N))
    if N==1:
        return 1
    elif N==10**(digit-1):
        return 9*(digit-1)
    else:
        if digit==1:
            return N
        else:
            return 9*(digit-1)+int(str(N)[0])-1

N=int(input())
print(maxdigit(N))
# Judge status: Wrong Answer
n, m = map(int, input().split())
a = list(map(int, input().split()))
l = []
for i in range(m):
    l.append(list(map(int, input().split())))
l.sort(reverse=True)
cnt = 0
for i in range(m):
    a += [l[i][1]] * l[i][0]
    cnt += l[i][0]
    if cnt >= n:
        break
a.sort(reverse=True)
print(sum(a[:n]))
# Judge status: Accepted
w, h, n = list(map(int, input().split()))
left = 0
right = w
lower = 0
upper = h

for i in range(n):
    x, y, a = list(map(int, input().split()))

    if a == 1:
        left = max(left, x)
    elif a == 2:
        right = min(x, right)
    elif a == 3:
        lower = max(lower, y)
    elif a == 4:
        upper = min(y, upper)

if left > right or lower > upper:
    print(0)
else:
    print((right-left)*(upper-lower))
# Judge status: Accepted
from functools import reduce
from fractions import gcd

N, M, *A = map(int, open(0).read().split())

def lcm(x, y):
    return x * y // gcd(x, y)

def sub_by_2(n):
    cnt = 0
    while n % 2 == 0:
        n //= 2
        cnt += 1
    return cnt

lcm_2 = [sub_by_2(n // 2) for n in A]
if all(lcm_2[0] == v for v in lcm_2):
    num = reduce(lcm, [v // 2 for v in A])
    res = M // num
    print(res // 2 + res % 2)
else:
    print(0)
# Judge status: Accepted
n=int(input())
s=input()
t=input()
for i in range(n):
  if s[i]==t[0]:
    if s[i:]==t[:n-i]:
      print(n+i)
      break
else:
  print(2*n)
# Judge status: Accepted
N = [int(_) for _ in input().split()][0]
if N>=1000:
    print('ABD')
else:
    print('ABC')
# Judge status: Accepted
from math import log2
import decimal

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

decimal.getcontext().prec = 28

ans = decimal.Decimal(0)

for i in range(1, N+1):
    if i < K:
        power = -(-(log2(K) - log2(i))//1)
        prob = decimal.Decimal(1/((2**power) * N))
    else:
        prob = decimal.Decimal(1/N)

    #print(prob)
    ans = decimal.Decimal(ans + prob)
    #print(ans)

print(ans)
# Judge status: Wrong Answer
N, D = map(int, input().split())
D = 2*D + 1
print(N//D)
# Judge status: Accepted
def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    ans = [None] * n
    for idx, ea in enumerate(a):
        ans[ea-1] = idx+1
    print(*ans)
    
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import sys
N = int(input())
A = list(map(int,input().split()))
k = 0
l = 0
m = 0
for i in range(N):
    if A[i] % 4 == 0:
        m += 1
    elif A[i] % 2 == 0:
        l += 1
    else:
        k += 1
if N <= 3:
    if m > 0:
        print('Yes')
        sys.exit()
    if k > 0:
        print('No')
        sys.exit()
    else:
        print('Yes')
        sys.exit()
if k <= m:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N ,K = map(int,input().split())
print(N%K)
# Judge status: Accepted
x = int(input())

ans = x//11*2
t = x%11
if t > 6: ans += 2
elif t > 0: ans += 1
print(ans)
# Judge status: Wrong Answer
import bisect
N = int(input())
al = list(map(int,input().split()))
bl = list(map(int,input().split()))
cl = list(map(int,input().split()))

cnt = 0
for b in range(N):
    al_idx = bisect.bisect(al,bl[b])
    cnt_ab = al_idx

    cl_idx = bisect.bisect(cl,bl[b])
    cnt_bc = len(cl) - cl_idx

    cnt += cnt_ab*cnt_bc
    
print(cnt)
# Judge status: Wrong Answer
# coding: utf-8


def solve(*args: str) -> str:
    n, k = map(int, args[0].split())
    A = tuple(map(int, args[1].split()))

    l, r = 0, max(A)
    while l+1 < r:
        m = (l+r)/2
        cnt = 0
        for a in A:
            cnt += -int(-a//m)-1

        if k < cnt:
            l = m
        else:
            r = m

    return str(-int(-l//1))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))
# Judge status: Accepted
def main():
    a, b, x = map(int, input().split())

    if a <= x <= a + b:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N,P = map(int, input().split())
A = list(map(int, input().split()))

even_num=0
odd_num=0

for a in A:
    if a%2==0:
        even_num+=1
    else:
        odd_num+=1

ev_case = 2**even_num


from math import factorial

res=0
for i in range(P,odd_num+1,2):                                                                   res += factorial(odd_num) / factorial(i) / factorial(odd_num - i)

print(ev_case*res)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
print(sum(a)-min(a))
# Judge status: Accepted
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    H = int(readline())

    cur = 1
    cnt = 1

    while 2 * cur <= H:
        cur *= 2
        cnt *= 2
        cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
x = int(input())

time = 1
total = 0
while True:
    total += time
    if total > x:
        total -= time
        time -= 1
        print(time + (x - total))
        break
    elif total == x:
        print(time)
        break
    time += 1
# Judge status: Accepted
n,m = map(int,input().split())

if (n==m):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
s=list(input())
t=list(input())

x=len(s)

ch1=0
ch=0

for i in range(x):
  if s[i]==t[x-1-i]:
    ch+=1

for j in range(x):
  if s[j]==t[j]:
    ch1+=1
    
print('Yes') if ch==x or ch1==x else print('No')
# Judge status: Wrong Answer
n = int(input())
for i in range(1,11):
  for j in range(1,11):
    if i*j == n:
      print("Yes")
      exit()
print("No")
# Judge status: Wrong Answer
import numpy as np
A, B, M = map(int,input().split())
a = np.array([int(num) for num in input().split()])
a_min = np.min(a)

b = np.array([int(num) for num in input().split()])
b_min = np.min(b)
total_min= a_min + b_min
for i in range(0, M):
    x, y, c = map(int,input().split())
    min_can = a[x-1] + b[y-1] -c
    if total_min > min_can:
        taotal_min = min_can
print(min_can)
# Judge status: Wrong Answer
otoshidama = list(map(int,input().split()))
flg = True
while flg:
    for i in range(otoshidama[0]+1):
        yukichi =i
        for n in range(otoshidama[0]-yukichi+1):
            higuchi =n
            noguchi = otoshidama[0]-yukichi - higuchi

            if 10000*yukichi+5000*higuchi+1000*noguchi==otoshidama[1]:
                print("{} {} {}".format(yukichi,higuchi,noguchi))
                flg = False

if flg:
    print("-1 -1 -1")
# Judge status: Accepted
a,b,c = map(int,input().split())
# b/aの商がcより大きければcを出力
if b // a > c:
    print(c)
# そうでなければb/aの商を出力
else:
    print(b // a)
# Judge status: Accepted
def main():
    l, r = map(int, input().split())
    ans = 2019
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            ans = min(ans, i * j % 2019)
            if ans == 0:
                break
        if ans == 0:
            break
    print(ans)
 
 
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N, K = map(int, input().split())
price = input().split()
price.sort()
total = 0
for i in range(K):
    total = total + int(price[i])
    
print(total)
# Judge status: Accepted
s=input()
print(2*min(s.count("0"), s.count("1")))
# Judge status: Accepted
T = str(input())
ans = ""
for i in range(len(T)):
  if T[i] == "?":
    ans = ans + "D"
  else:
    ans = ans + T[i]
print(ans)
# Judge status: Accepted
C={25:'Christmas',24:'Christmas Eve',23:'Christmas Eve Eve',22:'Christmas Eve Eve Eve'}
print(C[int(input())])
# Judge status: Accepted
import sys
input = sys.stdin.readline

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

if n == m:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
ASUM = sum(A)
B = list(map(int,input().split()))
for i,b in enumerate(B):
    if A[i] > b:
        A[i] -= b
        continue
    else:
        b -= A[i]
        A[i] = 0
        b -= A[i]
    if A[i+1] > b:
        A[i+1] -= b
    else:
        A[i+1] = 0
print(ASUM-sum(A))
# Judge status: Accepted
import copy
a = [list(map(int, input().split())) for _ in range(5)]
b = copy.deepcopy(a) #二次元配列だと単純なコピーでは参照が残る。
a2 = []
diff = 0
total = 0

for i in range(5):
    b[i][0] = (0 - (-b[i][0]//10)*10)
    a2.append(b[i][0])

total = sum(a2)

for i in range(5):
    diff1 = b[i][0] - a[i][0]
    diff = max(diff, diff1)

ans = total - diff
print(ans)
# Judge status: Wrong Answer
x = int(input())
if x >= 0:
  print("1")
else:
  print("0")
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

anker=-1
ans=0
for i in range(1,n+1):
    cuisine=a.index(i)
    if cuisine-anker==1:
        print("おいしい")
        ans += c[i-2]
    anker = cuisine
ans += sum(b)
print(ans)
# Judge status: Accepted
a = int(input())

print(a*(1+a+a*a))
# Judge status: Wrong Answer
n, m = map(int, input().split())
a = [list(input()) for _ in range(n)]
b = [list(input()) for _ in range(m)]

flag = True
for i in range(n):
    for j in range(n):
        if i + m > n and j + m > n:
            a[i : i + m][j : j + m] == b
            print('Yes')
            flag = False
            break
if flag:
	print('No')
# Judge status: Wrong Answer
abcde = []
abcde.append(int(input()))
abcde.append(int(input()))
abcde.append(int(input()))
abcde.append(int(input()))
abcde.append(int(input()))

minVal = 0
total = 0
for x in abcde:
    mod = x % 10
    if minVal == 0 and mod != 0:
        minVal = mod

    if minVal != 0 and mod != 0 and mod < minVal:
        minVal = mod

    if mod == 0:
        total += x - mod
    else:
        total += x + 10 - mod

total += minVal - 10
print(total)
# Judge status: Wrong Answer
s=int(input())
l=[]
while (s not in l):
    l.append(s)
    if s%2==0:
        s//=2
    else:
        s=3*s+1
print(l)
print(len(l)+1)
# Judge status: Wrong Answer
#abc047 a 
a,b,c=map(int,input().split())
if (a+b+c)%3==0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
S=list(input())
n=len(S)
for i in range(n):
    S[i]="x"
ans="".join(map(str,S))
print(ans)
# Judge status: Accepted
#ABC068.B
N = int(input())
for x in range(7):
    if 2**x <= N < 2**(x+1):
        print(2**x)
        break
# Judge status: Accepted
a, b = map(int, input().split())
print(a+b-24 if a+b >= 24 else a+b)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

m=max(a)
r=0
for i in range(n):
    if abs(m/2-a[i])<abs(m/2-r):
        r=a[i]

print(m,r)
# Judge status: Wrong Answer
k = int(input())
s = input()
l = len(s)
if k <= l:
  print(s)
if k > l:
  print(s[0:k]+"...")
# Judge status: Wrong Answer
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
ans=[]
for i in range(n):
	ans.append(abs(int(abs(a)-abs(t-h[i]*0.006))))
print(ans.index(min(ans))+1)
# Judge status: Accepted
import bisect
import heapq
n,m = map(int,input().split())
A = list(map(int,input().split()))
A = list(map(lambda x: x*(-1), A))


heapq.heapify(A)


for _ in range(m):
  a = -heapq.heappop(A)//2
  heapq.heappush(A,-a)
print(-sum(A))
# Judge status: Accepted
n, m, *a = map(int, open(0).read().split())
a.sort()
print(sum(sorted([a[i + 1] - a[i] for i in range(m - 1)])[:max(0, m - n)]))
# Judge status: Accepted
o=list(input())
e=list(input())
k=[]
for i in range(len(e)):
    k.append(o[i])
    k.append(e[i])
if len(o)!=len(e):print(''.join(k)+o[-1])
else:print(''.join(k))
# Judge status: Wrong Answer
X = int(input())

deposit = 100
count = 0
while deposit < X:
    deposit = deposit + (deposit * 0.01)
    int(deposit)
    count += 1
print(count)
# Judge status: Wrong Answer
n,k = map(int,input().split())
h = list(map(int,input().split()))

dp = [100000 for i in range(n)]
dp[0] = 0

for i in range(n):
    for j in range(k+1):
        if i+j<n:
            dp[i + j] = min(dp[i] + abs(h[i] - h[i + j]), dp[i + j])
print(dp[n-1])
# Judge status: Accepted
x = list(map(int,input().split()))
for i in range(len(x)):
	if x[i] == 0:
		print(i+1)
# Judge status: Accepted
N, A, B, C, D = map(int, input().split())
S = input()
if '##' in S[A-1:max(C, D)]:
    print('No')
elif C < D or ('...' in S[B-2:D+1]):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
x, y = map(int, input().split())
A = set([1, 3, 5, 7, 8, 10, 12])
B = set([4, 6, 9, 11])
C = set([2])

for S in [A, B, C]:
    if x in S and y in S:
        print('Yes')
        break
else:
    print('No')
# Judge status: Accepted
N = int(input())
B = list(map(int,input().split()))
A = [0]*N
A[0] = B[0]
A[N-1] = B[N-2]

for i in range(1,N-1):
  if B[i] >= B[i-1]:
    A[i] = B[i-1]
  else:
    A[i] = B[i]
print(sum(A))
# Judge status: Wrong Answer
N=int(input())
*A,=map(int,input().split())
d={}
for a in A:
    d[a] = d.get(a, 0)+1
s=sorted([k for k,v in d.items() if 2<=v], reverse=True)
if len(s)<2:
    print(0)
else:
    print(s[0]*s[1])
# Judge status: Wrong Answer
n=input()
t=0
for i in n:
  t+=int(i)
if t//9==0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
c = [list(map(int, input().split())) for i in range(3)]

res = 0
ans = 0

for i in range(3):
  res += sum(c[i])
  ans += c[i][i]*3
  
if res == ans:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
l1 = [0,0]
from collections import Counter
c = Counter(l)
for i in c.items():
  if i[1]>=2 :
    l1.append(i[0])
  if i[1]>=4 :
    l1.append(i[0])
l1.sort()
print(l1[-1]*l1[-2])
# Judge status: Wrong Answer
S, W = list(map(int, input().split()))
if S < W :
    print("unsafe")
if S > W :
    print("safe")
# Judge status: Accepted
#!/usr/bin/env python3
import sys
import math

def main():
    N,M = map(int, input().split())
    A = list(map(int, input().split()))
    print(max(-1, N-sum(A)))

if __name__ == '__main__':
    main()
# Judge status: Accepted
def solve():
  D = int(input())
  C = list(map(int, input().split()))
  S = [list(map(int, input().split())) for _ in range(D)]

  ans = [0]*D
  points = [0]*26
  last = [-1]*26
  for d in range(D):
    for i in range(26):
      points[i] = S[d][i]+C[i]*(d-last[i])*(d-last[i]+1)//2
    maxi = 0
    for i in range(26):
        if points[i]>maxi:
            con = i
            maxi = points[i]
    ans[d] = con+1
    last[con] = d
  
  return ans
print(*solve(),sep='\n')