Harryxun/stf_run huggingface dataset:
N,M = list(map(int,input().split()))
A = input().split()

count = 0
A = np.array(A,dtype='int64')
B = np.cumsum(A)
C = np.append([0],B)

L = (1 for i in range(N) for t in range(N) if i<t and (C[t] - C[i])%M==0)
print(len(list(L)))

### FIXED CODE ###

import collections
import numpy as np

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

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
L = [i%M for i in C]
L_c = collections.Counter(L)

ans = 0
for i in L_c.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))
x = input()
y = input()
a == 11
b == 12
c == 13
d == 14
f == 15
print('<' if x<y else '>' if x>y else '=' if x==y )

### FIXED CODE ###

X,Y = input().split()
print('<' if X<Y  else '=' if X==Y else '>')
N = int(input())
ans = set()
for i in range(N):
    tmp = set()
    x, y, h = map(int, input().split())
    for cx in range(0,101):
        for cy in range(0, 101):
            ch = abs(x-cx) + abs(y-cy) + h
            if ch < 1:
                continue
            tmp.add((cx, cy, ch))
    if i == 0:
        ans = tmp
        continue
    # elif tmp == set():
    #     continue
    ans = ans & tmp
ans = list(ans)[0]
print(ans[0], ans[1], ans[2])


### FIXED CODE ###

N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
ansx = 0
ansy = 0
ansh = 0
for x in range(101):
  for y in range(101):
    hset = set()
    for i in range(N):
      xyhi = xyh[i]
      if xyhi[2] == 0:
        continue
      hset.add(abs(xyhi[0]-x) + abs(xyhi[1]-y) + xyhi[2])

    if len(hset) == 1 and list(hset)[0] != 0:
      flag = True
      for i in range(N):
        xyhi = xyh[i]
        if xyhi[2] != 0:
          continue
        elif xyhi[2] == 0 and max(list(hset)[0] - abs(xyhi[0]-x) - abs(xyhi[1]-y), 0) == 0:
          continue
        flag = False
        break
      if flag:
        ansx = x
        ansy = y
        ansh = list(hset)[0]

print(ansx, ansy, ansh)
n,h=map(int,input().split())
li=[tuple(map(int,input().split())) for i in range(n)]

zenbu=[]

for i in range(n):
  a=[li[i][0],"a"]
  b=[li[i][1],"b"]
  zenbu.append(a)
  zenbu.append(b)

zenbu.sort(reverse=True)

life=h
ans=0

import math
for i in range(n):
  if zenbu[i][1]=="b":
    life-=zenbu[i][0]
    ans+=1
    if life<=0:
      print(ans)
      exit()
  elif zenbu[i][1]=="a":
    print(ans+math.ceil(life/zenbu[i][1]))
    exit()
#以下、bを全部投げて足りない場合。この場合は残りを最大のaで割る
ali=[]
for i in range(n):
  ali.append(li[i][0])
ali.sort()

print(ans+math.ceil(life/ali[-1]))

### FIXED CODE ###

n,h=map(int,input().split())
li=[tuple(map(int,input().split())) for i in range(n)]

zenbu=[]

for i in range(n):
  a=[li[i][0],"a"]
  b=[li[i][1],"b"]
  zenbu.append(a)
  zenbu.append(b)

zenbu.sort(reverse=True)

life=h
ans=0

import math
for i in range(n):
  if zenbu[i][1]=="b":
    life-=zenbu[i][0]
    ans+=1
    if life<=0:
      print(ans)
      exit()
  elif zenbu[i][1]=="a":
    print(ans+math.ceil(life/zenbu[i][0]))
    exit()
#以下、bを全部投げて足りない場合。この場合は残りを最大のaで割る
ali=[]
for i in range(n):
  ali.append(li[i][0])
ali.sort()

print(ans+math.ceil(life/ali[-1]))
# coding: utf-8
import sys
from math import gcd
from collections import defaultdict

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def prime_factorize(n): # Nの素因数分解
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

