Harryxun/stf_run huggingface dataset:
import numpy as np
N,X = map(int, input().split())
L = list(map(int, input().split()))

dist = np.zeros(N+1, dtype=int)
for i in range(N):
  dist[i+1] = dist[i] + L[i]

i = 0
count = 0
while dist[i] <= X:
  count += 1
  i += 1
print(count)
"""
dist = 0
count = 1
for i in range(N):
  if dist + L[i] <= X:
    count += 1
    dist += L[i]
print(count)
"""

### FIXED CODE ###

import numpy as np
N,X = map(int, input().split())
L = list(map(int, input().split()))

dist = np.zeros(N+1, dtype=int)
for i in range(N):
  dist[i+1] = dist[i] + L[i]

i = 0
count = 0
while dist[i] <= X:
  count += 1
  i += 1
  if i == N +1:
    break
print(count)
"""
dist = 0
count = 1
for i in range(N):
  if dist + L[i] <= X:
    count += 1
    dist += L[i]
print(count)
"""
N=int(input())
aN=[int(input()) for _ in range(N)]
c=0
i=1
while True:
  print(aN)
  c+=1
  if aN[i-1]==2:
    print(c)
    break
  elif aN[i-1]==0:
    print(-1)
    break
  t=aN[i-1]
  aN[i-1]=0
  i=t

### FIXED CODE ###

N=int(input())
aN=[int(input()) for _ in range(N)]
c=0
i=1
while True:
  c+=1
  if aN[i-1]==2:
    print(c)
    break
  elif aN[i-1]==0:
    print(-1)
    break
  t=aN[i-1]
  aN[i-1]=0
  i=t
s = input()
c = collections.Counter(s)

if [2,2] == [x for x in c.values()]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

import collections
s = input()
c = collections.Counter(s)

if [2,2] == [x for x in c.values()]:
  print('Yes')
else:
  print('No')
N,A,B=map(int, input().split())
#最大の数
x = min(A, B)
#最小
y = 0
        
if N < A+B:
    if A > B:
        y = A - B
    else:
        y = B - A

print(x + " " + y)

### FIXED CODE ###

n, a, b = map(int, input().split())
ans1 = min(a, b)
ans2 = max(0, a + b - n)
print(ans1, ans2)
SD = input()
T = input()

for i, ch in enumerate(T):
    if ch in SD:
        n = SD.find(ch)
        flag = True
        c = 0
        for j in range(n-1, n-i, -1):
            if j < 0:
                flag = False
                break
            if SD[j] != '?' and SD[j] != T[i-c]:
                flag = False
                break
            flag = True
            c += 1
        if flag:
            c = 0
            for j in range(n+1, n+len(T)-i):
                if j > len(SD)-1:
                    flag = False
                    break
                if SD[j] != '?' and SD[j] != T[i+c]:
                    flag = False
                    break
                flag = True
                c += 1
        if flag:
            remP = SD[:n-i]
            remA = SD[n+1+len(T)-i:]
            for j, rc in enumerate(remP):
                if rc == '?':
                    remP = remP[:j] + 'a' + remP[j+1:]
            for j, rc in enumerate(remA)
            	if rc == '?:
              		remA = remA[:j] + 'a' + remA[j+1:]
            print(remP+T+remA)
            quit()
print('UNRESTORABLE')


### FIXED CODE ###

S = input()
T = input()
c = 0
idx = 0
ans = []
for i, s in enumerate(S):
    if s == T[0] or s == '?':
        tmp = S[i:min(i+len(T), len(S))]
        flg = True
        if len(T) != len(tmp):
            continue
        for j, c in enumerate(tmp):
            if c != T[j] and c != '?':
                flg = False
                break
        if flg:
            ans.append((S[:i] + T + S[i+len(T):]).replace('?', 'a'))
if len(ans) == 0:
    print('UNRESTORABLE')
else:
    ans.sort()
    print(ans[0])
b == input()

if b == A:
  print("T")
elif b == T:
  print("A")
elif b == C:
  print("G")
elif b == G:
  print("C")

### FIXED CODE ###

b = input()
 
if b == "A":
  print("T")
if b == "T":
  print("A")
if b == "C":
  print("G")
if b == "G":
  print("C")
