peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

g = [1000, 0]

for i in range(1, N):
    if A[i] > A[i-1]:
        g[1] += g[0] // A[i-1] 
        g[0] %= A[i-1]
        g[0] += g[1] * A[i]
        g[1] = 0
    elif A[i] < A[i-1]:
        g[0] += g[1] * A[i-1]
        g[1] = g[0] // A[i]
        g[0] %= A[i]

print(g[0] + g[1] * A[-1])
# Judge status: Accepted
import numpy as np
import math
import collections
import bisect


X = int(input())

print(int(360 / math.gcd(360, X)))
# Judge status: Wrong Answer
#ABC132 B

n = int(input())
P = list(map(int,input().split()))
K = 0
for i in range(n-2):
    T = [P[i], P[i+1], P[i+2]]
    T.sort()
    if T[2] == P[i+1]:
        K += 1
        
print(K)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
k = int(input())

ans = 0
for x in range(1,k+1):
    for y in range(1,k+1):
        for z in range(1,k+1):
            if b**2*y > a**2*x and c**2*z > b**2*y:
                ans += 1

if ans >= 1:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N,K = map(int,input().split())
S = list(input())
ans = 0
k = 0
c = 0

for i in range(N-1):
    if S[i] != S[i+1]:
        if c < K:
            if k == 0:
                k += 1
            else:
                ans += 2
                c += 1
                k = 0
    else:
        ans += 1

if k == 1 and c < K:
    ans += 1

print(ans)
# Judge status: Wrong Answer
word = list(input())
#print(word) ['5', '5', '7']
a=0
b=0
for i in range(3):
    if word[i]==str(5):
        a=a+1
for i in range(3):
    if word[i]==str(7):
        b=b+1
if a==2 and b==1:
	print("YES")
else:
  	print("NO")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

num_four = 0
num_two = 0
num_odd = 0
for i in range(N):
    if A[i] % 4 == 0:
        num_four += 1
    elif A[i] % 2 == 0:
        num_two += 1
    else:
        num_odd += 1

# print(num_four, num_two, num_odd)

if num_two != 0:
    ans = 'Yes' if num_four + 1 >= num_odd + 1 else 'No'
else:
    ans = 'Yes' if num_four + 1 >= num_odd else 'No'
print(ans)
# Judge status: Accepted
n,a,b = map(int , input().split())
s = input()
Judgment = 0
rank = 0
overseas=0
for num in range(n):
  if s[num] == 'a' and rank < a+b:
    print('Yes')
    rank = rank+1
  elif s[num] == 'b' and rank < a+b and overseas < b:
    print('Yes')
    rank = rank +1
    overseas = overseas + 1
  else:
    print('No')
# Judge status: Accepted
N = int(input())
doc = [int(x) for x in input().split() if int(x) % 2 == 0]
for i in doc:
  if i % 3 != 0 and i % 5 != 0:
    print('DENIED')
    exit()
print('APPROVED')
# Judge status: Accepted
import sys
import heapq

input = sys.stdin.readline
n,m = map(int, input().split())
A = list(map(int,input().split()))
d = [list(map(int,input().split())) for _ in range(m)]

d.sort(key=lambda x:-x[1])
total = sum(A)
heapq.heapify(A)

for i in range(m):
    for j in range(d[i][0]):
        tmp = heapq.heappushpop(A, d[i][1])
        if tmp < d[i][1]:
                total += (d[i][1] - tmp)
        else:
            break

print(total)
# Judge status: Accepted
x,y=input().split()
a={"1","3","5","7","8","10","12"}
b={"4","6","9","11"}
print("Yes" if {x,y}<=a or {x,y}<=b else "No")
# Judge status: Accepted
#python3
from itertools import cycle
def main():
   s = input() 
   if s == 'Sunny':
        print('Cloudy')
   elif s == 'Cloudy':
        print('Rainy')
   else:
        print('Sunny')

main()
# Judge status: Accepted
[D,N] = list(map(int,input().split()))
if N!=100:
    print(100**D*N)
