Problem:


﻿Score: 300 points

Problem Statement

Mr. Infinity has a string S consisting of digits from 1 to 9. Each time the date changes, this string changes as follows:

Each occurrence of 2 in S is replaced with 22. Similarly, each 3 becomes 333, 4 becomes 4444, 5 becomes 55555, 6 becomes 666666, 7 becomes 7777777, 8 becomes 88888888 and 9 becomes 999999999. 1 remains as 1.

For example, if S is 1324, it becomes 1333224444 the next day, and it becomes 133333333322224444444444444444 the day after next.
You are interested in what the string looks like after 5 \times 10^{15} days. What is the K-th character from the left in the string after 5 \times 10^{15} days?

Constraints

S is a string of length between 1 and 100 (inclusive).

K is an integer between 1 and 10^{18} (inclusive).

The length of the string after 5 \times 10^{15} days is at least K.

Input

Input is given from Standard Input in the following format:

S
K

Output

Print the K-th character from the left in Mr. Infinity's string after 5 \times 10^{15} days.

Sample Input 1

1214
4

Sample Output 1

2

The string S changes as follows:  

Now: 1214

After one day: 12214444

After two days: 1222214444444444444444

After three days: 12222222214444444444444444444444444444444444444444444444444444444444444444

The first five characters in the string after 5 \times 10^{15} days is 12222. As K=4, we should print the fourth character, 2.

Sample Input 2

3
157

Sample Output 2

3

The initial string is 3. The string after 5 \times 10^{15} days consists only of 3.

Sample Input 3

299792458
9460730472580800

Sample Output 3

2



Sample input:
1214
4


Sample output:
2

Submission status: Wrong Answer

Solution code:
s = input()
t = '1'

for i in range(len(s)) :
   if s[i]=='1' :
      continue
   else :
      t = s[i]
      break

print(t)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    s = input()
    k = int(input())

    if s[0] == '1':
        if k == 1:
            print(s[0])
        else:
            print(s[1])
    else:
        print(s[0])


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())

ans = ''
if k >= 2 and s[0] == '1':
    ans = s[1]
else:
    ans = s[0]
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(input())
k = input()

if k == '1':
    print(s[0])
else:
    n = min(int(k)-1, len(s))
    f = True
    for i in range(n):
        if s[i] != '1':
            print(s[i])
            f = False
    if f:
        print(s[n])

Submission status: Wrong Answer

Solution code:
l=list(input())
k=int(input())
m=[0]*len(l)
for i in range(len(l)):
    var=pow(int(l[i]),int(l[i]))
    if(i==0):
        m[i]+=var
    if(i>=1):
        m[i]+=(m[i-1]+var)
    if(k<=m[i]):
        print(l[i])
        exit()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import math,string,itertools,fractions,heapq,collections,re,array,bisect

def s():
    return input()
def n():
    return int(input())

S = s()
K = n()

n=0
for s in S:
    n += 1
    if s != '1':
        s_first = s
        break

if n < K:
    print(s)
else:
    print(1)

Submission status: Wrong Answer

Solution code:
import sys
s=input()
k=int(input())
if(len(s)==1):
    print(s[0])
    sys.exit()
c=0
for i in range(k):
    if(s[i]==1):c+=1
    else:break
if(c==k):
    print(1)
else:
    if(c==0):print(s[0])
    else:print(s[c+1])

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())

if K == 1:
    print(S[0])
else:
    for n, s in enumerate(S):
        if n == K:
            print(1)
            break
        
        if s == "1":
            continue
        
        print(s)
        break

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())

if len(S) == 1:
    print(S)
elif S[0] == '1' and K == 1:
    print('1')
elif S[0] == '1' and K > 1:
    print(S[1])
else:
    print(S[0])

Submission status: Wrong Answer

Solution code:
S = (input())						# 5
K = int(input())						# 5

## 5000兆日
#a = 5000 * 10000 * 10000 * 10000
#
## 10の18乗
#k = 10 ** 18 = 10 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000

ans="1"
for c in S:
	if (c=="1"): continue
	ans = c
	break

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

str_s = input()
k = input()

int_s = int(str_s)
k = int(k)

gosentyo = 5000000000000000
count = 0
for s in str_s:
    if int(s) == 1:
        count += 1
        continue
    for i in range(gosentyo):

        if int(s)* int(s) + count >= k:
            print(s)
            sys.exit()
        else:
            count += int(s) * gosentyo