n,m = map(int,input().split())
x = [0]*n
y = [0]*n
mx = [0]*m
my = [0]*m
for i in range(n):
    x[i],y[i] = map(int,input().split())
for j in range(m):
    mx[j],my[j] = map(int,input().split())
ans = [0]*n
for k in range(n):
    dis = 0
    cnt = 1
    for l in range(n):
        if abs(x[k]-xs[l])+abs(y[k]-ys[l]) > dis:
            dis = abs(x[k]-xs[l])+abs(y[k]-ys[l])
            cnt = l+1
    ans[k] = cnt
for h in ans:
    print(h)

### FIXED CODE ###

n,m = map(int,input().split())
student = []
Coodinate = []
for i in range(n):
    student.append(list(map(int,input().split())))
for j in range(m):
    Coodinate.append(list(map(int,input().split())))
ans = []
#print(student)
#print(Coodinate)
for k in student:
    manhattan = 100000000000
    number = 0
    for u in range(m):
        manhattann = abs(k[0]-Coodinate[u][0])+abs(k[1]-Coodinate[u][1])
        if manhattann < manhattan:
            manhattan = manhattann
            number = u+1
    ans.append(number)
for y in ans:
    print(y)
import fractions as f
n=int(input())
ans=int(input())
for i in range(n):
   ans=f.lcm(ans,int(input()))
print(ans)

### FIXED CODE ###

import fractions as f
n=int(input())
ans=int(input())
for i in range(n-1):
   x=int(input())
   ans=x*ans//f.gcd(ans,x)
print(ans)
# coding:utf-8
import sys
import datetime

H1 = int(sys.stdin.readline())
M1 = int(sys.stdin.readline())
H2 = int(sys.stdin.readline())
M2 = int(sys.stdin.readline())
K = int(sys.stdin.readline())


if not 0 <= H1 < 23 and 0 <= M1 < 59 and 0 <= H2 < 23 and 0 <= M2 < 59:
    H1 = int(sys.stdin.readline())
    M1 = int(sys.stdin.readline())
    H2 = int(sys.stdin.readline())
    M2 = int(sys.stdin.readline())
    K = int(sys.stdin.readline())

if M2 >= M1:
    a = (H2 - H1) * 60 + M2 - M1
    print(a - K)
if M2 < M1:
    b = (H2 - H1) * 60 + M1 - M2
    print(b - K)

### FIXED CODE ###

import sys
readline = sys.stdin.buffer.readline

h1, m1, h2, m2, k = map(int, readline().split())
print(60 * (h2 - h1) + m2 - m1 - k)
n,m,K = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

#累積和
sa = [0]
sb = [0]
for i in range(n):
    sa.append(sa[i]+a[i])
for i in range(m):
    sb.append(sb[i]+b[i])
    
#片方全部見ていくともう片方が簡単に求まる
ans = 0
for i in range(n+1):
    if a[i] > k:
        break
    while b[m] > k - a[i]:
        m -= 1
    ans = max(ans,i+m)
print(ans)

### FIXED CODE ###

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

#累積和
sa = [0]
sb = [0]
for i in range(n):
    sa.append(sa[i]+a[i])
for i in range(m):
    sb.append(sb[i]+b[i])

#片方全部見ていくともう片方が簡単に求まる
ans = 0
for i in range(n+1):
    if sa[i] > k:
        break
    while sb[m] > k - sa[i]:
        m -= 1
    ans = max(ans,i+m)
print(ans)
from scipy.sparse import*;n,*t=map(int,open(0).read().split());print('SFeicrosntd'[csgraph.dijkstra(csr_matrix(([1]*~-n,(t[::2],t[1::2])),[n+1]*2),0)[1:,1:].max()%3!=1::2])

### FIXED CODE ###

from collections import*
def s(s):
  f=[1]*-~n
  f[s]=0
  q=deque([(s,0)])
  while q:
    t,c=q.popleft()
    for v in e[t]:
      if f[v]:
        f[v]=0
        q.append((v,c+1))
  return t,c
n,*t=map(int,open(0).read().split())
e=[[]for _ in range(n+1)]
for a,b in zip(t[::2],t[1::2]):
  e[a].append(b)
  e[b].append(a)
