CodeEff/ECCO huggingface dataset:
# Original solution
from statistics import mean, median,variance,stdev
import sys
import math
import fractions

def j(q):
    if q==1: print("YES")
    else:print("NO")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(eval(input()))

#n = ip()                              #入力整数1つ
#n,k= (int(i) for i in input().split())      #入力整数横2つ
x,y,z = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列

#jの変数はしようできないので注意
for i in range(x,y+1):
    if i <x+z:
        print(i)
    elif i > y-z:
        print(i)

# Optimized solution
from statistics import mean, median,variance,stdev
import sys
import math
import fractions

def j(q):
    if q==1: print("AC")
    else:print("WA")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(eval(input()))

#n = ip()                              #入力整数1つ
#x,y= (int(i) for i in input().split())      #入力整数横2つ
a,b,k = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
c = [ i for i in range(a,min(b,a+k))]
d = [ i for i in range(max(b-k+1,a),b+1)]
e = set()
for i in range(len(c)):
    e.add(c[i])
for i in range(len(d)):
    e.add(d[i])
e = list(e)
e.sort()
for i in range(len(e)):
    print((e[i]))
# Original solution
a, b, k = list(map(int, input().split()))

int_list = [i for i in range(a, b + 1)]
out_list = sorted(int_list[:k] + int_list[-k:])

last_val = 0
for out_val in out_list:
    if last_val != out_val:
        print(out_val)
    last_val = out_val

# Optimized solution
a, b, k = list(map(int, input().split()))

lower_list = [i for i in range(a, a + k)]
upper_list = [i for i in range(b, b - k, -1)]
out_list = sorted(set(lower_list + upper_list))

for out_val in out_list:
    if a <= out_val <= b:
        print(out_val)
# Original solution
a, b, k = list(map(int, input().split()))
l = [i for i in range(a, b + 1)]
ans = l[:k] + l[-k:]
ans = list(set(ans))
ans.sort()
for e in ans:
  print(e)

# Optimized solution
a, b, k = list(map(int, input().split()))
ans =  [i for i in range(a, b + 1) if a <= i < a + k or b - k < i <=b]
for e in ans:
  print(e)
# Original solution
a, b, k = list(map(int, input().split()))
ans =  [i for i in range(a, b + 1) if a <= i < a + k or b - k < i <=b]
for e in ans:
  print(e)

# Optimized solution
a, b, k = list(map(int, input().split()))
ans = []
for i in range(k):
  if a + i <= b:
    ans.append(a + i)
  if b - i >= a:
    ans.append(b - i) 
for i in sorted(set(ans)):
    print(i)
# Original solution
A, B, K = list(map(int,input().split()))
li = [i for i in range(A,B + 1)]
ans = set(li[:K] + sorted(li,reverse = True)[:K])
  
for i in sorted(ans):
  print(i)

# Optimized solution
A, B, K = list(map(int,input().split()))

ans = []
for i in range(K):
  if A + i <= B:
    ans.append(A + i)
  if B - i >= A:
    ans.append(B - i)

for i in sorted(set(ans)):
  print(i)
# Original solution
a,b,k = list(map(int,input().split()))
for x in range(a,b+1):
  if x<a+k or x>b-k:
    print(x)

# Optimized solution
a,b,k = list(map(int,input().split()))
if b-a<2*k:
  for x in range(a,b+1):
    print(x)
else:
  for x in range(a,a+k):
    print(x)
  for x in range(b-k+1,b+1):
    print(x)
# Original solution
A,B,K=list(map(int,input().split()))

for i in range(A,B+1):
    if abs(A-i)<K or abs(B-i)<K:
        print(i)

# Optimized solution
A,B,K=list(map(int,input().split()))
if B-A>=2*K:
    for i in range(A,A+K-1+1):
        print(i)
    for i in range(B-K+1,B+1):
        print(i)
    exit()
else:
    for i in range(A,B+1):
        print(i)
# Original solution
a,b,k = list(map(int,input().split()))
r = list(range(a,b+1))
for i in sorted (set(r[:k])|set(r[-k:])):
    print(i)

# Optimized solution
a,b,k=list(map(int,input().split()))
l=list(range(a,b+1))
ans=sorted(set(l[:k])|set(l[-k:]))
for i in ans:
    print(i)
