Harryxun/stf_run huggingface dataset:
n,k=map(int,input().split())
h=[0]*10**9
h=list(map(int,input().split()))
H=max(h)

for i in range(k):
  H[i]=0

mon=0
for i in range(n):
  mon+=h[i]
  
print(mon)

### FIXED CODE ###

n,k=map(int,input().split())
h=map(int,input().split())
h=sorted(h)
if n<=k:
  print('0')
  exit()
  
for i in range(k):
  h[-i-1]=0
print(sum(h))
from collections import defaultdict
n,k = map(int,input().split())
nums = input().split()
count_per_num = defaultdict(int)
for n in nums:
  count_per_num[n] += 1
count_per_nums = sorted(count_per_nums, key=lambda x:x[1])
ans = 0
for i in range(len(count_per_nums)-k):
  ans += count_per_nums[i]
print(ans)

### FIXED CODE ###

from collections import defaultdict
n,k = map(int,input().split())
nums = input().split()
count_per_nums = defaultdict(int)
for n in nums:
  count_per_nums[n] += 1
count_per_nums = sorted(count_per_nums.items(), key=lambda x:x[1])
ans = 0
for i in range(len(count_per_nums)-k):
  ans += count_per_nums[i][1]
print(ans)
n, m = map(int, input().split())
dmg = []
cost = []

for i in range(m):
    a, b = map(int, input().split())
    dmg.append(a)
    cost.append(b)

inf = 10**9
dp = [inf] * 2 * n
dp[0] = 0

for i in range(m):
    for j in range(n):
        if dp[j] != inf:
            dp[j + dmg[i]] = min(dp[j + dmg[i]], dp[j] + cost[i])
print(min(dp[n:]))


### FIXED CODE ###

n, m = map(int, input().split())
dmg = []
cost = []

for i in range(m):
    a, b = map(int, input().split())
    dmg.append(a)
    cost.append(b)

inf = 10**9
dp = [inf] * 30000
dp[0] = 0

for i in range(m):
    for j in range(n):
        if dp[j] != inf:
            dp[j + dmg[i]] = min(dp[j + dmg[i]], dp[j] + cost[i])
print(min(dp[n:]))
# AOJ 0502: Dice
# Python3 2018.6.29 bal4u

dir = { "North":1, "East":2, "West":3, "South":4, "Right":5, "Left":6 }

rot = ((0,1,2,3,4,5,6),(0,2,6,3,4,1,5),(0,4,2,1,6,5,3),(0,3,2,6,1,5,4), \
       (0,5,1,3,4,6,2),(0,1,3,5,2,4,6),(0,1,4,2,5,3,6))

while True:
	n = int(input())
	if n == 0: break
	dice = [[i for i in range(7)] for j in range(2)]
	ans = 1
	for i in range(n):
		j = dir[input()]
		for k in range(1, 7): dice[1-(i&1)][k] = dice[i&1][rot[j][k]];
		ans += dice[1-(i&1)][1]
	print(ans)


### FIXED CODE ###

# AOJ 0502: Dice
# Python3 2018.6.29 bal4u

d = { "North":1, "East":2, "West":3, "South":4, "Right":5, "Left":6 }

rot = ((0,1,2,3,4,5,6),(0,2,6,3,4,1,5),(0,4,2,1,6,5,3),(0,3,2,6,1,5,4), \
       (0,5,1,3,4,6,2),(0,1,3,5,2,4,6),(0,1,4,2,5,3,6))

import sys
while True:
	n = int(input())
	if n == 0: break
	dice = [[j for j in range(7)] for i in range(2)]
	ans = 1
	for i in range(n):
		j = d[input().strip()]
		for k in range(1, 7): dice[1-(i&1)][k] = dice[i&1][rot[j][k]]
		ans += dice[1-(i&1)][1]
	print(ans)
N=int(input())
k=int(input())

ans=1

for i in range(1,n):
  if ans*2 < ans+k:
    ans = ans*2
  else:
    ans = ans+k

print(ans)

### FIXED CODE ###

n=int(input())
k=int(input())

ans=1

for i in range(n):
  if ans*2 < ans+k:
    ans = ans*2
  else:
    ans = ans+k

print(ans)
n=int(input())
s=[]
for i in range(n):
    s.append(int(input()))
