Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

cnt = 0
coefficients = [1]
n = 1

_list = []
length = int(input())
for i in range(length):
    try:
        _list.append(int(input()))
    except EOFError:
        continue


for i in range(1,length):
    if i < n:
        continue
    coefficients.append(i)
    n = i*3 + 1

for c in coefficients[::-1]:
    for i in range(length):
        val = _list[i]
        j = i - c
        while j >= 0 and _list[j] > val:
            _list[j + c] = _list[j]
            j -= c
            cnt += 1
        _list[j+c] = val

print(len(coefficients))
print(*coefficients[::-1])
print(cnt)
print(*_list, sep='\n')

### FIXED CODE ###

cnt = 0
coefficients = [1]
n = 1

_list = []
length = int(input())
for i in range(length):
    try:
        _list.append(int(input()))
    except EOFError:
        continue


for i in range(1,length):
    if i < n:
        continue
    coefficients.append(i)
    n = i*2.25 + 1

for c in coefficients[::-1]:
    for i in range(length):
        val = _list[i]
        j = i - c
        while j >= 0 and _list[j] > val:
            _list[j + c] = _list[j]
            j -= c
            cnt += 1
        _list[j+c] = val

print(len(coefficients))
print(*coefficients[::-1])
print(cnt)
print(*_list, sep='\n')
### BUGGY CODE ###

n=int(input())
league=[list(map(int,input().split()))[::-1] for _ in range(n)]

total_match=n*(n-1)//2
match=0
day=0


for _ in range(total_match):
    day+=1
    today_match=[]

    for i in range(n):
        try:
            m=league[i][-1]-1
            if not i in today_match and not m in today_match:
                if league[m][-1]-1==i:
                    today_match.extend((i,m))
                    league[i].pop()
                    league[m].pop()
        except:
            continue
    if not today_match:
        day=-1
        break
    match+=len(today_match)//2
    if match>=total_match:
        break

print(day)

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
pair = N * (N - 1) // 2
ptoi = dict()

i = 0
for x in range(1, N):
    for y in range(x + 1, N + 1):
        ptoi[(x, y)] = i
        ptoi[(y, x)] = i
        i += 1

edge = [[] for _ in range(pair)]
indeg = [0] * pair
for i in range(1, N+1):
    inp = list(map(int, input().split()))
    for s, t in zip(inp[:-1], inp[1:]):
        edge[ptoi[(i, s)]].append(ptoi[(i, t)])
        indeg[ptoi[(i, t)]] += 1


now = [i for i, d in enumerate(indeg) if d == 0]
day = 0
while now:
    nxt = []
    while now:
        s = now.pop()
        for t in edge[s]:
            if indeg[t] <= 0:
                continue
            indeg[t] -= 1
            if indeg[t] == 0:
                nxt.append(t)
    day += 1
    now = nxt

if all(i <= 0 for i in indeg):
    print(day)
else:
    print(-1)
### BUGGY CODE ###

N, Q = map(int, input().split())
S = input()

lr = []
for i in range(Q):
    l, r = map(int, input().split())
    lr.append([l, r])
    
import re
    
for i in range(len(lr)):
    #print(S[lr[i][0]-1 : lr[i][1]])
    #print(re.findall("AC", S[lr[i][0]-1 : lr[i][1]]))
    #print(len(re.findall("AC", S[lr[i][0]-1 : lr[i][1]])))
    print(S[lr[i][0]-1 : lr[i][1]].count("AC"))

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()

import re

s = [i.span()[0] for i in list(re.finditer("AC", S))]
#print(s)

count = [0] * (N+1)
c = 0
for i in range(N):
    try:
        if s[0]+1 == i:
            s.pop(0)
            c += 1
    except:
        pass
            
    count[i] = c
    
#print(count)

ans = []
for i in range(Q):
    l, r = map(int, input().split())
    #print(S[l-1:r])
    #print(count[r-1], count[l-1])
    ans.append(count[r-1] - count[l-1])

print(" ".join(map(str, ans)))
### BUGGY CODE ###

while True:
    try:
        n = int(raw_input())
    except EOFError:
        break    
    
    ls = []
    for i in range(n):
        ls.append(int(raw_input()))
    
    maxvalue = -999999999999999999999999999999
    for k in range(len(ls)):
        for j in range(1,k+1):
            if ls[k]-ls[k-j] > maxvalue:
                maxvalue = ls[k]-ls[k-j]
    print maxvalue