Submission status: Wrong Answer

Solution code:
S=input()
K=int(input())
if K==1:
	print(int(S[0:1]))
elif int(S[0:1])==1:
	print(int(S[1:2]))
else:
	print(int(S[0:1]))

Submission status: Wrong Answer

Solution code:
s = input()
k = input()

total = 0

ans = 1

for i, c in enumerate(s, 1):
    if i == k:
        break

    if int(c) == 1:
        total += 1
    else:
        ans = c
        break

print(ans)

Submission status: Wrong Answer

Solution code:
a=input()
k=int(input())
a=list(a)
#print(a)
if a[0]=='1':
    if k==1:
        #print("h")
        print("1")
    else:
        print(a[1])
else:
    print(a[0])

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())

i=0
while(s[i]=="1"):
    if i==(len(s)-1):
        break
    i +=1
    
if k<i:
    print(1)
else:
    print(s[i])

Submission status: Wrong Answer

Solution code:
s = input()
k = input()
flag = -1
n = len(s)

if n >= 5:
	n = 5

for i in range(n):
	if flag == -1:
		if s[i] != '1':
			flag = i

if flag == -1:
	print('1')
else:
	print(s[flag])

Submission status: Wrong Answer

Solution code:
import math, string, fractions, heapq, re, array, bisect, sys, random, time, copy
import itertools as it
import operator as op
import collections as cl
import functools as ft

def LI(): return list(map(int, input().split()))
def LI_(): return list(map(lambda x: int(x) - 1, input().split()))
def LF(): return list(map(float, input().split()))
def LS(): return input().split()
def I(): return int(input())
def F(): return float(input())
def S(): return input()


wait_time = 5 * 10**15

if __name__ == "__main__":
    s = S()
    k = input()

    for letter in s:
        if letter != '1':
            print(letter)
            break

Submission status: Wrong Answer

Solution code:
a = list(map(int,input()))

b = int(input())

k = 0

if len(a) == 1:
    print(a[0])

else:
    for i in range(len(a)):
        if a[i] == 1:
            k += 1
        else:
            k = a[i]
            break
        if k == b:
            break
    print(k)

Submission status: Wrong Answer

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


def solve():
    s = input()
    n = int(input())
    idx = 0
    slen = len(s)
    while idx < slen and s[idx] == "1":
        idx += 1
    if idx < n or idx == slen:
        print(1)
    else:
        print(s[idx])


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
if k==1:
    print(s[0])
else:
    if s[0]=="1":
        if k < (10**16):
            print(s[1])
        else:
            #print("reached")
            print(s[2])
    else:
        if k < (10**16):
            print(s[0])
        else:
            print(s[1])

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())
n = len(s)
index = 0
num = 0
for i in range(n):
    if s[i] != "1":
        index = i + 1
        num = s[i]
        break

if k <= index:
    print(1)
else:
    print(num)

Submission status: Wrong Answer

Solution code:
data = input()
num = int(input())

cnt = 0
for lop in range(len(data)):
    if int(data[lop]) == 1:
        if num == cnt:
            print(data[lop])
            break
        else :
            cnt = cnt + 1
    else :
        print(data[lop])
        break

Submission status: Wrong Answer

Solution code:
S = input().strip()
K = input().strip()

if len(S) == 1:
    print(S)
elif len(S) == sum([int(i) for i in S]):
    print(1)
else:
    for i in S:
        if i != "1":
            print(i)
            break

Submission status: Wrong Answer

Solution code:
import sys
s=input()
k=int(input())
if(len(s)==1):
    print(s[0])
    sys.exit()
c=0
for i in range(k):
    if(s[i]==1):c+=1
    else:break
if(c==k):
    print(1)
else:
    if(s[0]!='1'):print(s[0])
    if(s[0]=='1' and k=='1'):print(1)
    if(s[0]=='1' and k!='1'):print(s[1])

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())
a = 0
b = 0
for i in range(len(s)):
  if(s[i] != "1"):
    a = s[i]
    b = i + 1
    break
if(k < b):
  print(1)
else:
  print(a)

Submission status: Wrong Answer

