peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N,L = map(int,input().split())
l1 = []
l2 = []
for i in range(1,N+1):
    a = L+i-1
    l1.append(a)
    l2.append(abs(a))

for j in range(N):
    if abs(l1[j]) == min(l2):
        del l1[j]
        break
print(sum(l1))
# Judge status: Accepted
D = int(input())
c = list(map(int, input().split()))
sdi = [list(map(int, input().split())) for i in range(D)]

lastdi = [0 for i in range(26)]
ans_c = []
for d in range(D):
  
  day_s = sdi[d]
  
  sloss = [day_s[i] + c[i]*(d - lastdi[i]) for i in range(26) ]
  ans = sloss.index(max(sloss))
  ans_c.append( ans+1 )
  
  lastdi[ans] = d

for i in range(D):
  print(ans_c[i])
# Judge status: Accepted
n = int(input())
if n >= 1000:
    print('ABD')
else:
    print('ABC')
# Judge status: Wrong Answer
S = input()
print("Yes" if (S[0] == S[1] and S[2] == S[3]) or (S[0] == S[2] and S[1] == S[3]) or (S[0] == S[3] and S[1] == S[2]) else "No")
# Judge status: Accepted
x,y,a,b,c = map(int,input().split())
r = sorted([i for i in map(int,input().split())],reverse = True)
r = r[0:x]
g = sorted([i for i in map(int,input().split())],reverse = True)
g = g[0:y]
n = sorted([i for i in map(int,input().split())],reverse = True)
#print(r,g,n)
com = sorted(r + g + n,reverse = True)
print(sum(com[0:x + y]))
# Judge status: Accepted
import sys
from collections import defaultdict
n,k=map(int,sys.stdin.readline().split())
if n>k:
    n=n%k
