peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n=int(input())
h=list(map(int,input().split()))

cnt=0

for i in range(1,n):
    if h[i-1]>h[i]:
        cnt+=1

if cnt==0:
    print('Yes')
if cnt>1:
     print('No')
if cnt==1:
    for j in range(1,n):
        if h[j-1]>h[j]:
            if h[j-1]-h[j]==1:
                print('Yes')
            else:
                print('No')
# Judge status: Accepted
N = [int(e) for e in input().split()]
if(N[0]*2>=N[1]):
    ans = N[1]//2
    print(ans)
else:
    ans = N[0] + (N[1] - N[0]*2)//4
    print(ans)
# Judge status: Accepted
n = list(map(int, input()))
dp = (0, 1)
for i in n:
  dp = (min(dp[0] + i, dp[1] + 10 - i), min(dp[0] + i + 1, dp[1] + 9 - i))
print(dp[0])
# Judge status: Accepted
N = int(input())
if N%10 ==0:
  ans = 10
else:
  NN = list(str(N))
  ans = 0
  for i in NN:
    ans += int(i)
print(ans)
# Judge status: Accepted
print(2**max((i^(i-1)).bit_length()-1 for i in range(int(input())+1)))
# Judge status: Accepted
N = int(input())
import math

num2alpha = lambda c: chr(c)
tmp_N = N
result = ''
while (tmp_N / 26) > 1.0:
    k = int(tmp_N / 26)
    res = tmp_N % 26
    if res == 0:
        res = 26
        k -= 1
    result += num2alpha(res+64).lower()
    tmp_N = k
res = tmp_N % 26
if res == 0:
    res = 26
    k -= 1
result += num2alpha(res+64).lower()
new_str = ''.join(list(reversed(result)))
print(new_str)
# Judge status: Accepted
def main():
    import sys
    N=int(sys.stdin.readline())
    count=0
    for i in range(N):
        D1,D2=list(map(int,sys.stdin.readline().split()))
        if D1==D2:
            count+=1
        else:
            count=0
        if count==3:
            print('Yes')
            break
    else:
        print('No')

main()
# Judge status: Wrong Answer
a,b = map(int,input().split())
c = b-a
wa = c*(c+1)//2
print(b-wa)
# Judge status: Accepted
from collections import deque

s = deque((str(input())))
loop = int(input())

rev = 0
for i in range(loop):
    queries = input().split()
    if len(queries) == 1:
        rev = (rev+1) % 2
    else:
        type = int(queries[1])
        c = str(queries[2])
        if (type + rev) % 2 == 1:
            s.appendleft(c)
        else:
            s.append(c)
if rev == 1:
    s.reverse()
print("".join(list(s)))
# Judge status: Wrong Answer
n = int(input())

INF = 10**9

dp = [INF] * (n+1)
dp[1] = 1

for i in range(1, n):
    dp[i+1] = min(dp[i+1], dp[i] +1)
    six = 6
    while i + six <= n:
        dp[i + six] = min(dp[i+six], dp[i] + 1)
        six *= 6
    nine = 9
    while i + nine <= n:
        dp[i + nine] = min(dp[i+nine], dp[i] + 1)
        nine *= 9
print(dp[-1])
# Judge status: Accepted
N, K = map(int, input().split())
S = input()

happy = 0
for i in range(N-1):
    if S[i] == S[i+1]:
        happy += 1

m = 0
for i in range(N-1):
    if S[i] == 'R' and S[i+1] == 'L':
        m += 1

if K <= m:
    happy += 2*K
else:
    if m > 1:
        happy += 2*m
    if S[0] != S[N-1]:
        happy += 1
print(happy)
# Judge status: Accepted
x,y=map(int,input().split())
c=0
while x<=y:
    x=x*2
    c+=1
print(c)
# Judge status: Accepted
#!/usr/bin/env python3

s,w=map(int,input().split())
if s<=w:
    print('unsafe')
else:
    print('safe')