print('SFeicrosntd'[s(s(1)[0])[1]%3!=1::2])
S = input()
if S = 'ABC': print('ARC')
else: print('ABC')

### FIXED CODE ###

S = input()
if S == 'ABC': print('ARC')
else: print('ABC')
import sys
ary = list(map(int,input().split()))
parity = 0
count = 0
#最初から同じだった時
if ary[0] == ary[1] == ary[3]:
    print(0)
    sys.exit()

#和が偶数だった時
if (ary[0] + ary[1] + ary[2]) % 2 == 0:
    for i in range(3):
        if ary[i] % 2 == 1:
            ary[i] += 1
            count += 0.5
        print(ary)
# 和が奇数だった時
elif (ary[0] + ary[1] + ary[2]) % 2 == 1:
    for i in range(3):
        if ary[i] % 2 == 0:
            ary[i] += 1
            count += 0.5
while not ary[0] == ary[1] == ary[2]:
    ary.sort()
    ary[0] += 2
    count += 1
    
print(int(count))

### FIXED CODE ###

import sys
ary = list(map(int,input().split()))
count = 0
#最初から同じだった時
if ary[0] == ary[1] == ary[2]:
    print(0)
    sys.exit()

#和が偶数だった時
if (ary[0] + ary[1] + ary[2]) % 2 == 0:
    for i in range(3):
        if ary[i] % 2 == 1:
            ary[i] += 1
            count += 0.5
# 和が奇数だった時
elif (ary[0] + ary[1] + ary[2]) % 2 == 1:
    for i in range(3):
        if ary[i] % 2 == 0:
            ary[i] += 1
            count += 0.5

while not ary[0] == ary[1] == ary[2]:
    ary.sort()
    ary[0] += 2
    count += 1

print(int(count))
N, K = map(int, input().split())
S = list(input())

l = []
for i in range(N):
  if i == 0:
    tmp = i
  if S[i - 1] != S[i]:
    l.append([tmp, i - 1, i - tmp])
    tmp = i
  if i == N - 1:
    l.append([tmp, i, i - tmp + 1])
l.sort(key = lambda x:x[2], reverse = True)

for k in range(K):
  if S[l[k][0]] == "L":
    S[l[k][0] : l[k][1] + 1] = "R" * l[k][2]
  else:
    S[l[k][0] : l[k][1] + 1] = "L" * l[k][2]

ans = 0
for i in range(N):
  if S[i] == "L":
    if i != 0 and S[i - 1] == "L":
      ans += 1
  else:
    if i != N - 1 and S[i + 1] == "R":
      ans += 1

print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
S = list(input())

l = []
tmp = 0
for i in range(1, N):
  if S[i - 1] != S[i]:
    l.append([tmp, i - 1, i - tmp])
    tmp = i
  if i == N - 1:
    l.append([tmp, i, i - tmp + 1])

for k in range(K):
  i = 2 * k + 1
  if i >= len(l):
    break
  if S[l[i][0]] == "L":
    S[l[i][0] : l[i][1] + 1] = "R" * l[i][2]
  else:
    S[l[i][0] : l[i][1] + 1] = "L" * l[i][2]

ans = 0
for i in range(N - 1):
  if S[i] == S[i + 1]:
    ans += 1

print(ans)
def qsort(array):
	if len(array) < 2:
        return array
    else:
        pivot = array[0]
        less = [i for i in array[1:] if i <= pivot]
        greater = [i for i in array[1:] if i > pivot]
        return qsort(less) + [pivot] + qsort(greater)
      
si = input()
ti = input()

s_sort = qsort(si)
t_sort = qsort(ti)

s = ''
t = ''

for i in s_sort:
    s += i
for i in t_sort[::-1]:
	t += i
if s < t:
	print('Yes')
else:
  	print('No')


### FIXED CODE ###

def qsort(array):
    if len(array) < 2:
        return array
    else:
        pivot = array[0]
        less = [i for i in array[1:] if i <= pivot]
        greater = [i for i in array[1:] if i > pivot]
        return qsort(less) + [pivot] + qsort(greater)

si = input()
ti = input()

s_sort = qsort(si)
t_sort = qsort(ti)

s = ''
t = ''

for i in s_sort:
    s += i
for i in t_sort[::-1]:
    t += i
