Harryxun/stf_run huggingface dataset:
N = int(input())
arr = list(map(int, input().split()))
 
ans = []
 
for idx1 in range(1, N+1):
	for idx2 in range(len(arr), 0, -1):
		if arr[idx2-1] == idx2:
			ans.append(arr.pop(idx2-1))
			break
		elif idx2 == 1:
			print(-1)
			exit()

for idx in range(0, N):
	print(ans.pop(-1))
  	print("\n")


### FIXED CODE ###

N = int(input())
arr = list(map(int, input().split()))
 
ans = []
 
for idx1 in range(1, N+1):
	for idx2 in range(len(arr), 0, -1):
		if arr[idx2-1] == idx2:
			tmp = arr.pop(idx2-1)
			ans.append(tmp)
			break
		elif idx2 == 1:
			print(-1)
			exit()

for idx in range(0, N):
	tmp = ans.pop(-1)
	print(tmp)
#!python3

iim = lambda: map(int, input().rstrip().split())

def f1(n, num):
    if num == 0:
        return
    for i in range(num-1):
        print(n, end= " ")
    print(n, end="")

def NKS(N, K, S):
    M5 = 10**5
    M9 = 10**9

    for i in range(K):
        yield S

    tmp = S + 1 if S < M9 else 1
    for i in range(N-K):
        print(tmp)

def resolve():
    N, K, S = iim()

    it = NKS(N, K, S)
    for i in range(N-1):
        print(next(it), end=" ")
    print(next(it))

if __name__ == "__main__":
    resolve()


### FIXED CODE ###

#!python3

iim = lambda: map(int, input().rstrip().split())

def NKS(N, K, S):
    M5 = 10**5
    M9 = 10**9

    for i in range(K):
        yield S

    tmp = S + 1 if S < M9 else 1
    for i in range(N-K):
        yield tmp

def resolve():
    N, K, S = iim()

    it = NKS(N, K, S)
    for i in range(N-1):
        print(next(it), end=" ")
    print(next(it))

if __name__ == "__main__":
    resolve()
n = int(input())
List=[int(input()) for i in range(n)]
ans = 0
while True
for i,j in range(n):
  if i == j:
    ans +=1
print(n-ans)

### FIXED CODE ###

n = int(input())
x = [int(input()) for i in range(n)]
y = set(x)
print(len(y))
k,x = map(int, raw_input.strip().split())
print 'Yes' if k*500>=x else 'No'

### FIXED CODE ###

k,x = map(int, raw_input().strip().split())
print 'Yes' if k*500>=x else 'No'
import math
from functools import reduce

n = int(input())

clock_list = []
for i in range(n):
    a = int(input())
    clock_list.append(a)

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


print(lcm_list(clock_list))

### FIXED CODE ###

import fractions
from functools import reduce

n = int(input())

clock_list = []
for i in range(n):
    a = int(input())
    clock_list.append(a)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


print(lcm_list(clock_list))
X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
N=X*Y
K1=[0]*(N)
n=0
for i in range(X):
  for j in range(Y):
    K1[n]=A[i]+B[j]
    n+=1
K1.sort(reverse=True)
n=0
K2=[0]*(N*Z)
for i in range(N):
  for j in range(Z):
    K2[n]=K1[i]+C[j]
    n+=1
K2.sort(reverse=True)
for i in range(K):
  print(K2[i])

### FIXED CODE ###

import heapq

def main():
  X,Y,Z,K=map(int,input().split())
  A=list(reversed(sorted(map(int,input().split()))))
  B=list(reversed(sorted(map(int,input().split()))))
  C=list(reversed(sorted(map(int,input().split()))))
  q=[(-A[0]-B[0]-C[0],0,0,0)]
  queued={(0,0,0)}
  for i in range(K):
    v,s,t,u=heapq.heappop(q)
    print(-v)
    for e,f,g in [(s,t,u+1),(s,t+1,u),(s+1,t,u)]:
      if e>=X or f>=Y or g>=Z:
        continue
      if (e,f,g) in queued:
        continue
      heapq.heappush(q,(-(A[e]+B[f]+C[g]),e,f,g))
      queued.add((e,f,g))
      
if __name__=="__main__":
  main()
x = input()
S = H = C = D = [1,2,3,4,5,6,7,8,9,10,11,12,13]
for i in range(x):
	mark, num = map(str, raw_input().split())
	if mark == 'S':
		S.remove(int(num))
	elif mark == 'H':
		H.remove(int(num))
	elif mark == 'C':
		C.remove(int(num))
	elif mark == 'D':
		D.remove(int(num))