# Original solution
A, B, K = list(map(int, input().split()))
x = [i for i in range(A, B+1)]
for i in x:
    if (i < A+K) or (i>B-K):
        print(i)

# Optimized solution
A, B, K = list(map(int, input().split()))

if abs(A-B)<K:
    for i in range(A, B+1):
        print(i)
else:
    x = {i for i in range(A, A+K)}
    y = {j for j in range(B-K+1, B+1)}
    z = x | y
    z = sorted(list(z))
    for a in z:
        print(a)
# Original solution
# ABC093B
a,b,k = list(map(int,input().split()))
for x in range(a,b+1):
    if x<a+k or x>b-k:
        print(x)

# Optimized solution
# ABC093B
a,b,k = list(map(int,input().split()))
xx =[]
for x in range(a,a+k):
    if x>b:
        break
    xx.append(x)
for x in range(b+1-k,b+1):
    if x<a:
        break
    xx.append(x)
for x in sorted(list(set(xx))):
    print(x)
# Original solution
a, b, k = list(map(int,input().split()))
c = b - a + 1
if k > c:
  for i in range(a, b+1):
    print(i)
else:
  l = list(range(a, a+k))
  l1 = list(range(b-k+1, b+1))
  l2 = l + l1
  l3 = set(l2)
  l4 = sorted(l3)
  for i in l4:
    print(i)

# Optimized solution
a, b, k = list(map(int,input().split()))
r = list(range(a, b+1))
for i in sorted(set(r[:k])|set(r[-k:])):
  print(i)
# Original solution
A,B,K=list(map(int,input().split()))
L={i for i in range(A,A+K)}
R={i for i in range(B-K+1,B+1)}
S=[i for i in range(A,B+1) if i in L or i in R]
for i in range(len(S)):
  print((S[i]))

# Optimized solution
A,B,K=list(map(int,input().split()))
S=[i for i in range(A,B+1) if i<A+K or i>=B-K+1]
for i in range(len(S)):
  print((S[i]))
# Original solution
# ABC093 B - Small and Large Integers
a,b,k = list(map(int, input().split()))

for i in range(a,b+1):
    if i <= a+k-1:
        print(i)
        continue
    elif i >= b-k+1:
        print(i)
        continue

# Optimized solution
# ABC093 B - Small and Large Integers
a,b,k = map(int, input().split())

range_ab = set(range(a,a+k))|set(range(b-k+1,b+1))
l = list(range_ab)
l = [x for x in l if a<=x<=b]

l.sort()
print(*l,sep='\n')
# Original solution
# -coding: utf-8 -

a,b,k = list(map(int, input().split()))

s = [i for i in range(a,b+1)]
add = "\n"
#print(s)

if len(s) < k*2:
    strs = [str(num) for num in s]
    k = add.join(strs)
else:
    s_left = s[:k]
    s_right = s[-k:]
    s2 = s_left+s_right
    strs = [str(num) for num in s2]
    k = add.join(strs)
print(k)



# Optimized solution
# -coding: utf-8 -

a,b,k = list(map(int, input().split()))

s = list(range(a,b+1))
s_small = s[:k]
s_large = s[-k:]
ans = list(set(s_small)|set(s_large))
ans = sorted(ans)
for i in ans:
    print(i)
# Original solution
A,B,K = list(map(int,input().split()))
li = []
for i in range(A,B+1):
    if abs(A-i)<K:
        li.append(i)
    elif abs(B-i)<K:
        li.append(i)
li.sort()
for j in range(len(li)):
    print((li[j]))


# Optimized solution
A,B,K=list(map(int,input().split()))
li=list(range(A,B+1))
ans=sorted(set(li[:K])|set(li[-K:]))
for i in ans:
    print(i)
# Original solution
a, b, k = list(map(int, input().split()))

if b - a < 2 * k:
    for i in range(a, b + 1):
        print(i)

else:
    ans = []
    for i in range(k):
        ans.append(a + i)
    for i in range(k-1, -1, -1):
        ans.append(b - i)

    for i in ans:
        print(i)