### FIXED CODE ###

n = int(raw_input())
R = []
R.append(int(raw_input()))
minv = R[0]
maxv = -1 * 10**9
for j in xrange(1,n):
    R.append(int(raw_input()))
    maxv = max(maxv,R[j]-minv)
    minv = min(minv,R[j])
print maxv
### BUGGY CODE ###

n, k = map(int, input().split(' '))
pp = list(map(int, input().split(' ')))

pp_ex = list(map(lambda p: (p + 1) / 2, pp))

max_ex = 0
# for i in range(k):
#     max_ex += pp_ex[i]

for i in range(0, n - k + 1):
    ex = 0
    for j in range(k):
        ex += pp_ex[i + j]
    if max_ex < ex:
        max_ex = ex

print(max_ex)


### FIXED CODE ###

n, k = map(int, input().split(' '))
pp = list(map(int, input().split(' ')))

pp_ex = list(map(lambda p: (p + 1) / 2, pp))

max_ex = 0
for i in range(k):
    max_ex += pp_ex[i]
bef_ex = max_ex
for i in range(1, n - k + 1):
    ex = bef_ex - pp_ex[i - 1] + pp_ex[i + k - 1]
    bef_ex = ex
    if max_ex < ex:
        max_ex = ex

print(max_ex)
### BUGGY CODE ###

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

status = [n, 0, 0, 0, 0, 0]

for i in range(10000000000):
    status[5] += min(status[4], e)
    status[4] -= min(status[4], e)

    status[4] += min(status[3], d)
    status[3] -= min(status[3], d)

    status[3] += min(status[2], c)
    status[2] -= min(status[2], c)

    status[2] += min(status[1], b)
    status[1] -= min(status[1], b)

    status[1] += min(status[0], a)
    status[0] -= min(status[0], a)

#    print(status)

    if status == [0, 0, 0, 0, 0, n]:
        #        print('finish!')
        print(i+1)
        exit()

# if status == [n, 0, 0, 0, 0, 0]:
#    print('ittti')
# print(status)


### FIXED CODE ###

import math

N = int(input())
num_person = [int(input()) for _ in range(5)]

min_num_person = min(num_person)

print(math.ceil(N/min_num_person) + 4)
### BUGGY CODE ###

import math

def main():
    A, B, N = map(int, input().split(" "))
    max_score = -float("inf")
    log = []

    for x in range(1, min(B, N)+1):
        score = math.floor((A*x)/B) - A*math.floor(x/B)
        log.append(score)
        max_score = max(max_score, score)
    print(max_score)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import math

def main():
    A, B, N = map(int, input().split(" "))
    max_score = -float("inf")

    if B <= N:
        x = B-1 
    else:
        x = N
    score = math.floor((A*x)/B) - A*math.floor(x/B)
    print(score)

if __name__ == "__main__":
    main()
### BUGGY CODE ###

import fractions