Solution code:
s =  int(input())
k =  int(input())
#print(pow(10, 12))
def main(string_s):
    if str(s).lstrip('1') == '':
         print('1')
         return
    if str(s).lstrip('1')[0] == '2':
        print('2')
    elif str(s).lstrip('1')[0] == '3':
        print('3')
    elif str(s).lstrip('1')[0] == '4':
        print('4')
    elif str(s).lstrip('1')[0] == '5':
        print('5')
    elif str(s).lstrip('1')[0] == '6':
        print('6')
    elif str(s).lstrip('1')[0] == '7':
        print('7')
    elif str(s).lstrip('1')[0] == '8':
        print('8')
    elif str(s).lstrip('1')[0] == '9':
        print('9')
    else:
        print('1')

main(s)

Submission status: Wrong Answer

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


def solve():
    s = input()
    n = int(input())
    idx = 0
    slen = len(s)
    while idx < slen and s[idx] == "1":
        idx += 1
    if idx == slen:
        print(1)
    else:
        print(s[idx])


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
for i in range(len(S)):
    if S[i] != "1":
        break
if  S == "1"*len(S):
    print(1)
else:
    if K <= i+1:
        print(1)
    else:
        print(S[i])

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())

for i in range(K):
    if S[i]== '1':
        pass
    else:
        print(S[i])
        break

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())

#s = "1214"
#k = 4

ch_cnt = 1
first_num = 1

for ch in s:
    if ch != "1":
        first_num = int(ch)
        break
    ch_cnt += 1

# print(first_num, k)

if k <= ch_cnt:
    print(1)
else:
    print(first_num)

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
key = 1
i = 0
while True:
    if i >= K:
        break
    if i >= len(S):
        break
    if int(S[i]) != 1:
        print(S[i])
        key = 1
        break
    i += 1

if key == 0:
    print(S[0])

Submission status: Wrong Answer

Solution code:
S = input().strip()
K = input().strip()

if len(S) == 1:
    print(S)

if len(S) == sum([int(i) for i in S]):
    print(1)

for i in S:
    if i != "1":
        print(i)
        break

Submission status: Wrong Answer

Solution code:
S=raw_input()
K=input()

if S[0]=="1":
	if K==1:
		print 1
	else:
		print S[1]
else:
	print S[0]

Submission status: Wrong Answer

Solution code:
s = list(input())
k = input()

if k == '1':
    print(s[0])
else:
    if s[0] == '1':
        print(s[1])
    else:
        print(s[0])

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
key = 1
i = 0
while True:
    if i >= len(S):
        break
    if int(S[i]) != 1:
        print(S[i])
        key = 1
        break
    i += 1

if key == 0:
    print(S[0])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    s = input()
    k = int(input())

    if s[0] == 1:
        print(s[1])
    else:
        print(s[0])


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())

ans = []
for i,c in enumerate(S,1):
        if c == "1" and i != 18:
                continue
        else:
                print(c)
                break

Submission status: Wrong Answer

Solution code:
#兆：10**12
S = input()
K = int(input())



if K == 1:
    print(S[0])
elif K <= 9460730472580800:
    if S[0] == "1":
        if len(S)>1:
            print(S[1])
        else:
            print(S[0])
    elif len(S) == 1:
        print(S[0])
    else:
        print(S[0])
else:
    if S[0] == "1":
        if len(S)>1:
            print(S[2])
        else:
            print(S[0])
    elif len(S) == 1:
        print(S[0])
    else:
        print(S[1])

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())

for i in s:
    if i != '1':
        ans = int(i)
        break

print (i)

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())
n = len(s)
index = 0
num = 0
for i in range(n):
    if s[i] != "1":
        index = i + 1
        num = s[i]
        break

if k < index:
    print(1)
else:
    print(num)

Submission status: Wrong Answer

Solution code:
def c_to_infinity(S, K):
    for s in S:
        if s != '1':
            return s
    return 1

S = input().strip()
K = int(input())
print(c_to_infinity(S, K))

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())


i=0
while i<k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        break

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())
n = len(s)
index = 0
num = 0
for i in range(n):
    if s[i] != "1":
        index = i
        num = s[i]
        break

if k < index:
    print(1)
else:
    print(num)

Submission status: Wrong Answer

Solution code:
s = input()
K = int(input())
a = 0
b = ''
for i, j in enumerate(s):
    if j != '1':
        a = i
        b = j
        break

if K <= a:
    print(1)
else:
    print(b)

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
key = 1
i = 0
while True:
    if i == K - 1:
        break
    if int(S[i]) != 1:
        print(S[i])
        key = 1
        break
    i += 1