# Judge status: Accepted
n = int(input())
l = [int(i) for i in input().split()]
ans = 0
b = True
while b:
    for i in range(n):
        if l[i]%2==0:
            l[i]/=2
        else:
            b=False
            break
    if b:
      ans+=1
print(ans)
# Judge status: Wrong Answer
n, *A = map(int, open(0).read().split())
c = [0]*9
for a in A:
  c[min(8, a//400)] += 1
cmin = max(1, 8-c.count(0))
cmax = min(8, cmin+c[8])
print(cmin, cmax)
# Judge status: Wrong Answer
a = list(input())
b = list(input())
c = list(input())

D = {'a':a, 'b':b, 'c':c}
curr = 'a'
while True:
  tmp = D[curr]
  if tmp == []:
    break
  curr = tmp.pop()
print(curr.upper())
# Judge status: Accepted
print("A" + input()[8:9] + "C")
# Judge status: Accepted
n=int(input())
lr=[]
for i in range(n):
  x,l=map(int,input().split())
  lr.append((x-l,x+l))
lr.sort(key=lambda x: x[1])
ans=0
l=-10**18
r=0
for i in range(n):
  if i==0:
    tl,tr=lr[i]
    l=tl
    r=tr
    ans+=1
    continue
  tl,tr=lr[i]
  if tl>=r:
    ans+=1
    r=tr
    l=tl
print(ans)
# Judge status: Accepted
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t=[input() for _ in range(m)]
ans=0
buf=0
s.sort()
t.sort()
for i in range(n):
    buf=0
    for j in range(i,n):
        if s[i]==s[j]:
            buf+=1
        elif s[i]<s[j]:
            break
    for j in range(m):
        if s[i]==t[j]:
            buf-=1
        elif s[i]<t[j]:
            break
    if buf>ans:
        ans=buf
print(ans)
# Judge status: Accepted
n, l = map(int, input().split())
S = [str(input()) for i in range(n)]
ans = ''
for s in sorted(S):
  ans += s
print(ans)
# Judge status: Accepted
N=int(input())
A=list(map(int, input().split()))
A=sorted(A, reverse=True)
ans=sum(A[1::2][:N])
print(ans)
#print(A)
#print(A[1::2])
# Judge status: Wrong Answer
W,H,X,Y = map(int, input().split())
C = X/W
D = Y/H
result2 = 0
result = 0
if C == 0 and D == 0:
    result = W*H*0.5
elif C == 0:
    result = D*W*H
elif D == 0:
    result = C*W*H
else:
    result = min(C,D)*W*H

if X != 0 and Y != 0:
    if X == Y:
        result2 = 1

print(result,result2)
# Judge status: Wrong Answer
a,b,c,d=map(int,input().split())
print("Yes" if abs(a-b)<=d or abs(c-a)<=d and abs(b-c)<=d else "No" )
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
a.insert(0, a[0])
a.append(a[-1])
INF = 10 ** 9 + 7

money = 1000
mi = INF
ma = 0
for i in range(1, n + 1):
    mi = min(mi, a[i])
    ma = max(ma, a[i])
    if a[i - 1] < a[i] >= a[i + 1]:
        stock = money // mi
        money %= mi
        money += stock * ma
        mi = a[i]
        ma = a[i]

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

n = int(input())
ac = []
for i in range(n):
    i = list(map(int,input().split()))
    ac.append(i)
ac = np.array(ac)
dp = [0]*n

cnt = 3 #二個目のfor文で0~2と被らないようにするため
for j in range(n):
    tmp = 0
    m = 0
    for k in range(3):
        if k != cnt:
            if tmp < ac[j][k]:
                tmp = ac[j][k]
                m = k
    cnt = m
    dp[j] = tmp

print(sum(dp))
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))
flag = True
for i in range(n-1):
    if h[i+1] - h[i] >= 1:
        h[i+1] -= 1
    elif h[i+1] -h[i] == 0:
        pass
    else:
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
# import math
# import statistics
a=int(input())
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#     c.append(i)
#e1,e2 = map(int,input().split())
f = list(map(int,input().split()))
#g = [input() for _ in range(a)]

