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

S = list(input())
prev = ''
K = []

while len(S) > 0:
    text = S.pop(0)
    K.append(text)
    while text == prev:
        if len(S) == 0:
            text = prev + text
            K.pop(-1)
        else:
            text += S.pop(0)
    prev = text
    K[-1] = text

print(len(K))

### FIXED CODE ###

S = input()
prev = ''
K = ['']

i = 0

while i < len(S):
    text = S[i]
    prev = K[-1]
    if text == prev:
        if len(S) == i+1:
            K[-1] += text
            break
        else:
            j = i
            i += len(prev)
            text = S[j:i+1]
    K.append(text)
    i += 1

# print(K)
print(len(K)-1)
### BUGGY CODE ###

if __name__ == '__main__':
    h,w = list(map(int, input().split()))
    s = []
    for i in range(h):
        s.append(input())
    
    l = [[0 for i in range(w)] for j in range(h)]
    r = [[0 for i in range(w)] for j in range(h)]
    u = [[0 for i in range(w)] for j in range(h)]
    d = [[0 for i in range(w)] for j in range(h)]

    for i in range(h):
        for j in range(0, w):
            if(s[i][j] == "#"):
                l[i][j] = 0
            elif(j == 0):
                l[i][j] = 1
            else:
                l[i][j] = l[i][j-1] + 1
            
            if(s[i][w-j-1] == "#"):
                r[i][w-j-1] = 0
            elif(j == 0):
                r[i][w-j-1] = 1
            else:
                r[i][w-j-1] = r[i][w-j] + 1
            
            if(s[i][j] == "#"):
                u[i][j] = 0
            elif(i == 0):
                u[i][j] = 1
            else:
                u[i][j] = u[i-1][j] + 1
                
            if(s[h-i-1][j] == "#"):
                d[h-i-1][j] = 0
            elif(i == 0):
                d[h-i-1][j] = 1
            else:
                d[h-i-1][j] = d[h-i][j] + 1
            
    result = 0

    for i in range(h):
        for j in range(w):
            result = max(result, l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3)


    print(result)


### FIXED CODE ###

if __name__ == '__main__':
    h,w = list(map(int, input().split()))
    s = []
    for i in range(h):
        s.append(input())
    
    l = [[0 for i in range(w)] for j in range(h)]
    r = [[0 for i in range(w)] for j in range(h)]
    u = [[0 for i in range(w)] for j in range(h)]
    d = [[0 for i in range(w)] for j in range(h)]

    for i in range(h):
        for j in range(0, w):
            if(s[i][j] == "#"):
                l[i][j] = 0
            elif(j == 0):
                l[i][j] = 1
            else:
                l[i][j] = l[i][j-1] + 1
            
            tw = w-j-1
            if(s[i][tw] == "#"):
                r[i][tw] = 0
            elif(j == 0):
                r[i][tw] = 1
            else:
                r[i][tw] = r[i][tw+1] + 1
            
            if(s[i][j] == "#"):
                u[i][j] = 0
            elif(i == 0):
                u[i][j] = 1
            else:
                u[i][j] = u[i-1][j] + 1
                
            th = h-i-1
            if(s[th][j] == "#"):
                d[th][j] = 0
            elif(i == 0):
                d[th][j] = 1
            else:
                d[th][j] = d[th+1][j] + 1
            
    result = 0

    for i in range(h):
        for j in range(w):
            result = max(result, l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3)


    print(result)
### BUGGY CODE ###


N, P = map(int, input().split())
S = list(map(int, input()))
ans = 0
if P == 2:
    for i in range(N):
        if S[i]%2 == 0:
            ans +=i+1
    print(ans)

elif P ==5:
    for i in range(N):
        if S[i]%5 == 0:
            ans +=i+1
    print(ans)
else:
    data =[0]*P
    S[-1] = S[-1]%P
    data[S[-1]] +=1
    for i in range(N-2,-1,-1):
        k = (S[i+1] + S[i]*(10**(N-i-1))) %P
        S[i] =k
        data[k] += 1
    for i in data:
        ans += i*(i-1)/2
    ans +=data[0]
    print(int(ans))