ans=min(n,abs(n-k))
print(ans)
# Judge status: Accepted
n = [int(input()) for hoge in range(5)]
c = 0
t = 0
a = [10]
while t < 5:
  if n[t]%10 == 0:
    c += n[t]
  else:
    c += (n[t]//10 + 1)*10
    a.append(n[t]%10)
  t += 1
c -= (10-min(a))
print(c)
# Judge status: Accepted
s=str(input())
# print(s)
List=list(s)
List.pop(-1)
# print(List)
ans=0
for i in range((len(List)//2)+1):
    R=List[0:i]
    L=List[i:i+len(R)]
    # print("L",L,"R",R)
    if(R==L):
        # print(i,i+1,R,L)
        ans=len(R)*2

print(ans)
# Judge status: Wrong Answer
from collections import Counter
for i in range(int(input())):
  s = input()
for j in range(int(input())):
  t = input()
               
c = Counter(s)

for i in t:
  if i in c:
    c[i] -=1
    
print(max(0,c.most_common()[0][1]))
# Judge status: Accepted
a,b,c,d=map(int,input().split())
print(max(0,min(b-c,d-a,b-a,d-c)))
# Judge status: Accepted
import numpy as np

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

p = np.zeros(n)


for i in range(k):
  input()
  l = np.array(list(map(int, input().split())))
  p[l-1] += 1

print(len(np.where(p==0)[0]))
# Judge status: Wrong Answer
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, x = LI()
l = LI()
cnt = 1
d = 0
for i in range(n):
    if d + l[i] <= x:
        cnt += 1
        d += l[i]
print(cnt)
# Judge status: Accepted
a,b,k=map(int,input().split())
d=[]
for i in range(1,101):
    if a%i==0 and b%i==0:
        d.append(i)
print(d[-1*k])
# Judge status: Wrong Answer
def gcd(a,b):
  while b:
    a,b=b,a%b
  return a
n,a=int(input()),list(map(int,input().split()))
if n==2:
  print(max(a));exit()
if n==3:
  print(max(gcd(a[0],a[1]),gcd(a[0],a[2]),gcd(a[1],a[2])));exit()
ans=ans2=a[0]
for i in range(1,n):
  g=gcd(ans,a[i])
  if g!=ans:
    ans=g*ans2//gcd(g,ans2)
    ans2=gcd(g,ans2)
print(ans)
# Judge status: Accepted
n = int(input())
s = input()

if n%2==0:
    if s[:len(s)//2] == s[len(s)//2:]:
        print("Yes")
    else:
        print("No")
else:
    print("No")
# Judge status: Wrong Answer
a,b = map(int,input().split())
i = 0

while True:
    if a*i < b:
        i += 1
    else:
        break

print(i)
# Judge status: Wrong Answer
s=input()
if s== 'SUN':
  print(7)
elif s=='SAT':
  print(1)
elif s=='FRI':
  print(2)
elif s=='THU':
  print(3)
elif s=='WED':
  print(4)
elif s=='TUE':
  print(5)
elif s=='MON':
  print(6)
# Judge status: Accepted
a = int(input())
ans = a%10 + (int(a/10))%10 + int(a/100)%10
print(ans)
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
ans = 0
for i in range(1,len(a)):
    if a[i-1] > a[i]:
        ii = a[i-1] - a[i]       
        a[i] += ii
        ans += ii
print(ans)
# Judge status: Accepted
n,x,y=map(int,input().split())
dis=[0]*(n-1)
for i in range(1,n):
  for j in range(i+1,n+1):
    d=j-i
    if d>abs(j-x)+1+abs(i-y):
      d=abs(j-x)+1+abs(i-y)
    if d>abs(j-y)+1+abs(i-x):
      d=abs(j-y)+1+abs(i-x)
    dis[d-1]+=1
for i in dis:
  print(i)
# Judge status: Accepted
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
res = pow(10,n,mod) 
res -= pow(9,n,mod)*2
res %= mod
res += pow(8,n,mod)
print(res%mod)
# Judge status: Accepted
import collections
import sys

S=collections.deque(input())
Q=int(input())

r=0
for _ in range(Q):
    fs=next(sys.stdin).split()
    T=int(fs[0])
    if T==1:
        r^=1
    else:
        F,C=int(fs[1])-1,fs[2]
        if F==r:
            S.appendleft(C)
        else:
            S.append(C)

ans=''.join(reversed(S) if r else S)
print(ans)
# Judge status: Accepted
n = int(input())
ans = 1
p = pow(10,9)+7
for i in range(2,n+1):
    ans = (i * ans)%p
print(ans)
# Judge status: Accepted
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

a,b = i2()
s = s()
if "-" in s[0:a] or "-" in s[a+1:] or s[a] != "-":
	print("No")
else:
	print("Yes")
# Judge status: Accepted
A, B = map(int, input().split())
K = (A+B)/2
if K.is_integer():
    print(int(K))
else:
    print("IMPOSSIBLE")
# Judge status: Wrong Answer
import math


def readints():
    return list(map(int, input().split()))


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

if k == 1:
    print(100)
    exit()

for i in range(k):
    print(x-(k-1)+i)

for j in range(1, k):
    print(x+j)
# Judge status: Accepted
N,M,K = map(int,input().split(" "))
ans = 'No'
for i in range(1,N+1):
    for j in range(1,M+1):
        tmp = i*(M-j)+j*(N-i)
        if tmp == K:
            ans = 'Yes'
            break
        else:continue
    if ans == 'Yes':
        break
if K == N*M or K == 0:
    ans = 'Yes'
print(ans)
# Judge status: Accepted
a, b, x = map(int, input().split())
if a == x or (a + b >= x and a < x):
  print("YES")
else:
  print("NO")
# Judge status: Accepted
N = int(input().count('7'))
print("No" if N == 0 else "Yes")
# Judge status: Accepted
import math
k=int(input())
if k%2==0:
    print(int((k/2)**2))
else:
    a=math.floor(k/2)
    print(a*(a+1))
# Judge status: Accepted
def resolve(x,y):
    if (x+y)%2==0:
        print((x+y)//2)
    else:
        print(((x+y)//2)+1)
a,b=map(int,input().split())
resolve(a,b)
# Judge status: Accepted
s=(input())
k=s[2:-1]
m=k.replace('C', 'c')
t=s[-1]
t1=s[1]
if k.count('C')==1 and s[0]=='A' and m==k.lower() and t==s[-1].lower() and s[1]==t1.lower():
    print('AC')
else:
    print('WA')
# Judge status: Wrong Answer
import sys
N=int(input())
A=list(map(int,input().split()))
flag=True
for i in range(N):
    if A[i]%2==0:
        if A[i]%3!=0 or A[i]%5!=0:
            flag=False
if flag==True:
    print('APPROVED')
else:
    print('DENIED')
# Judge status: Accepted
x = int(input())

if x < 600:
	ans = 8
elif x < 800:
	ans = 7
elif x < 1000:
	ans = 6
elif x < 1200:
	ans = 5
elif x < 1400:
	ans = 4
elif x < 1600:
	ans = 3
elif x < 1800:
	ans = 2
elif x < 2000:
	ans = 1

print(ans)
# Judge status: Wrong Answer
li = input()
list = ['dream','dreamer','erase','eraser']
flag = 'NO'
for x in list:
  for y in list:
    z = x + y
    if z == li:
      flag = 'YES'
      
print(flag)
# Judge status: Accepted
from heapq import *
n,m = map(int,input().split())
a = list(map(int,input().split()))
bc = [list(map(int,input().split()))for _ in range(m)]

heapify(a)
bc = sorted(bc,key=lambda x:x[1],reverse=True)

for b,c in bc:
    for i in range(b):
        tmp = heappop(a)
        if tmp >= c:
            heappush(a,tmp)
            break
        else:
            heappush(a,c)

print(sum(a))
# Judge status: Wrong Answer
def main():
    a,b,c,k = map(int, input().split())

    ans = 0
    if a >= k:
        ans += k
    if a+b < k:
        ans += a
        ans -= k - (a+b)
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
k, a, b = map(int, input().split())
if b-a<=2 or k<=a-1:
    print(1+k)
else:
    print((k-a+1)//2*(b-a)+(k-a+1)%2+a)
# Judge status: Accepted
S = list(input())
if S.count("a") == 1 and S.count("b") == 1 and S.count("c") == 1:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
X = [int(a) for a in input().split()]

mi = 1<<100
for i in range(1, 101):
    mi = min(mi, sum([(x-i)**2 for x in X]))

print(mi)
# Judge status: Accepted
import math
N = int(input())
number = [2]*N
ans = 1
if(N>=2):
  for i in range(2,N+1):
    ans += number[i-1]*i
    #if(i<=math.sqrt(N)):
    if(i <= int(N/2)):
      for j in range(2,N//i+1):
        number[i*j-1] += 1
print(ans)
# Judge status: Accepted
def main():
    input()  # n
    stones = input()
    white_counter = []
    white_stones = 0
    red_stones = 0
    for color in stones:
        if color == 'W':
            white_stones += 1
        else:
            red_stones += 1
        white_counter.append(white_stones)

    if red_stones == 0:
        print(0)
    else:
        print(white_counter[red_stones - 1])


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
s=str(input())
n=len(s)
b=s.count('0')
A=[b,n-b]
print(n-min(A)-min(A))
# Judge status: Wrong Answer
antenna = [input() for _ in range(5)]
k = int(input())

check = True
for i in range(4):
  if int(antenna[i+1]) - int(antenna[i]) > k:
    check = False
    
print("Yay!" if check else ":(")
# Judge status: Accepted
n =int(input())
s = input()
r = s.count("R")
g = s.count("G")
b = s.count("B")

an = 0
for i in range(n-2):
	for j in range(i+1,n-1):
		k = 2*j-i
		if k>=n:
			continue
		else:
			if s[i] != s[j] and s[k] != s[j] and s[k] != s[i]:
				an+=1


print(r*g*b-an)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
p = tuple(p)
q = tuple(q)


import itertools
a = (list(itertools.permutations(list(range(1,n+1)))))

b = 0
c = 0
cnt = 1
for i in a:
    if i == p:
        c += cnt
    elif i == q:
        b += cnt
    if c!= 0 and b!=0:
        break
    else:
        cnt += 1
print(abs(c-b))
# Judge status: Wrong Answer
S = list(input())
T = list(input())
flag = False
for i in range(len(S)):
  ii = len(S) - i
  for j in range(len(T)):
    if (ii+j >= len(S)):
      flag = False
      break
    elif S[ii+j]==T[j] or S[ii+j] == "?":
      flag = True
    else:
      flag = False
      break
  if (flag):
    for k in range(len(T)):
      S[ii+k] = T[k]
    break
if (flag):
  print("".join(S).replace("?","a"))
else:
  print("UNRESTORABLE")
# Judge status: Accepted
A,B,C,D=map(int,input().split())
if max(A,C) - min(A,C) <= D:
  print('Yes')
elif max(A,B) - min(A,B) <= D and max(C,B) - min(C,B) <= D:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
A, B, C = map(int,input().split())
if B-A == C-B:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n=int(input())
word_list = ['AC','WA','TLE','RE']
A = 0
W = 0
T = 0
R = 0

for i in range(n):
    s = input()
    if s == 'AC':
        A = A + 1
    elif s == 'WA':
        W = W + 1
    elif s == 'TLE':
        T = T + 1
    else:
        R = R + 1
Ans_list = [A,W,T,R]
for i in range(4):
    print(str(word_list[i])+ ' x '+ str(Ans_list[i]))
# Judge status: Accepted
N,x = map(int,input().split())
a = list(map(int, input().split()))
ans=0
wa=a[0]+a[1]
if wa>x:
    ans=wa-x
    if a[1]<ans:
        a[1]=0
    else:
        a[1]-=ans
for i in range(1,N-1):
    wa=a[i]+a[i+1]
    if wa>x:
        ans+=wa-x
        a[i+1]-=(wa-x)
print(ans)
# Judge status: Accepted
n,m = (int(i) for i in input().split())
if n==m:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n, m, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

x.append(X)
x.sort()
y.sort()

if x[-1] >= y[0]:
    print("War")
else:
    print("NO War")
# Judge status: Accepted
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: Wrong Answer
n = int(input())
m = 10**13
for x in range(1,1000001):
  y = n / x
  if y % 1 == 0:
    v = x + y -2
    m = min(m, v)
print(m)
# Judge status: Accepted
_dog_no = int(input())
_letter = [chr(i) for i in range(97,97+26)]
_dog_name = ""
for _i in range(11):
  _dog_no -= 1
  _dog_name = _letter[_dog_no % 26] + _dog_name
  _dog_no = _dog_no // 26
  if _dog_no < 1:
    break
print(_dog_name)
# Judge status: Wrong Answer
N, K = map(int, input().split())
if N >=13:
    print(K)
elif N >= 6:
    print(K/2)
else:
    print(0)
# Judge status: Accepted
import math

def divisors(n):
    s = set()
    for x in range(2, math.ceil(n ** 0.5) + 1):
        while n % x == 0:
            s.add(x)
            n /= x
            if n == 1:
                break
    if n > 1:
        s.add(n)
    return s
 
a, b = map(int, input().split())
d = divisors(a) & divisors(b)
print(len(d) + 1)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.append(0)
b.append(0)
ans = 0
for i in range(n+1):
    if a[i]-b[i] > 0:
        ans += a[i]-b[i]
    else:
        b[i+1] += b[i]-a[i]
print(sum(a)-ans)
# Judge status: Accepted
import collections
import numpy as np

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

c=collections.Counter(A)
kazu=list(c.values())
a=np.array(kazu)
sn=a*(a-1)/2
s=sum(sn)
for k in range(N):
    sub=c[A[k]]-1
    print(int(s-sub))
# Judge status: Wrong Answer
x = int(input())
dp = [0] * (x+1)
dp[0] = 1
for i in range(1,x+1):
    for t in range(100,107):
        if i - t >= 0:
            dp[i] = max(dp[i], dp[i-t])
print(dp[x])
# Judge status: Wrong Answer
a, b, c, k = map(int, input().split())
if k > a:
    print(k)
elif k <= a+b:
    print(a)
else:
    k -= a+b
    print(a+k)
# Judge status: Accepted
import queue

ok_list = set()

q = queue.Queue()
q.put(0)
while not q.empty():
    current = q.get()
    for i in [4, 7]:
        n = current + i
        if n > 100:
            continue
        elif n in ok_list:
            continue
        else:
            ok_list.add(n)
            q.put(n)

n = int(input())
if n in ok_list:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
x =list(map(int,input().split()))
a = [0,abs(x[1]-x[0])]
if n>2:
    for i in range(2,n):
        a.append(min(abs(x[i-2]-x[i])+a[-2],abs(x[i-1]+x[i])+a[-1]))
else:
    print(a[-1])
    exit()
  
print(a[-1])
# Judge status: Wrong Answer
N = int(input())
num_list = [int(i) for i in input().split()]

counter = {"check": 1}
for i in range(1,N):

    count = len([j for j in range(0,i) if num_list[i] <= num_list[j]])
    if count != 0:
        counter["check"] += 1

print(counter["check"])
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
x = 0
y = 0

for a in A:
  if a%4==0:
    x+=1
  elif a%2==0:
    y+=1

if N//2<=x+y//2:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())

if N % 2 == 1:
  print(0)
  exit()
else:
  tmp = 2
  ans = 0
  while 5 * tmp <= N:
    tmp *= 5
    ans = ans + N // tmp
print(ans)
# Judge status: Accepted
N = int(input())
S = input()
 
r = S.count('R')
g = S.count('G')
b = S.count('B')
 
c = 0
for i in range(N):
    for j in range(i+1, N):
        h = 2*j-i
        if h >= N:
            break
        if S[i]!=S[h] and S[i]!=S[j] and S[j]!=S[h]:
            c += 1
 
print(r*g*b-c)
# Judge status: Accepted
S = input()
T = input()
R_s = [-1] * 26
R_t = [-1] * 26
ans = 'Yes'

for i in range(len(S)):
  tmpS = ord(S[i]) - 97
  tmpT = ord(T[i]) - 97
  if R_s[tmpS] < 0:
    R_s[tmpS] = tmpT
  elif R_s[tmpS] != tmpT:
    ans = 'No'
  
  if R_t[tmpT] < 0:
    R_t[tmpT] = tmpS
  elif R_t[tmpT] != tmpS:
    ans = 'No'

print(ans)
# Judge status: Accepted

s = input()
t = input()
sl = len(s)
tl = len(t)
res = list(s)

def check(s1, s2):
    for i in range(len(s1)):
        if s1[i] == '?':
            continue
        if s1[i] != s2[i]:
            return False
    return True

for i in range(sl-tl, -1, -1):
    if check(s[i: i+tl], t):
        res[i: i+tl] = t
        res = ['a' if s == '?' else s for s in res]
        break
else:
    res = list('UNRESTORABLE')

print(''.join(res))
# Judge status: Accepted
#int(input())
#int(x) for x in input().split()
#map(int,input().split())
n,k=map(int,input().split())
a=[int(x) for x in input().split()]
co=0
s=set([1])
i=0
path=[1]
j=0
while True:
	co+=1
	path.append(a[i])
	if a[i] in s:
		j=path.index(a[i])
		break
	else:
		s.add(a[i])
	i=a[i]-1
#print(path)
if k<=j:
	print(path[k])
else:
	k-=j
	path=path[j+1:]
	k-=1
	k=k%(len(path))
	print(path[k])
# Judge status: Wrong Answer
a,b=input().split()
a=int(a)
b=int(b)
c=0
for i in range(int(b/10000)+1):
  for k in range(int(b/5000)+1):
    if i*10000+k*5000+(a-i-k)*1000==b:
      c=c+1
      break
if c==0:
  print(-1,-1,-1)
else:
  print(i,k,a-i-k)
# Judge status: Wrong Answer
n = int(input())
a = list((map(int ,input().split())))
a.sort()
print(sum(a[n:2*n]))
# Judge status: Accepted
a=open(0).read().split();print('YNeos'[all(t-set(map(a.index,a[10:]))for t in({0,3,6},{0,4,8},{2,4,6},{2,5,8},{3,4,5},{6,7,8}))::2])
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-

N,K = list(map(int, input().rstrip().split()))
x_list = list(map(int, input().rstrip().split()))
#-----

cnt_time = max(x_list)*N
for l in range(N-K+1):
    r=l+K-1

    route1 = abs(x_list[l]) + abs(x_list[r] - x_list[l])
    route2 = abs(x_list[r]) + abs(x_list[r] - x_list[l])
    cnt_time = min( cnt_time, route1, route2 )

print(cnt_time)
# Judge status: Accepted
import math

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

ans = 0
for i in range(1, n+1):
    if i < k:
        ans += (1/n)*(1/2)**math.ceil(math.log2(k/i))
    else:
        ans += 1/n

print(ans)
# Judge status: Accepted
import sys
import copy
from collections import deque
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
p = na()


p.sort()

print(sum(p[:k]))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

x = y = 0
for i in range(n):
    dif = b[i]-a[i]
    if dif>0:x += dif//2
    else:y += -dif

print('Yes' if x>=y else 'No')
# Judge status: Accepted
n = int(input())
from bisect import bisect 
ab = [list(map(int,input().split())) for i in range(n)]

ab.sort(key = lambda x: x[1])
ok = True
last = 0
for a,b in ab:
    if b-a>=last:
        last += a
    else:
        ok = not ok
        break
print('Yes' if ok else 'No')
# Judge status: Accepted
s = input()
ans = "Yes"
if len(s) % 2 != 0:
  ans = "No"
else:
  for i in range(len(s)//2):
    if s[i*2] != "h" or s[i*2+1] != "i":
      ans = "No"
      break
print(ans)
# Judge status: Accepted
s = input()
a = ""
b = ""
ans = 0
for i in range(len(s)):
  b += s[i]
  if a == b:
    continue
  else:
    ans += 1
    a = b
    b = ""
print(ans)
# Judge status: Accepted
n, a, b, c, d = map(int, input().split())
s = input()
if '##' in s[a:d+1]:
    print('No')
elif c < d or '...' in s[b-2:d+1]:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n, k = [int(x) for x in input().split()]
d = {}
for _ in range(k):
    d.setdefault(input(), list(map(int, input().split())))
l = []
for _ in d.values():
    l.extend(_)
s = set(l)
print(n - len(s))
# Judge status: Accepted
N = int(input())
R = sorted([list(map(int, input().split())) for i in range(N)])
T = []
for i in range(N):
    T.append([R[i][0] + R[i][1], R[i][0] - R[i][1]])
T.sort(reverse=True)
while len(T) - 1 > 0:
    t = T.pop()
    i = 1
    while len(T) and t[0] > T[-1][1]:
        N -= 1
        i += 1
        T.pop()
print(N)
# Judge status: Accepted
n=int(input())

x=800*n
y=200*(n//15)

print(x-y)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int,input().split()))
ans = []
for i in range(n-2):
    ans.append(sorted(p[i:i+3])[1])
print(len(set(ans)))
# Judge status: Accepted
def cumsum(xs):
    result = [0,xs[0]]
    for x in xs[1:]:
        result.append(result[-1] + x)
    return result
a,b=map(int,input().split())
c=list(map(int,input().split()))
n=cumsum(c)
ans=[]
for i in range(len(n)):
    if n[i]<=b:
        ans.append(n[i])
print(len(ans))
# Judge status: Accepted
N, val= list(map(int,input().split()))
list = list(map(int,input().split()))
d=0
l=[]
for i in list:
  d=d+i
  l.append(d)
count=0
for num in l:
  if num<=val:
    count=count+1
print(count+1)
# Judge status: Wrong Answer
A = int(input())
B = int(input())
C = int(input())

print((A+B)*C/2)
# Judge status: Wrong Answer
n = int(input())
ans = [0] * n
loop = int((n/6) ** 1.5) + 1

def f(i, j, k):
    return i ** 2 + j ** 2 + k ** 2 + i*j + j*k + k*i

for i in range(1, loop+1):
    for j in range(1, loop+1):
        for k in range(1, loop+1):
            res = int(f(i, j, k))
            if res <= n:
                ans[res] += 1

for a in ans:
    print(a)
# Judge status: Accepted
if __name__ == '__main__':
    s = input()
    print("No" if s == "AAA" or s == "BBB" else "Yes")
# Judge status: Wrong Answer
n=int(input())
l=map(int,input().split())
print('Yes' if max(l)*2< sum(l) else 'No')
# Judge status: Accepted
N = int(input())
MOD = 10 ** 9 + 7
dp = [0] * 2010
dp[0] = 1
for i in range(3, N + 1):
    for j in range(i - 3 + 1):
        dp[i] = (dp[i] + dp[j]) % MOD
print(dp[N])
# Judge status: Accepted
N, M = map(int, input().split())
A = set(int(input()) for i in range(M))
MOD = 10 ** 9 + 7
DP = [0] * (N + 10)
if 1 not in A:
    DP[1] = 1
if 2 not in A and 1 in A:
    DP[2] = 1
if 2 not in A and 1 not in A:
    DP[2] = 2
for i in range(3, N + 1):
    if i not in A:
        DP[i] = (DP[i - 1] + DP[i - 2]) % MOD
print(DP[N])
# Judge status: Wrong Answer
a=int(input())
b=int(input())
c=int(input())

d=max(a,b)
ans=0
for i in range(d):
  if d*i>=c:
    print(i)
    exit()
# Judge status: Wrong Answer
import math
n = int(input())
if n == 1:
  print(1)
  exit(0)
  
pows = []
upto = int(math.sqrt(n))
for i in range(2, upto):
  if n % i == 0:
    cc = 0
    while n % i == 0:
      n //= i
      cc += 1
    pows.append(cc)

    
if len(pows) == 0:
  print(1)
  exit(0)
  
ans = 0
# print(pows)
for pp in pows:
  start = 1
  cc = 0
  while pp - start >= 0:
    cc += 1
    pp -= start
    start += 1
    
  ans += cc

print(ans)
# Judge status: Accepted
N=list(input())
answer=0
for n in range(len(N)):
    answer+=int(N[n])
if answer%9==0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from collections import Counter

n = int(input())
A = list(map(int, input().split()))
C = Counter(A)
ans = sorted([(k,v) for k,v in C.items() if v>=2], key = lambda x:-x[0])[:2]

if len(ans)<2:
  print(0)
elif ans[0][1]>=4:
  print(ans[0][0]**2)
else:
  print(ans[0][0]*ans[1][0])
# Judge status: Accepted

x = []*5
x = list(map(int,input().split()))



for i in range(0,5):
    if (x[i] == 0):
        print(i+1)
# Judge status: Accepted
c=input()
l=['a','i','u','e','o']
if c in l:print('vowel')
else:print('consonant')
# Judge status: Wrong Answer
#20C10のcombinatrics全探索？
#本番でCでこれ見たら凍るw
n,m,q=map(int, input().split( ))
qs=tuple(tuple(map(int, input().split( ))) for _ in range(q))
import itertools
ans=0
for comb in itertools.combinations(range(1,n+m+1),n):
    tmp=0
    comb2=[comb[i]-i for i in range(n)]
    for ai,bi,ci,di in qs:
        if comb2[bi-1]-comb2[ai-1]==ci:
            tmp+=di 
    ans=max(ans,tmp)
print(ans)