# Optimized solution
a, b, k = list(map(int, input().split()))
r = list(range(a, b + 1))
for i in sorted(set(r[:k]) | set(r[-k:])):
    print(i)
# Original solution
# 2019/05/22
# AtCoder Beginner Contest 093 - B

# Input
a, b, k = list(map(int, input().split()))

vals = list()
for i in range(a, b+1):
    vals.append(i)

if b - a + 1 < k:
    wk = b - a + 1
else:
    wk = k

# small
for i in range(wk):
    print((vals[i]))
if k * 2 > b - a + 1:
    wk = b - a + 1 - wk

# large
for i in range(len(vals)-wk, len(vals)):
    print((vals[i]))


# Optimized solution
# 2019/05/22
# AtCoder Beginner Contest 093 - B

# Input
a, b, k = list(map(int, input().split()))
cnt = b - a + 1

vals = list()
if cnt < k:
    wk = cnt
else:
    wk = k

# small
for i in range(a, a + wk):
    print(i)

if k * 2 > cnt:
    wk = cnt - wk

# large
for i in range(b - wk + 1, b+1):
    print(i)
# Original solution
a,b,k = list(map(int,input().split()))
lis = [i for i in range(a,b+1)]

ans = lis[:k]+ lis[-k:]

if len(lis)<k*2:
  for i in lis:
    print(i)
else:
  for i in ans:
    print(i)


# Optimized solution
a,b,k = list(map(int,input().split()))

if (b-a)<k*2:
  for i in range(a,b+1):
    print(i)
else:
  for i in range(a,a+k):
    print(i)
  for j in range(b-k+1,b+1):
    print(j)
# Original solution
a, b, k = list(map(int, input().split()))
prev = 0

for i in range(k):
    if a + i < b:
        print((a + i))
        prev = a + i

for i in range(k)[::-1]:
    if b - i > prev:
        print((b - i))

# Optimized solution
a, b, k = list(map(int, input().split()))

for i in range(a, a + k):
    if i <= b:
        print(i)

for j in range(b - k + 1, b + 1):
    if i < j:
        print(j)
# Original solution
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    a,b,k=list(map(int,input().split()))
    l=[i for i in range(a,b+1)]

    ans=[]
    if k>=b-a+1:
        for i in range(a,b+1):
            print(i)
    else:
        for i in range(a,a+k):
            ans.append(i)
        for j in range(b-k+1,b+1):
            if j not in ans:
                ans.append(j)


        for i in ans:
            print(i)


resolve()

# Optimized solution
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    a,b,k=list(map(int,input().split()))

    ans=[]
    if k>=b-a+1:
        for i in range(a,b+1):
            print(i)
    else:
        for i in range(a,a+k):
            ans.append(i)
        for j in range(b-k+1,b+1):
            if j not in ans:
                ans.append(j)


        for i in ans:
            print(i)


resolve()
# Original solution
a, b, k = list(map(int, input().split()))

for i in range(a, b+1):
    if b - k < i or i < a + k:
        print(i)
    else:
        continue

# Optimized solution
a, b, k = list(map(int, input().split()))

for i in range(a, min(a+k, b+1)):
    print(i)
for i in range(max(a+k, b+1-k), b+1):
    print(i)
# Original solution
def main():
    a,b,k = list(map(int, input().split()))

    for i in range(a, b+1):
        if i-a + 1 > k and b-i + 1 > k:
            continue
        print(i)

if __name__ == "__main__":
    main()

# Optimized solution
def main():
    a,b,k = list(map(int, input().split()))

    i = a
    while True:
        if i > b:
            return
        if i-a + 1 > k:
            i = max(i, b-k+1)
            break
        print(i)
        i += 1
    while True:
        if i > b:
            break
        print(i)
        i += 1

if __name__ == "__main__":
    main()
# Original solution
import sys

inf = 1<<30
w = 100

def solve():
    while 1:
        e = int(sys.stdin.readline().rstrip())

        if e == 0:
            return

        ans = inf

        z0 = int(e**(1/3))

        for z in range(max(0, z0 - w), z0 + w):
            if e - z**3 < 0:
                break

            y0 = int((e - z**3)**0.5)
            for y in range(max(0, y0 - w), y0 + w):
                x = e - z**3 - y**2

                if x < 0:
                    break

                ans = min(ans, x + y + z)

        print(ans)

