Harryxun/stf_run huggingface dataset:
def checks(s) :
	ret = 'NO'
	if len(s) < 5 :
		return 'NO'
	elif( s[0] == 'd' ) :
		#dream
		if s[:5] == 'dream' :
			if len(s) != 5 :
				ret = checks(s[5:])
			else :
				return 'YES'
		#dreamer
		if ( len(s) > 6 ) and ( ret != 'YES' ) and (s[:7] == 'dreamer') :
			if len(s) != 7 :
				ret = checks(s[7:])
			else :
				return 'YES'
	elif( s[0] == 'e' ) :
		#erase
		if s[:5] == 'erase' :
			if len(s) != 5 :
				ret = checks(s[5:])
			else :
				return 'YES'
		#eraser
		if ( len(s) > 5 ) and ( ret != 'YES' ) and ( s[:6] == 'eraser' ) :
			if len(s) != 6 :
				ret = checks(s[6:])
			else :
				return 'YES'
	return ret

S = input()

print(checks(S))

### FIXED CODE ###

s = input()

tmp_index = 0

while(len(s) - tmp_index > 4) :

	if( s[tmp_index] == 'd' ) :
		if s[tmp_index:tmp_index+7] == 'dreamer' :
			if ( s[tmp_index + 5:tmp_index + 10] == 'erase' ):
				tmp_index += 5
			else :
				tmp_index += 7
		elif s[tmp_index:tmp_index+5] == 'dream' :
			tmp_index += 5
		else :
			tmp_index = len(s) - 1
			
	elif( s[tmp_index] == 'e' ) :
		if  s[tmp_index:tmp_index + 6] == 'eraser' :
			tmp_index += 6
		elif s[tmp_index:tmp_index+5] == 'erase' :
			tmp_index += 5
		else :
			tmp_index = len(s) - 1
	else :
		tmp_index = len(s) - 1
	if len(s) == tmp_index :
		print('YES')
	elif len(s) - tmp_index < 5 :
		print('NO')
# E - Multiplication 4
import heapq
N, K = map(int, input().split())
A = list(int(a) for a in input().split())
MOD = 10**9 + 7

# N = K の時
if N == K:
    ans = 1
    for a in A:
        ans = (ans * a) % MOD