count=0
for i in range(a-1):
    if f[i]!=f[i+1]-1:
        count+=1
if count==2 or count==0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

print('YES' if len(a) == len(set(a)) else 'NO')
# Judge status: Accepted
a = [7,5,3]
x = int(input())
if x in a:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
def solve(n, A):
    total = sum(A)
    x = A[0]
    ret = total
    for i in range(1, n - 1):
        x += A[i]
        y = total - x
        if abs(x - y) < ret:
            ret = abs(x - y)
    return ret

_n = int(input())
_A = list(map(int, input().split()))
print(solve(_n, _A))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
num_odd = 0
num_mul2 = 0
num_mul4 = 0
for a in A:
    if a % 4 == 0:
        num_mul4 += 1
    elif a % 2 == 0:
        num_mul2 += 1
    elif a % 2 == 1:
        num_odd += 1

ans = False
if num_mul2 == 0:
    if num_mul4 + 1>= num_odd:
        ans = True
else:
    if num_mul4 >= num_odd:
        ans = True
print('Yes' if ans else 'No')
# Judge status: Wrong Answer
word1 = input()
word2 = input()
up = list(word1)
down = list(word2)

if word1[0]==word2[2] and word1[1]== word2[1] and word1[2] == word2[0]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
w, a, b = map(int, input().split())

if a < b:
    ans = b - (a+w)
    if ans <= 0:
        print(0)
    else:
        print(ans)
else:
    ans = a - (b+w)
    if ans <= 0:
        print(0)
    else:
        print(ans)
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(lambda x:int(x) - 1, input().split()))

already = [False for i in range(N)]
already[0] = True
tel = [0]

while True:
    tmp = A[tel[-1]]
    tel.append(tmp)
    
    if already[tmp]:
        tel.pop()
        break
        
    already[tmp] = True

for i in range(len(tel)):
    if tel[i] == tmp:
        s = i
        break
if K - s >= 0:
    ans = (K - s) % (len(tel) - s) 
    print(tel[ans + s] + 1)
else:
    print(tel[K])
# Judge status: Accepted
N = int(input())
R = []
for _ in range(N):
    X, L = map(int, input().split())
    l, r = X-L, X+L
    R.append([l, r])

R = sorted(R, key=lambda x: x[1])
tmp = R[0]
ans = [R[0]]
for i in range(1, N):
    v = R[i]
    if tmp[1] <= v[0]:
        ans.append(v)
        tmp = v

print(len(ans))
# Judge status: Accepted
A,B,C=map(int, input().split())
print(max(0,C-(A-B)))
# Judge status: Accepted
k = int(input())

e = k // 2
o = k // 2 + k % 2

print(e*o)
# Judge status: Wrong Answer
n,k = map(int,input().split())
a = list(map(int,input().split()))
list.sort(a)
sum(a[0:k])
# Judge status: Wrong Answer
a,b,c = map(int,input().split())

if a == b:
    print(2)
elif a == c:
    print(2)
elif b == c:
    print(2)
elif a == b == c:
    print(1)
else:
    print(3)
# Judge status: Wrong Answer
#coding:utf-8
a, b = map(int, input().split())
count = 0

for i in range(a, b+1):
    num = str(i)
    if int(num[0:2]) == int(num[3:5]):
        count += 1

print(count)
# Judge status: Accepted
N,M = map(int,input().split())
a = [1]+[0]*(N-1)
b = [1]*N

for i in range(M):
  x,y = map(int,input().split())
  if a[x-1]==1 and b[x-1]==1:
    a[x-1]=0
    a[y-1]=1
  elif a[x-1]==1:
    a[y-1]=1
  b[x-1]-=1
  b[y-1]+=1
    
print(sum(a))
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
B=A[:]
count=0
zero=0
for i in range(N):
  if(A[i]<0):
    count+=1
  elif(A[i]==0):
    zero+=1