for i in range(len(S)):
	print "S " + str(S[i])
for i in range(len(H)):
	print "H " + str(H[i])
for i in range(len(C)):
	print "C " + str(C[i])
for i in range(len(D)):
	print "D " + str(D[i])

### FIXED CODE ###

x = input()
S = [1,2,3,4,5,6,7,8,9,10,11,12,13]
H = [1,2,3,4,5,6,7,8,9,10,11,12,13]
C = [1,2,3,4,5,6,7,8,9,10,11,12,13]
D = [1,2,3,4,5,6,7,8,9,10,11,12,13]
for i in range(x):
	mark, num = map(str, raw_input().split())
	if mark == 'S':
		S.remove(int(num))
	elif mark == 'H':
		H.remove(int(num))
	elif mark == 'C':
		C.remove(int(num))
	elif mark == 'D':
		D.remove(int(num))
for i in range(len(S)):
	print "S " + str(S[i])
for i in range(len(H)):
	print "H " + str(H[i])
for i in range(len(C)):
	print "C " + str(C[i])
for i in range(len(D)):
	print "D " + str(D[i])
import math
a,b = map(int,input().split())

def lcm(x,y):
    return (x*y) // math.gcd(x,y)

print(lcm(a,b))

### FIXED CODE ###

def gcd(a, b):
    if a < b :
        a, b = b, a
    while True:
        a, b = b, a % b
        if b == 0:
            return a
 
a, b = map(int, input().split())
print(int(a * b / gcd(a, b)))
M, N = map(int ,input().split())
x = [int(x) for x in input().split()]
if 1 <= (N) < 10**6 and 1 <= (M) < 10**4 and 1 <= x[1] < 10**4 :
    if (sum(x)) > M:
        print(-1)
    elif(sum(x) == M):
        print(0)
    elif(sum(x)<M):
        print(M-sum(x))

### FIXED CODE ###

M, N = map(int ,input().split())
x = [int(x) for x in input().split()]
if (sum(x)) > M:
    print(-1)
elif(sum(x) == M):
    print(0)
elif(sum(x)<M):
    print(M-sum(x))
S,T=input().split(" ")
A,B=map(int,input().split(" "))
U=input()
if U==S:
    A=A-1
else:
    B=B-1
print(" ".join([A,B]))

### FIXED CODE ###

S,T=input().split(" ")
A,B=map(int,input().split(" "))
U=input()
if U==S:
    A=A-1
else:
    B=B-1
print(" ".join([str(A),str(B)]))
def remove_fwhite(S):
    fwhite = 0
    for fw in S:
        if fw == '.':
            fwhite += 1
        else:
            break
    return fwhite

def remove_fblack(S):
    fblack = 0
    for fb in S[::-1]:
        if fb == '#':
            fblack += 1
        else:
            break
    return fblack

def count_stone(S):
    black = 0
    white = 0
    for stone in S:
        if stone == '#':
            black += 1
        else:
            white += 1
    print(min(black,white))

N = int(input())
S = str(input())


fw = remove_fwhite(S)
fb = remove_fblack(S)
#print('fw:')
#print(fw)
#print('fb:')
#print(fb)
#print(S[fw:N-fb])
if fw == 0 or fb == 0:
    count_stone(S)
elif fw == N:
    print('0')
else:
    count_stone(S[fw:N-fb])


### FIXED CODE ###

def check_between(a,b,c):
    if  (b < c) and (c < a) :
        print('Yes')
    elif (a < c) and (c <b) :
        print('Yes')
    else:
        print('No')

a, b, c = map(int, input().split())
check_between(a,b,c)
import math
import numpy as np

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

x = np.array(x)

dist = x[1:] - x[:-1]

ans = 0
MOD = 10**9 + 7

p = [0]*(n-1)
p[0] = 1 * math.factorial(n-1)
for i in range(1,n-1):
    p[i] = p[i-1] + math.factorial(n-1)/(i+1)
    p[i] %= MOD

for i in range(n-1):
    ans += dist[i]*p[i]
    ans %= MOD

ans %= MOD

print(int(ans))

### FIXED CODE ###

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


def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

def mod_inv(a,mod):
    x = extgcd(a,mod)[0]
    return (mod+x%mod)%mod