### FIXED CODE ###

N, P = map(int, input().split())
S = list(map(int, input()))
ans = 0
if P == 2:
    for i in range(N):
        if S[i]%2 == 0:
            ans +=i+1
    print(ans)

elif P ==5:
    for i in range(N):
        if S[i]%5 == 0:
            ans +=i+1
    print(ans)
else:
    data =[0]*P
    tens = 1
    k = 0
    for i in range(N-1,-1,-1):
        k += S[i] *tens %P
        k = k%P
        data[k] += 1
        tens *=10
        tens %=P

    for i in data:
        ans += i*(i-1)/2
    ans +=data[0]
    print(int(ans))
### BUGGY CODE ###

#!/usr/bin/python3
# -*- coding: utf-8 -*-
MOD = 1000000007


def main():
  S = str(input())
  dp = [[0 for _ in range(3)] for _ in range(len(S)+1)]
  A,AB,ABC = [0,1,2]
  wc_num = 0
  for i,s in enumerate(S):
    if s in "A?":
      dp[i+1][A] = (dp[i+1][A]+dp[i][A]+3**wc_num) % MOD
      dp[i+1][AB] = (dp[i+1][AB]+dp[i][AB]) % MOD
      dp[i+1][ABC] = (dp[i+1][ABC]+dp[i][ABC]) % MOD
    if s in "B?":
      dp[i+1][A] = (dp[i+1][A]+dp[i][A]) % MOD
      dp[i+1][AB] = (dp[i+1][AB]+dp[i][AB]+dp[i][A]) % MOD
      dp[i+1][ABC] = (dp[i+1][ABC]+dp[i][ABC]) % MOD
    if s in "C?":
      dp[i+1][A] = (dp[i+1][A]+dp[i][A]) % MOD
      dp[i+1][AB] = (dp[i+1][AB]+dp[i][AB]) % MOD
      dp[i+1][ABC] = (dp[i+1][ABC]+dp[i][ABC]+dp[i][AB]) % MOD
    if s == "?":
      wc_num += 1
  print(dp[len(S)][ABC])



if __name__ == "__main__":
  main()

### FIXED CODE ###

#!/usr/bin/python3
# -*- coding: utf-8 -*-
MOD = 1000000007


def main():
  S = str(input())
  dp = [[0 for _ in range(3)] for _ in range(len(S)+1)]
  A,AB,ABC = [0,1,2]
  wc_num = 1
  for i,s in enumerate(S):
    if s in "A?":
      dp[i+1][A] = (dp[i+1][A]+dp[i][A]+wc_num) % MOD
      dp[i+1][AB] = (dp[i+1][AB]+dp[i][AB]) % MOD
      dp[i+1][ABC] = (dp[i+1][ABC]+dp[i][ABC]) % MOD
    if s in "B?":
      dp[i+1][A] = (dp[i+1][A]+dp[i][A]) % MOD
      dp[i+1][AB] = (dp[i+1][AB]+dp[i][AB]+dp[i][A]) % MOD
      dp[i+1][ABC] = (dp[i+1][ABC]+dp[i][ABC]) % MOD
    if s in "C?":
      dp[i+1][A] = (dp[i+1][A]+dp[i][A]) % MOD
      dp[i+1][AB] = (dp[i+1][AB]+dp[i][AB]) % MOD
      dp[i+1][ABC] = (dp[i+1][ABC]+dp[i][ABC]+dp[i][AB]) % MOD
    if s == "?":
      wc_num = (wc_num*3) % MOD
  print(dp[len(S)][ABC])



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

k = int(input())
num = input().split()

ass = 0

for i in range(k):
    for j in range(i+1,k):
        n1 = int(num[i])
        n2 = int(num[j])
        n3 = n1 * n2
        ass += n3
        ass = ass % (10**9 + 7)


ans = ass % (10**9 + 7)
print(ans)

### FIXED CODE ###

k = int(input())
num = input().split()

l = 0
ass = 0
ans = 0

for i in range(k):
    l += int(num[i])

for i in range(k):
    l -= int(num[i])
    ass += int(num[i]) * l
    