for i in range(N):
  B[i]=abs(A[i])
if(zero==0 and count%2==1):
  print(sum(B)-2*min(B))
else:
  print(sum(B))
# Judge status: Accepted
N = int(input())
AB = []
for _ in range(N):
    ab = list(map(int, input().split()))
    AB.append(ab)

AB.sort(key=lambda x:x[1])
sum_t = 0

for ab in AB:
    sum_t += ab[0]
    if sum_t > ab[1]:
        print("No")
        exit()

print("Yes")
# Judge status: Accepted
K = int(input())
S = input()

if len(S) > K:
    print(S[:K] + '...')
else:
    print(S)
# Judge status: Wrong Answer
n=list(map(int, input().strip().split()))

lis1=[]
for i in range(0,len(n)):
    for a in range(0,len(n)):
        if n[i]!=n[a]:
            z=(int(n[a])+int(n[i]))
            lis1.append(z)

minscore='9999999999'
for i in range(0,len(lis1)):
    if float(minscore)>float(lis1[i]):
        minscore=lis1[i]

print(minscore)
# Judge status: Wrong Answer
n,m= map(int,input().split())

t1=list(map(int,input().split()))
ans=set(t1[1:])
for _ in range(n-1):
    t2=list(map(int,input().split()))
    ans &= set(t2[1:])

print(ans)
# Judge status: Wrong Answer
n = int(input())
abc = [list(map(int, input().split())) for i in range(n)]
dp = [-1] * n
m = max(abc[0])
dp[0] = m
x = abc[0].index(m)

for i in range(1,n):
    t = -1
    for j in range(3):
        if x == j:
            continue
        if dp[i] < dp[i-1]+abc[i][j]:
            t = j
            dp[i] = dp[i-1]+abc[i][j]
    x = t
print(dp[-1])
# Judge status: Accepted
S = input()
S = S[:3]
print(S)
# Judge status: Accepted
import math
a, b, c = map(int, input().split())
if c - a - b > 0 and 4*a*b < (c - a - b)**2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input());
A = list(map(int,input().split()))

def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in a:
        x = (x * i) // gcd(x, i)
    return x

l = lcm(A)
ans = 0
for i in A:
	ans += l//i

MOD = 10**9+7
print(ans%MOD)
# Judge status: Accepted
n = int(input())
T,A = map(int,input().split())
h = list(map(int,input().split()))
#print(h)
l =[]
for i in range(n):
  a = T - h[i]*0.006
 # print(a)
  b = abs(a-A)
  l.append(b)
  #print(l)
c = l.index(min(l))
print(c+1)
# Judge status: Accepted
import sys
input=sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
def cmb(n):
    if n == 1:
        return 0
    else:
        return n * (n-1) /2
mydict = {}
for i in range(N):
    a = A[i]
    if a in mydict.keys():
        mydict[a] += 1
    else:
        mydict[a] = 1
s = 0
for i in mydict.values():
	s += cmb(i)
for i in range(N):
    a = A[i]
    x = mydict[a] - 1
    print(int(s-x))
# Judge status: Accepted
n,m=map(int,input().split())
al=[]
bl=[]
for _ in range(n):
    al.append(input())
for _ in range(m):
    bl.append(input())

bl_left_top=bl[0][0]

ans=0
for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            if al[i+k][j:j+m]!=bl[k]:
                break
            if k==m-1:
                ans=1
    if ans==1:
        break

print('Yes') if ans==1 else print('No')
# Judge status: Accepted
n = int(input())
print(int(n ** (1 / 2)) ** 2)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
total = str((a + b + c) / 2)
if total[-1] == '0':
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import itertools
n, m, q = map(int, input().split())
abcd = [tuple(map(int, input().split())) for _ in range(q)]
Max = 0
for A in itertools.combinations_with_replacement(range(1, m + 1), n):
    #score = sum([d for a, b, c, d in abcd if C[b - 1] - C[a - 1] == c])
    score = 0
    for ai, bi, ci, di in abcd:
        if A[bi - 1] - A[ai - 1] == ci:
            score += di
    Max = max(Max, score)
    #print(C)