if key == 0:
    print(S[0])

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())
idx = 0
while idx < len(s) and s[idx] == '1':
    idx += 1
if k < idx or k == len(s):
    print(1)
else:
    print(s[idx])

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
if(len(s)==1):print(s[0])
else:
    if(s[0]!='1'):print(s[0])
    if(s[0]=='1' and k=='1'):print(1)
    if(s[0]=='1' and k!='1'):print(s[1])

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())

if s[0] != '1':
    ans = s[0]
elif k == 1:
    ans = s[0]
else:
    ans = s[1]

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())

for i in range(len(s)):
    if s[i] != '1':
        break
if k < i:
    print('1')
else:
    print(s[i])

Submission status: Wrong Answer

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


def main():
    s, k = input(), int(input())

    if len(s) == 1:
        print(0)

    idx = 0
    for i in range(len(s)):
        if s[i] != "1":
            idx = i
            break

    print(s[idx])


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#-*-coding:utf-8-*-

def main():
    s = list(map(int, list(input())))
    k = int(input())

    if k == 1:
        print(s[0])
        exit()

    for i in s:
        if i != 1:
            print(i)
            break

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = list(map(int, list(input())))
k = int(input())
res = False
for e in s:
    if e == 1:
        continue
    else:
        res = True
        print(e)
        break
if not res:
    print(1)

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
key = 1
i = 0
while True:
    if i == K - 1:
        break
    if int(S[i]) != 1:
        print(S[i])
        key = 1
        break
    i += 1

if key == 0:
    print(1)

Submission status: Wrong Answer

Solution code:
#兆：10**12
S = input()
K = int(input())



if K == 1:
    print(S[0])
elif S[0] == "1":
    if len(S)>1:
        print(S[1])
    else:
        print(S[0])
elif len(S) == 1:
    print(S[0])
else:
    print(S[0])

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())

for i in range(len(s)):
    if s[i] != '1':
        print(s[i])
        break

Submission status: Wrong Answer

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


def main():
    s, k = input(), int(input())

    if len(s) == 1:
        print(s[0])
    elif s[0] == "1":
        print(s[1])
    else:
        print(s[0])


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())

def solve():
    count = 0
    for si in S:
        if count == K:
            print(si)
            break
        if si == "1":
            count += 1
            continue
        else:
            print(si)
            break

solve()

Submission status: Wrong Answer

Solution code:
s = list(map(int, list(input())))
k = int(input())
for e in s:
    if e == 1:
        continue
    else:
        print(e)
        break

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())

X = 0
for s in S:
    X += (s== "1")

if K == 1:
    print(S[0])

elif K <= X:
    print(1)
    
else:
    for s in S:
        if s != "1":
            print(s)
            break
    else:
        print(1)

Submission status: Wrong Answer

Solution code:
S = input()
k = int(input())

for s in S:
    if int(s) != 1:
        print(s)
        exit()
print(1)

Submission status: Wrong Answer

Solution code:
s = input()

for i in s:
    if i != '1':
         print(i)
         break

Submission status: Wrong Answer

Solution code:
#-*-coding:utf-8-*-

def main():
    s = list(map(int, list(input())))
    k = int(input())

    for i in s:
        if i != 1:
            print(i)
            break

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())

for c in s:
    if c != '1':
        print(c)
        exit()
print('1')

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())

if K == 1:
    print(S[0])
else:
    for s in S:
        if s != "1":
            print(s)
            break
    else:
        print(1)

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())

if K == 1:
    print(S[0])
else:
    for s in S:
        if s != "1":
            print(s)
            break

Submission status: Wrong Answer

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


# --------------------------------------------

dp = None


def main():
    S = input()
    K = int(input())

    if K == 1:
        print(S[0])
    else:
        if S[0] == "1":
            print(S[1])
        else:
            print(S[0])


main()

Submission status: Wrong Answer

Solution code:
S = input()
N = int(input())

for i in range(len(S)):
  if S[i] != '1':
    print(S[i])
    exit()
print('1')

Submission status: Time Limit Exceeded

Solution code:
s = input()
k = int(input())

count = 0
for i in s:
  if i == "1":
    count += 1
  else :
    count += int(i)**k
  if count >= k:
    print(i)
    break

Submission status: Time Limit Exceeded