ans = 0
MOD = 10**9 + 7

factorial = 1
for i in range(2,n):
    factorial = (factorial * i%MOD) %MOD

p = [0]*(n-1)
p[0] = 1 * factorial%MOD

for i in range(1,n-1):
    p[i] = p[i-1] + factorial*mod_inv(i+1,MOD)
    p[i] %= MOD

for i in range(n-1):
    ans += (x[i+1]-x[i])%MOD*p[i]
    ans %= MOD

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


if (A+B)%2=1:
  print(IMPOSSIBLE)
  
else:
  print((A+B)/2)

### FIXED CODE ###

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

if (B%2!=A%2):
  print("IMPOSSIBLE")
  
else:
  print((B+A)//2)
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(M)]
c=[[] for i in range(N)]
for a,b in AB:
    c[a-1].append(b-1)
v=[0]*N
w=[0]*N
def f(p,v,l):
    v[p]=1
    w[p]=1
    l.append(p+1)
    for n in c[p]:
        if v[n]:
            print(len(l),*l,sep='\n')
            exit()
        else:
            f(n,v,l)
    l.pop()
    v[p]=0
for p in range(N):
    if w[p]==0:
        f(p,v,[])
print(-1)

### FIXED CODE ###

N,M=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(M)]
c=[[] for i in range(N)]
for a,b in AB:
    c[a-1].append(b-1)
from collections import deque
import sys
sys.setrecursionlimit(10**9)
def f2(q):
    s=set(q)
    for a,b in AB:
        if a in s and b in s:
            i=q.index(b)
            if q[i-1]!=a:
                break
    if a in s and b in s and q[i-1]!=a:
        q2=deque([a,b])
        while q[(i+1)%len(q)]!=a:
            q2.append(q[(i+1)%len(q)])
            i+=1
        f2(q2)
    print(len(q),*q,sep='\n')
    exit()
v=[0]*N 
w=[0]*N
def f(p,v,q):
    v[p]=1
    w[p]=1
    q.append(p+1)
    for n in c[p]:
        if v[n]:
            f2(q)
        else:
            f(n,v,q)
    q.pop()
    v[p]=0
for p in range(N):
    if w[p]==0:
        f(p,v,deque())
print(-1)
S=input()
n=len(S)
def T(i):
    if i == 0:
        return 0
    else:
        i-=1
        return T(i)+(10**i)*int(S[n-1-i])
s=[0]*2019
for j in range(1,n+1):
    m=T(j)%2019
    s[m]+=1

c=s[0]

for m in s:
    c += m*(m-1)/2

print(int(c))

### FIXED CODE ###

s = input()
p = 2019
n = 0
ans = 0
mods = [0]*p
mods[0] = 1
for i, j in enumerate(reversed(s)):
  n += int(j)*pow(10, i, p)
  n %= p
  mods[n] += 1
for i in mods:
  ans += i*(i-1)//2
print(ans)
import numpy as np

from sys import stdin


def main():
    n, m = map(int, stdin.readline().split())
    a = list(map(int, stdin.readline().split()))

    ans = n - np.sum(a)

    print(-1) if ans < 0 else print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import numpy as np

from sys import stdin


def main():
    n, m = map(int, stdin.readline().split())
    a = list(map(int, stdin.readline().split()))
    a = np.array(a)

    ans = n - np.sum(a)

    print(-1) if ans < 0 else print(ans)


if __name__ == "__main__":
    main()
num = list(map(int,input().split()))
K = int(input())
A = max(num)
A.sort()
for i in range(K):
  A *= 2
print(sum(num)-num[-1]+A)

### FIXED CODE ###

num = list(map(int,input().split()))
K = int(input())
A = max(num)
num.sort()
for i in range(K):
  A *= 2
print(sum(num)-num[-1]+A)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    P = list(map(int, input().split()))
    cnt = 0
    pmax = P[0]
    for i in P:
        if P[i] <= pmax:
            pmax = P[i]
            cnt += 1
        print(cnt)


if __name__ == "__main__":
    main()


### FIXED CODE ###

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


def main():
    n = int(input())
    p = list(map(int, input().split()))

    count = 0
    n_min = 0
    for i in range(0, n):
        if i == 0:
            count += 1
            n_min = p[i]
            continue
        if p[i] <= n_min:
            count += 1
            n_min = p[i]
    print(count)


if __name__ == "__main__":
    main()
x = input()
print (x*x*x)