# 約数が１つしかないものを探す
N = ir()
A = lr()
g = A[0]
dic = defaultdict(int)
for a in A:
    g = gcd(g, a)
    primes = prime_factorize(a)
    for p in primes:
        dic[p] += 1

cand = [1]
for k, v in dic.items():
    if v == 1:
        cand.append(k)

x = max(cand)
g = A[0] if A[0] % x != 0 else A[-1]
for a in A:
    if a%x == 0:
        continue
    g = gcd(g, a)

answer = g
print(answer)


### FIXED CODE ###

from fractions import gcd
import math
N = int(input())
A = list(map(int, input().split()))

gl = [0] * (N-1)
gr = [0] * (N-1)

gl[0] = A[0]
gr[0] = A[-1]
for i in range(1,N-1):
    gl[i] = gcd(gl[i-1],A[i])
    gr[i] = gcd(gr[i-1],A[-i-1])
#print(gl[i])
ans = max(gr[-1],gl[N-2])
for i in range(1,N-1):
    g = gcd(gl[i-1],gr[-i-1])
    ans = max(ans,g)
#print(gl,gr)
print(ans)
import numpy as np
n = int(input())
a = list(map(int,input().split()))

a = np.array(a)

'''
for i in range(1,n+1):
    result.append(a.index(i)+1)
'''


print(*np.argsort(a)+1)

### FIXED CODE ###

import numpy as np
n = int(input())
a = list(map(int,input().split()))

a = np.array(a)