Solution code:
def resolve():
    s = input()
    k = int(input())
    c = 0
    for i in s:
        if i == "1":
            c += 1
        else:
            c += int(i)**((5*10**16)-1)
        if k <= c:
            print(i)
            break
resolve()

Submission status: Time Limit Exceeded

Solution code:
s = list(input())
k = int(input())
S = [int(s[i]) for i in range(len(s))]
for i in range(len(S)):
  for j in range(16):
    if k<= S[i]**(5 * (10**i)):
      print(S[i])
      exit()
    else:
      pass
  k = k- S[i]**(5000000000000000)

Submission status: Time Limit Exceeded

Solution code:
import math

print(math.log10(2**5000000000000000))

Submission status: Time Limit Exceeded

Solution code:
SS=input()
K=int(input())
for i in range(0,5000000000000000):
    S=SS[0:K]
    S.replace('2','22')
    S.replace('3','333')
    S.replace('4','4444')
    S.replace('5','55555')
    S.replace('6','666666')
    S.replace('7','7777777')
    S.replace('8','88888888')
    S.replace('9','999999999')
print(S[K:K])

Submission status: Time Limit Exceeded

Solution code:
S=input()
K=int(input())
for i in range(0,5000000000000000):
    ll=list(S)
    ss=ll[0:K]
    S=''.join(ss)
    S.replace('2','22')
    S.replace('3','333')
    S.replace('4','4444')
    S.replace('5','55555')
    S.replace('6','666666')
    S.replace('7','7777777')
    S.replace('8','88888888')
    S.replace('9','999999999')

f=list(S)
print(f[K-1])

Submission status: Time Limit Exceeded

Solution code:
S=input()
K=int(input())
for i in range(0,5000000000000000):
    S.replace('2','22')
    S.replace('3','333')
    S.replace('4','4444')
    S.replace('5','55555')
    S.replace('6','666666')
    S.replace('7','7777777')
    S.replace('8','88888888')
    S.replace('9','999999999')
    ll=list(S)
    ss=ll[0:K]
    S=''.join(ss)

f=list(S)
print(f[K-1])

Submission status: Time Limit Exceeded

Solution code:
S=input()
K=int(input())
for i in range(0,5000000000000000):
    S.replace('2','22')
    S.replace('3','333')
    S.replace('4','4444')
    S.replace('5','55555')
    S.replace('6','666666')
    S.replace('7','7777777')
    S.replace('8','88888888')
    S.replace('9','999999999')

f=list(S)
print(f[K-1])

Submission status: Time Limit Exceeded

Solution code:
s = input()
k = int(input())
l = []
for i in s:
    l.append(str(int(i)**(5*10**15)))
print("".join(l)[k-1])

Submission status: Time Limit Exceeded

Solution code:
s=input()
k=int(input())
count=0
for i in s:
    count+=int(i)**(5*(10**10))
    if count>=k:
        print(i)
        break

Submission status: Time Limit Exceeded

Solution code:
S=list(str(input()))
k=int(input())
for i in range(len(S)):
    si=int(S[i])
    ti=si**(5*10**15)
    if k<=ti:
        print(S[i])
        break
    else:
        k-=ti

Submission status: Time Limit Exceeded

Solution code:
s = input()
k = int(input())
day = 5 * (10 ** 15)

for c in s:
  i = int(c)
  l = i ** day
  if k <= l:
    print(c)
    exit()
  else:
    k -= l

Submission status: Time Limit Exceeded

Solution code:
s = input()
k = int(input())
anstr = ""
for i in range(len(s)):
  anstr += s[i]*(int(s[i])**5000000000000000)
  if len(anstr) > k:
    break
print(anstr[k-1])

Submission status: Time Limit Exceeded

Solution code:
s = input()
k = int(input())
anstr = ""
for i in range(len(s)):
  anstr += s[i]*(int(s[i])**5000000000000000)
print(anstr[k-1])

Submission status: Time Limit Exceeded

Solution code:
s=input()
k=int(input())
ans=0
for i in range(len(s)):
    ans+=int(s[i])**500000000000
    if ans>=k:
        print(s[i])
        break

Submission status: Time Limit Exceeded

Solution code:
numbers = input()
position = int(input())
roop = True
while roop:
    new_number = ""
    if len(numbers) > position:
        numbers = numbers[:position]
    while len(new_number) < position:
        for num in numbers:
                new_number += num * int(num)
    if (numbers != new_number[:position]):
        numbers = new_number[:position]
    else:
        roop = False