else:
    pos = []
    neg = []
    for a in A:
        if a >= 0:
            pos.append(a)
        else:
            neg.append(a)

    # 必ずマイナスになる時＝全てがマイナスの値であり、
    # かつKが奇数の時
    if len(neg) == N and K&1 == 1:
        neg.sort(reverse=True)
        ans = 1
        for i in range(K):
            ans = (ans * neg[i]) % MOD

    # それ以外のプラスになるケース
    # プラスの要素とマイナスの要素を絶対値の大きい順にソートし、
    # Kが奇数であれば、プラスのリストから1つ選び、
    # 残りの偶数個のKに対して、２つずつを選んだ時の
    # 大きい方から取得していく
    else:
        pos.sort(reverse=True)
        pos2 = []
        ans = 1
        ini = 0
        if K&1 == 1:
            ans = (ans * pos[0]) % MOD
            ini = 1
        for i in range(ini, len(pos)//2, 2):
            heapq.heappush(pos2, (pos[i] * pos[i+1])*-1)
        neg.sort()
        neg2 = []
        for i in range(0, len(neg)//2, 2):
            heapq.heappush(neg2, (neg[i] * neg[i+1]) * -1)
        rem = K-1
        while rem > 0:
            if pos2[0] <= neg2[0]:
                tmp = heapq.heappop(pos2) * -1
            else:
                tmp = heapq.heappop(neg2) * -1
            ans = (ans * tmp) % MOD
            rem -= 2

print(ans)

### FIXED CODE ###

# E - Multiplication 4
import heapq
N, K = map(int, input().split())
A = list(int(a) for a in input().split())
MOD = 10**9 + 7

# N = K の時
if N == K:
    ans = 1
    for a in A:
        ans = (ans * a) % MOD

else:
    pos = []
    neg = []
    for a in A:
        if a >= 0:
            pos.append(a)
        else:
            neg.append(a)

    # 必ずマイナスになる時＝全てがマイナスの値であり、
    # かつKが奇数の時
    if len(neg) == N and K&1 == 1:
        neg.sort(reverse=True)
        ans = 1
        for i in range(K):
            ans = (ans * neg[i]) % MOD

    # それ以外のプラスになるケース
    # プラスの要素とマイナスの要素を絶対値の大きい順にソートし、
    # Kが奇数であれば、プラスのリストから1つ選び、
    # 残りの偶数個のKに対して、２つずつを選んだ時の
    # 大きい方から取得していく
    else:
        pos.sort(reverse=True)
        pos2 = []
        ans = 1
        ini = 0
        rem = K
        if K&1 == 1:
            ans = (ans * pos[0]) % MOD
            ini = 1
            rem -= 1
        for i in range(0, (len(pos)-ini)//2):
            heapq.heappush(pos2, (pos[i*2+ini] * pos[i*2+ini+1])*-1)
        neg.sort()
        neg2 = []
        for i in range(0, len(neg)//2):
            heapq.heappush(neg2, (neg[i*2] * neg[i*2+1]) * -1)
        while rem > 0:
            if (pos2 != [] and neg2 == []) or (pos2 != [] and neg2 != [] and pos2[0] <= neg2[0]):
                tmp = heapq.heappop(pos2) * -1
            else:
                tmp = heapq.heappop(neg2) * -1
            ans = (ans * tmp) % MOD
            rem -= 2

print(ans)
from collections import deque
import sys

N_MAX = 200000 + 5

H, W, K = map(int, input().split())
sth, stw, glh, glw = map(int, input().split())

INF = 10**6 * K

dp = [[INF for _ in range(W + 2)] for _ in range(H + 2)]

dp[0] = [-1] * (W + 2)
dp[H + 1] = [-1] * (W + 2)
for h in range(1, H + 1):
    s = sys.stdin.readline()
    dp[h][0] = -1
    dp[h][W + 1] = -1
    for w in range(1, W + 1):
        if s[w - 1] == "@":
            dp[h][w] = -1

dp[sth][stw] = 0


# Seen = [[INF]*W for _ in range(H)]
XY = {(1, 0), (-1, 0), (0, 1), (0, -1)}


def bfs(sth, stw, glh, glw):
    next_q = deque()
    next_q.append((sth, stw))

    while len(next_q) != 0:
        # キュー取り出し(先頭)
        h, w = next_q.popleft()
        for dh, dw in XY:
            for sk in range(1, K + 1):
                hs, ws = h + dh * sk, w + dw * sk
                if dp[hs][ws] == -1:
                    break
                if dp[hs][ws] == INF:
                    next_q.append((hs, ws))
                    dp[hs][ws] = dp[h][w] + 1
                elif dp[hs][ws] <= dp[h][w]:
                    # もし、dp[hs][ws] が 今の値以下なら
                    # その先はdp[hs][ws]をもとに 書き込まれている or 今後書き込まれる ので止める
                    break
                # if hs == glh and ws == glw:
                #    return dp[h][w] + 1
    # return -1


def main():
    bfs(sth, stw, glh, glw)

    if dp[glh, glw] == INF:
        print(-1)
    else:
        print(dp[glh, glw])


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-
 
H, W, K = map(int,input().split())
sth, stw, glh, glw = map(int,input().split())
sth, stw = sth-1, stw-1
glh, glw = glh-1, glw-1
 
INF = -1
Gmap = [list(input()) for _ in range(H)]
Seen = [[INF]*W for _ in range(H)]
direc = {(1,0), (-1,0), (0,1), (0,-1)}
 
from collections import deque
 
def bfs(sth, stw, glh, glw):
    next_q = deque([])
    next_q.append((sth,stw,0))
    Seen[sth][stw] = 0
 
    while len(next_q)!=0:
        #キュー取り出し(先頭)
        h, w, c = next_q.popleft()
        for dh, dw in direc:
            for sk in range(1,K+1):
                hs, ws = h + dh*sk, w + dw*sk
                if not (0<=hs<H and 0<=ws<W):
                    break
                if Gmap[hs][ws]=='@':
                    break
                if Seen[hs][ws]==INF:
                    next_q.append((hs,ws,c+1))
                    Seen[hs][ws] = c + 1
                elif Seen[hs][ws]<=c:
                    break
                if hs==glh and ws==glw:
                    return c + 1
    return -1

def main():
    ret = bfs(sth, stw, glh, glw)
    print(ret)

if __name__ == '__main__':
    main()
from collections import deque, _heapq
N, K = map(int, input().split())
V = deque(map(int, input().split()))

class Money:
    def __init__(self):
        self.yen = 0
        self.red = []

    def value(self):
        return self.yen + sum(self.red)

    def add(self, yen):
        if yen >= 0:
            self.yen += yen
        else:
            self.red.append(yen)

    def remove(self, yen):
        if yen >= 0:
            self.yen -= yen
        else:
            self.red.remove(yen)

#mny = Money()
def get(cnt, mny, lstop, rstop):
    ans = mny.value()

    if cnt <= 0:
        return ans

    if len(V) > 0:

        if lstop == 0:
            w = V.popleft()
            mny.add(w)
            ans = max(ans, get(cnt-1, mny, lstop, rstop))
            mny.remove(w)
            V.appendleft(w)
        elif lstop > 0:
            lstop -= 1

        if rstop == 0:
            w = V.pop()
            mny.add(w)
            ans = max(ans, get(cnt-1, mny, -1, rstop))
            mny.remove(w)
            V.append(w)

    if len(mny.red) >= cnt // 2:
        w = min(mny.red)
        mny.red.remove(w)

        V.appendleft(w)
        ans = max(ans, get(cnt-1, mny, -1, rstop))
        V.popleft()

        V.append(w)
        ans = max(ans, get(cnt-1, mny, lstop, -1))
        V.pop()

        mny.red.append(w)    

    return ans

print(get(K, Money(), 0, 0))


### FIXED CODE ###

from collections import deque, _heapq
N, K = map(int, input().split())
V = deque(map(int, input().split()))

class Money:
    def __init__(self):
        self.yen = 0
        self.red = []

    def value(self):
        return self.yen + sum(self.red)

    def add(self, yen):
        if yen >= 0:
            self.yen += yen
        else:
            self.red.append(yen)

    def remove(self, yen):
        if yen >= 0:
            self.yen -= yen
        else:
            self.red.remove(yen)

#mny = Money()
def get(cnt, mny, lstop, rstop):
    ans = mny.value()

    if cnt <= 0:
        return ans

    if len(V) > 0:

        if lstop == 0:
            w = V.popleft()
            mny.add(w)
            ans = max(ans, get(cnt-1, mny, lstop, rstop))
            mny.remove(w)
            V.appendleft(w)
        elif lstop > 0:
            lstop -= 1

        if rstop == 0:
            w = V.pop()
            mny.add(w)
            ans = max(ans, get(cnt-1, mny, -1, rstop))
            mny.remove(w)
            V.append(w)

    if len(mny.red) > 0:
        w = min(mny.red)
        mny.red.remove(w)

        V.appendleft(w)
        ans = max(ans, get(cnt-1, mny, -1, -1))
        V.popleft()

        mny.red.append(w)    

    return ans

print(get(K, Money(), 0, 0))
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))

print(gcd(a))


### FIXED CODE ###

from fractions import gcd
from functools import reduce

n = int(input())
a = list(map(int, input().split()))

print(reduce(gcd, a))
n,l=map(int,input().split())
m=map(str,input())
A=m[l-1]
for i in range(5):
    if m[i]==A:
        continue
        if m[i]!=A:
            m.replace(m[i],'*')
print(m)

### FIXED CODE ###

n,s,k=int(input()),input(),int(input()) #入力を順番に一気に定義する
A=s[k-1]
for i in range(n):
    if s[i]!=A:
        s=s.replace(s[i],'*')
print(s)
n=int(input())
d=[int(input()) for _ in range(n)]
from collections import deque
d.sort()
a=deque(d)

tmpl=a.popleft()
tmpr=tmpl
ans=0
i=0

while len(a)>0:
    #0 大きいほうから
    if i%4==0:
        tmp=a.pop()
        ans+=abs(tmpl-tmp)
        tmpl=tmp

    #1 大きいほうから
    elif i%4==1:
        tmp=a.pop()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    #2 小さいほうから
    elif i%4==2:
        tmp=a.popleft()
        ans+=abs(tmpl-tmp)
        tmpl=tmp


    #3 小さいほうから
    elif i%4==3:
        tmp=a.popleft()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    i+=1

res=ans

d.sort(reverse=True)
a= deque(copy.deepcopy(d))

tmpl=a.popleft()
tmpr=tmpl
ans=0
i=0

while len(a)>0:
    #0 大きいほうから
    if i%4==0:
        tmp=a.pop()
        ans+=abs(tmpl-tmp)
        tmpl=tmp

    #1 大きいほうから
    elif i%4==1:
        tmp=a.pop()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    #2 小さいほうから
    elif i%4==2:
        tmp=a.popleft()
        ans+=abs(tmpl-tmp)
        tmpl=tmp


    #3 小さいほうから
    elif i%4==3:
        tmp=a.popleft()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    i+=1

print(max(ans,res))




            




### FIXED CODE ###

n=int(input())
d=[int(input()) for _ in range(n)]
from collections import deque
d.sort()
a=deque(d)

tmpl=a.popleft()
tmpr=tmpl
ans=0
i=0

while len(a)>0:
    #0 大きいほうから
    if i%4==0:
        tmp=a.pop()
        ans+=abs(tmpl-tmp)
        tmpl=tmp

    #1 大きいほうから
    elif i%4==1:
        tmp=a.pop()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    #2 小さいほうから
    elif i%4==2:
        tmp=a.popleft()
        ans+=abs(tmpl-tmp)
        tmpl=tmp


    #3 小さいほうから
    elif i%4==3:
        tmp=a.popleft()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    i+=1

res=ans
import copy
d.sort(reverse=True)
a= deque(copy.deepcopy(d))

tmpl=a.popleft()
tmpr=tmpl
ans=0
i=0

while len(a)>0:
    #0 大きいほうから
    if i%4==0:
        tmp=a.pop()
        ans+=abs(tmpl-tmp)
        tmpl=tmp

    #1 大きいほうから
    elif i%4==1:
        tmp=a.pop()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    #2 小さいほうから
    elif i%4==2:
        tmp=a.popleft()
        ans+=abs(tmpl-tmp)
        tmpl=tmp


    #3 小さいほうから
    elif i%4==3:
        tmp=a.popleft()
        ans+=abs(tmpr-tmp)
        tmpr=tmp

    i+=1

print(max(ans,res))
from operator import itemgetter

A, B, C, D, E, F = list(map(int,input().split()))
X = []
ans = 1000
for a in range(31):
    for b in range(31):
        for c in range(31):
            for d in range(31):
                w = 100*A*a+100*B*b #砂糖水の質量
                s = C*c+D*d        #砂糖の質量
                if w == 0 or s == 0 or w + s >= F: #ダメな条件
                    break
                else:
                    if s/(w+s) <= E/(100 + E):
                        ans = 100 * s/(w+s)
                        X.append([ans,w + s, s])
X = sorted(X,key=itemgetter(0),reverse = True) 
print(X[0][1],X[0][2])

### FIXED CODE ###

from operator import itemgetter

A, B, C, D, E, F = list(map(int,input().split()))
X = []
ans = 1000
for i in range(31):
    for j in range(31):
        for k in range(51):
            for l in range(51):
                if 100*A*i+100*B*j+C*k+D*l != 0:
                    if 100*A*i+100*B*j+C*k+D*l <= F and (C*k+D*l)/(100*A*i+100*B*j+C*k+D*l) <= E/(100 + E):
                        ans =(E/(100 + E) - (C*k+D*l)/(100*A*i+100*B*j+C*k+D*l))
                        X.append([ans , 100*A*i+100*B*j+C*k+D*l, C*k+D*l])
X = sorted(X,key=itemgetter(0),reverse = False) 

print(X[0][1],X[0][2])
n,k = map(int,input().split())

arr = list(input())

for _ in range(k):
    whl = [i for i, x in enumerate(arr) if x == 'L']
    whr = [i for i, x in enumerate(arr) if x == 'R']
    a=[]
    for i in range(1,len(whl)):
        a.append(whl[i]-whl[i-1])
    
    b=[]
    for i in range(1,len(whr)):
        b.append(whr[i]-whr[i-1])
    
    suma = []
    for i in range(len(a)-1):
        suma.append(a[i]+a[i+1])
    
    sumb = []
    for i in range(len(b)-1):
        sumb.append(b[i]+b[i+1])
    
    
    
    if max(suma) > max(sumb):
        na = suma.index(max(suma))
        
        arr[whl[na]+1:whl[na+2]] = arr[whl[na]+1:whl[na+2]][::-1]
        for i in range(whl[na]+1,whl[na+2]):
            if arr[i] == "L":
                arr[i] = "R"
            else:
                arr[i] = "L"

    
    else:
        nb = sumb.index(max(sumb))
        
        arr[whr[nb]+1:whr[nb+2]-1] = arr[whr[nb]+1:whr[nb+2]-1][::-1]
        for i in range(whr[nb]+1,whr[nb+2]):
            if arr[i] == "L":
                arr[i] = "R"
            else:
                arr[i] = "L"

count = 0
for i in range(len(arr)-1):
    if arr[i]==arr[i+1]:
        count+=1
print(count)

### FIXED CODE ###

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

ans = 0
for i in range(n-1):
    if arr[i] == arr[i+1]:
        ans +=1

ans +=k*2

if ans>n-1:
    ans = n-1

print(ans)
a,b.c = input().split(",")
print(a,b,c)

### FIXED CODE ###

a,b,c = input().split(",")
print(a,b,c)
x=int(input())
if x == 1:
  print('Hello World')
else:
  a,b=map(int,input().split())
  print(int(a+b))

### FIXED CODE ###

x=int(input())
if x == 1:
  print('Hello World')
else:
  a=int(input())
  b=int(input())
  print(a+b)
import math

h = int(input())
a = int(input())
 
print(math.ceil(h/a))

### FIXED CODE ###

import math

val = input().split(' ')
h = float(val[0])
a = float(val[1])

print(math.ceil(h/a))
N, M = map(int, input().split())
results = [input().split() for _ in range(M)]
solved = set()
missed = dict()
penalty = 0

for p, S in results:
    if p in solved:
        continue

    if S == 'AC':
        solved.add(p)
        penalty += missed[p]
    elif p not in missed:
        missed[p] = 1
    else:
        missed[p] += 1

print(len(solved), penalty)

### FIXED CODE ###

N, M = map(int, input().split())
results = [input().split() for _ in range(M)]
solved = set()
missed = dict()
penalty = 0

for p, S in results:
    if p in solved:
        continue

    if S == 'AC':
        solved.add(p)
        penalty += missed[p] if p in missed else 0
    else:
        missed[p] = missed[p] + 1 if p in missed else 1

print(len(solved), penalty)
from fractions import gcd

N = int(input())
T = []
for i in range(N):
  T.append(int(input()))

res = 1
for t in T:
  res = int(res/(gcd(res, t))) * t
print(res)

### FIXED CODE ###

import sys

N = input()

for i in range(len(N)):
  if N[i] != N[len(N)-1-i]:
    print("No")
    sys.exit()

print("Yes")
n = int(input())
l = [2,1]

if n == 1:
    print(1)

else:
    for i in range(2,n+1):
        l.append(int(l[i-1] +l[i-2]))
	print(l[n])


### FIXED CODE ###

n = int(input())
l = [2,1]

if n == 1:
    print(1)

else:
    for i in range(2,n+1):
        l.append(int(l[i-1] +l[i-2]))
    print(l[n])
n = int(input())
list1 = [int(x) for x in input().split()]
list2 = list(reversed(sorted(list1)))
m = list2[0]

ans = []
for i in range(1, len(list2)):
  if list2[i] == m:
    ans.append(m)
  if len(ans) == 2:
    break
  m = list2[i]

print(ans[0] * ans[1])

### FIXED CODE ###

n = int(input())
list1 = [int(x) for x in input().split()]
list2 = list(reversed(sorted(list1)))

fflag = 0
ans = []
for i in range(len(list2) - 1):
  if fflag ==0:
    if list2[i] == list2[i + 1]:
      ans.append(list2[i])
      fflag = 1
  elif fflag == 1:
    fflag = 0
    continue
  if len(ans) == 2:
    break

if len(ans) == 2:
  print(ans[0] * ans[1])
else:
  print(0)
from operator import itemgetter

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

a = []
R=[]
D = 0
X = 0
for i in range(N):
    a.append(list(map(int,input().split())))
if N ==1:
    Z = M*a[0]
    print(Z)
else:
    a.sort(key = itemgetter(0))

    for i in range(N):
        D += a[i][1]
        if D>M:
            R.append(i)
            break
    for i in range(R[0]+1):
        X += a[i][0]*a[i][1]
    Y = X-(D-M)*a[R[0]][0]
    print(Y)

### FIXED CODE ###

from operator import itemgetter

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


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

if N ==1:
    Z = M*a[0][0]
    print(Z)
else:
    a.sort(key = itemgetter(0))
    X = 0 
    D = 0
    var=0
    while M>D:
        D+=a[var][1]
        X+=a[var][0]*a[var][1]
        var+=1
        
    X += a[var-1][0]*(M-D)
    print(X)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# D-Grid and Integers

from collections import defaultdict

def ReadInput():
	return [int(i) for i in input().split(" ")]

(R, C) = ReadInput()
N = int(input())
VectorSet = set() 
Grid = defaultdict(list)
for i in range(N):
	(r, c, a) = ReadInput()
	Grid[("R", r)].append((("C", c), a))
	Grid[("C", c)].append((("R", r), a))
	VectorSet.add(('R', r))
	VectorSet.add(('C', c))

def iteration(vector):
	VectorSet.discard(vector)
	for (v, a) in Grid[vector]:
		temp = a - VectorCover[vector]
		if (v in VectorCover):
			if(temp != VectorCover[v]):
				print("No")
				print("No equal")
				exit()
		else:
			VectorCover[v] = temp
			iteration(v) 

while(len(VectorSet) != 0):
	vector = VectorSet.pop()
	VectorCover = dict() 
	VectorCover[vector] = 0
	iteration(vector)
	minR = min(a for (p, a) in VectorCover.items() if (p[0] == "R"))
	minC = min(a for (p, a) in VectorCover.items() if (p[0] == "C"))
	if (minR + minC < 0):
		print("No")
		print("min")
		exit()
		
print("Yes")

### FIXED CODE ###

#A-Codefestival 2016
str=input()
str1=str[:4]+" "+str[4:]
print(str1)
A, B = map(int(), input().split())
print(A*B)

### FIXED CODE ###

A, B = map(int, input().split())
print(A*B)
N, M = map(int, input().split())
x = list(map(int, input().split()))

x.sort()
s = [0] * (M - 1)
for i in range(M - 1):
    s[i] = x[i + 1] - x[i]

s.sort(reverse=True)

res = sum(s)
if M == 1:
    print(0)
else:
    for i in range(N - 1):
        res -= s[i]

print(res)

### FIXED CODE ###

N, M = map(int, input().split())
x = list(map(int, input().split()))
if N >= M:
    print(0)
    quit()


x.sort()
s = [0] * (M - 1)
for i in range(M - 1):
    s[i] = x[i + 1] - x[i]

s.sort(reverse=True)

res = sum(s)
if M == 1:
    print(0)
    quit()
else:
    for i in range(N - 1):
        res -= s[i]

print(res)
num = int(input())

count_max = 0
for i in range(num)
  tmp = i
  count = 0
  while tmp % 2 == 0:
    tmp = tmp / 2
    count += 1
  if conut > count_max:
    count_max = count


### FIXED CODE ###

num = int(input())

count_max = 0
num_max = 0
for i in range(1, num+1):
  tmp = i
  count = 0
  while tmp % 2 == 0:
    tmp = tmp / 2
    count += 1
  if count >= count_max:
    count_max = count
    num_max = i

if num == 1:
  print(1)
else:
  print(num_max)
from bisect import bisect_left

n = input()
ls = list(map(int, input().split()))
count = 0
for i in range(n - 2):
  for j in range(i + 1, n - 1):
    two_sides_sum = ls[i]+ ls[j]
    bi = bisect_left(ls, two_sides_sum)
    count += bi - j - 1
print(count)

### FIXED CODE ###

import bisect
n = int(input())

li = list(map(int, input().split()))
li.sort()

count = 0

for i in range(n - 2):
  for j in range(i + 1, n - 1):
    bi = bisect.bisect_left(li, li[i] + li[j])
    count += bi - j - 1
print(count)
N=input()
ans=0
hoge=0
for i in range(N-1):
  if A[i] >A[i+1]:
    hoge+=1
    ans=max(ans,hoge)
print(ans)

### FIXED CODE ###

N = int(input())
H = list(map(int,input().split()))
ans = 0
x = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    x += 1
    ans = max(ans,x)
  else:
    x = 0
print(ans)
O = input()
E = input()

ans = []
while True:
    if O == []:
        break
    ans.append(O.pop(0))
    if E == []:
        break
    ans.append(E.pop(0))

print("".join(ans))

### FIXED CODE ###

O = list(input())
E = list(input())

ans = []
while True:
    if O == []:
        break
    ans.append(O.pop(0))
    if E == []:
        break
    ans.append(E.pop(0))

print("".join(ans))
n,k = map(int,input().split())
a = sorted(list(map(int,input().split())) for i in range(n))
i = 0
while k > 0:
    k -= a[i][1]
    i += 1
print(a[i+1][0])

### FIXED CODE ###

n,k = map(int,input().split())
a = sorted(list(map(int,input().split())) for i in range(n))
i = 0
while k > 0:
    k -= a[i][1]
    i += 1
print(a[i-1][0])
def fun(i):
    if dp[i]!=-1:
        return dp[i]
    if i==n-1:
        best=0
    elif i==n-2:
        best=abs(h1[n-1]-h1[n-2])
    else:
        best=min(fun(i+1)+abs(h1[i+1]-h1[i]),fun(i+2)+abs(h1[i+2]-h1[i]))
    dp[i]=best
    return best
for k in range(n):
    fun(n-1-k)

print(fun(0)) 

### FIXED CODE ###

n= int(input())
h1=list(map(int,input().split()))
dp=[-1 for i in range(n)]
def fun(i):
    if dp[i]!=-1:
        return dp[i]
    if i==n-1:
        best=0
    elif i==n-2:
        best=abs(h1[n-1]-h1[n-2])
    else:
        best=min(fun(i+1)+abs(h1[i+1]-h1[i]),fun(i+2)+abs(h1[i+2]-h1[i]))
    dp[i]=best
    return best
for k in range(n):
    fun(n-1-k)

print(fun(0))
x = split().input()
y = int(x[0])*int(x[1])
if y%2 = 0:
  print(Even)
else:
  print(Odd)


### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
  print("Odd")
else:
  print("Even")
N, M = map(int, input().split())
S = [list(input().split()) for _ in range(N)]
C = [list(input().split()) for _ in range(M)]
for a, b in S:
    dist = [abs(a-c) + abs(b-d) for c, d in C]
    print(dist[dist.index(min(dist))])


### FIXED CODE ###

N, M = map(int, input().split())
S = [list(map(int, input().split())) for _ in range(N)]
C = [list(map(int, input().split())) for _ in range(M)]
for a, b in S:
    dist = [abs(a-c) + abs(b-d) for c, d in C]
    print(dist.index(min(dist))+1)
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
score_map = {
    "r": p,
    "p": s,
    "s": r,
    "n": 0,
}
t = list(t)
ans = 0
for i in range(k):
    skipped_list = t[i::k]
    print(f"{skipped_list}===")
    for j, c in enumerate(skipped_list[1:]):
        if skipped_list[j] == c:
            skipped_list[j+1] = "n"
    for c in skipped_list:
        ans += score_map[c]
print(ans)


### FIXED CODE ###

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
score_map = {
    "r": p,
    "p": s,
    "s": r,
    "n": 0,
}
t = list(t)
ans = 0
for i in range(k):
    skipped_list = t[i::k]
    for j, c in enumerate(skipped_list[1:]):
        if skipped_list[j] == c:
            skipped_list[j+1] = "n"
    for c in skipped_list:
        ans += score_map[c]
print(ans)
n,k = map(int,input().split())
s = input()
ans = 0

for i in range(n - 1):
    if s[i] == s[i + 1] :
        ans += 1
print(min(n-1, ans + 2 * k))

### FIXED CODE ###

n = int(input())
print(n * n * n)