print(*np.argsort(a)+1)
x = N
if x % 2 == 1:
    print((N + 1)*(N // 2)+(N + 1) / 2)
if x % 2 == 0:
    print((N + 1) * N / 2)

### FIXED CODE ###

N = int(input())
print(N*(N+1)//2)
import collections
N=int(input())
X=list(input())
X=list(map(int,X))
#print(X)
ans1=0
ans2=0
c=collections.Counter(X)
div=c[1]
for i in range(N):
    ans1=(ans1+X[i]*pow(2,N-i-1,div+1))%(div+1)
    ans2=(ans2+X[i]*pow(2,N-i-1,div-1))%(div-1)
    #print(ans1)
#print(ans1,div+1)
#print(ans2,div-1)
#ここまででXについてのXのbit数、X%(Xのbit数)がわかる
for i in range(N):
    cnt = 1
    if (X[i]==0):
        num=(ans1+pow(2,N-i-1,div+1))%(div+1)
        #print(num)
    else:
        num=(ans2+div-1-pow(2,N-i-1,div-1))%(div-1)
        #print(num)
    while num != 0:
        di = 0
        for j in range(18):
            if (num >> j)&1 == 1:
                di = di + 1
        num = num % di
        cnt = cnt + 1
    print(cnt)



### FIXED CODE ###

import collections
N=int(input())
X=list(input())
X=list(map(int,X))
#print(X)
ans1=0
ans2=0
c=collections.Counter(X)
div=c[1]
for i in range(N):
    ans1=(ans1+X[i]*pow(2,N-i-1,div+1))%(div+1)
    if div-1!=0:
        ans2=(ans2+X[i]*pow(2,N-i-1,div-1))%(div-1)
    else:
        ans2=None
    #print(ans1)
#print(ans1,div+1)
#print(ans2,div-1)
#ここまででXについてのXのbit数、X%(Xのbit数)がわかる
for i in range(N):
    cnt = 1
    if (X[i]==0):
        num=(ans1+pow(2,N-i-1,div+1))%(div+1)
        #print(num)
    else:
        if (div-1)!=0:
            num=(ans2+div-1-pow(2,N-i-1,div-1))%(div-1)
        else:
            cnt=0
            num=0
        #print(num)
    while num != 0:
        di = 0
        for j in range(18):
            if (num >> j)&1 == 1:
                di = di + 1
        num = num % di
        cnt = cnt + 1
    print(cnt)
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():

    def de(l,i):
        if len(l) == 0:
            return
        if len(l) == 2:
            if l[0] != l[1]:
                l = []
            return
        if l[i] != l[i-1]:
            l.pop(i)
            l.pop(i-1)
            de(l,i-1)
        elif len(l) >= i+1:
            if l[i] != l[i+1]:
                l.pop(i+1)
                l.pop(i)
                de(l,i)
        else:
            pass

    s = list(input().rstrip())
    l = len(s)
    for i in range(1,len(s)):
        de(s,i)
    print(l - len(s))

if __name__=="__main__":
    main()


### FIXED CODE ###

import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():

    s = list(input().rstrip())
    zero = 0
    one = 0
    for i in s:
        if i == "0":
            zero += 1
        else:
            one += 1
    print(2*min(zero,one))

if __name__=="__main__":
    main()
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
from functools import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys
from math import gcd

N, X = map(int, input().split())
Xs = map(int, input().split())
diffs = [abs(X - x) for x in Xs]
ans = reduce(gcd, diffs)
print(ans)



### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
from functools import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

# python3.4では存在しない!!
# from math import gcd

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

N, X = map(int, input().split())
Xs = map(int, input().split())
diffs = [abs(X - x) for x in Xs]
ans = reduce(gcd, diffs)
print(ans)
N = int(input())
s = str(input())
maxlen = N//2

def solve(tgt):
    for i in range(N-tgt*2+1):
        src = s[i:i+tgt]
        if src in s[i+tgt:]:
            return True
    return False

ng = maxlen + 1
ok = 0
while np.abs(ok-ng) > 1:
    tgt = (ok+ng)//2
    if solve(tgt):
        ok = tgt
    else:
        ng = tgt
print(ok)


### FIXED CODE ###

from collections import defaultdict as dd
N = int(input())
s = str(input())
maxlen = N//2

def solve(tgt):
    dic = dd(int)
    st = s[tgt:2*tgt]
    dic[st] += 1
    ls = [st]
    for char in s[2*tgt:]:
        st = st[1:]+char
        dic[st] += 1
        ls.append(st)
    st = s[:tgt]
    if dic[st] > 0:
        return True
    dic[ls[0]] -= 1
    for i,char in enumerate(s[tgt:N-tgt]):
        st = st[1:]+char
        if dic[st] > 0:
            return True
        dic[ls[i+1]] -= 1
    return False

ng = maxlen + 1
ok = 0
while ng-ok > 1:
    tgt = (ok+ng)//2
    if solve(tgt):
        ok = tgt
    else:
        ng = tgt
print(ok)
N=int(input())
u=[0]*N
v=[0]*N
w=[0]*N
for i in range(N-1):
    u[i], v[i], w[i] = map(int, input().split())

class Path:
    def __init__(self, next, length, num):
        self.next=next
        self.len=length
        self.num=num

class Node:
    def __init__(self, index):
        self.index = index
        self.paths = []

    def append(self, next, length, num):
        self.paths.append(Path(next, length, num))

nodes = [Node(i) for i in range(N)]
for i in range(N-1):
    nodes[u[i]-1].append(v[i]-1, w[i], i)
    nodes[v[i]-1].append(u[i]-1, w[i], i)

pasts = []
paints = [-1]*N

def rec(pos, color):
    if paints[pos] == -1:
        paints[pos] = color
    for path in nodes[pos].paths:
        # まだ通ってない道を通る
        if path.num not in pasts:
            pasts.append(path.num)
            if path.len % 2 == 1:
                rec(path.next, (color + 1) % 2)
            else:
                rec(path.next, color)
        # さっきの道を戻ってくる

rec(0, 0)

for i in paints:
    print(i)

### FIXED CODE ###

import sys

N=int(input())
sys.setrecursionlimit(100000)
u = [0]*(N-1)
v = [0]*(N-1)
w = [0]*(N-1)
for i in range(N-1):
    u[i], v[i], w[i] = map(int, input().split())
    u[i] -= 1
    v[i] -= 1

class Path:
    def __init__(self, next_node, length, num):
        self.next=next_node
        self.len=length
        self.num=num

class Node:
    def __init__(self, index):
        self.index = index
        self.paths = []

    def append(self, next_node, length, num):
        self.paths.append(Path(next_node, length, num))

nodes = [Node(i) for i in range(N)]
for i in range(N-1):
    nodes[u[i]].append(v[i], w[i], i)
    nodes[v[i]].append(u[i], w[i], i)

past_paths = [0]*(N-1)
paints = [-1]*N

def rec(pos, color):
    if paints[pos] == -1:
        paints[pos] = color
    for path in nodes[pos].paths:
        # まだ通ってない道を通る
        if past_paths[path.num] == 0:
            past_paths[path.num] = 1
            rec(path.next, (color + path.len) % 2)
        # さっきの道を戻ってくる

rec(0, 0)

for i in paints:
    print(i)
N=int(input())
info=[input().split() for i in range(N)] #mojiretu
#print(info)
from operator import itemgetter
dic1={}
for i in range(len(info)):
    dic1[i+1]=info[i]
#print(dic1)
info1=sorted(info,key=lambda x:int(x[1]),reverse=True)
info2=sorted(info1,key=itemgetter(0))
#print(info2)
for i in info2:
    for key,value in dic1.items():
        if value==i:
            print(key)


### FIXED CODE ###

A,P=map(int,input().split())
num=3*A+P
print(num//2)
hoge = str(input())
a = int(hoge[:2])
b = int(hoge[2:4])

if 0 < a and a < 12:
  result = "YYMM"
  if 0 < b and b < 12:
    result = "AMBIGUOUS"
if 0 < b and b < 12:
  result = "MMYY"
  if 0 < a and a < 12:
    result = "AMBIGUOUS"
if result == None:
  result = "NA"

print(result)

### FIXED CODE ###

hoge = str(input())
a = int(hoge[:2])
b = int(hoge[2:4])
result = None

if 0 < a and a <= 12:
  result = "MMYY"
  if 0 < b and b <= 12:
    result = "AMBIGUOUS"
if 0 < b and b <= 12:
  result = "YYMM"
  if 0 < a and a <= 12:
    result = "AMBIGUOUS"
if result == None:
  result = "NA"

print(result)
import math

def main():
  N = int(input())
  A = list(map(int, input().split()))
  MAX = A[-1]
  dp = [True] * MAX
  c = [0] * MAX
  ans = 0

  A.sort()

  for v in A:
    c[v - 1] += 1

    if(not dp[v - 1] and c[v - 1] > 1):
      continue

    e = v * 2    
    while e < MAX:
      dp[e-1] = False
      e += v
      
  for v in A:
    if dp[v - 1] and c[v - 1] == 1:
      ans += 1

  print(ans)

if __name__ == "__main__":
  main()

### FIXED CODE ###

import math

def main():
  N = int(input())
  A = list(map(int, input().split()))
  A.sort()
  MAX = A[-1]
  dp = [True] * MAX
  c = [0] * MAX
  ans = 0

  for a in A:
    i = a - 1
    c[i] += 1

    if((not dp[i]) and c[i] > 1):
      continue

    e = a * 2    
    while e <= MAX:
      dp[e-1] = False
      e += a
      
  for v in A:
    i = v - 1
    if dp[i] and c[i] == 1:
      ans += 1

  print(ans)

if __name__ == "__main__":
  main()
(a,b)=list(map(int,input()));print( a-b if( a > b ) else 0 )

### FIXED CODE ###

(a,b)=list(map(int,input().split()))
print( a-b if( a > b ) else 0 )
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
if e-a<=k:
  print('Yay!')
else:
  print(':(')


### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-a<=k:
  print('Yay!')
else:
  print(':(')
n = int(input())
record =  [ [ [0 for r in range(10)] for f in range(3) ] for b in range(4)]
for i in range(n):
    b, f, r, v = [int(a) for a in input().split(" ")]
    record[b - ][f - 1][r - 1] += v
for b in range(4):
    for f in record[b]:
        print( " "+" ".join([str(x) for x in f]) )
    if b != 3:
        print("".join(["#" for q in range(20)]))
        

### FIXED CODE ###

n = int(input())
record = [ [ [0 for r in range(10)] for f in range(3)] for b in range(4)]
for _ in range(n):
    b,f,r,v = [int(i) for i in input().split(" ")]
    record[b - 1][f - 1][r - 1] += v
for b1 in range(4):
    for f in record[b1]:
        print(" "+" ".join([str(x) for x in f]))
    if b1 != 3:
        print("#" * 20)
n,w=map(int,input().split())
a=[0]*(w+1)
for i in range(n):
    b=a.copy()
    x,y=map(int,input().split())
    for j in range(min(x,w),w+1):
        b[j]=max(a[j-x]+y,a[j])
    a=b.copy()
print(max(b))
        



### FIXED CODE ###

n,w=map(int,input().split())
from copy import copy
a=[0]*(w+1)
for i in range(n):
    b=copy(a)
    x,y=map(int,input().split())
    for j in range(min(x,w),w+1):
        b[j]=max(a[j-x]+y,a[j])
    a=copy(b)
print(max(a))
S = srt(input())
T = str(input())

print(T + S)

### FIXED CODE ###

S ,T = input().split()

print(T,S,sep="")
n=map(int,raw_imput().split())
ans=[]
n.sort()
n.reverse()
for i in n:
	ans.append(str(i))
print(' '.join(ans))

### FIXED CODE ###

n=map(int,raw_input().split())
n.sort()
n.reverse()
n=map(str,n)
print(" ".join(n))
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n,k = Is()
ls = Is()
_1 = ls.index(1)
if _1 < k-1:
    _1 = k-1
elif _1 < n-k:
    _1 = n-k
print(math.ceil(_1/(k-1))+math.ceil((n-1-_1)/(k-1)))


### FIXED CODE ###

import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n = I()
s = 0
for e in str(n):
    s += int(e)
if n%s == 0:
    print("Yes")
else:
    print("No")
n=int(input())
s=sorted([int(input()) for _ in range(n)])
ans=sum(s)
if ans%10==0:
    tmp=ans
    for i in range(n):
        tmp-=s[i]
        if tmp%10!=0:
            break
    num=ans
    for i in s:
        if i%10!=0:
            num=i
            break
print(max(tmp,ans-num))

### FIXED CODE ###

n=int(input())
s=sorted([int(input()) for _ in range(n)])
ans=sum(s)
tmp=ans
num=ans
if ans%10==0:
    for i in range(n):
        tmp-=s[i]
        if tmp%10!=0:
            break
    for i in s:
        if i%10!=0:
            num=i
            break
print(max(tmp,ans-num))
if __name__=="__main__":
    N, K = map(int, input().split(' '))
    _town_list = input().split(' ')
    town_list = [int(n) for n in _town_list]

    next_town = town_list[0]
    visited_town = set()
    visited_town.add(1)
    visited_town.add(next_town)
    lst_visited_town = [1]
    lst_visited_town.append(next_town)
    counter = 1

    while True:
        counter += 1
        next_town = town_list[next_town-1]
        if counter == K:
            print(next_town)
            break
        if next_town in visited_town:
            repeated_town_idx = lst_visited_town.index(next_town)
            loop_num = counter - repeated_town_idx
            print(visited_town[(K-repeated_town_idx)%loop_num + repeated_town_idx])
            break
        lst_visited_town.append(next_town)
        visited_town.add(next_town)

### FIXED CODE ###

if __name__=="__main__":
    N, K = map(int, input().split(' '))
    _town_list = input().split(' ')
    town_list = [int(n) for n in _town_list]

    next_town = town_list[0]
    visited_town = set()
    visited_town.add(1)
    visited_town.add(next_town)
    lst_visited_town = [1]
    lst_visited_town.append(next_town)
    counter = 1

    while True:
        counter += 1
        next_town = town_list[next_town-1]
        if counter == K:
            print(next_town)
            break
        if next_town in visited_town:
            repeated_town_idx = lst_visited_town.index(next_town)
            loop_num = counter - repeated_town_idx
            print(lst_visited_town[(K-repeated_town_idx)%loop_num + repeated_town_idx])
            break
        lst_visited_town.append(next_town)
        visited_town.add(next_town)
class Dice:

u,s,e,w,n,b = map(int,input().split())
roll = input()
for i in range(len(data)):
	if roll[i] == E:
		tmp = e
		e = u
		u = w
		w = b
		b = tmp
	elif roll[i] == S:
		tmp = s
		s = u
		u = n
		n = b
		b = tmp
	elif roll[i] == W:
		tmp = w
		w = u
		u = e
		e = b
		b = tmp
	elif roll[i] == N:
		tmp = n
		n = u
		u = s
		s = b
		b = tmp

print(u)

### FIXED CODE ###

class Dice:
    u, s, e, w, n, b = map(int, input().split())
    roll = input()
    for i in roll:
        if i == "E":
            e,u,w,b = u,w,b,e
        elif i == "S":
            s,u,n,b = u,n,b,s
        elif i == "W":
            w,u,e,b = u,e,b,w
        elif i == "N":
            n,u,s,b = u,s,b,n
    print(u)

dice = Dice()
a,b =map(int,input().split())
s = b-a
s = int(s*(s+1)/2-b)
print(s)

### FIXED CODE ###

num = input()
num = int(num)
if num <= 999 and num >= 0 :
    print('ABC')
elif num >= 1000 and num <= 1998 :
    print('ABD')
n=input()
a = list(map(int, input().split()))
ans=1
a0=a.index(0)

for i in range(len(a)):
    ans*= a[i]

    if a0>0:
        ans=0
        break
    if ans>=1000000000000000001:
        ans=-1
        break

print(ans)


### FIXED CODE ###

n=input()
a = list(map(int, input().split()))
ans=1
az=a.count(0)

if az>0:
    print(0)
else:
    for i in range(len(a)):
        ans*= a[i]
    
        if ans>=1000000000000000001:
            ans=-1
            break
    print(ans)
l = input().split()
a = int(l[0])
b  int(l[1])
if (a>8) or (b>8):
    print(":(")
else:
    print("Yay!")


### FIXED CODE ###

l = input().split()
a = int(l[0])
b = int(l[1])
if (a>8) or (b>8):
    print(":(")
else:
    print("Yay!")
n = 10000
ans = {}
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            i = x**2 + y**2 + z**2 + x*y + y*z + z*x
                ans.setdefault(i, 0)
                ans[i] += 1
for i in range(1, N+1):
    print(ans[i])


### FIXED CODE ###

N = int(input())
ans = {i:0 for i in range(100000)}
for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            i = x**2 + y**2 + z**2 + x*y + y*z + z*x
            ans[i] += 1
for i in range(1, N+1):
    print(ans[i])
n,d = map(int,input().split())

p = [list(map(int,input().split())) for i in range(n)]

kyori = d * d
count = 0

for s in range(n):
  nagasa = p[s][0] * p[s][0] + p[s][1] * p[s][1]
  if nagasa <= kyori:
    count += 1
    
print(count)


### FIXED CODE ###

x = int(input())

if x >= 30 :
  print("Yes")
 

else: 
  print("No")
N = int(input())
num = [int(i) for i in input().split()]
coment = 'Yes'

if N = 1:
  coment = 'Yes'
  
elif N = 2:
  if num[1] - num[0] < -1:
    coment = 'No'
    
else:
  for i in range(N-2):
    if num[i+1] - num[i] < -1:
      coment = 'No'
      break
    elif num[i+1] - num[i] < 0:
      if num[i+2] - num[i+1] < 0:
        coment = 'No'
        break

print(coment)

### FIXED CODE ###

N = int(input())
num = [int(i) for i in input().split()]
coment = 'Yes'

if N == 1:
  coment = 'Yes'
  
elif N == 2:
  if num[1] - num[0] < -1:
    coment = 'No'
    
else:
  for i in range(N-2):
    if num[i+1] - num[i] < -1:
      coment = 'No'
      break
    elif num[i+1] - num[i] < 0:
      for j in range(N-2-i):
        if num[i+2+j] - num[i+1] < 0:
          coment = 'No'
          break
        elif num[i+2+j] - num[i+1] > 0:
          break
          
print(coment)
from sys import stdin
n,k=map(int,input().split())
c=0
while n > 0:
    c += 1
    n//=k
print(c)


### FIXED CODE ###

from sys import stdin

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

if n < 10:
    print(r + 100 * (10-n))
else:
    print(r)
K=int(input())
A,B=(int(x) for x in input().split())
if K-(A%K)<=B-A or k==A:print('OK')
else:print('NG')


### FIXED CODE ###

K=int(input())
A,B=(int(x) for x in input().split())
if K-(A%K)<=B-A or A%K==0:print('OK')
else:print('NG')
N, K = map(int, input().split())
L = list(map(int, input().split()))

for i in range(K):
    ans += L.pop(max(L))

print(ans)

### FIXED CODE ###

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

L.sort(reverse=True)
print(sum(L[:K]))
import itertools

    IP  = input()
    
    A1 = int(IP[0])
    A2 = int(IP[2])
    A3 = int(IP[4])
    
    vec = [A1,A2,A3]
    com = list(itertools.permutations(vec))
    
    
    all_cos = [0,0,0,0,0,0]
    for i in range(6):
        tmp_com = com[i]
        
        tmp_A1 = tmp_com[0]
        tmp_A2 = tmp_com[1]
        tmp_A3 = tmp_com[2]
        
        cos1 = 0
        cos2 = abs(tmp_A1 - tmp_A2)
        cos3 = abs(tmp_A2 - tmp_A3)
        
        all_cos[i] = cos1 + cos2 + cos3
    
    res = min(all_cos)
    print(res)



### FIXED CODE ###

import itertools

A1,A2,A3 = map(int,input().split())
    
vec = [A1,A2,A3]
com = list(itertools.permutations(vec))
    
all_cos = [0,0,0,0,0,0]
for i in range(6):
    tmp_com = com[i]
        
    tmp_A1 = tmp_com[0]
    tmp_A2 = tmp_com[1]
    tmp_A3 = tmp_com[2]
        
    cos1 = 0
    cos2 = abs(tmp_A1 - tmp_A2)
    cos3 = abs(tmp_A2 - tmp_A3)
        
    all_cos[i] = cos1 + cos2 + cos3
    
res = min(all_cos)
print(res)
A , B , C , D = map(int,input().split())

if C == 1 and D == 1 :
  print(0)
else :
  print(z)



### FIXED CODE ###

import math
import fractions

# A以上B以下の数でXの倍数の個数
def countX(X) :
    if X > B :
        return 0

    minX = (A - 1) // X
    maxX = B // X

    return maxX - minX

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

ans = B - A + 1

# 最小公倍数
Z = int(C * D / fractions.gcd(C,D))

ans -= countX(C)
ans -= countX(D)
ans += countX(Z)

print(int(ans))
a, b = list(map(int, input().split(' ')))
print((a+b) // 2 if a + b % 2 == 0 else 'IMPOSSIBLE)

### FIXED CODE ###

a, b = map(int, raw_input().split(' '))
print (a + b) / 2 if (a + b) % 2 == 0 else 'IMPOSSIBLE'