if s < t:
    print('Yes')
else:
    print('No')
import fractions
import collections
import copy

n = int(input())
ai = [int(i) for i in input().split()]

num = 10**4

mod = 10**9+7

if n == 1:
    print(1)
    exit()

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

pri_li = []

for i in range(n):
    pri_li.append(collections.Counter(prime_factorize(ai[i])))

com_ab = [0]*(num)

for i in range(n):
    tmp = 1
    #print(len(b_li[i]))
    keys = pri_li[i].keys()
    #print(keys)
    for j in keys:
        com_ab[j] = max(com_ab[j],pri_li[i][j])

"""
for i in range(10**3):
    if com_ab[i] > 0:
        com_num *= pow(i,com_ab[i],mod)
"""
ans = 0
exit()
for i in range(n):
    com_ab_new = copy.deepcopy(com_ab)
    #print(com_ab,com_ab_new)
    keys = pri_li[i].keys()
    for j in keys:
        com_ab_new[j] -= pri_li[i][j]
    kari = 1
    for j in range(num):
        if com_ab_new[j] > 0:
            kari *= pow(j,com_ab_new[j],mod)
    ans += kari
    ans %= mod
    #print(ans)
        
print(ans)


### FIXED CODE ###

import collections
import math
n = int(input())
ai = [int(i) for i in input().split()]

mod = 10**9+7

if n == 1:
    print(1)
    exit()
    
    
# 素因数分解、辞書で返すやつ
# mathをimportする
def prime(n):
    factor = {}
    tmp = int(math.sqrt(n)) + 1
    for num in range(2, tmp):
        while n % num == 0:
            n //= num
            if not num in factor.keys():
                factor[num] = 1
            else:
                factor[num] += 1
        if num > n:
            break
    if n != 1:
        if not n in factor.keys():
            factor[n] = 1
        else:
            factor[n] += 1
    return factor


dic = {}
for a in ai:
    pr = prime(a)
    for num, count in pr.items():
        if not num in dic.keys():
            dic[num] = count
        else:
            if dic[num] < count:
                dic[num] = count

kari = 1
for num,count in dic.items():
    kari *= pow(num,count,mod)
    kari %= mod

kari_old = kari
ans = 0

for i in range(n):
    kari = kari_old
    #com_ab_new = copy.deepcopy(com_ab)
    #print(com_ab,com_ab_new)
    #kari = 1
    #for j in range(kosu):
    #kari *= pow(sosu_li[j][0],com_ab[sosu_li[j][0]],mod)
    kari *= pow(ai[i],mod-2,mod)
    ans += kari
    ans %= mod
    #print(ans)
    #print(ans)
        
print(ans)
s=list(input())
k=int(input())
for i in range(len(s)):
    if k>=ord("z")-ord(s[i])+1:
        k-=(ord("z")-ord(s[i])+1)
        s[i]="a"

if k:
    s[-1]=chr(ord(s[-1])+k)

print("".join(s))


### FIXED CODE ###

s=list(input())
k=int(input())
for i in range(len(s)):
    if s[i]=="a":
        continue
    if k>=ord("z")-ord(s[i])+1:
        k-=(ord("z")-ord(s[i])+1)
        s[i]="a"

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

print("".join(s))
import numpy as np

N = int(input())
A = np.array(input().split(),np.int64)
MOD = 10 ** 9 + 7

ans = 0
for i in range(60):
    c = np.count_nonzero((A>>i)&1)
    ans += (2 ** i) * c * (N - c)

print(ans%MOD)

### FIXED CODE ###

import numpy as np

N = int(input())
A = np.array(input().split(),np.int64)
MOD = 10 ** 9 + 7

ans = 0
for i in range(60):
    c = np.count_nonzero((A>>i)&1)
    ans += (2 ** i) * c * (N - c)

print(ans%MOD)
n=int(input())
prime=0
tmp = n
while prime == 0:
  flag=True
  for i in range(2,int(n**0.5)+1):
  	flag=False
    break
  if frag:
    prime=tmp
  tmp+=1
print(prime)


### FIXED CODE ###

n=int(input())
prime=0
tmp = n
while prime == 0:
  flag=True
  for i in range(2,int(tmp**0.5)+1):
    if tmp%i==0:
      flag=False
      break
  if flag:
    prime=tmp
  tmp+=1