print(Max)
# Judge status: Accepted
N,M = map(int,input().split())
A= list(map(int,input().split()))
D = sum(A)
if N < D:
    print(-1)
else:
    print(N-D)
# Judge status: Wrong Answer
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N, M = map(int, input().split())
    XY = [tuple(map(int, input().split())) for _ in [0] * M]

    box = [1] * (N + 1)
    red = [0] * (N + 1)
    box[0], red[1] = 0, 1
    for x, y in XY:
        box[x] -= 1
        box[y] += 1
        red[y] = red[x]
        if not box[x]:
            red[x] = 0
    print(sum(red))


main()
# Judge status: Accepted
from collections import *
n,m = map(int,input().split())
d = dict()
i,j = 1,n
for y in range(m):
	if(n%2 == 0 and i == (m+1)//2+1):
		i += 1
	print(i,j)
	i += 1
	j -= 1
# Judge status: Wrong Answer
n,x=[int(x) for x in input().split()]
l=[int(x) for x in input().split()]
d=0
cnt=0
for i in range(n):
  d=d+l[i]
  if d<=x:
    cnt+=1
print(cnt)
# Judge status: Wrong Answer
a, b = map(int, input().split())
c = 0
while a < b:
    if str(a)[:2] == str(a)[3:]:
        c += 1
    a += 1
print(c)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)

h = 0
w = 0


for i in range(N-1):
    if A[i] == A[i+1]:
        h = A[i]
        break

for i in range(N-1):
    if A[i] != h:
        if A[i] == A[i+1]:
            w = A[i]
            print(h*w)
            exit()

print(0)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    l=int(input())
    print((l/3)**3)
resolve()
# Judge status: Wrong Answer
dp = [10001 for i in range(100002)]
n = int(input())
hs = list(map(int, input().split()))

dp[0] = 0
for i in range(1, n):
    dp[i] = min(dp[i], dp[i-1] + abs(hs[i-1] - hs[i]))
    if i > 1 :
        dp[i] = min(dp[i], dp[i-2] + abs(hs[i-2] - hs[i]))

print(dp[n-1])
# Judge status: Wrong Answer
def main():
    n,a,b = map(int,input().split())
    MOD = (10**9)+7
    s = pow(2,n,MOD)
    u = 1
    bb = 1


    for i in range(1,(max(a,b) + 1)):
        u*=(n-i+1)%MOD
        bb*= i % MOD
        if i == a or i == b:
            s-=u*pow(bb,MOD-2,MOD)



    print(s%MOD)
#


if __name__=='__main__':
    main()
# Judge status: Accepted
n = int(input())
a = [0]*n
b = [0]*n
for i in range(n): a[i],b[i] = map(int,input().split())
a.sort()
b.sort()
if n%2 == 1:
    m = n//2
    ans = b[m] - a[m] + 1
else:
    ml = n//2-1
    mr = n//2
    ma = (a[ml] + a[mr])/2 
    mb = (b[ml] + b[mr])/2
    ans = int((mb - ma)*2 + 1)
print(ans)
# Judge status: Accepted
N = int(input())
robot = [list(map(int,input().split())) for _ in range(N)]

L = [[0,0] for _ in range(N)]
for i in range(N):
    L[i][0] = robot[i][0]-robot[i][1]
    L[i][1] = robot[i][0]+robot[i][1]-1

L.sort(key = lambda x:x[1])

a = 0
b = -float('inf')

for i in range(N):
    if b < L[i][0]:
        a += 1
        b = L[i][1]

print(a)
# Judge status: Accepted
x = int(input())
if x <= 599:
    print(8)
elif x <= 799:
    print(7)
elif x <= 999:
    print(6)
elif x <= 1199:
    print(5)
elif x <= 1399:
    print(4)
elif x <= 1599:
    print(3)
elif x <= 1799:
    print(2)
else:
    print(1)
# Judge status: Wrong Answer
contest = input()