print(numbers[position - 1: position])

Submission status: Time Limit Exceeded

Solution code:
numbers = input()
position = int(input())
roop = True
while roop:
    new_number = ""
    if len(numbers) > position:
        numbers = numbers[:position]
    while len(new_number) < position:
        for num in numbers:
            for i in range(1, 10):
                if num == str(i):
                    new_number += str(i) * i
        if (numbers != new_number[:position]):
            numbers = new_number[:position]
        else:
            roop = False
print(numbers[position - 1: position])

Submission status: Time Limit Exceeded

Solution code:
numbers = input()
position = int(input())
roop = True
while roop:
    new_number = ""
    if len(numbers) > position:
        numbers = numbers[:position]
    for num in numbers:
        for i in range(1, 10):
            if num == str(i):
                new_number += str(i) * i
    if (numbers != new_number[:position]):
        numbers = new_number[:position]
    else:
        roop = False
print(numbers[position - 1: position])

Submission status: Time Limit Exceeded

Solution code:
s=input()
k=int(input())
li=[i for i in s]
a=0
for j in li:
  if a+int(j)**int(5e15)>=k:
    print(j)
    break
  else:
    a+=int(j)**int(5e15)

Submission status: Time Limit Exceeded

Solution code:
s = raw_input()
k = int(raw_input())
count = 0
for n in s:
	count += int(n)**(5*(10**14))
	if count>=k:
		print n
		break

Submission status: Time Limit Exceeded

Solution code:
S, K = str(input()), int(input())
n = int(5000*10**12)
S_= []
for char in S:
    if len(S_)<=K:
        char = char*int(char)**n
        S_.append(char)
    else:
        break
print(S_[K-1])

Submission status: Time Limit Exceeded

Solution code:
S, K = str(input()), int(input())
n = int(5000*10**12)
S_= []
table = {}
for i in range(1,10):
    char = str(i)
    table[char] = char*int(char)**n
print(table)
table = str.maketrans(table)
S = S.translate(table)
print(S[K-1])

Submission status: Time Limit Exceeded

Solution code:
S, K = str(input()), int(input())
n = int(5000*10**12)
S_= []
for char in S:
    char = char*int(char)**n
    S_.append(char)
print(S_[K-1])

Submission status: Time Limit Exceeded

Solution code:
s = input()
k = int(input())
for i in range(5*10**15):
    s = s.replace('2','22')
    s = s.replace('3','333')
    s = s.replace('4','4444')
    s = s.replace('5','55555')
    s = s.replace('6','666666')
    s = s.replace('7','7777777')
    s = s.replace('8','88888888')
    s = s.replace('9','999999999')
    s = s[:k]
print(s)

Submission status: Time Limit Exceeded

Solution code:
a=input()
k=int(input())
x=5*pow(10,15)
i=0
while k>0:
    k-=pow(int(a[i]),x)
    i+=1
print(a[i-1])

Submission status: Time Limit Exceeded

Solution code:
S = input()
K = int(input())

D=5000000000000000

tmp=0
for s in S:
  t=1
  for _ in range(K):
    t=t*int(s)
    if tmp+t>=K:
      print(s)
      break
  else:
    tmp+=t
    continue
  break

Submission status: Time Limit Exceeded

Solution code:
S = input()
K = int(input())

D=5000000000000000

tmp=0
for s in S:
  t=1
  for _ in range(D):
    t=t*int(s)
    if tmp+t>=K:
      print(s)
      break
  else:
    tmp+=t
    continue
  break

Submission status: Time Limit Exceeded

Solution code:
S = input()
K = int(input())

D=5000000000000000

tmp=0
for s in S:
  t=1
  for _ in range(D):
    t=t*int(s)
    if tmp+t>=K:
      print(s)
      break
  else:
    continue
  break

Submission status: Time Limit Exceeded

Solution code:
s = input()
k = int(input())
for i in range(k):
  s = s.replace("2","22").replace("3","333").replace("4","4444").replace("5","55555").replace("6","666666").replace("7","7777777").replace("8","88888888").replace("9","9999999")
print(s[k-1])

Submission status: Time Limit Exceeded

Solution code:
def reflesh_string(current_answer):
    index = min(K, len(current_answer))
    return current_answer[:index]