ans = ass % (10**9 + 7 )
print(ans)
### BUGGY CODE ###

# import time
#
# start = time.time()

import sys
input = sys.stdin.readline
N,Q = [int(n) for n in input().split()]
S = "f" + str(input()) + "f"
# print(S)
t = [""]*Q
d = [""]*Q
for i in range(Q):
    t[i],d[i] = [str(n) for n in input().split()]

#左に落ちるやつで一番右のゴーレムのインデックスを探す
def leftbinarysearch():
    l = 0
    r = N + 1
    # cnt = 0#デバグ用カウンタ
    while(l<r):
        m = (l+r)//2 + 1#探索範囲の中央値のIndexのゴーレムでシミュレーション
        cur = m#探す一つのゴーレムの現在地
        fall = False
        # print(l,r,m)
        for i in range(Q):
            if t[i] == S[cur]:
                if d[i] == "L":
                    cur-=1
                else:
                    cur+=1
                if(cur == 0):#左端に落ちるなら次はもっと右のやつを確かめる
                    l = m
                    fall = True
                    break
                elif(cur == N+1):#右端に落ちるなら下の処理に飛ぶ
                    break
        if not fall:#落ちなかったならそれより左端を探す
            r = m - 1
        # cnt+=1
        # if(cnt == 10):print("loop", file=sys.stderr);break;
    return l

#→に落ちるやつを返す
def rightbinarysearch():
        l = 0
        r = N + 1
        # cnt = 0
        while(l<r):
            m = (l+r)//2#探索範囲の中央値のIndexのゴーレムでシミュレーション
            cur = m#探す一つのゴーレムの現在地
            fall = False
            # print(l,r,m)
            for i in range(Q):
                if t[i] == S[cur]:
                    if d[i] == "L":
                        cur-=1
                    else:
                        cur+=1
                    if(cur == N+1):#右端に落ちるなら次はもっと左のやつを確かめる
                        r = m
                        fall = True
                        break
                    elif(cur == -1):#左端に落ちるなら下の処理まで飛ぶ
                        break
            if not fall:#落ちなかったならそれより右端を探す
                l = m + 1
            # cnt+=1
            # if(cnt == 10):print("loop", file=sys.stderr);break;
        return l
# print(rightbinarysearch())
# print(leftbinarysearch())
print(rightbinarysearch()-leftbinarysearch()-1)

# end = time.time()
# print(end - start)


### FIXED CODE ###

n, q = [int(_) for _ in input().split()]
s = input()

Q = [(input().split()) for i in range(q)]
Q.reverse()
l = 0
r = n - 1
for t,d in Q:
    if s[l] == t and d == "L":
        l += 1
    elif l > 0 and s[l - 1] == t and d == "R":
        l -= 1
    if s[r] == t and d == "R":
        r -= 1
    elif r < n - 1 and s[r + 1] == t and d == "L":
        r += 1
    # print(r,l,r-l+1)
    if l > r:
        break
print(r - l + 1)
### BUGGY CODE ###

#https://atcoder.jp/contests/abc174/tasks/abc174_c

K= int(input(" "))

B= 7

if K%2==0 or K%5==0:
    print(-1)
elif K==1 or K==7:
    print(1)
else:
    i = 1
    while 1:
        i= i+1
        B = 10*B + 7
        if B%K==0:
            print(i)
            break

### FIXED CODE ###

#https://atcoder.jp/contests/abc174/tasks/abc174_c
K= int(input())

if K%2==0 or K%5==0:
    print(-1)
elif K==1 or K==7:
    print(1)
else:
    B = 7
    i = 1
    while 1:
        if B==0:
            print(i)
            break
        else:
            B = (10 * B + 7) % K
            i = i + 1
### BUGGY CODE ###

def main():
	N = int(input())
	A = list(map(int, input().split()))
	ans = ["0"]*N
	mat = [[1 for _ in range(N)] for _ in range(N)]
	for i in range(N):
		for j in range(1, N, 2):
			mat[i][(i+j)%N] = -1
	for i in range(N):
		this_ans = 0
		for j in range(N):
			this_ans += mat[i][j]*A[j]
		ans[i] = str(this_ans)
	print(" ".join(ans))