### FIXED CODE ###

x = input()
x = int(x)
print (x*x*x)
def checker(ded, da):
  for i in range(3):
    for j in range(2):
      if da[i][j] - ded[j] != da[i][2] - ded[2]:
        return False
  return True

def ma(da):
  for i in range(-100, 101):
    for j in range(-100, 101):
      for k in range(-100, 101)
      if not checher([i, j, k], da):
        return False
  return True

da = [list(map(int,input().split())) for i in range(3)]
if ma(da):
  print('Yes')
else:
  print('No')


### FIXED CODE ###

def checker(ded, da):
  for i in range(3):
    for j in range(2):
      if da[i][j] - ded[j] != da[i][2] - ded[2]:
        return False
  return True

def ma(da):
  for i in range(-100, 101):
    for j in range(-100, 101):
      for k in range(-100, 101):
        if checker([i, j, k], da):
          return False
  return True

da = [list(map(int,input().split())) for i in range(3)]
if not ma(da):
  print('Yes')
else:
  print('No')
n = int(input())
b = list(map(int, input().split()))
a = [b[0]]
for i in range(1, n):
    if a[-1] != b[i]:
        a.append(b[i])

ans = 1
inc = a[0] < a[1]

n = len(a)
i = 1
while i < n:
    if (a[i-1] < a[i]) ^ inc:
        ans += 1
        inc = a[i] < a[min(i+1, n-1)]
        i += 2
    else:
        i += 1
print(ans)

### FIXED CODE ###

n = int(input())
b = list(map(int, input().split()))
a = [b[0]]
for i in range(1, n):
    if a[-1] != b[i]:
        a.append(b[i])

ans = 1
inc = a[0] < a[min(1, n-1)]

n = len(a)
i = 1
while i < n:
    if (a[i-1] < a[i]) ^ inc:
        ans += 1
        inc = a[i] < a[min(i+1, n-1)]
        i += 2
    else:
        i += 1
print(ans)
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

# memory = {}

# def dfs(stones, N, depth):
#     if N <= 2:
#         # print(" "*depth, stones, "leaf")
#         return 1
#     # print(" "*depth, stones)
#     if stones in memory:
#         return memory[stones]

#     # ans1 はじめの石使わない
#     # print(" "*depth, "ans1")
#     ans1 = dfs(stones[1:], N-1, depth+1)

#     # ans2 はじめの石を使う
#     try:
#         ind = stones[2:].index(stones[0])
#         # print(" "*depth, "ans2", c)
#         # print(" "*depth, ind, stones, stones[ind:])
#         ans2 = dfs(stones[2+ind:], N-ind-2, depth+1)
#     except:
#         ans2 = 0

#     ans = (ans1 + ans2) % MOD
#     memory[stones] = ans
#     return ans


def solve(N: int, C: "List[int]"):
    # print(dfs(tuple(C), N, 0))
    dp = [0]*N
    pre = 0
    souwa = [0]*N
    for i, s in enumerate(C):
        # print(dp, souwa, pre)
        if i == 0:
            dp[i] = 1
        else:
            if s == pre:
                dp[i] = dp[i-1]
            else:
                souwa[pre-1] = dp[i-1]
                dp[i] = dp[i-1] + souwa[s-1]
        pre = s
    # print(dp, souwa, pre)
    print(dp[N-1])
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, C)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

memory = {}


def solve(N: int, C: "List[int]"):
    # print(dfs(tuple(C), N, 0))

    dp = [0]*N
    last = [-1]*(2*(10**5)+1)
    for i, s in enumerate(C):
        if i == 0:
            dp[i] = 1
        else:
            dp[i] = dp[i-1]
            if last[s] != -1 and last[s] < i-1:
                dp[i] = (dp[i] + dp[last[s]]) % MOD
        last[s] = i
    # print(dp, souwa, pre)
    print(dp[-1])
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, C)


if __name__ == '__main__':
    main()
def z_arr(s):

    Z = [0] * len(s)
    Z[0] = len(s)

    rt = 0
    lt = 0

    for k in range(1, len(s)):
        if k > rt:
            n = 0
            while n + k < len(s) and s[n] == s[n + k] and n < k:
                n += 1
            Z[k] = n
            if n > 0:
                lt = k
                rt = k + n - 1
        else:

            p = k - lt
            right_part_len = rt - k + 1

            if Z[p] < right_part_len:
                Z[k] = Z[p]
            else:
                i = rt + 1
                while i < len(s) and s[i] == s[i - k] and i-k+1 < k:
                    i += 1
                Z[k] = i - k

                lt = k
                rt = i - 1
    return Z