total=sum(s)
s.sort()
if total%10!=0:
    print(total)
else:
    for i in s:
        if i%10!=0:
            total-=i
            if total%10!=0:
                break
if total%10==0:
    print(0)
else:
    print(total)


### FIXED CODE ###

a,b=map(int,input().split())
if 10<=a+b:
    print("error")
else:
    print(a+b)
N, K = [int(item) for item in input().split()]
h =[0] + [int(item) for item in input().split()]

dp = [0 for _ in range(N+1)]
dp[2]= abs(h[2] - h[1])


for i in range(3, N):
    for k in range(1,K+1):
        print(i,k, dp[i])
        if dp[i] != 0:
            if 2 <= i-k:
                dp[i] = min(dp[i], dp[i-k] + abs(h[i-k] - h[i]))
        else:
            print('make')
            if 2 <= i-k:
                dp[i] = dp[i-k] + abs(h[i-k] - h[i])

print(dp[1+N-K])

### FIXED CODE ###

import numpy as np

N, K = [int(item) for item in input().split()]
h =np.array([int(item) for item in input().split()])
# print(h.shape)
dp = np.full(N+K, 10**10+1, dtype='int64')
dp[0] = 0

for i in range(1, N):
    max1 = min(N, i+K)
    cost = abs(h[i:max1] - h[i-1])
    # print(cost.shape, dp[i:max1].shape)
    dp[i:max1] = np.minimum(dp[i:max1], dp[i-1] + cost)

    # print(dp)
print(dp[N-1])
n, a = map(int, input().split())
xlist = list(map(int, input().split()))

j = n
k = n
t = n * a
maxv = max(xlist)


dp = [[[0 for t in range(n*maxv + 1)] for k in range(k + 1)] for j in range(j + 1)]

dp[1][0][0] = 1
dp[0][0][0] = 1

# for d in dp:
#     print(d)
# print(dp[1][1][15])

for ji in range(1, j + 1):
    for ki in range(0, ji + 1):
        for ti in range(0, ki * maxv + 1):
            # print('now', ji, ki, ti)
            if ji == 0 and ki == 0 and ti == 0:
                # print('branch 1')
                dp[ji][ki][ti] = 1
            elif ji >= 1 and ti < xlist[ji - 1]:
                dp[ji][ki][ti] = dp[ji - 1][ki][ti]
                # print('branch 2')
            elif ji >= 1 and ki >= 1 and ti >= xlist[ji - 1]:
                # print('branch 3', ji - 1)
                dp[ji][ki][ti] = dp[ji - 1][ki][ti] + dp[ji - 1][ki - 1][ti - xlist[ji - 1]]
            # print(dp[ji][ki][ti])

count = 0
for i in range(1, k + 1):
    count += dp[j][i][i*a]

print(count)

### FIXED CODE ###

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

j = n
k = n
t = n * a
maxv = max(a, max(xlist))


dp = [[[0 for t in range(n*maxv + 1)] for k in range(k + 1)] for j in range(j + 1)]

dp[1][0][0] = 1
dp[0][0][0] = 1

# for d in dp:
#     print(d)
# print(dp[1][1][15])

for ji in range(0, j + 1):
    for ki in range(0, ji + 1):
        for ti in range(0, ki * maxv + 1):
            # print('now', ji, ki, ti)
            if ji == 0 and ki == 0 and ti == 0:
                # print('branch 1')
                dp[ji][ki][ti] = 1
            elif ji >= 1 and ti < xlist[ji - 1]:
                dp[ji][ki][ti] = dp[ji - 1][ki][ti]
                # print('branch 2')
            elif ji >= 1 and ki >= 1 and ti >= xlist[ji - 1]:
                # print('branch 3', ji - 1)
                dp[ji][ki][ti] = dp[ji - 1][ki][ti] + dp[ji - 1][ki - 1][ti - xlist[ji - 1]]
            # print(dp[ji][ki][ti])

count = 0
for i in range(1, k + 1):
    count += dp[j][i][i*a]

print(count)
str = input()

str[2] == str[3] and str[4] == str[5] ? 'Yes' : 'No';


### FIXED CODE ###

str = input()

if str[2] == str[3] and str[4] == str[5]:
  print('Yes')