def update_string(string_answer):
    string_answer = string_answer.replace("1", "1")
    string_answer = string_answer.replace("2", "22")
    string_answer = string_answer.replace("3", "333")
    string_answer = string_answer.replace("4", "4444")
    string_answer = string_answer.replace("5", "55555")
    string_answer = string_answer.replace("6", "666666")
    string_answer = string_answer.replace("7", "7777777")
    string_answer = string_answer.replace("8", "88888888")
    string_answer = string_answer.replace("9", "999999999")
    return string_answer
  
def check_skip(current_answer):
    counter = [0 for i in range(10)]
    for k in range(min(K, len(current_answer))):
        counter[int(current_answer[k])] = 1
    if(sum(counter) == 1):
        return True
    
    if(sum(counter) == 2 and current_answer[min(K, len(current_answer)) - 1] != "1"):
        return True
    
    return False
    
S = input().strip()
K = int(input().strip())
for c in range(5 * 10**15):
    S = update_string(S)
    S = reflesh_string(S)
    if(check_skip(S)):
        break
print(S[min(K, len(S)) - 1])

Submission status: Time Limit Exceeded

Solution code:
def reflesh_string(current_answer):
    index = min(K, len(current_answer))
    return current_answer[:index]
  
def update_string(string_answer):
    string_answer = string_answer.replace("1", "1")
    string_answer = string_answer.replace("2", "22")
    string_answer = string_answer.replace("3", "333")
    string_answer = string_answer.replace("4", "4444")
    string_answer = string_answer.replace("5", "55555")
    string_answer = string_answer.replace("6", "666666")
    string_answer = string_answer.replace("7", "7777777")
    string_answer = string_answer.replace("8", "88888888")
    string_answer = string_answer.replace("9", "999999999")
    return string_answer
  
def check_skip(current_answer):
    for i in range(2, 10):
        i = str(i)
        if(i in current_answer):
            return False
    return True
  
S = input().strip()
K = int(input().strip())
for c in range(5 * 10**15):
    S = update_string(S)
    S = reflesh_string(S)
    if(check_skip(S)):
        break
print(S[K-1])

Submission status: Time Limit Exceeded

Solution code:
import sys
# N,M = [int(n) for n in input().split()]
# S = str(input())
# T = str(input())

S = str(input())
K = int(input())
numplace = 0

for i in range(len(S)):
    if (S[i] == "1"):
        numplace+=1
    else:
        numplace+= int(S[i])**5000000000000000
    if(numplace>=K):
        print(S[i])
        sys.exit()

Submission status: Time Limit Exceeded

Solution code:
s = input()
k = int(input())

count = 0

for i in range(len(s)):
    if count < k:
        num = int(s[i])
        count += num ** 5000000000000000
        
    else:
        break

print(num)

Submission status: Time Limit Exceeded

Solution code:
s = input()
k = int(input())
 
s = list(s)
v = 5 * 10**15
a = []
for i in range(9):
  a.append(i ** v)

nuar = []
lear = []
co = 0
rear = 0

for i in s:
  for j in range(1,10):
    if int(i) == j:
      nuar.append(j)
      rear += a[j - 1]
      lear.append(rear)
      
for p in range(len(s)):
  if p == 0:
    if lear[p] >= k:
      print(nuar[p])
  elif lear[p] >= k and lear[p - 1] < k:
    print(nuar[p])

Submission status: Time Limit Exceeded

Solution code:
S = raw_input()
K = int(raw_input())
n = 0
i = 0
while n<K:
  a = int(S[i])
  n += a**5000000000000000
  i += 1
print a

Submission status: Time Limit Exceeded

Solution code:
s = input()
num =list(map(int, list(s)))
k = int(input())
days = int(5e15)
for i in range(days):
    temp = s[:k]
    for j in num:
         s = s.replace(str(j), str(j)*j)
    if temp == s[:k]:
        break 
print(s[k-1])

Submission status: Time Limit Exceeded

Solution code:
s = input()
k = int(input())
days = int(5e15)
for i in range(days):
    temp = s[:k]
    for j in range(2,10):
         s = s.replace(str(j), str(j)*j)
    if temp == s[:k]:
        break 
print(s[k-1])

Submission status: Time Limit Exceeded

Solution code:
s = input()
k = int(input())
days = int(5e15)
for i in range(days):
    for j in range(2,10):
         s = s.replace(str(j), str(j)*j)

print(s[k-1])