if __name__ == '__main__':
	main()

### FIXED CODE ###

def main():
	N = int(input())
	A = list(map(int, input().split()))
	ans = ["0"]*N
	this_ans = 0
	offset = [1, -1]
	for i in range(N):
		this_ans += A[i]*offset[i%2]
	ans[0] = str(this_ans)
	for i in range(N-1):
		this_ans = A[i] - int(ans[i])//2
		ans[i+1] = str(this_ans*2)
	print(" ".join(ans))


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

import math
from functools import reduce
from collections import deque,defaultdict
import sys
sys.setrecursionlimit(10**7)

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

s = input()
X = list(map(int, list(s)))
n = len(s)

ruiseki = [0] * (n+1)
for i in (range(n-1, -1, -1)):
    ruiseki[i] = (X[i] * 10**(n-i-1) + ruiseki[i+1]) % 2019

# log(ruiseki)

ans = 0
count = defaultdict(int)

for x in ruiseki:
    # log(count[x])
    ans += count[x]
    count[x] += 1
# log(count)
print(ans)


### FIXED CODE ###

import math
from functools import reduce
from collections import deque,defaultdict
import sys
sys.setrecursionlimit(10**7)

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

s = input()
X = list(map(int, list(s)))
n = len(s)

ruiseki = [0] * (n+1)
for i in (range(n-1, -1, -1)):
    ruiseki[i] = (X[i] * pow(10, (n-i-1), 2019) + ruiseki[i+1]) % 2019

# log(ruiseki)

ans = 0
count = defaultdict(int)

for x in ruiseki:
    # log(count[x])
    ans += count[x]
    count[x] += 1
# log(count)
print(ans)
### BUGGY CODE ###

from itertools import combinations
from itertools import permutations

N = int(input())
L = list(map(int, input().split()))

count = 0
for pars in list(combinations(L, 3)):
    for bars in list(permutations(list(pars), 3)):
        if bars[0] < bars[1] + bars[2]:
            if abs(bars[1] - bars[2]) < bars[0]:
                count += 1
                break
print(count)

### FIXED CODE ###

N = int(input())
L = sorted(list(map(int, input().split())), reverse=True)

def aaa(arr): 
    n = len(arr) 
    arr.sort() 
    count = 0
    for i in range(0,n-2): 
        k = i + 2
        for j in range(i+1,n): 
            while (k < n and arr[i] + arr[j] > arr[k]): 
                k += 1
            if(k>j): 
                count += k - j - 1
  
    return count 

print(aaa(L))
### BUGGY CODE ###

N = int(input())
A = [int(a) for a in input().split()]

dp = [[0]*N for _ in range(N)]
        
for k in range(N):
    for i in range(N-k):
        if k == 0:
            dp[i][i] = A[i]
            continue
    
        dp[i][i+k] = max(A[i]-dp[i+1][i+k], A[i+k]-dp[i][i+k-1])

print(dp[0][N-1])

### FIXED CODE ###

N = int(input())
A = [int(a) for a in input().split()]

dp = [[0]*N for _ in range(N)]
        
for k in range(N):
    for i in range(N-k):
        if k == 0:
            dp[i][i] = A[i]
            continue
    
        dp[i][i+k] = max(A[i]-dp[i+1][i+k], A[i+k]-dp[i][i+k-1])

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

n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(m):
    a.sort()
    a[-1]=a[-1]//2
print(sum(a))

### FIXED CODE ###

import heapq

n,m=map(int,input().split())
a=list(map(lambda x: int(x)*(-1),input().split()))
heapq.heapify(a)

for i in range(m):
    tmp_min=heapq.heappop(a)
    if tmp_min%2==0:
        push=tmp_min/2
    else:
        push=tmp_min//2+1
    heapq.heappush(a,push)
print(int(-sum(a)))
### BUGGY CODE ###

s=input()
q=int(input())
flag=0
for _ in range(q):
  query=input().split()
  if len(query)==1:
    flag=(flag+1)%2
  else:
    if (int(query[1])+flag)%2:
      s=query[2]+s
    else:
      s=s+query[2]