print(prime)
n = int(input())
*a, = map(int,input().split())
g = []
M = 10**5+1
for i in range(1,5):
    g.append((i,0))
g = dict(g); s = 0
for A in a:
    g[A] += 1
    s += A
q = int(input())
for loop in range(q):
    b,c = map(int,input().split())
    if g[b] == 0:
        print(s)
        continue
    s += g[b] * (c - b)
    g[c] += g[b]
    g[b] == 0
    print(s)


### FIXED CODE ###

n = int(input())
*a, = map(int,input().split())
M = 10**5+1
g = [0] * M
s = 0
for A in a:
    g[A] += 1
    s += A

q = int(input())
for loop in range(q):
    b,c = map(int,input().split())
    if g[b] == 0:
        print(s)
        continue
    s += g[b] * (c - b)
    g[c] += g[b]
    g[b] = 0
    print(s)
n = int(input)

for i in range(n):
  sum += n
  
print(sum)

### FIXED CODE ###

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

list = np.array(range(n+1))

print(sum(list))
n = int(input())
a = list(map(int, input().split()))
n = int(input())
q = 1000000000000000000
b = 1
cek = True
a = list(map(int, input().split()))
for i in range n :
	b = b * a[i] 
	if b > q :
		cek = False
		break
if cek :
	print(b)
else :
	print("-1")


### FIXED CODE ###

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

q = 1000000000000000000
b = 1
cek = True
zero = a.count(0)
if zero > 0 :
	print("0")
else :
	for i in range(n) :
		b = b*a[i]
		if b > q :
			cek = False
			break
	if cek :
		print(b)
	else :
		print("-1")
k=int(input())
s=input()
if len(s)<=k
    print('s')
else:
  print('s[:k+1]'+'...')
    

### FIXED CODE ###

k=int(input())
s=input()
if int(len(s))<=k:
  print(s)
else:
  print(s[0:k]+'...')
A,B=map(int,input().split())
if (A+B) % 2 = 0:
  K = (A+B)/2
else:
  K ="IMPOSSIBLE"
print(K)

### FIXED CODE ###

A,B=map(int,input().split())
if (A+B) % 2 == 0:
  K = (A+B)//2
else:
  K ="IMPOSSIBLE"
print(K)
N, *X = map(int, open(0).read().split())
X.sort()
y = []
for i in range(N):
  y.append(X[i + 1] - X[i])

ans = y[0]
for v in y[1:]:
  ans = gcd(ans, v)
print(ans)

### FIXED CODE ###

from fractions import gcd
N, *X = map(int, open(0).read().split())
X.sort()
y = [X[i + 1] - X[i] for i in range(N)]

ans = y[0]
for v in y[1:]:
  ans = gcd(ans, v)
print(ans)
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n, m = map(int, input().split())
uf = UnionFind(n)
for i in range(m):
    a, b = map(int, input().split())
    uf.union(a, b)
print(len(set([uf.find(node) for node in range(n)])) - 1)

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n, m = map(int, input().split())
uf = UnionFind(n)
for i in range(m):
    a, b = map(int, input().split())
    uf.union(a-1, b-1)
print(len(set([uf.find(node) for node in range(n)])) - 1)
while 1:
    n = int(input())
    team = []
    for _ in range(n):
        i, *T = map(int, input().split())
        t = 0
        for m, s in zip(T[::2], T[1::2]):
            t += m*60 + s
        team.append((t, i))
    team.sort()
    print(*[team[0][1], team[1][1], team[-2][1]], sep='\n')

### FIXED CODE ###

while 1:
    n = int(input())
    if n == 0:
        break
    team = []
    for _ in range(n):
        i, *T = map(int, input().split())
        t = 0
        for m, s in zip(T[::2], T[1::2]):
            t += m*60 + s
        team.append((t, i))
    team.sort()
    print(*[team[0][1], team[1][1], team[-2][1]], sep='\n')
n = int(input())
a = list(map(int,input().split()))

if(len(set(a)) == 1):
    print(0)
else:
    a.sort()
    b = [a[0]]
    for i in range(1,n):
        flag = 1
        for j in b:
            if(a[i]%j == 0):
                flag = 0
                break
        if(flag == 1):
            b.append(a[i])