N = int(input())
S = input()
answer = 0
for i in range(N-1):
    ZZ = z_arr(S[i:])
    # print(ZZ)
    temp_max = max(ZZ[1:])
    if answer < temp_max:
        answer = temp_max
print(answer)


### FIXED CODE ###

S = input()
if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
s=input()
p=0; m=0
for i in range(0,4)
  if s[i]=='+':
    p += 1
  else:
    m += 1
print(p-m)

### FIXED CODE ###

s=input()
p=0; m=0
for i in range(0,4):
  if s[i]=='+':
    p += 1
  else:
    m += 1
print(p-m)
def create_links(n, k):
  links = [[] for _ in range(n)]
  for i in range(k):
    p, q = map(int, readline().split())
    links[p - 1].append(q - 1)
    links[q - 1].append(p - 1)
  return links

def create_groups(n, links):
  groups = list(range(n))
  for i in range(n):
    if groups[i] != i:
      continue
    q = [i]
    while q:
      j = q.pop()
      for k in links[j]:
        if groups[k] != i:
          groups[k] = i
          q.append(k)

n, k, l = map(int, input().split())
road_links = create_links(n, k)
rail_links = create_links(n, l)
road_groups = create_groups(n, road_links)
rail_groups = create_groups(n, rail_links)
d = {}
for i in range(n):
  t = (road_groups[i], rail_groups[i])
  if t in d:
    d[t] += 1
  else:
    d[t] = 1
print(*[d[(road_groups[i], rail_groups[i])] for i in range(n)])


### FIXED CODE ###

from sys import stdin

def find(parent, i):
  if parent[i] == i:
    return i
  parent[i] = find(parent, parent[i])
  return parent[i]

def unite(parent, i, j):
  i = find(parent, i)
  j = find(parent, j)
  if i == j:
    return
  parent[i] = j

n, k, l = map(int, stdin.readline().split())

roads = list(range(n))
rails = list(range(n))

for i in range(k):
  p, q = map(int, stdin.readline().split())
  unite(roads, p - 1, q - 1)

for i in range(l):
  p, q = map(int, stdin.readline().split())
  unite(rails, p - 1, q - 1)

d = {}
for i in range(n):
  t = (find(roads, i), find(rails, i))
  if t in d:
    d[t] += 1
  else:
    d[t] = 1

print(*[d[(find(roads, i), find(rails, i))] for i in range(n)])
#coding:utf-8