n, m = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in range(n):
	b.append(a[i]//2)

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

now = b[0]
for i in range(1, n):
	now = lcm(now, b[i])

for i in range(n):
	if (now//b[i])%2 == 0:
		print(0)
		exit(0)

print(((m//now)+1)//2)


### FIXED CODE ###

import fractions

n, m = map(int, input().split())
a = list(map(int, input().split()))
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

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

now = a[0]
for i in range(1, n):
	now = lcm(now, a[i])
	if now > 2 * m:
		print(0)
		exit(0)

for i in range(n):
	if (now//a[i])%2 == 0:
		print(0)
		exit(0)

print(((m//(now//2))+1)//2)
### BUGGY CODE ###

def calc(n, to_metal, to_acorn):
    mas = tuple(zip(to_metal, to_acorn))
    dp = list(range(n + 1))
    for i in range(n + 1):
        for m, a in mas:
            if i >= m:
                dp[i] = max(dp[i], dp[i - m] + a)
    return dp[n]


def main():
    N = int(input())
    a = tuple(map(int, input().split()))
    b = tuple(map(int, input().split()))

    N = calc(N, a, b)  # 1 周目 : dp[巣から持ってきたドングリ数] = 取引所 B で持てる最大ドングリ数
    N = calc(N, b, a)  # 2 周目 : dp[取引所 B から持ってきたドングリ数] = 巣に持ち帰れる最大ドングリ数
    print(N)


if __name__ == '__main__':
    main()


### FIXED CODE ###

N = int(input())
ga, sa, ba = map(int, input().split())
gb, sb, bb = map(int, input().split())

# A : ドングリと金属に変える
# B : 全部ドングリに変える
# B : ドングリと金属に変える（無駄な操作でロスがないので、いったんドングリ化してよい）
# A : ドングリに変える

dp1 = list(range(N + 1))  # dp1[巣から持ってきたドングリ数] = 取引所 B で持てる最大ドングリ数
dp1[0] = 0
for i in range(N + 1):
    if i >= ga:
        dp1[i] = max(dp1[i], dp1[i - ga] + gb)
    if i >= sa:
        dp1[i] = max(dp1[i], dp1[i - sa] + sb)
    if i >= ba:
        dp1[i] = max(dp1[i], dp1[i - ba] + bb)

N = dp1[N]
dp2 = list(range(N + 1))  # dp2[取引所 B から持ってきたドングリ数] = 巣に持ち帰れる最大ドングリ数
for i in range(N + 1):
    if i >= gb:
        dp2[i] = max(dp2[i], dp2[i - gb] + ga)
    if i >= sb:
        dp2[i] = max(dp2[i], dp2[i - sb] + sa)
    if i >= bb:
        dp2[i] = max(dp2[i], dp2[i - bb] + ba)
print(dp2[N])
### BUGGY CODE ###

n = int(raw_input())
ax = []
bx = []
for _ in xrange(n):
    a,b = map(int,raw_input().split())
    ax.append(a)
    bx.append(b)

ax = ax[::-1]
bx = bx[::-1]
cnt = 0
for i in xrange(n):
    if ax[0] % bx[0] !=0:
        k = bx[0] - (ax[0] % bx[0])
        cnt += k
        ax = map(lambda x:x+k,ax)
        ax.pop(0)
        bx.pop(0)
print cnt


### FIXED CODE ###

n = int(raw_input())
ax = []
bx = []
for _ in xrange(n):
    a,b = map(int,raw_input().split())
    ax.append(a)
    bx.append(b)

ax = ax[::-1]
bx = bx[::-1]
cnt = 0
for i in xrange(n):
    if (ax[i] + cnt) % bx[i] !=0:
        k = bx[i] - ((ax[i] + cnt) % bx[i])
        cnt += k

print cnt
### BUGGY CODE ###

#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

h, w = LI()
ch, cw = LI()
dh, dw = LI()
s = [list(input()) for _ in range(h)]

dx, dy = [1, 0, -1, 0], [0, 1, 0, -1]
d = [[10**10] * w for _ in range(h)]
d[ch-1][cw-1] = 0
H = []
heappush(H, (0, cw-1, ch-1))
while H:
    D, x, y = heappop(H)
    if D > d[y][x]:
        continue
    for i in range(-2, 3):
        for j in range(-2, 3):
            nx, ny = x + i, y + j
            if i == 0 and j == 0:
                continue
            if 0 <= nx < w and 0 <= ny < h:
                if s[ny][nx] == '#':
                    continue
                if abs(i) + abs(j) <= 1:
                    if d[ny][nx] > D:
                        d[ny][nx] = D
                        heappush(H, (D, nx, ny))
                else:
                    if d[ny][nx] > D + 1:
                        d[ny][nx] = D + 1
                        heappush(H, (D + 1, nx, ny))
if d[dh-1][dw-1] == 10**10:
    print(-1)
else:
    print(d[dh-1][dw-1])


### FIXED CODE ###

#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

h, w = LI()
ch, cw = LI()
dh, dw = LI()
s = [input() for _ in range(h)]

dx, dy = [1, 0, -1, 0], [0, 1, 0, -1]
que = deque([(cw-1, ch-1)])
d = [[10**10] * w for _ in range(h)]
d[ch-1][cw-1] = 0
while que:
    x, y = que.popleft()
    for i in range(4):
        nx, ny = x + dx[i], y + dy[i]
        if 0 <= nx < w and 0 <= ny < h:
            if s[ny][nx] == '.' and d[ny][nx] > d[y][x]:
                d[ny][nx] = d[y][x]
                que.appendleft((nx, ny))
    for i in range(-2, 3):
        for j in range(-2, 3):
            nx, ny = x + i, y + j
            if 0 <= nx < w and 0 <= ny < h:
                if s[ny][nx] == '.' and d[ny][nx] > d[y][x] + 1:
                    d[ny][nx] = d[y][x] + 1
                    que.append((nx, ny))
if d[dh-1][dw-1] == 10**10:
    print(-1)
else:
    print(d[dh-1][dw-1])
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())
a = []
for _ in range(m):
    a.append(int(input()))
#a=set(a)

memo = [0]*(n+1)
memo[0]=1
if not(1 in a):
    memo[1]=1

for i in range(2,n+1):
    #print(i)
    if i in a:
        continue
    #print(memo[i-1],memo[i-2])
    memo[i]=memo[i-2]+memo[i-1]
            

#print(memo)
print(memo[n]% 1000000007)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())
a = []
for _ in range(m):
    a.append(int(input()))
a=set(a)

memo = [0]*(n+1)
memo[0]=1
if not(1 in a):
    memo[1]=1

for i in range(2,n+1):
    #print(i)
    if i in a:
        continue
    #print(memo[i-1],memo[i-2])
    memo[i]=memo[i-2]+memo[i-1]
            

#print(memo)
print(memo[n]% 1000000007)
### BUGGY CODE ###

N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))

m_cur = 1
for i in range(1, K+1):
    m_cur *= A[i]

for i in range(K+1, N+1):
    a_latest, a_last = A[i], A[i-K]
    m_last, m_cur = m_cur, (m_cur // a_last) * a_latest
    if m_last < m_cur:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))

for i in range(K+1, N+1):
    a_latest, a_last = A[i], A[i-K]
    if a_latest > a_last:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

from functools import reduce
from itertools import combinations
from operator import or_

n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
d = [1 << i for i in range(n)]
same_groups = [0] * (1 << n)
dp = [0] * (1 << n)

for i in range(1, 1 << n):
    k = i
    rb = k & -k
    ri = rb.bit_length() - 1
    ar = a[ri]
    k ^= rb
    val = same_groups[k]
    while k:
        pb = k & -k
        val += ar[pb.bit_length() - 1]
        k ^= pb
    same_groups[i] = val
# print(same_groups)

for k in range(3, n + 1):
    for grp in combinations(d, k):
        grp_i = reduce(or_, grp)
        val = float('-inf')
        for j in range(1, k + 1):
            for subgrp in combinations(grp, j):
                subgrp_i = reduce(or_, subgrp)
                comple_i = grp_i ^ subgrp_i
                val = max(val, same_groups[subgrp_i] + dp[comple_i])
                # print(grp, subgrp, same_groups[subgrp_i], dp[comple_i])
        dp[grp_i] = val
        # print(k, dp, grp_i)
    # print(k)

print(dp[-1])


### FIXED CODE ###

n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
d = [1 << i for i in range(n)]

same_groups = [0] * (1 << n)
for i in range(1, 1 << n):
    k = i
    rb = k & -k
    ri = rb.bit_length() - 1
    ar = a[ri]
    k ^= rb
    val = same_groups[k]
    while k:
        pb = k & -k
        val += ar[pb.bit_length() - 1]
        k ^= pb
    same_groups[i] = val

dp = [0] * (1 << n)
for grp in range(1 << n):
    g = grp
    while g:
        dp[grp] = max(dp[grp], same_groups[g] + dp[grp ^ g])
        g = (g - 1) & grp

print(dp[-1])
### BUGGY CODE ###

a,b,x=map(int,input().split())
if a%x==0:
    m=a//x
else:
    m=a//x+1
ans=0
while b>=m*x:
    ans+=1
    m+=1
print(ans)

### FIXED CODE ###

a,b,x=map(int,input().split())
if a%x==0:
    print(b//x-a//x+1)
else:
    print(b//x-a//x)
### BUGGY CODE ###

n, m = map(int, input().split())
num = list(map(int, input().split()))
for i in range(m):
  num.sort()
  cnt, changeNum = map(int, input().split())
  for j in range(cnt):
    if num[j] >= changeNum:
      break
    else:
      num[j] = changeNum
print(sum(num))

### FIXED CODE ###

import sys
from heapq import heappush, heappop

input = sys.stdin.readline
n, m = map(int, input().split())
heap = []

for i in map(int, input().split()):
  heappush(heap, i)

bc = [list(map(int, input().split())) for _ in range(m)]
bc.sort(key = lambda x: -x[1])#cが大きいものから順に操作を加える

for b,c in bc:
  for j in range(b):
    a = heappop(heap)
    if a < c:
      heappush(heap, c)
    else:
      heappush(heap, a)
      break
print(sum(heap))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N = int(input())
A = [[int(i) - 1 for i in input().split()] for _ in range(N)]

cur = [0] * N

max_pairs = N * (N - 1)

pairs = 0
cnt = 1
for _ in range(max_pairs):
    visited = [False] * N
    for i, a in enumerate(A):
        if cur[i] >= N - 1:
            continue
        p = a[cur[i]]
        if A[p][cur[p]] == i:
            # print(cnt, p + 1, A[p][cur[p]] + 1, i + 1)
            visited[i] = True
            visited[a[cur[i]]] = True
            pairs += 1

    # print(pairs)
    if pairs == max_pairs:
        break
    if pairs > max_pairs:
        print(-1)
        quit()

    update = False
    for i, v in enumerate(visited):
        if v:
            cur[i] += 1
            update = True

    if not update:
        print(-1)
        quit()

    cnt += 1

print(cnt)

### FIXED CODE ###

import time
start = time.time()

import sys
input = sys.stdin.readline

N = int(input())
A = [[int(i) - 1 for i in input().split()] for _ in range(N)]

cur = [0] * N

max_pairs = N * (N - 1)

pairs = 0
cnt = 1
for _ in range(max_pairs // 2):
    visited = [False] * N
    for i, a in enumerate(A):
        if cur[i] >= N - 1:
            continue
        p = a[cur[i]]
        if A[p][cur[p]] == i:
            # print(cnt, p + 1, A[p][cur[p]] + 1, i + 1)
            visited[i] = True
            visited[a[cur[i]]] = True
            pairs += 1

    # print(pairs)
    if pairs == max_pairs:
        break
    if pairs > max_pairs:
        print(-1)
        quit()

    update = False
    for i, v in enumerate(visited):
        if v:
            cur[i] += 1
            update = True

    if not update:
        print(-1)
        quit()

    if time.time() - start > 1.8:
        print(N * (N - 1) // 2)
        exit()

    cnt += 1

print(cnt)
### BUGGY CODE ###

import numpy as np
N,K,Q=map(int,input().split(' '))
A=[]
for i in range(Q):
  A.append(int(input()))
  
scores=np.array([K for x in range(N)])
for x in A:
  scores-=1
  scores[x-1]+=1

for i,xx in enumerate(scores):
  if xx>0:
    print('Yes')
  else:
    print('No')


### FIXED CODE ###

import numpy as np
import collections

N,K,Q=map(int,input().split(' '))
A=[]
for i in range(Q):
  A.append(int(input()))

c = collections.Counter(A)
for i in range(1,N+1):
  if K+c[i]-Q>0:
    print('Yes')
  else:
    print('No')
### BUGGY CODE ###

import numpy as np
N = int(input())
a = np.array( list(map(float, input().split(" "))) )
b = np.array( list(map(float, input().split(" "))) )
c = np.array( list(map(float, input().split(" "))) )

mem_b = np.zeros(N, dtype=np.int16)

dict_c = {}
def count_c(v):
    key = v
    if v in dict_c:
        return dict_c[v]
    else:
        val = len(np.where( (v < c) == True )[0])
        dict_c.update({key:val})
        return val

num = 0
for i in range(N):
    mem_b[i] += count_c(b[i])

for i in range(N):
    num += ( (a[i] < b) * mem_b ).sum()
print(num)

### FIXED CODE ###

N = int(input())
a = list(map(float, input().split(" ")))
b = list(map(float, input().split(" ")))
c = list(map(float, input().split(" ")))

a.sort()
c.sort()


def bisect_left(a, x, lo=0, hi=None):
    """Return the index where to insert item x in list a, assuming a is sorted.
    The return value i is such that all e in a[:i] have e < x, and all e in
    a[i:] have e >= x.  So if x already appears in the list, a.insert(x) will
    insert just before the leftmost x already there.
    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    """

    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if a[mid] < x: lo = mid+1
        else: hi = mid
    return lo

def bisect_right(a, x, lo=0, hi=None):
    """Return the index where to insert item x in list a, assuming a is sorted.
    The return value i is such that all e in a[:i] have e <= x, and all e in
    a[i:] have e > x.  So if x already appears in the list, a.insert(x) will
    insert just after the rightmost x already there.
    Optional args lo (default 0) and hi (default len(a)) bound the
    slice of a to be searched.
    """

    if lo < 0:
        raise ValueError('lo must be non-negative')
    if hi is None:
        hi = len(a)
    while lo < hi:
        mid = (lo+hi)//2
        if x < a[mid]: hi = mid
        else: lo = mid+1
    return lo

num = 0
for i in range(N):
    num += (bisect_left(a, b[i])) * (len(c) - bisect_right(c, b[i]))
print(num)
### BUGGY CODE ###

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

# check
result_score = 0
for score, i in [(1, A), (0, B), (-1, C)]:
        if K <= 0:
                break
        while K > 0 and i > 0:
                result_score += score
                i -= 1
                K -= 1

print(result_score)

### FIXED CODE ###

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

# check
result_score = 0
for score, i in [(1, A), (0, B), (-1, C)]:
        if K <= 0:
               continue

        if K >= i:
            result_score += score * i
            K -= i
        else:
            result_score += score * K
            K = 0

print(result_score)
### BUGGY CODE ###

N = int(input())
a = list(map(int,input().split()))
s = [0] * 30
t = [1] * 30
for i in range(29):
    t[i + 1] *= t[i] * 2
for i in range(N):
    aa = a[i]
    for j in range(30):
        if aa == 0:
            break
        s[j] += aa%2
        aa = aa//2
for i in range(30):
    s[i] = s[i]%2
for i in range(N):
    ans1 = [0] * 30
    for j in range(30):
        ans1[j] = a[i]%2
        a[i] = a[i]//2
        if s[j] == 1:
            ans1[j] = (ans1[j] + 1)%2
    ans = 0
    for j in range(30):
        ans += ans1[j]*t[j]
    print(ans,end = " ")
print()

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
s = [0] * 30
t = [1] * 30
for i in range(29):
    t[i + 1] = t[i] * 2
ss = a[0]
for j in range(N - 1):
    ss = ss ^ a[j + 1]
for j in range(N):
    print(a[j] ^ ss,end = " ")
print()
### BUGGY CODE ###

N = int(input())
li = []
for _ in range(N):
    li.append(int(input()))
    
for i in range(N):
    if i != 0:
        a = max(li[:i])
    else:
        a = 0
    
    if i != N-1:
        b = max(li[i+1:])
    else:
        b = 0
    print(max([a,b]))

### FIXED CODE ###

N = int(input())
li = []
for _ in range(N):
    li.append(int(input()))

li2 = sorted(li)
max1 = li2[-1]
max2 = li2[-2]
max_index = li.index(max1)

if max1 != max2:
    for i in range(N):
        if i == max_index:
            print(max2)
        else:
            print(max1)
else:
    for i in range(N):
        print(max1)
### BUGGY CODE ###

import numpy as np
import sys
input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    for _ in range(K):
        B = np.zeros(N)
        for i, a in enumerate(A):
            bottom = int(i - a)
            top = int(i + a + 1)
            if bottom < 0:
                bottom = 0
            if top > N:
                top = N
            B[bottom:top] += np.ones(top-bottom)
        A = B[:]

    ans = ' '.join(list(map(str, map(int, A))))
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from numba import jit
import sys
input = sys.stdin.readline


@jit
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    for _ in range(K):
        B = [0]*(N+1)
        for i, a in enumerate(A):
            B[max(0, i-a)] += 1
            B[min(N, i+a+1)] -= 1
        for j in range(1, N):
            B[j] += B[j-1]
        if A == B[:-1]:
            A = B[:-1]
            break
        A = B[:-1]

    ans = ' '.join(list(map(str, A)))
    print(ans)


if __name__ == '__main__':
    main()