print(s if flag==0 else s[::-1])

### FIXED CODE ###

from collections import deque
s=deque(input())
q=int(input())
flag=0
for _ in range(q):
  query=input().split()
  if len(query)==1:
    flag=(flag+1)%2
  else:
    if (int(query[1])+flag)%2:
      s.appendleft(query[2])
    else:
      s.append(query[2])
print(''.join(s) if flag==0 else ''.join(reversed(s)))
### BUGGY CODE ###

n = int(input())
t = list(map(int, input().split()))
v = list(map(int, input().split()))
v.insert(0, 0)
v.append(0)
l = [0, 0]
r = [0]
for i in range(n):
    l.append(l[i+1]+t[i])
    r.append(l[i+2])
r.append(r[n])
d = 0
vl = 0
for k in range(l[n+1]*2):
    now = k / 2 + 0.5
    vr = 1000
    for i in range(n+2):
        tv = 0
        if now < l[i]:
            tv = v[i] + l[i] - now
        elif now < r[i]:
            tv = v[i]
        else:
            tv = v[i] + now - r[i]
        vr = min(vr, tv)
    d += (vl+vr) * 0.25
    vl = vr
print(d)

### FIXED CODE ###

n = int(input())
t = list(map(int, input().split()))
v = list(map(int, input().split()))
v.insert(0, 0)
v.append(0)
l = [0, 0]
r = [0]
for i in range(n):
    l.append(l[i+1]+t[i])
    r.append(l[i+2])
r.append(r[n])
d = 0
vl = 0
for k in range(l[n+1]*2):
    now = k / 2 + 0.5
    vr = 1000
    for i in range(n+2):
        tv = 0
        if now < l[i]:
            tv = v[i] + l[i] - now
        elif now < r[i]:
            tv = v[i]
        else:
            tv = v[i] + now - r[i]
        vr = min(vr, tv)
    d += (vl+vr) * 0.25
    vl = vr
print(d)
### BUGGY CODE ###

import numpy as np
S = input()
S_list = []
for i in range(len(S)):
    S_list.append(int(S[i]))
S_list = np.array(S_list)
num = 0
for i in range(len(S_list)-3):
    sum_temp = np.sum([v * np.power(10, k) for k, v in enumerate(S_list[i:i+3][::-1])])
    for j in range(i+3, len(S)):
        sum_temp *= 10
        sum_temp += S_list[j]
        if sum_temp % 2019 == 0:
            num += 1
print(num)

### FIXED CODE ###

S = input()
N = len(S)
mod = 2019
num = [0 for i in range(2019)]
num[0] = 1
t = 1
rem = 0

for i in reversed(S):
    rem += int(i) * t
    rem %= mod
    t *= 10
    t %= mod
    num[rem] += 1

print(int(sum([i * (i-1) / 2 for i in num])))
### BUGGY CODE ###

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

X=[int(_) for _ in input().split()]
X.sort()
if N>=M:
    print('0')
    exit(0)

Sum=[]
for i in range(M-1):
    Sum.append(abs(X[i+1]-X[i]))

Sum.sort()
for i in range(N-1):
    Sum.remove(Sum[-1])

print(sum(Sum))


### FIXED CODE ###

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

X=[int(_) for _ in input().split()]
X.sort()
if N>=M:
    print('0')
    exit(0)
Sum=[]
for i in range(M-1):
    Sum.append(abs(X[i+1]-X[i]))
Sum.sort()
for i in range(N-1):
    Sum.pop()
print(sum(Sum))
### BUGGY CODE ###

import numpy as np
import string

S = input()
T = input()

S_ = []
T_ = []
for c in string.ascii_lowercase:
    S_.append(np.array(list(map(lambda x: 0 if c != x else 1, S))))
    T_.append(np.array(list(map(lambda x: 0 if c != x else 1, T))))

for s_ in S_:
    flag = False
    for i,t_ in enumerate(T_):
        if np.all(t_- s_ == 0):
            flag = True
            T_.pop(i)
            break
    if not flag:
        print("No")
        exit(0)