def call(n):
    for i in range(1,n+1):
        x=i
        if x%3==0:
            print(" "+str(i,end="")
        else:
            while x!=0:
                if x%10==3:
                    print(" "+str(i),end="")
                    break
                else:
                    x//=10
                    
    print("")

n=int(input())
call(n)

### FIXED CODE ###

#coding:utf-8

def call(n):
    for i in range(1,n+1):
        x=i
        if x%3==0:
            print(" "+str(i),end="")
        else:
            while x!=0:
                if x%10==3:
                    print(" "+str(i),end="")
                    break
                else:
                    x//=10
                    
    print("")

n=int(input())
call(n)
H,W = map(int,input().split())
M = []
for i in range(H):
  M.append(input())
d = {}
for j in range(W):
  d[(1,j+1)] = 1
for k in range(H):
  d[(k+1,1)] = 1
for l in range(1,H):
  for m in range(1,W):
    if M[l][m]==".":
      if M[l-1][m]=="#":
        d[(l+1,m+1)]=(d[(l+1,m)])%(1000000007)
      elif M[l][m-1]=="#":
        d[(l+1,m+1)]=(d[(l,m+1)])%(1000000007)
      else :
        d[(l+1,m+1)]=(d[(l,m+1)]+d[(l+1,m)])%(1000000007)
print(d[(H,W)])

### FIXED CODE ###

H,W = map(int,input().split())
M = []
for i in range(H):
  M.append(input())
d = {}
d[(1,1)]=0
flag = False
for j in range(1,W):
  if flag or M[0][j]=="#":
    d[(1,j+1)] = 0
    flag = True
    continue
  d[(1,j+1)]=1
flag = False
for j in range(1,H):
  if flag or M[j][0]=="#":
    d[(j+1,1)] = 0
    flag = True
    continue
  d[(j+1,1)]=1
for l in range(1,H):
  for m in range(1,W):
    if M[l][m]==".":
      d[(l+1,m+1)]=(d[(l,m+1)]+d[(l+1,m)])%(1000000007)
    else :
      d[(l+1,m+1)] = 0
print(d[(H,W)])
from scipy.special import comb
n = int(input())
h = list(map(int, input().split()))
def triangle(n,h):
    x = comb(n, 3, exact = True)
    for i in range(0,n-2):
        for j in range(i+1,n-1):
            for k in range(j+1, n):
                if h[i] >= h[j] + h[k] or h[j] >= h[i] + h[k] or h[k] >= h[j] + h[i]:
                    x = x - 1
    return x
print(triangle(n,h))

### FIXED CODE ###

import bisect
N = int(input())
#ソートしておく
L = sorted(list(map(int, input().split())))
ans = 0
 
#短い2辺を総当たりで選択
for i in range(N - 2):
  for j in range(i + 1, N - 1):
    #小さい順に並べた時の成立条件
    # l1 + l2 > l3
    l12 = L[i] + L[j]
    #l2の隣から　l12以下のところまで全部が対象、成立しない場合
    #ans += max(bisect.bisect_left(L, l12) - j - 1, 0)
    ans += bisect.bisect_left(L, l12) - j - 1
print(ans)
A = int(input())
B = int(input())
C = int(input())
X = int(input())
 
count = 0
for a in range(A+1):
	for b in range(B+1):
        for c in range(C+1):
            if(500*a + 100*b + 50*c == X):
                count += 1
print(count)

### FIXED CODE ###

X = int(input())
A = int(input())
B = int(input())

print((X-A) % B)
N = int(input())

l = list(range(N))

for n in range(N):
    l[n] = int(input())

# print(l)

count_l = []
count = 1

st_ind = l.index(1)
num = 2

while num <= N:
    next_ind = l.index(num)
    if st_ind < next_ind:
        count += 1
    else:
        count_l.append(count)
        count = 1

    st_ind = next_ind
    num += 1

print(N - max(count_l))

### FIXED CODE ###

N = int(input())

l = list(range(N))

for n in range(N):
    l[n] = int(input())

# print(l)

count_l = []
ind_list = [0] * N

for i, k in enumerate(l):
    ind_list[k-1] = i

count = 1
for i in range(N):
    if i == N - 1:
        count_l.append(count)
    else:
        if ind_list[i] < ind_list[i+1]:
            count += 1
        else:
            count_l.append(count)
            count = 1

print(N - max(count_l))
n, a, b = list(map(int(), input().split()))
print("Borys" if (b - a) % 2 == 1 else "Alice")

### FIXED CODE ###

n, a, b = list(map(int, input().split()))
print("Borys" if (b - a) % 2 == 1 else "Alice")
import numpy as np
data = input()
data = data.split(" ")
ans = 0
dataset = np.zeros(int(data[0]), dtype=np.int)
cont = int(data[1])
if int(data[1]) == 0:
    ans = 0

else:
    for i in range(int(data[0])):
        dataset[i] = 1
    for i in range(int(data[0])):
        if i == cont:
            dataset[cont:int(data[2]) + cont] = 2
            cont = i + int(data[2]) + int(data[1])

print(int(np.count_nonzero(dataset == 1)))

### FIXED CODE ###

data = input()
if (data.count("A") == 3) or (data.count("B") == 3):
    ans = "No"
else:
    ans = "Yes"
print(ans)
data = input().split()
a = int(data[0])
b = int(data[1])

if a*b%2==0:
  print(Even)
else:
  print(Odd)

### FIXED CODE ###

a, b = map(int,input().split())
c = a*b
if c%2==0:
  print("Even")
else:
  print("Odd")
a,s = input().split()
if a >= 3200:
  print(s)
else:
  print('red')

### FIXED CODE ###

a = int(input())
s = input()
if a >= 3200:
  print(s)
else:
  print('red')
sum = int(input()) + int(input()) + int(input())

if sum >= 22:
	print("bust")
else:
	print("win")

### FIXED CODE ###

a, b, c = map(int, input().split())

if int(a+b+c) >= 22:
	print("bust")
else:
	print("win")
n = int(input())
f = 2
s = 1
for i in range(n-1):
    l = f + s
    f = s
    s = l
print(l)


### FIXED CODE ###

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