else :
  print('No')
a = 0
S = input().split()

for b in range(4):
    if S[b] == '+':
        a+=1
    elif S[b] == '-':
        a-=1
print(a)


### FIXED CODE ###

a = 0
S = list(input())

for b in range(4):
    if S[b] == '+':
        a+=1
    elif S[b] == '-':
        a-=1
print(a)
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
primes = np.ones(g+1)
primes[0:2] = 0
for i in range(2, int(math.sqrt(g))+1+1):
  if primes[i]:
    primes[i*2::i] = 0

count = 0
for i in range(g+1):
  if primes[i] and g%i == 0:
    count += 1
print(count + 1)

### FIXED CODE ###

from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])

def factorize(g):
  factor = []
  for i in range(2, int(np.sqrt(g))+2):
    if g % i != 0:
      continue
    while g % i == 0:
      g //= i
    factor.append(i)
  if g != 1:
    factor.append(g)
  return factor
print(len(factorize(g))+1)
import math
A,B,C,D = map(int, input().split())
X = B//C - (A-1)//C
Y = B//D - (A-1)//D
lcm = C*D//math.gcd(C,D)
Z = B//lcm - (A-1)//lcm
print(B-A+1-X-Y+Z)

### FIXED CODE ###

from fractions import gcd
A,B,C,D = map(int, input().split())
X = B//C - (A-1)//C
Y = B//D - (A-1)//D
lcm = round(C*D//gcd(C,D))
Z = B//lcm - (A-1)//lcm
print(B-A+1-X-Y+Z)
A, B, K = map(int, input().split())
if B-A < 2*K:
  for i in range(A, B+1):
    print(i)
else:
  for i in range(0, K):
    print(A+i)
  for i in reversed(range(0, K)):
    print(B-i)
A, B, K = map(int, input().split())
if B-A < 2*K:
  for i in range(A, B+1):
    print(i)
else:
  for i in range(0, K):
    print(A+i)
  for i in reversed(range(0, K)):
    print(B-i)

### FIXED CODE ###

A, B, K = map(int, input().split())
if B-A < 2*K:
  for i in range(A, B+1):
    print(i)
else:
  for i in range(0, K):
    print(A+i)
  for i in reversed(range(0, K)):
    print(B-i)
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
XY = []
xAve = 0
yAve = 0
for _ in range(N):
    x,y=map(int,input().split())
    XY.append([x,y])
    xAve += x
    yAve += y
xAve = xAve/N
yAve = yAve/N
XYnorm = [0]*4

for x,y in XY:
    nX = x-xAve
    nY = y-yAve
    if nX>=0 and nY>=0:#第1象限
        if XYnorm[0]<= nX+nY:
            XYnorm[0] = nX+nY
            XY0 =[x,y]

    if nX <=0 and nY >=0:#第2象限
        if XYnorm[1]<= -nX+nY:
            XYnorm[1] = -nX+nY
            XY1 =[x,y]
            
    if nX <=0 and nY <=0:#第3象限
        if XYnorm[2]<= -nX-nY:
            XYnorm[2] = -nX-nY
            XY2 =[x,y]
            
    if nX >=0 and nY <=0:#第4象限
        if XYnorm[3]<= nX+nY:
            XYnorm[3] = nX+nY
            XY3 =[x,y]
XY02 = abs(XY0[0]-XY2[0])+abs(XY0[1]-XY2[1])
XY13 = abs(XY1[0]-XY3[0])+abs(XY1[1]-XY3[1])
print(max(XY02,XY13))
    


### FIXED CODE ###

import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
zmax=-float('inf')
zmin = float('inf')
wmax = -float('inf')
wmin = float('inf')

for _ in range(N):
    x,y=map(int,input().split())
    z=x+y
    w=x-y
    zmax = max(z,zmax)
    zmin = min(z,zmin)
    wmax = max(w,wmax)
    wmin = min(w,wmin)
print(max(zmax-zmin,wmax-wmin))
a, b = input().split()

import math
c = math.sqrt(int(a + b))
ok = c.is_instance(c, int)

if ok:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a, b = input().split()
 
import math
c = math.sqrt(int(a + b))
ok = c.is_integer()
 
if ok:
  print("Yes")
else:
  print("No")
w,h,x,y=map(int,input().split())

s=float(w*h/2)

if w%2==0 and h%2==0:
    if w//2==x and h//2==y:
        ans=1
else:
    ans=0

print(str(float(s))+" "+str(ans))


### FIXED CODE ###

w,h,x,y=map(int,input().split())
s=float((w/2)*h)
ans=0
if w%2==0 and h%2==0:
    if w//2==x and h//2==y:
        ans=1
else:
    ans=0

print(str(float(s))+" "+str(ans))
#s,t間に奇数長のパスが存在したならば必ずs,t間には辺が張られる
#グラフが二部グラフでないならば奇数長のサイクルが存在して任意の(s,t)間に奇数長パスが作れる
#グラフが二部グラフであるならば異なるカラーグループ間の頂点には必ず辺が張られる
n,m = map(int,input().split())
G = defaultdict(set)
color = [0 for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    G[a-1].add(b-1)
    G[b-1].add(a-1)
#二部グラフ判定
color[0]=1
que = deque([0])
bipartite = True
while len(que):
    p = que.popleft()
    for q in list(G[p]):
        if color[q] == 0:
            color[q] = -color[p]
            que.append(q)
        elif color[q] == color[p]:
            bipartite = False
            break
if bipartite:
    print(color.count(1)*color.count(-1)-m)
else:
    print(n*(n-1)//2-m)

### FIXED CODE ###

from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

#s,t間に奇数長のパスが存在したならば必ずs,t間には辺が張られる
#グラフが二部グラフでないならば奇数長のサイクルが存在して任意の(s,t)間に奇数長パスが作れる
#グラフが二部グラフであるならば異なるカラーグループ間の頂点には必ず辺が張られる
n,m = map(int,input().split())
G = defaultdict(set)
color = [0 for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    G[a-1].add(b-1)
    G[b-1].add(a-1)
#二部グラフ判定
color[0]=1
que = deque([0])
bipartite = True
while len(que):
    p = que.popleft()
    for q in list(G[p]):
        if color[q] == 0:
            color[q] = -color[p]
            que.append(q)
        elif color[q] == color[p]:
            bipartite = False
            break
if bipartite:
    print(color.count(1)*color.count(-1)-m)
else:
    print(n*(n-1)//2-m)
s = input()
n = len(s)
k = int(input())

d = [0] * n
for i in range(n):
    if s[i] != 'a':
        d[i] = ord('z') - ord(s[i]) + 1

ans = list(s)
for i in range(n):
    if d[i] != 0 and d[i] <= k:
        k -= d[i]
        c = ord(s[i]) + d[i]
        ans[i] = chr(c - ord('z') + ord('a') - 1) if c > ord('z') else chr(c)
    if k == 0: break
    if i == n-1:
        ans[i] = chr(ord(s[i]) + k)

print(''.join(ans))


### FIXED CODE ###

s = list(input())
n = len(s)
k = int(input())

for i in range(n):
    x = ord(s[i]) - ord('a')
    if x == 0 or 26 -x > k: continue
    k -= 26 - x
    s[i] = 'a'

if k:
    s[-1] = chr((ord(s[-1]) - ord('a') + k) % 26 + ord('a'))

print(''.join(s))
import math
a,b,c,d= map(int,input().split())
count = 0
kou = (c*d) // math.gcd(c,d)
#print(kou)
if a % kou == 0:
    hajime = a
else :
    hajime = (kou - a % kou) + a
owari = b - (b % kou)
if a % c == 0:
    chajime = a
else :
    chajime = (c - a % c) + a
cowari = b - (b % c)
if a % d == 0:
    dhajime = a
else :
    dhajime = (d - a % d) + a
dowari = b - (b % d)


kousuu = ((cowari - chajime) // c + 1) + ((dowari - dhajime) // d + 1) - ((owari - hajime) // kou + 1)
sa = b - a + 1
print(sa - (kousuu))
#print(hajime,owari,chajime,cowari,dhajime,dowari,)


### FIXED CODE ###

import fractions
a,b,c,d= map(int,input().split())
count = 0
kou = (c*d) // fractions.gcd(c,d)
#print(kou)
if a % kou == 0:
    hajime = a
else :
    hajime = (kou - a % kou) + a
owari = b - (b % kou)
if a % c == 0:
    chajime = a
else :
    chajime = (c - a % c) + a
cowari = b - (b % c)
if a % d == 0:
    dhajime = a
else :
    dhajime = (d - a % d) + a
dowari = b - (b % d)


kousuu = ((cowari - chajime) // c + 1) + ((dowari - dhajime) // d + 1) - ((owari - hajime) // kou + 1)
sa = b - a + 1
print(sa - (kousuu))
#print(hajime,owari,chajime,cowari,dhajime,dowari,)
import fractions

def main():
    N=int(input())
    num=list(map(int,input().split()))
    gcd=0
    gcd_list_front=[]
    gcd_list_back=[]
    gcd_list_front.append(num[0])
    gcd_list_back.append(num[-1])

    for  i in range(l,N-1):
        gcd_list_front.append(fractions.gcd(gcd_list_front[i-1],num[i]))
        gcd_list_back.append(fractions.gcd(gcd_list_back[i-1],num[-i-1]))
   gcd_list_back.reverse()

   gcd=max(gcd_list_back[0],gcd_list_front[-1])
   for i in range(0,N-2):
       temp_gcd=fractions.gcd(gcd_list_front[i],gcd_list_back[i+1])
       if temp_gcd>gcd:
           gcd=temp_gcd
    print(gcd)


if  __name__="__main__":
    main()


### FIXED CODE ###

a,b,t=map(int,input().split())
x=0
num=0
c=a
for i in range(21):
    x=c
    c=a*(i+2)
    #print(x)
    if(x>t):
        break
    num+=b

print(num)
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    N = int(input())
    S = input()
    cnt0 = S.count("1")

    if cnt0 == 0:
        raise 1
        print("\n".join(map(str, [1]*N)))
        return

    X = int(S, 2)

    def f2():
        cache = [0] * (cnt0 + 1)
        i = 1
        bi = []
        while i <= cnt0:
            bi.append(i)
            i <<= 1
        from collections import deque
        dq = deque([(0, 0, 0)])
        ls = len(bi)
        while dq:
            i, x, cnt = dq.popleft()

            cnt += 1
            for j in range(i, ls):
                y = x | bi[j]

                if y > cnt0: break

                cache[y] = cache[y % cnt] + 1

                j += 1
                if j < ls:
                    dq.append((j, y, cnt))
        return cache


    memo = f2()

    dc = []
    for v in [1, -1]:
        x = cnt0 + v
        y = X % x if x else 0
        dc.append((x, v, y, [1, N-1]))

    ans = [0] * N
    for i in reversed(range(N)):
        cnt, v, n, m1 = dc[0 if S[i] == "0" else 1]

        if cnt == 0:
            ans[i] = 0
            continue

        m2 = (m1[0]<<(m1[1]-i)) % cnt
        n = (n + v*m2) % cnt
        m1[0], m1[1] =  m2, i

        ans[i] = 1 + memo[n]

    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    resolve()


### FIXED CODE ###

#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from functools import lru_cache


@lru_cache(maxsize=2*10**5)
def f2(x):
    if x == 0: return 0
    y = bin(x).count("1")
    return 1 + f2(x % y)

def resolve():
    N = int(input())
    W = 16
    S = input()
    cnt0 = S.count("1")

    if cnt0 == 0:
        print(*[1]*N, sep="\n")
        return

    X = int(S, 2)

    dc = {}
    for k, v in (("0", 1), ("1", -1)):
        x = cnt0 + v
        y = X % x if x else 0
        dc[k] = (x, v, y)

    ans = []
    for i, si in enumerate(S):
        cnt, v, n = dc[si]

        if cnt == 0:
            ans.append(0)
            continue

        ni = N - i - 1
        n = (n + v * pow(2, ni, cnt)) % cnt

        ans.append(1+f2(n))

    print(*ans, sep="\n")


if __name__ == "__main__":
    resolve()
import numpy as np

card_num, gate_num = map(int,input().split())
d = np.zeros((gate_num,2))
card_valid = [0]*card_num

for i in range(gate_num):
    l, r = map(int, input().split())
    d[i,0] = l
    d[i,1] = r
for i in range(gate_num):
    for ii in range(card_num):
        if ii + 1 >= d[i][0] and ii + 1 <= d[i][1]:
            card_valid[ii] += 1
        else:
            card_valid[ii] += 0
counter = 0
for i in range(card_num):
    if card_valid[i] == gate_num:
        counter += 1
print(counter)

### FIXED CODE ###

import sys
from itertools import accumulate

def main():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    acc = [0] * (N+1)
    for _ in range(M):
        left, right = map(int, input().split())
        acc[left-1] += 1
        acc[right] -= 1

    cnt = 0
    for a in accumulate(acc):
        if a == M:
            cnt += 1

    return cnt


if __name__ == '__main__':
    print(main())
import numpy as np

D = int(input())
C = list(map(int, input().split()))
for d in D:
    S = np.array(map(int, input().split()))
    print(np.argmax(S)+1)

### FIXED CODE ###

import numpy as np

D = int(input())
C = list(map(int, input().split()))
for d in range(D):
    S = np.array(list(map(int, input().split())))
    print(np.argmax(S)+1)
N, M = input().split(" ")
N = int(N)
M = int(M)
if (M >= 0 and M == N):
  return True
else:
  return False

### FIXED CODE ###

N, M = input().split(" ")
N = int(N)
M = int(M)
if (M == N):
  print("Yes")
else:
  print("No")
# -*- coding: utf-8 -*-

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

aa = list(range(a, b+1))

ans = set()
for i in range(len(aa)):
    if i <= k-1 or i >= len(aa)-k:
        ans.add(aa[i])

for i in sorted(list(ans)):
    print(i)


### FIXED CODE ###

# -*- coding: utf-8 -*-

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

if b-a < 2*k:
    for i in range(a, b+1):
        print(i)
else:
    for i in range(a, a+k):
        print(i)
    for i in range(b-k+1, b+1):
        print(i)
N, Q = (int(i) for i in input().split())  
s = input()
s="!"+s+"?"
spells = [input().split() for _ in range(Q)]
 
masu=[1]*(N+2)
for spell in spells:
   t=spell[0]
   d=spell[1]
   indexes = [i for i, x in enumerate(s) if x == t]
   if d=="R":
      for index in indexes:
         index=index+1
         masu[index]+=masu[index-1]
         masu[index-1]=0
   else:
      for index in indexes:
         masu[index]+=masu[index+1]
         masu[index+1]=0
 
masu.pop(0)
masu.pop(N)
print(sum(masu)-1)

### FIXED CODE ###

a, b, c = (int(i) for i in input().split())  
if a==b and b==c and a==c:
   print('Yes')
else:
   print('No')
#reversi
n=int(input())
lists=[]
for i in range(n):
    a=int(input())
    lists.append(a)
dp=[0 for i in range(n+1)]
dp[0]=1

before=[0 for i in range(n+1)]

for i in range(n):
    a=lists[i]
    if before[a]==0:
        dp[i+1]=dp[i]
        before[a]=i+1
    elif before[a]!=0:
        if before[a]==i:
            before[a]=i+1
            dp[i+1]=dp[i]
        else:
            dp[i+1]=dp[i]+dp[before[a]]
            before[a]=i+1
print(dp[n])  


### FIXED CODE ###

#reversi
n=int(input())
lists=[]
for i in range(n):
    a=int(input())
    lists.append(a)
dp=[0 for i in range(n+1)]
dp[0]=1
mod=10**9+7
before=[0 for i in range(2*10**5+1)]

for i in range(n):
    a=lists[i]
    if before[a]==0:
        dp[i+1]=dp[i]
        before[a]=i+1
        continue
        
    elif before[a]!=0:
        if before[a]==i:
            before[a]=i+1
            dp[i+1]=dp[i]
        else:
            dp[i+1]=(dp[i]+dp[before[a]])%mod

            before[a]=i+1
print(dp[n]%mod)
import math
a,b,x = map(int,input().split())
if (a*a*b)/2>=x :
    t = x*2/b/a/b
    ans = 90-math.degrees(math.atan(t))
else :
    x = (a*a*b) - x
    t = x*2/a/a
    ans = 90-math.degrees(math.atan(a/t))
print(ans)

### FIXED CODE ###

import math
a,b,x = map(int,input().split())
ans = 0
if (a*a*b)/2>=x :
    t = x*2/b/a/b
    ans = 90-math.degrees(math.atan(t))
elif (a*a*b)==x:
    ans = 0.0
else :
    x = (a*a*b) - x
    t = x*2/a/a
    ans = 90-math.degrees(math.atan(a/t))
print(ans)
n = input()
if n%2==0:
  k,g = n/2,n//2 + 1
else:
  k,g = n//2,n/2 +1
print(k*g)

### FIXED CODE ###

n = int(input())
if n%2==0:
  k,g = n/2,n/2
else:
  k,g = n//2,n//2+1
print(int(k*g))
while True:
    H,W = map(int,raw_input().split())
    if H,W == 0,0:
        break
    for k in range(H):
        print "#"*W
    print ""

### FIXED CODE ###

while True:
    H,W = map(int,raw_input().split())
    if (H,W) == (0,0):
        break
    for k in range(H):
        print "#"*W
    print ""
N,M,K = map(int,input().split())

par = [i for i in range(N+1)]

# 木の根を求める
def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return par[x]

# xとyが同じ集合に属するか否か
def bool_same(x,y):
    return root(x) == root(y)

# xとyの属する集合を併合
def unite(x,y):
    x = root(x)
    y = root(y)
    if x != y:
        par[x] = y

AB = [list(map(int,input().split())) for i in range(M)]
CD = [list(map(int,input().split())) for i in range(K)]

for a,b in AB:
    unite(a,b)

for i in range(N+1):
    root(i)

member = [0 for i in range(N+1)]

for p in par:
    member[p] += 1

ans = [member[par[i]]-1 for i in range(N+1)]

for i in range(M):
    a,b = AB[i]
    if bool_same(a,b):
        ans[a] -= 1
        ans[b] -= 1
for i in range(K):
    c,d = CD[i]
    if bool_same(c,d):
        ans[c] -= 1
        ans[d] -= 1
print(' '.join(map(str,ans[1:])))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

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

par = [i for i in range(N+1)]

# 木の根を求める
def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return par[x]

# xとyが同じ集合に属するか否か
def bool_same(x,y):
    return root(x) == root(y)

# xとyの属する集合を併合
def unite(x,y):
    x = root(x)
    y = root(y)
    if x != y:
        par[x] = y

AB = [list(map(int,input().split())) for i in range(M)]
CD = [list(map(int,input().split())) for i in range(K)]

for i in range(M):
    a,b = AB[i]
    unite(a,b)

member = [0 for i in range(N+1)]

for i in range(1,N+1):
    member[root(i)] += 1

ans = [member[par[i]]-1 for i in range(N+1)]

for i in range(M):
    a,b = AB[i]
    if bool_same(a,b):
        ans[a] -= 1
        ans[b] -= 1

for i in range(K):
    c,d = CD[i]
    if bool_same(c,d):
        ans[c] -= 1
        ans[d] -= 1

print(*ans[1:])
S = input()
s_i = 0
Q = int(input())
for _ in range(Q):
  T = input().split()
  if T[0]=="1":
    S = S[::-1]
  else:
	if T[1]=="1":
      S = T[2]+S
    else:
      S = S+T[2]
print(S)
	
      
    


### FIXED CODE ###

from collections import deque

S = input()
Q = int(input())

t = deque(S)
reverse = False
for _ in range(Q):
    query = input()
    if query[0] == '1':
        reverse = not reverse
    elif query[0] == '2':
        _, F, C = query.split()
        if F == '1':
            if reverse:
                t.append(C)
            else:
                t.appendleft(C)
        elif F == '2':
            if reverse:
                t.appendleft(C)
            else:
                t.append(C)
result = ''.join(t)
if reverse:
    result = result[::-1]
print(result)
def main():
    n,k = map(int,input().split())
    s = list(input())
    s[k] = chr(ord(s[k]) + 32)
    t = ''
    for i in s:
        t = t + i
    print(t)
main()

### FIXED CODE ###

def main():
    n,k = map(int,input().split())
    s = list(input())
    s[k - 1] = chr(ord(s[k - 1]) + 32)
    t = ''
    for i in s:
        t = t + i
    print(t)
main()