print("Yes")

    


### FIXED CODE ###

#このコード
# aabbccdd
# ababcdcd
# をYesと通すのだが....

from collections import Counter
 
S = list(input())
T = list(input())
 
cs = sorted(Counter(S).values())
ct = sorted(Counter(T).values())
 
if cs == ct:
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

import numpy as np
from collections import deque
n=int(input())
a=deque(list(map(int,input().split())))
c=np.array([1 if i%2==0 else -1 for i in range(n)])

ans=[]
for _ in range(n):
    rain=sum([i*j for i,j in zip(a,c)])
    tmp=a.popleft()
    a.append(tmp)
    ans.append(str(rain))
    


print(" ".join(ans))

### FIXED CODE ###

from collections import deque
n=int(input())
a=deque(list(map(int,input().split())))
c=deque([1 if i%2==0 else -1 for i in range(n)])

ans=[]
for loop in range(n):
    if loop==0:
        t=sum([i*j for i,j in zip(a,c)])
    else:
        t=2*a[loop-1]-t
    ans.append(str(t))


print(" ".join(ans))
### BUGGY CODE ###

import itertools
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()))
result = [a + b + c for (a,b,c) in list(itertools.product(A, B, C))]
result.sort(reverse = True)
for i in range(K):
    print(result[i])

### FIXED CODE ###

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()))
A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)
t =[]
for i in range(X):
    for j in range(Y):
        for k in range(Z):
            if (i+1)*(j+1)*(k) <= K:
                t.append(A[i]+B[j]+C[k])
            else:break
t.sort(reverse=True)
for i in range(K):
    print(t[i])
### BUGGY CODE ###

s = input()
t = input()

sl = len(s)
tl = len(t)
dp = [["" for i in range(tl+1)] for i in range(sl+1)]

#dp[i][j] sをi文字目、tをj文字目まで求めたときの最大の長さ