if contest == "ABC":
    print("ARC")
else:
    print("ARC")
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
cou = 0

for i in range(0,n-1):
  if l[i]==i+1:
      l[i],l[i+1] = l[i+1], l[i]
      cou += 1
if l[-1]==n:
  cou += 1
print(cou)
# Judge status: Wrong Answer
n,K = map(int,input().split())
p = min(n,K-1)
ans = 0
chk = [1]*(K-1)
k = K
for i in range(14):
  k /= 2
  for i in range(int(k*2-k-0.000000000000000001)):
    chk[i] += 1
  if k <= 1:
    break
    
#print(chk)
for i in range(p):
  ans += float(1/(2**chk[i]*n))
  #print(ans)
ans += max(0,(n-K+1)/n)
print(ans)
# Judge status: Accepted
N,M = map(int,input().split())

#nの約数列挙
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass #sortされていない

div = divisor(M)
ans = 0
for d in div:
    if M//d >= N:
        ans = max(ans,d)
print(ans)
# Judge status: Wrong Answer
import random
S = input()
i = len(S)
m = random.randint(0,i-3)
print (S[m],S[m+1],S[m+2])
# Judge status: Wrong Answer
a, b, c = list(map(int, input().split()))

if (a+b) <= c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, L = map(int, input().split())
S = [0]*N
for i in range(N):
    S[i] = input()

S.sort()
print(''.join(S))
# Judge status: Wrong Answer
import math
n=int(input())
num=math.log(n,10)
if 0<=num<1:
  print(n)
elif 1<=num<2:
  print(n-90)
elif 2<=num<3:
  print(909)
elif 3<=num<4:
  print(909)
elif 4<=n<5:
  print(n-9090)
else:
  print(90909)
# Judge status: Accepted
n = int(input())
l = [[0,0] for _ in range(n)]
for i in range(n):
    x,y = map(int,input().split())
    l[i] = [x-y,x+y]
ans = 0
for i in range(2):
    l2 = [l[j][i] for j in range(n)]
    ans = max(ans,max(l2)-min(l2))
print(ans)
# Judge status: Accepted
n = int(input())
b = list(map(int,input().split()))
s = b[0] + b[-1]

for i in range(1,n-1):
    s += min(b[i-1],b[i])
    
print(s)
# Judge status: Accepted
A, B= map(int, input().split())
print(A*B)
# Judge status: Accepted
x,y,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

l = p[:x]
l.extend(q[:y])
l.extend(r)
l.sort(reverse=True)
ans = sum(l[:x+y])

print(ans)
# Judge status: Wrong Answer
n = int(input())
s = input()
t = input()

ans = s+t
for i in range(n):
    if s[i:]==t[:n-i]:
        ans = s[:i]+s[i:]+t[n-i:]

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

def f(x):
    if M >= 2*x and N+(M-2*x)//2 >= x:
        return True
    return False

l = 0
r = 10**12
while r-l > 1:
    m = (l+r)//2
    if f(m):
        l = m
    else:
        r = m

if f(r):
    print(r)
else:
    print(l)
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(k, n):
    if a[i - k] < a[i]:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
N = int(input())
L = list(map(int,input().split()))
L.sort()
count = 0
print(L)
for i in range(N):
    for j in range(i,N):
         for k in range(j,N):
            a = L[i]
            b = L[j]
            c = L[k]
            if(a != b and b != c and c != a):
                if (a + b > c and a + c > b and b + c > a):
                    count += 1
print(count)
# Judge status: Accepted
A, B, K = [int(num) for num in input().split()]
M, m = max(A, B), min(A, B)
yakusu = []
koyakusu = []
for i in range(1, m+1):
  if m % i == 0:
    yakusu.append(i)
  else:
    continue
for j in yakusu:
  if M % j == 0:
    koyakusu.append(j)