else:
    print(100**D*(N+1))
# Judge status: Wrong Answer
N,M=map(int,input().split())
wa=0
ac=0
already=[]
for i in range(M):
    P,S=input().split()
    if S=="WA" and already.count(P)==0:
        wa=wa+1
    if S=="AC" and already.count(P)==0:
        ac=ac+1
        already.append(P)
    else:
        pass
if ac==0:
    print(0,0)
else:
    print(ac,wa)
# Judge status: Accepted
A, B = map(int,input().split())
if A >= 13: print(B)
elif A >= 6: print(B // 2)
else: print(0)
# Judge status: Wrong Answer
n, a, b = map(int, input().split())

i = 1
count = 0
for i in range(n+1):
    if(a <= i and b >= i):
        count += 1

print(count)
# Judge status: Accepted
N ,A ,B = map(int,input().split())

r = N % (A + B)
Q = N // (A + B)

ans = (Q * A + min(r,A))
print(ans)
# Judge status: Accepted
N = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

margin = 0 # b側で加算可能な回数
for a,b in zip(a_list, b_list):
    if a == b:
        continue
    elif a < b:
        margin -= (b-a)//2
    else:
        margin += a-b

if margin <= 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
x, y = map(int, input().split())
g = [set([1, 3, 5, 7, 8, 10, 12]), set([4, 6, 9, 11]), set([2])]
for s in g:
    if x in s and y in s:
        print('Yes')
        break
else:
    print('No')
# Judge status: Wrong Answer
A, B, C, D = list(map(int, input().split()))
while True:
    if A - D <= 0:
        print('No')
        break
    else:
        print('Yes')
        break
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
a.sort(reverse=True)
ans = 0
for i in range(n):
  ans += a[i*2+1]
print(ans)
# Judge status: Wrong Answer
N = int(input())
X = list(map(int, input().split()))
X = sorted(X)
# print('X', X)
# print('median candidate', X[N // 2 - 1], X[N // 2])
for i in X:
    if i <= X[N // 2 - 1]:
        print(X[N // 2])
    else:
        print(X[N // 2 - 1])
# Judge status: Accepted
x = input()
cs = 0
ct = 0
prev = ""
n = len(x)
cnt = 0
for i in range(n):
    if x[i] =="S":
        cs+=1
    elif x[i] =="T":
        if cs>0:
            ct+=1
    else:
        cs = 0
        ct = 0
    if cs>0 and ct>0:
        cnt+=1
        cs-=1
        ct-=1
print(n-cnt*2)
# Judge status: Wrong Answer
n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
mod = 10**9 + 7

def check(arr):
    for i in range(m-1):
      if a[i] + 1 == a[i+1]: return 0
    dp = [0 for _ in range(n+1)]
    dp[0] = 0
    dp[1] = 1
    for i in range(2, n+1):
        if i in a: continue
        dp[i] += dp[i-1] + dp[i-2]
        dp[i] %= mod
    #print(dp)
    return dp[n]

print(check(n))
# Judge status: Accepted
n,k = map(int,input().split())
p = list(map(int,input().split()))

p.sort()
ans = 0

for i in range(k):
    ans += p[i]

print(ans)
# Judge status: Accepted
# A,B,A+Bのいずれかが3の倍数になるか

A, B = map(int, input().split())

if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 ==0:
    print('Possible')
else:
    print('Impossible')
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

b = [0] * (N + 1)

for i in range(N, 0, -1):
    if sum(b[::i]) % 2 != a[i-1]:
        b[i] = 1

s = sum(b)
print(sum(b))
if s != 0:
    for i in range(N+1):
        if b[i] == 1:
            print(i, end=" ")
# Judge status: Wrong Answer
o=input()
e=input()
print("".join([o[i]+e[i] for i in range(len(o)-1)]),end="")
print(o[-1],end="")
if len(o) != len(e):
  print(e[-1])
# Judge status: Accepted
from itertools import permutations
from math import sqrt

def dist(A,B):
    p=A[0]-B[0]
    q=A[1]-B[1]
    return sqrt(p*p+q*q)

def f(n):
    if n==0:
        return 1
    return f(n-1)*n

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

T=permutations(P,N)

D=0
for H in T:
    S=0
    for k in range(N-1):
        S+=dist(H[k],H[k+1])
    D+=S
print(D/f(N))
# Judge status: Accepted
s = list(input())
n = len(s)

ans = []
for i in range(n):
    if s[i] == '0':
        ans.append('0')
    if s[i] == '1':
        ans.append('1')
    if s[i] == 'B':
        if ans:
            ans.pop()

print("".join(ans))
# Judge status: Accepted
a, b, c, d = map(int, input().split())


ans = 0

if b <= c or d <= a:
    ans = 0
else:
    ans = min(d, b) - max(a, c)

print(ans)
# Judge status: Accepted
# coding: utf-8
S=list(input())

if len(S)==len(set(S)):
    print("yes")
else:
    print("no")
# Judge status: Wrong Answer

x=int(input())

for a in range(x,0,-1):
    b=(a**5-x)
    if b<0:
        b=-(round(abs(b)**(1/5),7))
        if b.is_integer():
            b=int(b)
            print("{} {}".format(a,b))
            exit()

    else:
        b=(round(abs(b)**(1/5),7))
        if b.is_integer():
            b=int(b)
            print("{} {}".format(a,b))
            exit()
# Judge status: Accepted
n = int(input())
a = list(map(int,input().strip().split()))

import collections

c = sorted(collections.Counter(a).items(), reverse=True)

leng_1 = 0
for leng,count in c:
  if count >=4:
    if leng_1 != 0:
      print(leng_1 * leng)
      exit()
    else:
      print(leng**2)
      exit()
  elif count >=2:
    if leng_1 != 0:
      print(leng_1*leng)
      exit()
    else:
      leng_1 = leng
print(0)
# Judge status: Accepted
N = input()
if (N[0] == N[1] == N[2]) or (N[1] == N[2] == N[3]):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import numpy as np

def dfs(n,a,s):
  if n==0:
    return -1 if (a >= X).all()==False else s
  #print(a+A[n-1])
  x=dfs(n-1,a+A[n-1],s+C[n-1])
  y=dfs(n-1,a,s)
  return y if x==-1 else x if y==-1 else min(x,y)

N,M,X=map(int,input().split())
C=[]
A=[]
for i in range(N):
  c,*tmp=map(int,input().split())
  A.append(np.array(tmp))
  C.append(c)
#print(A)
print(dfs(N,np.array([0]*M),0))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
ju = 0
for i in range(n): 
  if(a[i]%4==0):
      ju +=1
  elif(a[i]%2!=0):
    ju -= 1
if(n%2==1):
  ju += 1
if(ju>=0):
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
x=int(input())
ans=(x//11)*2
x%=11
if 0<x<=6: ans+=1
else: ans+=2
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = []
b = []
for _ in range(n):
    atmp, btmp = map(int, input().split())
    a.append(atmp)
    b.append(btmp)
a.sort()
b.sort()
if n % 2 == 1:
    pos = n // 2
    print(b[pos] - a[pos] + 1)
else:
    pos = n // 2 - 1
    a1 = a[pos]
    a2 = a[pos + 1]
    b1 = b[pos]
    b2 = b[pos + 1]
    medmin = b1 + a1
    medmax = b2 + a2
    print(medmax - medmin + 1)
# Judge status: Wrong Answer
from math import floor
 
a, b, n = [int(x) for x in input().split()]
 
for x in range(0, n+1):
    value = floor(a*x/b) - a * floor(x/b)

print(value)
# Judge status: Accepted
S=input()

ans='NO'
# print(S.find('k'))
if S.find('k')==0 and S.rfind('eyence')==len(S)-6:
    ans='YES'
elif S.find('ke')==0 and S.rfind('yence')==len(S)-5:
    ans='YES'
elif S.find('key')==0 and S.rfind('ence')==len(S)-4:
    ans='YES'
elif S.find('keye')==0 and S.rfind('nce')==len(S)-3:
    ans='YES'
elif S.find('keyen')==0 and S.rfind('ce')==len(S)-2:
    ans='YES'
elif S.find('keyenc')==0 and S.rfind('e')==len(S)-1:
    ans='YES'

print(ans)
# Judge status: Accepted
from operator import itemgetter

N, M = list(map(int, input().split()))
A = [[1, a] for a in list(map(int, input().split()))]
BC = [list(map(int, input().split())) for i in range(M)]

q = sorted(A+BC, key=itemgetter(1), reverse=True)

ans = 0
i = 0

while N:
    n = min(q[i][0], N)
    ans += q[i][1] * n
    N -= n

    i += 1

print(ans)
# Judge status: Accepted
N, M = map(int, input().split())

# 偶数回裏返す->表
# 奇数回裏返す->裏

# 四隅->4回->表
# 四隅以外の外枠->6回->表
# 内側->9回->裏

# 1マスの場合
if N == 1 and M == 1:
    print(1)
    exit(0)

# 1行又は1列の場合->両端以外
if N == 1 or M == 1:
    print(max(N, M)-2)
    exit(0)

# 内側のカードの枚数を求める
print((N-2)*(M-2))
# Judge status: Accepted
a, b = map(int, input().split())

if b >= a:
    print(a)
else:
    print(a-1)
# Judge status: Accepted
from collections import Counter

n, k = map(int, input().split())
a = [int(an) for an in input().split()]
ans = 0
set_a = set(a)
num_of_types = len(set_a)
if num_of_types > k:
  cnt = Counter(a)
  ans = sum(sorted(cnt.values())[: num_of_types - k])

print(ans)
# Judge status: Accepted
a,b,c=sorted(map(int,input().split()))
print(a+c*10+b)
# Judge status: Accepted
N,K=map(int,input().split())
if N%K != 0:
    if abs(K-N%K)<N:
        print(K-N%K)
    else:
        print(N)
else:
    print(0)
# Judge status: Accepted
from bisect import (
    bisect_left,
    bisect_right
)

def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))
    a.sort()
    c.sort()

    ans = 0
    for target in b:
        ans += bisect_left(a, target) * (len(c) - bisect_right(c, target))
    print(ans)

main()
# Judge status: Accepted
N, M = map(int, input().split())
A = list(map(int, input().split()))
d = []
for i in A:
    d.append((i, 1))
for i in range(M):
    B, C = map(int, input().split())
    d.append((C, B))
d.sort()
d.reverse()
i = 0
ans = 0
for j, k in d:
    if i + k >= N:
        ans += j * (N - i)
        break
    i += k
    ans += j * k
print(ans)
# Judge status: Wrong Answer
S = input()
print("Yes" if any([all(["N" in S, "S" in S]), all(["W" in S, "E" in S])]) else "No")
# Judge status: Accepted
N = int(input())
a = []
for i in range(1, N + 1):
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        a.append(i)
print(sum(a))
# Judge status: Accepted
x, y = map(int, input().split())
i = 0
while x * (2 ** i) <= y:
    i += 1
print(i)
# Judge status: Wrong Answer
def main():
	N = int(input())

	for a in range(0, 101, 1):
		for b in range(-101, a+1, 1):
			val = a**5 - b**5
			if(val == N):
				print(str(a) + " " + str(b))
				return

if __name__ == "__main__":
	main()
# Judge status: Accepted
X = int(input())

div11 , mod = divmod(X,11)
div6, mod = divmod(mod,6)
num = 1 if mod > 0 else 0
ans = div11 * 2 + div6 + num

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

from collections import deque

cnt=1
q=deque([1,2,3,4,5,6,7,8,9])
while cnt<k:
    tmp=q.popleft()
    if tmp%10!=0:
        q.append(tmp*10+tmp%10-1)
    q.append(tmp*10+tmp%10)
    if tmp%10!=9:
        q.append(tmp*10+tmp%10+1)
    cnt+=1

print(q.popleft())
# Judge status: Wrong Answer
#134_D
n=int(input())
a=[0]+list(map(int,input().split()))
b=[0 for _ in range(n+1)]
for i in range(n,0,-1):
    if i<=n//2:
        b[i]=a[i]
    else:
        b[i]=sum([a[k] for k in range(2*i,n,i)])
print(sum(b))
if sum(b)>0:
    ans=[]
    for i in range(1,n+1):
        if b[i]==1:
            ans.append(i)
    print(*ans)
# Judge status: Accepted
num = str(input())
s = 0
for i in num:
    s+=int(i)
if(s%9==0):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
def main():
    a, b, c = map(int, input().split())
    k = int(input())

    abc = [a, b, c]
    ma = max(a, b, c)
    ans = 0
    for num in abc:
        if num == ma:
            for i in range(k):
                num *= 2
            ans += num
        else:
            ans += num

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
a, b, c = map(int, input().split())
if a == b + c:
    print('Yes')
elif b == a + c:
    print('Yes')
elif c == a + b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(K, N):
    if A[i] > A[i - K]:
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
n,m=list(map(int,input().split()))
d={}
for _ in range(n):
    a, b = list(map(int, input().split()))
    d[a]=b

sd=dict(sorted(d.items()))
result=0
ans=0
for i in sd:
	for j in range(sd[i]):
		ans+=i
		result+=1
		if result == m:
			print(ans)
			exit()
# Judge status: Wrong Answer
n,m=map(int,input().split())
ab=[list(map(int, input().split())) for i in range(n)]
cd=[list(map(int, input().split())) for j in range(m)]

for i in range(n):
    l=[]
    for j in range(m):
        dist=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        l.append(dist)
    print(l)
    goal = l.index(min(l))+1
    print(goal)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**6)

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

start = x+1-k
end = x+k

ans = [i for i in range(start, end)]

print(*ans)
# Judge status: Accepted
n=int(input())
sum=0
for i in range(n):
  sum+=(i+1)
print(sum)
# Judge status: Wrong Answer
a,b,c,d=input().split()
if int(a)<0 and int(c)<0:
  if int(a)*int(c)<int(b)*int(d):
    print(int(b)*int(d))
  else:
    print(int(a)*int(c))
elif int(a)<0:
  print(int(b)*int(d))
elif int(c)<0:
  print(int(b)*int(d))
elif int(a)>0 and int(c)>0:
  print(int(b)*int(d))
elif int(a)<0 and int(b)<0:
  print(int(b)*int(c))
elif int(c)<0 and int(d)<0:
  print(int(a)*int(d))
# Judge status: Accepted
n=int(input())

ans=10**5
for a in range(1,n):
  b=n-a
  aa=list(str(a))
  bb=list(str(b))
  tmp=0
  for k in (aa+bb):
    tmp+=int(k)
  ans=min(ans,tmp)
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
inf = 10**9+7
ans = 0
if abs(n-m) >= 2:
  pass
else:
  ans = 1
  for i in range(1, n+1):
    ans *= i
    ans %= inf
  for i in range(1, m+1):
    ans *= i
    ans %= inf
  if n == m:
    ans *= 2
    ans %= inf
print(ans)
# Judge status: Accepted
N,A,B = map(int,input().split())
S = input()

total = 0
b = 0
answer = []

for s in S:
  bl = False
  if s == 'a':
    if total < A+B:
      bl = True
      total += 1
  elif s == 'b':
    if total < A+B and b < B:
      bl = True
      total += 1
      b += 1
  answer.append('Yes' if bl else 'No')
  
print(*answer, sep='\n')
# Judge status: Wrong Answer
a,b,c,k = map(int,input().split())
if a+b>=k:
  print(a)
else:
  print(a-(k-a))
# Judge status: Accepted
taka, aoki, num = map(int, input().split())
if taka <= num:
  num -= taka
  taka = 0
  if aoki <= num:
    aoki = 0
    print(taka, aoki)
  elif aoki > num:
    aoki -= num
    print(taka, aoki)  
if taka > num:
  taka -= num
  print(taka, aoki)
# Judge status: Wrong Answer
n, m = map(int, input().split())
scList = [list(map(int, input().split())) for _ in range(m)]
num = ["-" for _ in range(n)]
flag = True
for i in range(m):
    s = scList[i][0] - 1
    c = scList[i][1]
    if (num[s] != "-" and num[s] != str(c)) or (s == 0 and c == 0):
        flag = False
        break
    num[s] = str(c)
if not flag:
    print("-1")
else:
    ans = "".join(num)
    ans = ans.replace("-", "0")
    if ans[0] == "0":
        ans = "1" + ans[1:]
    print(ans)
# Judge status: Accepted
def chmin(a, b):
  if a > b:
    return b
  else:
    return a
N, K = map(int, input().split())
h = list(map(int, input().split()))
dp = [float("inf")]*N
dp[0] = 0
for i in range(N - 1): #ジャンプ地点
	for j in range(1, min(K + 1, N - i)): #ジャンプ距離
		dp[i+j] = chmin(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
print(dp[N - 1])
# Judge status: Wrong Answer
x, y, z = map(int, input().split())
n = z
cnt = 0
while n <= x:
  n += y + z
  cnt += 1
print(cnt)
# Judge status: Accepted
n = int(input())
a = 25
b = 15

cnt = 0
for i in range(a + 1):
  for j in range(b + 1):
    if 4*i + 7*j == n:
      cnt += 1
if cnt >= 1:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N=int(input())
S=str(input())
x,ans=0,0
for i in range(N):
    if S[i]=="I":
        x+=1
    elif S[i]=="D":
        x-=1
    if ans<x:
        ans=x
print(ans)
# Judge status: Wrong Answer
from bisect import bisect_right

N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ans = 0
for c in C:
    i = bisect_right(B, c)
    for b in B[:i]:
        j = bisect_right(A, b)
        ans += j
print(ans)
# Judge status: Accepted
n = int(input())
b = []
for i in range(n):
    x,y = map(int,input().split())
    b.append([y,x])
b.sort()
ans = 'Yes'
t = 0
for i in range(n):
    t += b[i][1]
    if t>b[i][0]:
        ans='No'
print(ans)
# Judge status: Accepted
a, b= map(int, input().split())
if 1 <= a <= 9 and 1 <= b <= 9:
  print(a * b)
else:
  print(-1)
# Judge status: Accepted
x, y = map(int, input().split())

ans = 0

if x >= 0 and y >= 0:
    if y >= x:
        ans = y - x
    else:
        ans = abs(y-x) + 2
elif x >= 0 and y < 0:
    ans = abs(abs(y)-abs(x)) + 1

elif x < 0 and y >= 0:
    ans = abs(abs(y)-abs(x)) + 1

else:
    if y >= x:
        ans = abs(y-x)
    else:
        ans = abs(y-x) + 2

if y == 0:
    ans -= 1

print(ans)
# Judge status: Accepted
a,b,c=map(int,input().split())
aa=max(0,a-c)
print(aa,max(0,a+b-aa-c))
# Judge status: Wrong Answer
h, n = map(int, input().split())
an = list(map(int, input().split()))

if sum(an) > h:
  print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
[n, r] = map(int, input().rstrip().split(' '))

if n > 10:
    print(r)
else:
    print(r - 100 * (10 - n))
# Judge status: Wrong Answer
N,K=map(int,input().split())
t=[0]*N
for i in range(N): t[i]=int(input())
t.sort(key=int)
ans=10**5
for i in range(N-K+1): ans=min(ans,t[i+K-1]-t[i])
print(ans)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int,input().split()))
count = 0
for i in range(n-1):
    if p[i] == i+1:
        tmp = p[i]
        p[i] = p[i+1]
        p[i+1] = tmp
        count += 1
print(count)
# Judge status: Accepted
import bisect
n=int(input())
A=sorted(list(map(int,input().split())))
B=list(map(int,input().split()))
C=sorted(list(map(int,input().split())))
lc=len(C)
ans=0
for b in B:
  ma = bisect.bisect_left(A, b)
  mc = lc-bisect.bisect_right(C, b)
  ans += ma*mc
print(ans)
# Judge status: Wrong Answer
n = int(input())
c = input()
wc = c.count('W')
rc = c.count('R')
print(min(c[:rc].count('W'), c[wc:].count('R')))
# Judge status: Wrong Answer
def resolve():
    a, b, x = map(int, input().split())
    count = culc(b, x) - culc(a, x)
    if a % 2 == 0 and b % 2 == 0:
        count += 1
    print(count)

def culc(num, x):
    if num == 0:
        return -1
    else:
        return num // x + 1

if __name__ == '__main__':
    resolve()
# Judge status: Wrong Answer
n,k = map(int,input().split())
s = list(map(int,input().split()))
if k == 1 and 0 in s:
  print(0)
  exit()
if (n-k)<=1:
  print(abs(s[0]-s[-1])+min(abs(s[0]),abs(s[-1])))
  exit()
a = 10**9
for i in range(n-k):
  m = abs(s[i]-s[i+k-1])+min(abs(s[i]),abs(s[i+k-1]))
  if m<a:
    #print(s[i],s[i+k-1])
    a=m
print(a)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
    b += [a[i],a[i]+1,a[i]-1]
import collections
c = collections.Counter(b)
print(c.most_common()[0][1])
# Judge status: Accepted
n = int(input())

ans = 0
for i in range(1, n+1):
    if (i % 3) == 0:
        continue
    if (i % 5) == 0:
        continue
    ans += i
print(ans)
# Judge status: Accepted
import math
n,d=map(int,input().split())
cnt=0
for i in range(n):
  x,y = map(int,input().split())
  sq = (x**2) + (y**2)
  res = math.sqrt(sq)
  if res<=d:
    cnt=cnt+1
print(cnt)
# Judge status: Accepted
A,B,C,K = map(int,input().split())

limit = 10 ** 18

if K % 2 == 0:
  ans = (A - B)
else:
  ans = (B - A)
  
if ans < limit:
  print(ans)
else:
  print("Unfair")
# Judge status: Accepted
N = int(input())
S = input()
l, r = 0, 0
for s in S:
    if s == '(':
        r += 1
    else:
        if r > 0:
            r -= 1
        else:
            l += 1
print('(' * l + S + ')' * r)
# Judge status: Wrong Answer
linha = input()
menor = 101
segundoMenor = 101
for x in linha.split():
    if int(x) < menor:
        menor = int(x)
for x in linha.split():
    if int(x) == menor:
        pass
    elif int(x) < segundoMenor:
        segundoMenor = int(x)
print(menor + segundoMenor)
# Judge status: Accepted
a = map(int,input().split())

list_a = list(a)
list_a.sort()
if list_a == [5, 5, 7]:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n = int(input())
a = [int(input()) for _ in range(n)]
if 2 not in a:
    print(-1)
    quit()
else:
    t = a.index(2)
    s = 1
    count = 0
    while count <= 10**6:
        s = a[s-1]
        count += 1
        if s == 2:
            print(count)
            quit()
print(-1)
# Judge status: Accepted
N,A,B=map(int,input().split())
S=input()

passer=0
passb=0
for p in S:
    if p =="c":
        print("No")
    if p=="a":
        if passer < A+B:
            print("Yes")
            passer+=1
        else:
            print("No")
    if p=="b":
        if passer <A+B and passb <B:
            print("Yes")
            passer+=1
            passb+=1
        else:
            print("No")