if __name__ == '__main__':
    solve()

# Optimized solution
import sys

inf = 1<<30
lim = 10**5

def solve():
    cubics = [x**3 for x in range(100 + 1)]

    while 1:
        e = int(sys.stdin.readline().rstrip())

        if e == 0:
            return

        ans = inf

        for z, c in enumerate(cubics):
            if c > e:
                break
            y = int((e - c)**0.5)
            x = e - c - y**2
            ans = min(ans, x + y + z)

        print(ans)

if __name__ == '__main__':
    solve()
# Original solution
from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)

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

(R, C) = ReadInput()
N = int(eval(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")
				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 list(VectorCover.items()) if (p[0] == "R"))
	minC = min(a for (p, a) in list(VectorCover.items()) if (p[0] == "C"))
	if (minR + minC < 0):
		print("No")
		exit()

print("Yes")

# Optimized solution
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# D-Grid and Integers

from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)

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

(R, C) = ReadInput()
N = int(eval(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")
				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 list(VectorCover.items()) if (p[0] == "R"))
	minC = min(a for (p, a) in list(VectorCover.items()) if (p[0] == "C"))
	if (minR + minC < 0):
		print("No")
		exit()

print("Yes")
# Original solution
from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *
from collections import defaultdict

def read():
  return int(eval(input()))

def reads():
  return [int(x) for x in input().split()]

setrecursionlimit(10000)

(R, C) = reads()
N = read()

d = defaultdict(list)
V = set()

for _ in range(N):
  (r, c, a) = reads()
  d["R", r-1].append((("C", c-1), a))
  d["C", c-1].append((("R", r-1), a))
  V.add(("R", r-1))
  V.add(("C", c-1))

def walk(v):
  for (w, a) in d[v]:
    wcol = a - col[v]
    if w in col:
      if col[w] != wcol:
        print("No"); exit()
    else:
      col[w] = wcol
      walk(w)

while len(V) > 0:
  col = dict()
  v = V.pop()
  col[v] = 0
  walk(v)
  rcol = min(a for (v, a) in list(col.items()) if v[0] == "R")
  ccol = min(a for (v, a) in list(col.items()) if v[0] == "C")
  if rcol + ccol < 0:
    print("No"); exit()

print("Yes")


# Optimized solution
from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *
from collections import defaultdict

def read():
  return int(eval(input()))

def reads():
  return [int(x) for x in input().split()]

setrecursionlimit(1000000)

(R, C) = reads()
N = read()

d = defaultdict(list)
V = set()

for _ in range(N):
  (r, c, a) = reads()
  (r, c) = (r-1, c-1)
  d["R", r].append((("C", c), a))
  d["C", c].append((("R", r), a))
  V.add(("R", r))
  V.add(("C", c))

def walk(v):
  V.discard(v)
  for (w, a) in d[v]:
    wcol = a - col[v]
    if w in col:
      if col[w] != wcol:
        print("No"); exit()
    else:
      col[w] = wcol
      walk(w)

while len(V) > 0:
  v = V.pop()
  col = dict()
  col[v] = 0
  walk(v)
  rcol = min(a for (v, a) in list(col.items()) if v[0] == "R")
  ccol = min(a for (v, a) in list(col.items()) if v[0] == "C")
  if rcol + ccol < 0:
    print("No"); exit()

print("Yes")
# Original solution
c={}
for k in input():c[k]=(c[k]if k in c else 0)+1
print("No"if any(c[k]%2 for k in c)else"Yes")

# Optimized solution
c={}
for k in input():c[k]=1+c[k]if k in c else 1
print("No"if any(c[k]%2 for k in c)else"Yes")
# Original solution
import re
p = re.compile('^(.)\\1')
w = ''.join(sorted(list(input())))
r = re.subn(p,'',w)
while r[1]:
    r = re.subn(p,'',r[0])
if len(r[0]):
    print('No')
else:
    print('Yes')


# Optimized solution
import re
p = re.compile('^(.)\\1')
w = ''.join(sorted(list(input())))
r = re.subn(p,'',w)
while r[1]:
    r = re.subn(p,'',r[0])
print('No' if len(r[0]) else 'Yes')
# Original solution
import sys
X, Y = list(map(int, input().split()))
if X == Y:
    print((-1))
    sys.exit()

for i in range(2, 10 ** 18 + 1):
    ans = i * X
    if ans % Y != 0:
        print(ans)
        sys.exit()

# Optimized solution
import sys
X, Y = list(map(int, input().split()))
if X % Y == 0:
    print((-1))
    sys.exit()

for i in range(2, 10 ** 18 + 1):
    ans = i * X
    if ans % Y != 0:
        print(ans)
        sys.exit()
# Original solution
temp = input().split(" ")
X = int(temp[0])
Y = int(temp[1])
i = 2
while True:
    tgt = X * i
    if X == Y:
        print((-1))
        break
    elif tgt % Y != 0:
        print(tgt)
        break
    else:
        i += 1

# Optimized solution
temp = input().split(" ")
X = int(temp[0])
Y = int(temp[1])
i = 2
while True:
    tgt = X * i
    if X == Y:
        print((-1))
        break
    elif tgt % Y != 0:
        print(tgt)
        break
    elif i == 100000:
        print((-1))
        break
    else:
        i += 1
# Original solution
x,y = list(map(int,input().split()))

if x == y:
     print('-1')
elif y == 1:
     print('-1')
else:
     i = 2 
     while True:
          if x*i % y == 0:
               i += 1     
               continue
          else:
               print((x*i))
               break 

# Optimized solution
x,y = list(map(int,input().split()))


if x%y == 0:
     print('-1')
else:
     i = 2 
     while True:
          if x*i % y == 0:
               i += 1     
               continue
          else:
               print((x*i))
               break
# Original solution
x, y = [int(i) for i in input().split()]
if x % y == 0:
    print((-1))
else:
    i = 2
    while True:
        if i * x % y != 0:
            print((i * x))
            break


# Optimized solution
x, y = [int(i) for i in input().split()]
if x % y == 0:
    print((-1))
else:
    i = 2
    while True:
        if i * x % y != 0:
            print((i * x))
            break
        i += 1
# Original solution
x,y = [int(i) for i in input().split(" ")]

if x%y == 0:
    print((-1))
    quit()

for i in range(x*2,10**18+1,x):
    if (i < y*2):
        continue
    elif (i%y != 0):
        print(i)
        quit()
print((-1))



# Optimized solution
x,y = [int(i) for i in input().split(" ")]

if x%y == 0:
    print((-1))
    quit()

if x==1:
    print((y*2+1))
    quit()

for i in range(x*2,10**18+1,x):
    if (i < y*2):
        continue
    elif (i%y != 0):
        print(i)
        quit()
print((-1))
# Original solution
x,y = list(map(int,input().split()))

if x == y:
	print('-1')
	exit()

i =2

while x*i % y == 0:
	i = i + 1	

print((x*i))



# Optimized solution
x,y = list(map(int,input().split()))

if x == y:
	print((-1))
	exit()

i =2

if x < y :
	while x*i % y == 0:
		i = i + 1	
	print((x*i))
	
else:
	if x%y==0:
		print((-1))
	else:
		while x*i % y == 0:
			i = i + 1	
		print((x*i))
# Original solution
import sys
x,y = list(map(int, input().split()))
temp = x
if x == y:
    print((-1))
    sys.exit()
while True:
    temp += x
    if temp % y != 0:
        print(temp)
        sys.exit()
    elif temp > pow(10, 18):
        print((-1))
        sys.exit()

# Optimized solution
import sys
def gcd(a, b):
        while b:
                a, b = b, a % b
        return a
def lcm(a, b):
    return a * b // gcd (a, b)

x,y = list(map(int, input().split()))
temp = x
if x == y:
    print((-1))
    sys.exit()
while True:
    temp += x
    if temp % y != 0:
        print(temp)
        sys.exit()
    elif temp > lcm(x, y):
        print((-1))
        sys.exit()
# Original solution
#-*- coding: utf_8 -*-

data = []
data.append([int(eval(input()))])
length = 2
while length != 1:
    r = [int(x) for x in input().split(",")]
    data.append(r)
    length = len(r)

first = data[:int(len(data)/2) + 1]
mx_arr = [0] * 100

def dfs(n, i, mx):
    if n == len(first) - 1:
        s = mx * 2 + data[n][i]
        mx_arr[i] = max(s, mx_arr[i])
        return

    mx += data[n][i]
    dfs(n + 1, i, mx)
    dfs(n + 1, i + 1, mx)

dfs(0, 0, 0)

print((max(mx_arr)))

# Optimized solution
#-*- coding: utf_8 -*-

data = []
data.append([int(eval(input()))])
length = 2
counter = 0
while length != 1:
    r = [int(x) for x in input().split(",")]
    data.append(r)
    length = len(r)
    counter += 1

N = int((counter + 1 )/ 2) + 1
dp = [[0 for i in range(N)] for j in range(N)]
data_arr = [[0 for i in range(N)] for j in range(N)]

left = data[:N]
right = data[N:]

i = 0
for v in left:
    for idx, r in enumerate(v):
        data_arr[i - idx][idx] = r
    i += 1
right.reverse()
for i, v in enumerate(right):
    for idx, r in enumerate(v):
        data_arr[N - 1 - idx][N - 1 - i + idx] = r


dp[0][0] = data_arr[0][0]

for i in range(1, N):
    dp[0][i] = dp[0][i - 1] + data_arr[0][i]
    dp[i][0] = dp[i - 1][0] + data_arr[i][0]

for i in range(1, N):
    for j in range(1, N):
        dp[i][j] += data_arr[i][j] + max(dp[i - 1][j], dp[i][j - 1])

print((dp[N - 1][N - 1]))
# Original solution
import sys
for line in sys.stdin.readlines():
	data=line.split()
	print((int(data[0])+int(data[1])))
	#print(eval(data[0]+"+"+data[1]))

# Optimized solution
while True:
	try:
		x,y=list(map(int,input().split()))
		print((x+y))
	except EOFError:
		break
# Original solution
import sys
import bisect


def main():
    n, K, L, R = list(map(int, sys.stdin.readline().split()))
    a = tuple(map(int, sys.stdin.readline().split()))
    m = n//2
    ls = [[] for _ in range(m+1)]
    for i in range(1 << m):
        cnt = 0
        val = 0
        for j in range(m):
            if i >> j & 1:
                cnt += 1
                val += a[j]
        bisect.insort_left(ls[cnt], val)
    ans = 0
    for i in range(1 << n-m):
        cnt = 0
        val = 0
        for j in range(n-m):
            if i >> j & 1:
                cnt += 1
                val += a[m+j]
        if K-m <= cnt <= K:
            ans += bisect.bisect_right(ls[K-cnt], R-val) - bisect.bisect_right(ls[K-cnt], L-val-1)
    print(ans)


if __name__ == '__main__':
    main()



# Optimized solution
import sys
import bisect


def main():
    n, K, L, R = list(map(int, sys.stdin.readline().split()))
    a = tuple(map(int, sys.stdin.readline().split()))
    m = n//2
    ls = [[] for _ in range(m+1)]
    for i in range(1 << m):
        cnt = 0
        val = 0
        for j in range(m):
            if i >> j & 1:
                cnt += 1
                val += a[j]
        ls[cnt].append(val)
    for i in range(m+1):
        ls[i].sort()
    ans = 0
    for i in range(1 << n-m):
        cnt = 0
        val = 0
        for j in range(n-m):
            if i >> j & 1:
                cnt += 1
                val += a[m+j]
        if K-m <= cnt <= K:
            ans += bisect.bisect_right(ls[K-cnt], R-val) - bisect.bisect_right(ls[K-cnt], L-val-1)
    print(ans)


if __name__ == '__main__':
    main()
# Original solution
N = int(eval(input()))
Alist = [int(eval(input())) for _ in range(N)]

m = max(Alist)
for i in range(N):
    if Alist[i]==m:
        print((max(Alist[:i] + Alist[i+1:])))
    else:
        print(m)


# Optimized solution
N = int(eval(input()))
Alist = [int(eval(input())) for _ in range(N)]
Alist_sorted = sorted(Alist)

m = max(Alist)
for i in range(N):
    if Alist[i]==m:
        print((Alist_sorted[-2]))
    else:
        print(m)