print(len(b))

### FIXED CODE ###

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

si = set()
do = set()
for i in range(n):
    if(a[i] in si):
        do.add(a[i])
    else:
        si.add(a[i])
m = max(si)

li = [1]*m

for i in si:
    if(i in do):
        li[i-1] = 0
    for j in range(i*2,m+1,i):
        li[j-1] = 0

ans = 0
for i in si:
    if(li[i-1]==1):
        ans += 1
print(ans)
a = int(input()) 
b = [int(input()) for i in range(n)] 
for i in range(a):
  d=b[i-1]
  c=pop(b.i-1)
  print(max(c))
  b.insert(i-1.d)

### FIXED CODE ###

a = int(input()) 
b = [int(input()) for i in range(a)] 
 
m=max(b)
sorted(b)
s=sorted(b)[-2]
for i in range(a):
  if m>b[i]:
    print(m)
  else:
    print(s)
n,m = map(int,input().split())

a = int(m /n)

for i in range(min(a,m/2),0,-1):
  if m % i == 0:
    print(i)
    break

### FIXED CODE ###

n,m = map(int,input().split())

a = int(m /n)
for i in range(a,0,-1):
  if m % i == 0:
    print(i)
    break
n,k=map(int,input().split())
a=list(map(int,input().split()))
a=set(a)
print(max(0,len(a)-k)

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
cnt=[0]*(n+1)
for i in a:
   cnt[i]+=1
cnt.sort()
print(sum(cnt[:n-k+1]))
n = int(input())
list =list(input())
m = ""
j = int(input())
for i in range(n):
  if list[i] == list[j]:
    m += list[j]
  else:
    m += "*"
print(m)

### FIXED CODE ###

n = int(input())
list =list(input())
m = ""
j = int(input()) - 1
for i in range(n):
  if list[i] == list[j]:
    m += list[j]
  else:
    m += "*"
print(m)
k = input()
str = input()
l = len(str)
if l <= k:
  print(str)
  else:
    print(s[1:k])

### FIXED CODE ###

k = int(input())
s = input()
if int(len(s)) <= k:
  	print(str(s))
else:
  	print(((str(s))[0:k]) + "...")
import math

x1,y1,x2,y2=map(int,input().split())
answer=(math.sqrt((x2-x1)**2+(y2-y1)**2))
print("{0:.8f}".format(answer))

### FIXED CODE ###

import math

x1,y1,x2,y2=map(float,input().split())
answer=(math.sqrt((x2-x1)**2+(y2-y1)**2))
print("{0:.8f}".format(answer))
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
print(gcd(*a))

### FIXED CODE ###

import fractions
from functools import reduce
 
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
 
n = int(input())
a = list(map(int, input().split()))
print(gcd(*a))
while True:
    N, M = map(int, input().split())
    if N == M == 0:
        break

    L = []
    C = []
    for i in range(N):
        L.append(int(input()))
    for i in range(M):
        C.append(int(input()))
    for i in range(2, N+1):
        sL = []
        for j in range(N + 1 - i):
            sL.append(sum(L[j:i+j]))
        L += sL
    for i in range(2, M+1):
        sC = []
        for j in range(M +1 - i):
            sC.append(sum(C[j:i+j]))
        C += sC
    count = 0
    for x in C:
        for y in L:
            if x == y:
                count += 1
    print(count)

### FIXED CODE ###

from itertools import combinations
from collections import Counter

while True:
    N, M = map(int, input().split())
    if N == M == 0:
        break

    L = [0]
    C = [0]
    x = 0
    y = 0
    count = 0
    
    for i in range(N):
        l = int(input())
        x += l
        L.append(x)

    dL = Counter([max(x1, x2) - min(x1 ,x2) for (x1, x2) in combinations(L, 2)])

    for i in range(M):
        c = int(input())
        y += c
        C.append(y)
    for y1, y2 in combinations(C, 2):
        dy = max(y1,y2)-min(y1,y2)
        if dy in dL:
            count += dL[dy]


    print(count)
x = input()
x3 = x*x*x
print(x3)

### FIXED CODE ###

x0 = input()
x = int(x0)
x3 = x*x*x
print(x3)