print(koyakusu[-K])
# Judge status: Accepted
S = input()
print("2018"+S[4:10])
# Judge status: Accepted
s = list(input())
t = list(input())
for _ in range(len(s)):
    if s == t:
        print("Yes")
        quit()
    else:
        end = s.pop(0)
        s.append(end)
print("No")
# Judge status: Accepted
#176-A Takoyaki

takoyaki = input().split()

totalTime = -(-int(takoyaki[0]) // int(takoyaki[1])) * int(takoyaki[2])
print(totalTime)
# Judge status: Wrong Answer
s = input()
res = "Yes" if len(set(s)) < 3 else 'No'
print(res)
# Judge status: Accepted
# coding: utf-8
from math import ceil
from bisect import bisect_left
N = int(input())
A = list(map(int, input().split()))
A.sort()
a = A[-1]
ans = ceil(a / 2)
b = float("inf")
for i in range(N):
    if abs(b - ans) > abs(A[i] - ans):
        b = A[i]
print(a, b)
# Judge status: Accepted
N = int(input())
 
if N % 2 == 0:
  print(int(N / 2))
else:
  print(int((N + 1) / 2))
# Judge status: Accepted
from collections import defaultdict
N = int(input())
raw_numbers = list(map(int, input().split()))
numbers = defaultdict(int)

for num in raw_numbers:
    numbers[num] += 1
    
total = sum(raw_numbers)
    
Q = int(input())

for _ in range(Q):
    a, b = list(map(int, input().split()))
    taken = numbers[a]
    total -= a * numbers[a]
    numbers[b] += numbers[a]
    total += b * taken
    numbers[a] = 0
    print(total)
# Judge status: Accepted
import sys
X = int(input())
if not ( 1 <= X <= 9 ): sys.exit()

print('YES') if X == 3 or X == 5 or X == 7 else print('NO')
# Judge status: Accepted
n = int(input())
a = [list(map(int, input().split())) for _ in range(2)]
x = sum(a[1])+a[0][0]
ans = x
for i in range(1,n):
  x += a[0][i] -a[1][i-1]
  if ans < x: ans = x
print(ans)
# Judge status: Wrong Answer
n = sorted(input())
m = sorted(input())
if n<m:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())

# 1 <= N <= 10**5 = 100,000

if N <= 99:
  print(min(N, 9))
elif N <= 9999:
  ans = 9 + (min(N, 999) - 99)
  print(ans)
else:
  ans = 9 + 900 + (min(N, 99999) - 9999)
  print(ans)
# Judge status: Accepted
N,K = map(int,input().split())
fruit = [int(i) for i in input().split()]

fruit.sort()
price = 0
for i in range(N) :
    if i>K-1 :
        break
    price += fruit[i]
    
print(price)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
total = sum(A)
mid = total // 2
sum_left, sum_left2 = 0, 0
sep_i = 0
for i, a in enumerate(A):
  sum_left += a
  if sum_left >= mid:
    sep_i = i
    sum_left2 = sum_left - a
    break
sum_right, sum_right2 = sum(A[sep_i + 1:]), sum(A[sep_i:])
print(min(abs(sum_right - sum_left), abs(sum_right2 - sum_left2)))
# Judge status: Wrong Answer
import math

a,b,h,m = map(int, input().split())
start = 30*h
d = min(abs(start - 5.5 * m),360-abs(start - 5.5 * m))
if int(d)!=90 and int(d)!= 0:
    c = math.cos(math.radians(d))
    k = a**2+b**2-2*a*b*c
    ans = math.sqrt(k) 
    print(ans)
elif int(d) == 0:
    print(abs(a-b))
elif int(d) ==90:
    k= a**2+b**2
    ans = math.sqrt(k)
    print(ans)
# Judge status: Accepted
X = int(input())
cnt = 0
val = 100
while True:
    val = int(val * 1.01)
    cnt += 1
    if X <= val:
        break
print(cnt)
# Judge status: Wrong Answer
L=[int(input()) for _ in range(5)]
k=int(input())
for i in range(1,5):
  if L[i]-L[i-1]>k:
    print(":(")
    exit()
print("Yay!")