for i in range(1,sl+1):
    for j in range(1,tl+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = dp[i-1][j-1]+s[i-1]
        else:
            if len(dp[i-1][j]) > len(dp[i][j-1]):
                dp[i][j] = dp[i-1][j]
            else:
                dp[i][j] = dp[i][j-1]
print(dp[sl][tl])
    

### FIXED CODE ###

s = input()
t = input()

sl = len(s)
tl = len(t)
dp = [[0 for i in range(tl+1)] for i in range(sl+1)]

#dp[i][j] sをi文字目、tをj文字目まで求めたときの最大の長さ

for i in range(1,sl+1):
    for j in range(1,tl+1):
        if s[i-1] == t[j-1]:
            dp[i][j] = dp[i-1][j-1]+1
        else:
            dp[i][j] = max(dp[i-1][j],dp[i][j-1])

ansl = dp[sl][tl]
i = sl
j = tl
ans = [""]*ansl
while(ansl>0):
    if s[i-1] == t[j-1]:
        ans[ansl-1] = s[i-1]
        i -= 1
        j -= 1
        ansl -= 1
    elif dp[i][j]==dp[i-1][j]:
        i -= 1
    else:
        j -= 1

print("".join(ans))
### BUGGY CODE ###

x=input()
x0=x.split()
n=int(x0[0])
k=int(x0[1])
a0=input()
a0=a0.split()
a=[int(s) for s in a0]
a1=[int(s) for s in a0]
for f in range(k):
    for x in range(n):
        c=0
        for i in range(n):
            if a1[i]-abs(x-i)>=0:
                c=c+1
        a[x]=c
    a1=[int(s) for s in a]
a=[str(s) for s in a]
a=" ".join(a)
print(a)

### FIXED CODE ###

from numba import njit

@njit(cache=True)
def aaa(n,k,a):
    for f in range(k):
        a1=[0]*(n+1)
        for x in range(n):
            y=max(0,x-a[x])
            a1[y]=a1[y]+1    
            z=min(n-1,x+a[x])
            a1[z+1]=a1[z+1]-1
        a[0]=a1[0]
        for x in range(1,n):    
            a[x]=a[x-1]+a1[x]
        if a==[n]*n:
            break
    return a

x=input()
x0=x.split()
n=int(x0[0])
k=int(x0[1])
a0=input()
a0=a0.split()
a=[int(s) for s in a0]

b=aaa(n,k,a)
for i in range(n):
    print(b[i])
### BUGGY CODE ###

s=input()
t=input()

# minimize
mnmz={ch for ch in s} & {ch for ch in t}
if len(mnmz)==0:
    print("")
    exit()
s="".join([ z for z in s if z in mnmz])
t="".join([ z for z in t if z in mnmz])
if len(s)>len(t): s, t = t, s

# init
dp=[[0]*len(s) for _ in range(len(t))]

#dp frame

for i in range(len(s)): 
    if s[i]==t[0]:
        for j in range(i, len(s)):
            dp[0][j]=1
        break
for i in range(len(t)): 
    if s[0]==t[i]:
        for j in range(i, len(t)):
            dp[j][0]=1
        break
#dp
for i in range(1,len(t)):
    for j in range(1, len(s)):
        temp = max(dp[i][j-1], dp[i-1][j])
        if s[j]==t[i]:
            if temp<dp[i-1][j-1]+1:
                temp=dp[i-1][j-1]+1
        dp[i][j]=temp
    if dp[i][-1]==len(s): break

#recover string
res=[]
j=len(s)-1
i=len(t)-1
while i>0 and j>0:
    if s[j]==t[i] and dp[i][j]==dp[i-1][j-1]+1:
        res.append(s[j])
        i=i-1
        j=j-1
        continue
    if dp[i][j]==dp[i][j-1]:
        j=j-1
    else: i=i-1
# last letter (first acually)
if i==0:
    res.append(t[0])
elif j==0:
    res.append(s[0])


print("".join(reversed(res)))

### FIXED CODE ###

s=[ord(ch)-97 for ch in input()]
t=[ord(ch)-97 for ch in input()]

# minimize
mnmz={ch for ch in s} & {ch for ch in t}
if len(mnmz)==0:
    print("")
    exit()
s=[ z for z in s if z in mnmz ]
t=[ z for z in t if z in mnmz ]
if len(s)>len(t): s, t = t, s

# init
dp=[[0]*len(s) for _ in range(len(t))]

#dp frame init
for i in range(len(s)): 
    if s[i]==t[0]:
        for j in range(i, len(s)):
            dp[0][j]=1
        break
for i in range(len(t)): 
    if s[0]==t[i]:
        for j in range(i, len(t)):
            dp[j][0]=1
        break
#dp
for i in range(1,len(t)):
    for j in range(1, len(s)):
        if s[j]==t[i]:
            dp[i][j]=dp[i-1][j-1]+1
        else: dp[i][j]=(dp[i][j-1] if dp[i][j-1]>dp[i-1][j] else dp[i-1][j])

#recover string
res=[]
j=len(s)-1
i=len(t)-1
while i>=0 and j>=0:
    if s[j]==t[i]: #and dp[i][j]==dp[i-1][j-1]+1:
        res.append(s[j])
        i=i-1
        j=j-1
        continue
    if i==0 and j==0: break
    if j>0 and dp[i][j]==dp[i][j-1]:
        j=j-1
    else: i=i-1
# last letter (first acually)


print("".join(chr(i+97) for i in reversed(res)))
### BUGGY CODE ###

n = input()
l = list(map(int, input().split()))
l.sort(reverse=True)
s = 0
for i in range(len(l)-2):
  longest = l[i]
  if l[i+1] + l[i+2] > longest:
    for j in range(i + 1, len(l)-1):
      second = l[j]
      for k in range(len(l)-1, j, -1):
        if second + l[k] > longest:
          s += k - j
          break
print(s)

### FIXED CODE ###

from bisect import bisect_right
n = input()
l = list(map(int, input().split()))
l.sort()
s = 0
for i in range(len(l)-2):
  for j in range(i+1, len(l)-1):
    ind = bisect_right(l, l[i] + l[j] - 1)
    s += max(ind - j - 1, 0)
print(s)