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

def prep_array(X, Y):
    c = [[0]*1001 for _ in range(1000+1)]
    return c


def calc_lcs(X, Y, c):
    m = len(X)
    n = len(Y)
    X = ' ' + X
    Y = ' ' + Y

    pre_row = c[0]
    for i in range(1, m+1):
        row = c[i]
        XX = X[i]
        for j in range(1, n+1):
            if XX == Y[j]:
                row[j] = pre_row[j - 1] + 1
            elif pre_row[j] >= row[j - 1]:
                row[j] = pre_row[j]
            else:
                row[j] = row[j - 1]
        pre_row = row
    return check_max(c)


def check_max(array):
    max_lcs = 0
    for row in array:
        temp_max = max(row)
        if temp_max > max_lcs:
            max_lcs = temp_max
    return max_lcs


if __name__ == '__main__':
    # ??????????????\???
    num = int(input())
    # f = open('input.txt')
    # num = int(f.readline())

    for _ in range(num):
        X = input()
        Y = input()
        # X = f.readline().strip()
        # Y = f.readline().strip()

        # ???????????????
        result = calc_lcs(X, Y, prep_array(X, Y))

        # ???????????¨???
        print(result)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_C

最長共通部分列
"""


c = []
def prep_array(X, Y):
    global c
    """ 値が0の2次元配列を用意する。サイズは入力データの最大値を想定して縦横(1000+1)以上必要。 """
    # from array import array
    # c = [array('I', [0] * (len(X)+1)) for _ in range(len(Y)+1)]  #  arrayで用意
    c = [[0]*(len(Y)+2) for _ in range(len(X)+2)] #  リストで用意
    return c


def check_max(array):
    """ 2次元配列の中の最大の値を返す """
    max_lcs = 0
    for row in array:
        temp_max = max(row)
        if temp_max > max_lcs:
            max_lcs = temp_max
    return max_lcs


def calc_lcs4(X, Y, c):
    """
    Y[j]のアクセス方法を変更
    リストの値を一旦変数に保存するように変更
    最長共通部分長を関数内で計算するように変更
    4/5 のテストデータを使用してプロファイリングすると実効時間は 5.6秒
    """
    X = ' ' + X
    Y = ' ' + Y
    m = len(X)
    n = len(Y)
    max_lcs = 0

    pre_row = c[0]
    for i in range(1, m):
        row = c[i]
        XX = X[i]
        for j, YY in enumerate(Y):
            if XX == YY:
                pr_j1 = pre_row[j - 1]
                row[j] = pr_j1 + 1
                if pr_j1+1 > max_lcs:
                   max_lcs = pr_j1 + 1
            else:
                pr_j = pre_row[j]
                r_j1 = row[j-1]
                if pr_j >= r_j1:
                    row[j] = pr_j
                else:
                    row[j] = r_j1
        pre_row = row
    return max_lcs


if __name__ == '__main__':
    # データの入力
    num = int(input())
    #f = open('input.txt')
    #num = int(f.readline())

    for _ in range(num):
        X = input().strip()
        Y = input().strip()

        # 処理の実行
        result = calc_lcs4(X, Y, prep_array(X, Y))

        # 結果の表示
        print(result)
### BUGGY CODE ###

def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
gcd=lcm(a)
res = 0
for i in range(n):
    res += gcd//a[i]
    res%=mod
print(res)



### FIXED CODE ###


from fractions import gcd


n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
x = a[0]
for i in range(1, len(a)):
    x = (x * a[i]) // gcd(x, a[i])
gcd=x
res = 0
for i in a:
    res += gcd//i
    #res%=mod
print(res%mod)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
B=[]
C=[]
for i in range(N):
  if A[i] in B:
    C+=[A[i]]
    B.remove(A[i])
  else: 
    B+=[A[i]]
C.sort(reverse=1)
if len(C)<2:
  print(0)
else:
  print(C[0]*C[1])

### FIXED CODE ###

import sys
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=1)
a=0
b=0
j=N-1
for i in range(N-1):
  if A[i]==A[i+1]:
    a=A[i]
    j=i
    break
for i in range(j+2,N-1):
  if A[i]==A[i+1]:
    b=A[i]
    break

print(a*b)
### BUGGY CODE ###

N = int(input())
A_list = list(map(int,input().split()))
result_list = []
for i in range(1, N+1):
    list_idx = A_list.index(i)
    result_list.append(list_idx+1)
print(*result_list)


### FIXED CODE ###

N = int(input())
A_list = list(map(int,input().split()))
result_list = [0]*N
for i, val in enumerate(A_list):
    result_list[val-1] = i+1
print(*result_list)
### BUGGY CODE ###

import math
n, k = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
A = 0
for i in range(n-k+1):
    exp = sum(p[i:i+k])
    if ans < exp:
        ans = exp 
        A = (exp+k)/2
print(A)

### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
exp = sum(p[0:k])
ans = exp
for i in range(n-k):
  exp = exp-p[i]+p[i+k]
  #print(ans, exp)
  if ans<exp:
    ans = exp
    #print("ans", exp, ans)
print((ans+k)/2)
### BUGGY CODE ###

h,w,m=map(int,input().split())
lh=[0]*h
lw=[0]*w
l=[[0 for _ in range(w)] for _ in range(h)]
for i in range(m):
  h1,w1=map(int,input().split())
  l[h1-1][w1-1]=1
  lh[h1-1]+=1
  lw[w1-1]+=1
hmax=max(lh)
wmax=max(lw)
lh2=[]
lw2=[]
for i in range(h):
  if lh[i]==hmax:
    lh2.append(i)
for i in range(w):
  if lw[i]==wmax:
    lw2.append(i)
 
s=1
for m in lh2:
  for m2 in lw2:
    if l[m][m2]==0:
      s=0
      
print(hmax+wmax-s)

### FIXED CODE ###

h,w,m=map(int,input().split())
lh=[0]*h
lw=[0]*w
l=set()
for i in range(m):
  h1,w1=input().split()
  l.add(h1+"_"+w1)
  lh[int(h1)-1]+=1
  lw[int(w1)-1]+=1

hmax=max(lh)
wmax=max(lw)
lh2=[]
lw2=[]
for i in range(h):
  if lh[i]==hmax:
    lh2.append(i)
for i in range(w):
  if lw[i]==wmax:
    for m in lh2:
      if str(m+1)+"_"+str(i+1) not in l:
        print(hmax+wmax)
        exit()      
print(hmax+wmax-1)
### BUGGY CODE ###

import numpy as np
N = int(input())

x = np.array(list(map(int,input().split())))

for i in range(N):
    print (np.argsort(x)[i]+1,"",end="")

### FIXED CODE ###

import numpy as np
N = int(input())

x = np.array(list(map(int,input().split())),dtype=np.int)

print (*np.argsort(x)+1)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
a=1
for i in range(N):
    a=A[i]*a
if a>10**18:
    print(-1)
else:
    print(a)

### FIXED CODE ###

import sys
N = int(input())
A = list(map(int, input().split()))
a=1
if 0 in A:
    print('0')
    sys.exit()
for i in range(N):    
    a=A[i]*a
    if a>10**18:
        print('-1')
        sys.exit()
print(a)
### BUGGY CODE ###

import numpy as np
import sys
N, D, A = map(int, input().split())
L = 2 * D
I = np.array(sys.stdin.read().split(), np.int64)
X = I[::2]
H = I[1::2]
sort_ind = np.argsort(X)
X = X[sort_ind]
H = H[sort_ind]
S = np.zeros(N+1, np.int64)

atack = 0
ans = 0
for i in range(N):
	atack += S[i]
	H[i] -= atack
	if H[i] > 0:
		atack_cnt = -(-H[i]//A)
		ans += atack_cnt
		S[i+1] += atack_cnt * A
		ind = np.searchsorted(X,X[i]+L+1,side = 'left')
		S[ind] -= atack_cnt * A

print(ans)

### FIXED CODE ###

import numpy as np
import sys
N, D, A = map(int, input().split())
L = 2 * D
I = np.array(sys.stdin.read().split(), np.int64)
X = I[::2]
H = I[1::2]
sort_ind = np.argsort(X)
X = X[sort_ind]
H = H[sort_ind]
S = np.zeros(N+1, np.int64)
ind = np.searchsorted(X,X+L+1,side = 'left')

atack = 0
ans = 0
for i in range(N):
	atack += S[i]
	H[i] -= atack
	if H[i] > 0:
		atack_cnt = -(-H[i]//A)
		ans += atack_cnt
		tmp = atack_cnt * A
		S[i+1] += tmp
		S[ind[i]] -= tmp

print(ans)
### BUGGY CODE ###

def main():
    from fractions import gcd
    import sys
    n=int(input())
    a = tuple(map(int, input().split()))
    ans = a[0]

    mmm=10**9+7
    for i in a[1:]:
        ans = ans *i // gcd(ans, i)

    result=0
    for item in a:
      result+=ans//item

    print(result%mmm)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from fractions import gcd
    import sys
    n=int(input())
    a = tuple(map(int, input().split()))
    ans = 1

    mmm=10**9+7
    for i in a:
        ans = ans *i // gcd(ans, i)

    result=0
    for item in a:
      result+=ans//item

    print(result%mmm)

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

import sys
import math
def input():
    return sys.stdin.readline()[:-1]
n,s=map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353
dp = [[[0 for i in range(2)] for i in range(s+1)]for i in range(n+1)]
dp[0][0][0]=0

for i in range(1,n+1):
    for j in range(s+1):
        if j==0:
            b=1
        else:
            b=0
        dp[i][j][0] += (dp[i-1][j][0]+b)
        dp[i][j][0] %= mod
        dp[i][j][1] += (dp[i-1][j][1]+dp[i-1][j][0]+b)
        dp[i][j][1] %= mod
        if j+a[i-1]<=s:
            dp[i][j+a[i-1]][0] += (dp[i-1][j][0]+b)
            dp[i][j+a[i-1]][0] %= mod
            dp[i][j+a[i-1]][1] += (b+dp[i-1][j][0])
            dp[i][j+a[i-1]][1] %= mod

        dp[i][j][0]%=mod
        dp[i][j][1]%=mod

print(dp[n][s][1])



### FIXED CODE ###

import sys
import math
def input():
    return sys.stdin.readline()[:-1]
n,s=map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353
dp0 = [[0 for i in range(s+1)]for i in range(n+1)]
dp1 = [[0 for i in range(s+1)]for i in range(n+1)]
for i in range(1,n+1):
    for j in range(s+1):
        if j==0:
            b=1
        else:
            b=0
        dp0[i][j] += (dp0[i-1][j]+b)
        dp0[i][j] %= mod
        dp1[i][j] += (dp1[i-1][j]+dp0[i-1][j]+b)
        dp1[i][j] %= mod
        if j+a[i-1]<=s:
            dp0[i][j+a[i-1]] += (dp0[i-1][j]+b)
            dp0[i][j+a[i-1]] %= mod
            dp1[i][j+a[i-1]] += (b+dp0[i-1][j])
            dp1[i][j+a[i-1]] %= mod

        dp0[i][j]%=mod
        dp1[i][j]%=mod

print(dp1[n][s])
### BUGGY CODE ###

import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10**7)

ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

n = ni()
a = na()

ans = 1
for i in range(n):
    ans *= a[i]

if ans > 10 ** 18:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10**7)

ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

n = ni()
a = na()
a.sort()

ans = 1
for i in range(n):
    if ans >= 1 and a[i] > 10 ** 18:
        print(-1)
        exit()
    ans *= a[i]
    if ans > 10 ** 18:
        print(-1)
        exit()

if ans > 10 ** 18:
    print(-1)
else:
    print(ans)
### BUGGY CODE ###

s = input()
n = len(s)
p = 2019
ans = 0

num_rem = [0] * p
num_rem[0] = 1
for i in range(n):
    # print(int(s[i:]))
    mod = int(s[i:])%p
    num_rem[mod] = num_rem[mod] + 1
for m in num_rem:
    ans += (m*(m-1))//2
print(ans)


### FIXED CODE ###

s = input()
n = len(s)
p = 2019
ans = 0

num_rem = [0] * p
t = 1
mod = 0
num_rem[mod] = 1
for i in range(n):
    mod = (mod + int(s[-i-1])*t)%p
    num_rem[mod] += 1
    t = (10*t)%p
for m in num_rem:
    ans += (m*(m-1))//2
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6)

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

ans = [0]*n

for i in range(k-1, n):
    tmp = 1
    for a in A[i-k+1:i+1]:
        tmp *= a
    ans[i] = tmp

ans = ans[k-1:]

for i in range(len(ans)-1):
    if ans[i] < ans[i+1]:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

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

#val = 1
#for a in A[:k]:
#    val *= a
#ans = [val]
#pos = k
#while pos < n:
#    tmp = ans[-1]*A[pos]//A[pos-k]
#    ans.append(tmp)
#    pos += 1
#
#for i in range(len(ans)-1):
#    if ans[i] < ans[i+1]:
#        print('Yes')
#    else:
#        print('No')
        
for i in range(n-k):
    pos = k+i
    if A[pos] > A[pos-k]:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

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

import sys

_input = sys.stdin.readlines()
array_length = int(_input[0])
array = list(map(int, _input[1].split()))
# print(array_length, array)
assert array_length == len(array)


def merge(A, left, mid, right):
    global count

    n1 = mid - left
    n2 = right - mid
    L = [0 for _ in range(n1 + 1)]
    R = [0 for _ in range(n2 + 1)]

    for m in range(n1):
        L[m] = A[left + m]

    for n in range(n2):
        R[n] = A[mid + n]

    L[n1], R[n2] = [1e9] * 2
    i, j = [0] * 2

    for k in range(left, right):
        count += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1

    return None


def merge_sort(A, left, right):
    if left + 1 < right:
        mid = (left + right) // 2
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        merge(A, left, mid, right)
    return A


if __name__ == '__main__':
    count = 0
    print(*merge_sort(A=array, left=0, right=array_length))
    print(count)

### FIXED CODE ###

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

import sys


def merge(A, left, mid, right):
    global count

    L = A[left:mid] + [1e9]
    R = A[mid:right] + [1e9]

    i, j = 0, 0

    for k in range(left, right):
        count += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
    return None


def merge_sort(A, left, right):
    if left + 1 < right:
        mid = (left + right) // 2
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        merge(A, left, mid, right)
    return A


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    array_length = int(_input[0])
    array = list(map(int, _input[1].split()))
    assert array_length == len(array)
    count = 0
    print(*merge_sort(A=array, left=0, right=array_length))
    print(count)
### BUGGY CODE ###


N = int(input())
A = list(map(int, input().split()))
IND = list(set(A))
# CNT = [A.count(x) for x in IND]
# print(IND)
# print(CNT)
CONB = [A.count(x)*(A.count(x)-1)//2 for x in IND]
# print(CONB)
SUM = sum(CONB)
for i in A:
    ans = SUM - A.count(i) + 1
    print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
CNT = [0]*(N+1)
# IND = list(set(A))
# CNT = [A.count(x) for x in IND]
for i in A:
    CNT[i] += 1
# print(IND)
# print(CNT)
# CONB = [A.count(x)*(A.count(x)-1)//2 for x in IND]
CONB = [CNT[x]*(CNT[x]-1)//2 for x in range(len(CNT))]
# print(CONB)
SUM = sum(CONB)
for i in A:
    ans = SUM - CNT[i] + 1
    print(ans)
### BUGGY CODE ###


a=int(input())
b=list(map(int, input().split()))
c=1
d=0
if 0 in b:
    d=1
for i in range(a):
    c*=b[i]
    if d!=1 and c>10**18:
        print(-1)
        exit()


print(c)


### FIXED CODE ###


a=int(input())
b=list(map(int, input().split()))
c=1
d=0
if 0 in b:
    print(0)
    exit()
for i in range(a):
    c*=b[i]
    if c>10**18:
        print(-1)
        exit()


print(c)
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, W, K = MAP()
S = np.array([list(map(int, list(input()))) for _ in range(H)])

ans = INF
for x in product([0, 1], repeat=H-1):
	cut = sum(x)
	if any(x):
		lis = np.zeros((H, W+1))
		tmp_lis = np.zeros((W))
		idx = 0
		for i, n in enumerate(x):
			tmp_lis += S[i]
			if n:
				lis[idx][1:] += tmp_lis
				idx += 1
				tmp_lis = np.zeros((W))
				
		if H >= 2:
			tmp_lis += S[-1]
			lis[idx][1:] += tmp_lis
		if (lis>K).sum():
			continue
		lis = lis.cumsum(axis=1)
	else:
		lis = np.sum(S, axis=0)
		tmp = 0
		for n in lis:
			if n > K:
				cut = INF
				break
			tmp += n
			if tmp > K:
				cut += 1
				tmp = n
		ans = min(ans, cut)
		continue
	idxs = []
	idx = 0
	while idx != W:
		for i in range(len(lis)):
			for j in range(idx, W+1):
				if lis[i][j]-lis[i][idx] > K:  # 1番最初にKを超えるところを探す
					idxs.append(j)

		if not idxs:  # 超えない
			break

		idx = min(idxs)-1
		idxs = []
		cut += 1
	ans = min(ans, cut)

print(ans)


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
	H, W, K = MAP()
	S = np.array([list(map(int, list(input()))) for _ in range(H)])

	ans = INF
	for x in product([0, 1], repeat=H-1):
		cut = np.sum(x)
		if cut >= ans:
				continue
		r = 0
		l = []
		for i in range(H-1):
			if x[i]:
				l.append(np.sum(S[r:i+1, :], axis=0))
				r = i + 1
		l.append(np.sum(S[r:, :], axis=0))
		l = np.array(l)
		if np.max(l) > K:
			continue
		tmp = np.zeros(len(l), dtype=int)
		for i in range(W):
			tmp += l[:, i]
			if np.max(tmp) > K:
				cut += 1
				tmp = l[:, i]
			if cut >= ans:
				break

		ans = ans if ans <= cut else cut

	print(ans)

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

n,m = list(map(int,input().split()))
data = []
for i in range(m):
    x,y = list(map(int,input().split()))
    data.append([x,y])


kens = [[]for i in range(n)]
for dat in data:
    index = dat[0]
    kens[index-1].append(dat[1])

for i in range(n):
    kens[i] = sorted(kens[i])


for dat in data:
    ken = dat[0]
    year = dat[1]
    rank = kens[ken-1].index(year)+1
    leng1 = 6 - len(str(ken))
    leng2 = 6 - len(str(rank))
    st = ''
    st2 = ''
    for i in range(leng1):
        st += '0'
    for i in range(leng2):
        st2 += '0'
    st+= str(ken)
    st2 += str(rank)
    print(st + st2)

### FIXED CODE ###

N, M = list(map(int, input().split()))
kens = [[] for _ in range(N)]
for i in range(M):
    x, y = map(int, input().split())
    kens[x - 1].append((y, i))

ans = [[]for i in range(M)]
for i,ken in enumerate(kens):
    ken = sorted(ken)
    ken_number = i + 1
    for j, city in enumerate(ken):
        output_order = city[1]
        rank = j + 1
        ans[output_order] = "%06d%06d" % (ken_number,rank)
for i in ans:
    print(i)
### BUGGY CODE ###

from sys import stdin
s = str(stdin.readline().rstrip())
#A, B, C = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに
q= int(stdin.readline().rstrip())
hanten = 0
for i in range(q):
    l = list(map(str, stdin.readline().rstrip().split()))
    if int(l[0]) == 1:
        hanten += 1
    else:
        if int(l[1])==1:
            if hanten%2 == 0:
                s = l[2]+s
            else:
                s = s+l[2]
        else:
            if hanten%2==0:
                s = s+l[2]
            else:
                s = l[2]+s

if hanten%2==0:
    print(s)
else:
    print(s[::-1])


### FIXED CODE ###

from sys import stdin
s = str(stdin.readline().rstrip())
#A, B, C = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに
q= int(stdin.readline().rstrip())
hanten = 0
t=""
u=""

for i in range(q):
    l = list(map(str, stdin.readline().rstrip().split()))
    if int(l[0]) == 1:
        t,u = u,t
        hanten ^= 1
    else:
        if int(l[1])==1:
            t+=l[2]
        else:
            u+=l[2]


if hanten==0:
    print(t[::-1]+s+u)
else:
    print(t[::-1]+s[::-1]+u)
### BUGGY CODE ###

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

for i in range(k):
    l = [0] * n
    for j in range(n):
        for k in range(max(0, j-a[j]), min(n, j+a[j]+1)):
            l[k] += 1

    a = l[:]

a = list(map(str, a))
print(" ".join(a))

### FIXED CODE ###

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

for i in range(min(50, k)):
    DP = [0] * (n+1)
    for j in range(n):
        light = A[j]
        DP[max(0, j-light)] += 1
        DP[min(n, j+light+1)] -= 1

    for j in range(1, n):
        DP[j] += DP[j-1]

    A = DP[:-1]

print(*A)
### BUGGY CODE ###

import sys

def happyo(n,each_point):
  for x in range(n):
    if (each_point[x] < 1):
      print("No")
    else:
      print("Yes")

inp1 = input()
n = int(inp1.split(" ")[0])
k = int(inp1.split(" ")[1])
q = int(inp1.split(" ")[2])

if(k>100000):
  for x in range(n):
    print("Yes")
  sys.exit()
 
each_point = []
for i in range(n):
  each_point.append(k)
 
for j in range(q):
  ans = int(input())
  each_point = list(map(lambda x: x - 1,each_point))
  each_point[ans-1] += 1
 
happyo(n,each_point)

### FIXED CODE ###

import sys

def happyo(n,each_point):
  for x in range(n):
    if (each_point[x] < 1):
      print("No")
    else:
      print("Yes")

inp1 = input()
n = int(inp1.split(" ")[0])
k = int(inp1.split(" ")[1])
q = int(inp1.split(" ")[2])

if(k>100000):
  for x in range(n):
    print("Yes")
  sys.exit()

each_point = []
for i in range(n):
  each_point.append(k-q)
 

for j in range(q):
  ans = int(input())
  each_point[ans-1] += 1
 
happyo(n,each_point)