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:
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
p=5000000000000000
s=input()
n=int(input())

chk=1
ans=f=0
for i in s:
    chk=1
    if i=="1": 
        ans+=1
        continue
    for j in range(p-1):
        chk*=int(i)
        if ans+chk>=p:
            print(i)
            f=1
            break
    ans+=chk
    if f==1: break
if f==0: print(s[-1])

Submission status: Wrong Answer

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

for c in s:
    if c == 1:
        if k == 1:
            print(1)
        else:
            k -= 1
    else:
        print(c)
        break

Submission status: Wrong Answer

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

#5 sen tyou = 5 * (10 ** 15)

"""
flg = 0
if k <= 100:
    for i in range(len(s)-1):
        if s[i] != "1":
            print(s[i])
            break
        else:
            if k-1 == i:
                print(1)
                flg = 1
                break

if flg == 0:
    for i in range(len(s)):
        if s[i] == "1":
            continue
        else:
            print(s[i])
            break
"""
co = 0
for i in s:
    co += 1
    if i == "1":
        if k == co:
            print(1)
            break
        else:
            continue
    else:
        print(i)

Submission status: Wrong Answer

Solution code:
import copy
str = input()
k = int(input())
a = list(str)
b = list(map(int,a))
c = copy.deepcopy(b)
d = 0
if k < len(b):
  c.sort()
  for i in range(k):
    if b[i] > 1 :
      print(b[i])
      d = 1
    if d == 0 and i == k-1:
      print(1)
else:
  for i in range(len(b)):
    if b[i] > 1 :
      print(b[i])
      break

Submission status: Wrong Answer

Solution code:
import math

N = input()
K = int(input())

def func(N, K):
    p = 0
    for n in range(len(N)):
        p += 5*10**15* math.log10(int(N[n]))
        if K <= p:
            return N[n]

print(func(N, K))

Submission status: Wrong Answer

Solution code:
s=list(input())
k=int(input())
if s[0]=='1':
  if k==1:
    print(s[0])
  else:
    for i in range(len(s)):
      if s[i]!='1':
        print(s[i])
        break
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' :
      continue
   else :
      print(s[i])
      break

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
if len(S) == 1:
	print(S)
elif K <= pow(10, 18):
	if S[0] != '1':
		ans = S[0]
	elif S[0] == '1':
		ans = S[1]
	elif S.find('2') == S.find('3') == S.find('4') == S.find('5') == S.find('6') == S.find('7') == S.find('8') == S.find('9') == False:
		ans = 1
	print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
if S[0] == "1" and K == 1 or S[0] != "1" or len(S) == 1:
  print(S[0])
else :
  print(S[1])

Submission status: Wrong Answer

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

a=[]
while S !=0:
  s=S%10
  a.append(s)
  S //=10
m=0

for i in range(1,len(a)+1):
  if a[-i]!=1:
    ans=i
    break
  else:
    ans=1

print(a[-ans])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import copy
str = input()
k = int(input())
a = list(str)
b = list(map(int,a))
c = copy.deepcopy(b)
d = 0
if k < len(b):
  c.sort()
  print(b)
  for i in range(k):
    if b[i] > 1 :
      print(b[i])
      d = 1
    if d == 0 and i == k-1:
      print(1)
else:
  for i in range(len(b)):
    if b[i] > 1 :
      print(b[i])
      break

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
import re
s1,s2=re.match('^(1)*(\d)',s).groups()
if(s1 and k<=len(s1)):
  print(1)
else:
  print(s2)

Submission status: Wrong Answer

Solution code:
S = input()
K = input()
if len(K) > 100:
    K = 110
else:
    K = int(K)


def main():
    if S[0] != '1':
        print(S[0])
        return

    i = 0
    while i < len(S) - 1 and S[i] == '1':
        i += 1

    if K-1 <= i:
        print('1')
        return

    if i == len(S) - 1:
        print(S[i])
        return

    print(S[i+1])


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math

N = input()
K = int(input())

def func(N, K):
    p = 0
    for n in range(len(N)):
        p += 5*10**15* math.log10(int(N[n]))
        if math.log10(K) <= p:
            return N[n]

print(func(N, K))

Submission status: Wrong Answer

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

for i in range(k):
  if s[i] != "1":
    print(s[i])
    exit()

Submission status: Wrong Answer

Solution code:
S = input()
K = input()
if len(K) > 100:
    K = 110
else:
    K = int(K)


def main():
    if S[0] != '1':
        print(S[0])
        return

    i = 0
    while i < len(S) - 1 and S[i] == '1':
        i += 1

    if K-1 <= i:
        print('1')
        return

    print(S[i])


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

#5 sen tyou = 5 * (10 ** 15)
gosentyo = 5 * (10 ** 15)

"""
co = 0
length = 0
while True:
    if int(s[co]) ** gosentyo + length > k - 1:
        print(s[co])
        break
    else:
        length += int(s[co]) ** gosentyo
        co += 1
"""

flg = 0
if k <= 100:
    for i in range(len(s)-1):
        if s[i] != "1":
            print(s[i])
            break
        else:
            if k-1 == i:
                print(1)
                flg = 1
                break

if flg == 0:
    for i in range(len(s)):
        if s[i] == "1":
            continue
        else:
            print(s[i])
            break

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
 
if int(S[0]) != 1:
  if S[0] != 2 or K <= 10**15:
    Ans = S[0]
  else:
    Ans = S[1]
  
elif len(S) ==1:
  Ans = 1
else:
  Ans = S[1]
  
print(Ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
p=5000000000000000
s=input()
n=int(input())

chk=1
ans=f=0
for i in s:
    chk=1
    if i=="1": 
        ans+=1
        continue
    for j in range(p):
#    for j in range(10):
        chk*=int(i)
#        print(i,chk)
        if ans+chk>=p:
            print(i)
            f=1
            break
    ans+=chk
    if f==1: break
if f==0: print(s[-1])

Submission status: Wrong Answer

Solution code:
def mrinfinit(a):
    bf = list(set(a))

    if len(bf) == 1 and bf[0] == '1':
        return a[0]
    elif len(a) > 1:
        if '1' in a:
            a = a.replace('1', '')
            return a[0]
        else:
            return a[0]
    else:
        return a[0]


if __name__ == '__main__':
    la = input()
    lb = int(input())
    print(mrinfinit(la))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import logging
import time
import math


class Solver:
    def __init__(self):
        self.s = ''
        self.k = 0

    # 入力
    def input_value(self):
        # self.n = int(input())
        # self.A, self.B = map(int, input().split())
        # self.A = list(map(int, input().split()))
        # self.a, self.b, self.c = map(int, [input() for i in range(4)])
        # self.t = [None] * self.n
        self.s = input()
        self.k = int(input())

    # @staticmethod
    # def run(s, k):
    #     # count = [None] * len(s)
    #     sum = 0
    #     for i in range(len(s) + 1):
    #         # count[i] = int(s[i]) ** (5 * 10 ** 15)
    #         # sum += int(s[i]) ** (5 * 10 ** 15)
    #         sum += (5 * 10 ** 15) * math.log10(int(s[i]))
    #         if sum > math.log10(k):
    #             return s[i]
    #     return '0'

    @staticmethod
    def run(s, k):
        # count = [None] * len(s)
        i = 0
        while s[i] == '1':
            i += 1
            if i >= len(s):
                return '1'
        return s[i]

    @staticmethod
    def test():
        start_time = time.time()

        assert Solver.run('1214', 4) == '2', 'Error.'
        assert Solver.run('3', 157) == '3', 'Error.'
        assert Solver.run('299792458', 9460730472580800) == '2', 'Error.'
        assert Solver.run('123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789', 100000000000000000) == '2', 'Error.'

        elapsed_time = time.time() - start_time
        logging.debug('elapsed_time: {0}'.format(elapsed_time) + '[sec]')


if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)

    solver = Solver()
    # Solver.test()

    solver.input_value()
    ans = solver.run(solver.s, solver.k)
    print(ans)

Submission status: Wrong Answer

Solution code:
S = int(input())
K = int(input())
S_list = [int(x) for x in list(str(S))]
 
def saiki(i):
  if i == len(S_list):
    print("1")
    exit()
  if S_list[i] > 1:
    print(S_list[i])
    exit()
  if S_list[i] == 1:
    saiki(i+1)
 
print(saiki(0))

Submission status: Wrong Answer

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

#5 sen tyou = 5 * (10 ** 15)
gosentyo = 5 * (10 ** 15)

"""
co = 0
length = 0
while True:
    if int(s[co]) ** gosentyo + length > k - 1:
        print(s[co])
        break
    else:
        length += int(s[co]) ** gosentyo
        co += 1
"""

flg = 0
if k <= 100:
    for i in range(len(s)-1):
        if s[i] != "1":
            print(s[i])
            break
        else:
            if k-1 == i:
                print(1)
                flg = 1
                break

if flg == 0:
    for i in range(len(s)):
        if i == len(s)-1:
            print(1)
        if s[i] == "1":
            continue
        else:
            print(s[i])
            break

Submission status: Wrong Answer

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

n = 0

m = {
    '1': 1,
    '2': 2 * (5 * (10 ** 15)),
    '3': 3 * (5 * (10 ** 15)),
    '4': 4 * (5 * (10 ** 15)),
    '5': 5 * (5 * (10 ** 15)),
    '6': 6 * (5 * (10 ** 15)),
    '7': 7 * (5 * (10 ** 15)),
    '8': 8 * (5 * (10 ** 15)),
    '9': 9 * (5 * (10 ** 15))
}

for i in range(len(s)):
    n += m[s[i]]
    if n >= k:
        print(s[i])
        break
else:
    print('hogehoge')

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
flag = False
for x,i in enumerate(S):
    if(int(i) != 1):
        if(5000000000000000>=K):
            print(S[x])
            flag = True
            break
        elif(S[x+1]!=1):
            print(S[x+1])
            flag = True
            break
    else:
        if(x+1==K):
            # print("check")
            break
if(flag == False):
    print("1")

Submission status: Wrong Answer

Solution code:
S = input()
K = input()
flag = 0
for i in range(len(S)):
    if S[i] =="1":
        continue
    elif S[i] =="2":
        print("2")
        flag = 1
    elif S[i] =="3":
        print("3")
        flag = 1
    elif S[i] =="4":
        print("4")
        flag = 1
    elif S[i] =="5":
        print("5")
        flag = 1
    elif S[i] =="6":
        print("6")
        flag = 1
    elif S[i] =="7":
        print("7")
        flag = 1
    elif S[i] =="8":
        print("8")
        flag = 1
    elif S[i] =="9":
        print("9")
        flag = 1

    break
if flag == 0:
    print("1")

Submission status: Wrong Answer

Solution code:
S = int(input())
K = int(input())
l = [int(x) for x in list(str(S))]
flag=0
flag2=0
i=0
j=0
ans = 0
if K<=len(l):
    while j<K and flag2 == 0:
        if l[j] == 1 or l[j]==0:
            j = j + 1
        else:
            flag2 =1
            ans = l[j]
else:
    while flag ==0:
        if l[i] == 1 or l[i]==0:
            i = i + 1
        else:
            flag=1
            ans = l[i]
print(ans)

Submission status: Wrong Answer

Solution code:
import math
n = input()
m = input()
for i in n:
    if (i != "1"):
        print(i)
        break

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
if S[0] != "1" or K != 1 or len(S) == 1:
  print(S[0])
else :
  print(S[1])

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
s = list(map(int,S))

if len(s) == 1:
    print(s)
else:
    num = 1
    one_cnt = 0
    for i in s:
        if i != 1:
            num = i
            break
        else:
            one_cnt += 1
    if (one_cnt >= K):
        print(1)
    else:
        print(num)

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    K = int(input())
    S_splited = list(map(int, list(str(S))))
    offset = 0
    day = 5 * 10**18
    for i in S_splited:
        if i == 1:
            offset += i
            continue
        else:
            break
    print(i)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python


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

    # 1桁目が、1以外のときは、1桁目を表示
    if s[0] != '1':
        print(s[0])
        return

    count_one = 0
    for c in s:
        if c == '1':
            count_one += 1
            break

    if k <= count_one:
        print(1)
    else:
        print(s[count_one])


main()

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
flag = False
for x,i in enumerate(S):
    if(int(i) == 1):
        if(x+1==K):
            # print("check")
            break
    else:
        if(5000000000000000>=K):
            print(S[x])
            flag = True
            break
        elif(S[x+1]!=1):
            print(S[x+1])
            flag = True
            break
if(flag == False):
    print("1")

Submission status: Wrong Answer

Solution code:
S = list(str(input()))
S = list(map(int,S))

K = int(input())
cnt = 0

for i in range(len(S)):
	cnt += 1
	if(S[i]!=1 and K-1>i):
		ans = S[i]
		break

if(cnt==len(S)):
	print(S[0])
else:
	print(ans)

Submission status: Wrong Answer

Solution code:
import math
s = input()
k = int(input())
ch = 5000000000000000
one = 1
two =  math.ceil(ch * math.log10(2)) * 9
thr =  math.ceil(ch * math.log10(3)) * 9
fou =  math.ceil(ch * math.log10(4)) * 9
fif =  math.ceil(ch * math.log10(5)) * 9
six =  math.ceil(ch * math.log10(6)) * 9
sev =  math.ceil(ch * math.log10(7)) * 9
eig =  math.ceil(ch * math.log10(8)) * 9
nin =  math.ceil(ch * math.log10(9)) * 9

m = 0

for i in s:
    i = int(i)
    #print(i)
    if i == 1:
        m += one
    elif i == 2:
        m += two
    elif i == 3:
        m += thr
    elif i == 4:
        m += fou
    elif i == 5:
        m += fif
    elif i == 6:
        m += six
    elif i == 7:
        m += sev
    elif i == 8:
        m += eig
    else:
        m += nin
    
    if m > k:
        #print("--------------")
        #print("stop at :" + str(i))
        print(i)
        break

Submission status: Wrong Answer

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

cnt = 0
excep_flag = False
for i in s:
    cnt += 1
    if cnt >= 100:
        excep_flag = True

    if cnt == len(s):
        ans = 1

    if i != "1":
        ans = i
        break

if k <= 100 and excep_flag == True:
    ans = 1

print(ans)

Submission status: Wrong Answer

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

ans = 0
if len(S) == 1:
    ans = S[0]
else:
    i = 0
    for i in range(len(S)):
        if S[i] != '1':
            ans = S[i]
            break
print(ans)

Submission status: Wrong Answer

Solution code:
S = str(input())
K = int(input())
if S[0] == '1' and K == 1:
    print(1)
#     print('A')
elif list(map(int,list(S[:(K-1)]))).count(1) == K-1:
    print(S[K-1])
#     print('B')
elif len(S) == 1:
    print(S[0])
#     print('C')
elif S[0] != '1':
    print(S[0])
#     print('D')
else :
    print(S[1])
#     print('E')

Submission status: Wrong Answer

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

ans=0

n  = 5000000000000000

S = str(s) #文字列にする
saisho = 0

for i in range(len(S)):
  N = int(S[i])
  if saisho <= k <= saisho + N**n:#最初からの文字数
    print(k)
    print(saisho+N**n)
    ans = N
    break
    
  else:
    saisho += N**n
    
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
p=5000000000000000
s=input()
n=int(input())

ans=chk=1
f=0
for i in s:
    chk=1
    if i=="1": 
        ans+=1
        continue
    for j in range(p):
        chk*=int(i)
        #ans+=chk
        if ans+chk>=p:
            print(i)
            f=1
            break
    ans+=chk
    if f==1: break
if f==0: print(s[-1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = int(input())
K = int(input())
S_list = [int(x) for x in list(str(S))]

def saiki(i):
  if i == len(S_list):
    print(S_list[i-1])
    exit()
  if S_list[i] > 2:
    print(S_list[i])
    exit()
  if S_list[i] == 2:
    if K > 5000000000000000:
      saiki(i+1)
    
    else:
      print(2)
      exit()
  if S_list[i] == 1:
    saiki(i+1)

print(saiki(0))

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
ans = 0
if len(S) == 1:
	print(S)
else:
	if K <= pow(10, 18) and S[0] != '1':
		ans = S[0]
	else:
		ans = S[1]
	print(ans)

Submission status: Wrong Answer

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

SL = list(S)
for i in range(101):
    if int(SL[i]) == 1:
        count1 += 1
    if count1 == K:
        break
    else:
        break

if count1 >= K:
    print(1)
else:
    if count1 >= 1:
        SL.remove("1")
    print(SL[0])

Submission status: Wrong Answer

Solution code:
S = str(input())
K = int(input())
if S[0] == '1' and K == 1:
    print(1)
#     print('A')
elif len(S) <= K and list(map(int,list(S[:(K-1)]))).count(1) == K-1:
    print(S[K-1])
#     print('B')
elif len(S) == 1:
    print(S[0])
#     print('C')
elif S[0] != '1':
    print(S[0])
#     print('D')
else :
    print(S[1])
#     print('E')

Submission status: Wrong Answer

Solution code:
S = int(input())
K = int(input())
l = [int(x) for x in list(str(S))]
flag=0
i=0
j=0
ans = 0
if len(l)>=K:
    while j<K:
        if l[j] == 1 or l[j]==0:
            j = j + 1
        else:
            ans = l[j]
else:
    while flag ==0:
        if l[i] == 1 or l[i]==0:
            i = i + 1
        else:
            flag=1
            ans = l[i]
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
s = list(map(int,S))

if len(s) == 1:
    print(s)
else:
    num = 0
    one_cnt = 0
    for i in s:
        if i != 1:
            num = i
            break
        if i == 1:
            one_cnt += 1
    if (one_cnt >= K):
        print(1)
    else:
        print(num)

Submission status: Wrong Answer

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

cnt = 0
for i in s:
    cnt += 1
    if cnt == len(s):
        ans = 1

    if i != "1":
        ans = i
        break

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
flag = False
for x,i in enumerate(S):
    if(int(i) != 1):
        if(5000000000000000>=K):
            print(i)
        else:
            print(S[x+1])
        flag = True
        break
if(flag == False):
    print("1")

Submission status: Wrong Answer

Solution code:
s=list(input())
k=int(input())
if k==1 or len(s)==1:
  print(s[0])
else:
  for i in range(len(s)):
    num = int(s[i])**500000000
    if k-num<=0:
      print(s[i])
      break

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())
for i in range(len(s)):
    if s[i] != '1':
        print(s[i])
        exit()
    else:
        if i == len(s) - 1:
            print('1')
            exit()
        if i == k:
            print('1')
            exit()

Submission status: Wrong Answer

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


def main():
    if S[0] != '1':
        print(S[0])
        return

    i = 0
    while i < len(S) - 1 and S[i] == '1':
        i += 1

    if K <= i:
        print('1')
        return

    print(S[i+1])


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if len(S) > 1:
    while S[i] == 1:
        i += 1
    print(S[i])
else:
    print(S[0])

Submission status: Wrong Answer

Solution code:
s=list(input())
k=int(input())
if k==1 or len(s)==1:
  print(s[0])
else:
  for i in range(len(s)):
    num = int(s[i])**500000
    if k-num<=0:
      print(s[i])
      break

Submission status: Wrong Answer

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

#5 sen tyou = 5 * (10 ** 15)
gosentyo = 5 * (10 ** 15)

"""
co = 0
length = 0
while True:
    if int(s[co]) ** gosentyo + length > k - 1:
        print(s[co])
        break
    else:
        length += int(s[co]) ** gosentyo
        co += 1
"""

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

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
flag = False
for x,i in enumerate(S):
    if(5000000000000000>=K):
        if(int(i) != 1):
            print(i)
            flag = True
            break
    else:
        if(int(i)!=1):
            print(S[x+1])
            flag = True
            break
if(flag == False):
    print("1")

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

# print(2 ** gosentyo)


for s in str_s:
    now_count = 1

    if int(s) == 1:
        count += 1
    else:
        for i in range(gosentyo):
            # print(count,now_count)
            if (now_count + count >= k):
                print(s)
                sys.exit()
            now_count *= int(s)
        else:
            count += now_count

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

# print(2 ** gosentyo)


for s in str_s:
    now_count = 1

    if int(s) == 1:
        count += 1
    else:
        for i in range(gosentyo):
            print(count,now_count)
            if (now_count + count >= k):
                print(s)
                sys.exit()
            now_count *= int(s)
        else:
            count += now_count

Submission status: Wrong Answer

Solution code:
str = input()
a = list(str)
b = list(map(int,a))
b.sort()
if len(b) > 1 and b[0] == 1:
  print(b[1])
if len(b) > 1 and b[0] != 1:
  print(b[0])
elif len(b) == 1 and b[0] != 1:
  print(b[0])

Submission status: Wrong Answer

Solution code:
s = list(input())
r = int(input())
ls = s + ["1"]
if (len(list(set(ls[:r]))) == 1):
    print(1)
else:
    for i in s:
        if(i!="1"):
            print(i)
            break

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())
for i in range(len(s)):
    if s[i] != '1':
        print(s[i])
        exit()
    if i == len(s) - 1 and s[-1] == '1':
        print('1')

Submission status: Wrong Answer

Solution code:
S = int(input())
K = int(input())
l = [int(x) for x in list(str(S))]
flag=0
i=0
j=0
ans = 0
if len(l)>=K:
    while j<K:
        if l[j] == 1 or l[j]==0:
            j = j + 1
        else:
            ans = l[j]
else:
    while flag ==0:
        if l[i] == 1 or l[i]==0:
            i = i + 1
        else:
            flag=1
            ans = l[i]
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    s = raw_input().strip()
    k = int(raw_input().strip())
    for c in s:
        if k == 0:
            print c
            break
        if c == '1':
            k -= 1
        else:
            print c
            break

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
p=5000000000000000
s=input()
n=int(input())

ans=chk=1
f=0
for i in s:
    chk=1
    if i=="1": continue
    for j in range(p):
        chk*=int(i)
        #ans+=chk
        if ans+chk>=p:
            print(i)
            f=1
            break
    ans+=chk
    if f==1: break
if f==0: print(s[-1])

Submission status: Wrong Answer

Solution code:
S = str(input())
K = int(input())
if S[0] == '1' and K == 1:
    print(1)
#     print('A')
elif len(S) <= K and list(map(int,list(S[:(K-1)]))).count(1) == K:
    print(1)
#     print('B')
elif len(S) == 1:
    print(S[0])
#     print('C')
elif S[0] != '1':
    print(S[0])
#     print('D')
else :
    print(S[1])
#     print('E')

Submission status: Wrong Answer

Solution code:
s = list(input())
r = int(input())
ls = s + [1]

if (len(list(set(ls[:r]))) == 1):
    print(1)
else:
    for i in s:
        if(i!="1"):
            print(i)
            break

Submission status: Wrong Answer

Solution code:
S = int(input())
K = int(input())
S_list = [int(x) for x in list(str(S))]

def saiki(i):
  if i == len(S_list):
    print(S_list[i-1])
    exit()
  if S_list[i] > 2:
    print(S_list[i])
    exit()
  if S_list[i] == 2:
    if K > 5*1000000000000000:
      print(2)
      exit()
    else:
      saiki(i+1)
  if S_list[i] == 1:
    saiki(i+1)

print(saiki(0))

Submission status: Wrong Answer

Solution code:
import math

s = list(map(int, list(input())))
k = int(input())
n = 5000000000000000

digit = 0
result = 0
for i in s:
    digit += int(n * math.log10(i)) + 1
    if k <= digit:
        result = i
        break

print(result)

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())
for i in range(len(s)):
    if s[i] != '1':
        print(s[i])
        exit()

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:
    now_count = 1

    if int(s) == 1:
        count += 1
    else:
        for i in range(gosentyo):
            if (i == 0 and now_count + count >= k) or (i != 0 and now_count * int(s) + count >= k):
                print(s)
                sys.exit()
            else:
                if i == 0:
                    now_count *= 1
                else:        
                    now_count *= int(s)
        else:
            count += now_count

Submission status: Wrong Answer

Solution code:
S = input()
K = input()
if len(K) > 100:
    K = 110
else:
    K = int(K)


def main():
    if S[0] != '1':
        print(S[0])
        return

    i = 0
    while i < len(S) - 1 and S[i] == '1':
        i += 1

    if K < i:
        print('1')
        return

    print(S[i])


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())
for i in range(len(s)):
    if s[i] != '1':
        print(s[i])
        exit()
    if s[-1] == '1':
        print('1')

Submission status: Wrong Answer

Solution code:
s = list(input())
r = int(input())
ls = s + [1]
if r <= len(s) and (len(list(set(ls))) == 1):
    print(1)
else:
    for i in s:
        if(i!="1"):
            print(i)
            break

Submission status: Wrong Answer

Solution code:
import collections
a=input()
k=int(input())
a=list(a)
#print(a)
d=collections.Counter(a)
if a[0]=='1':
    if k<=d['1']:
        #print("h")
        print("1")
    else:
        for i in range(0,len(a)):
            if a[i]!='1':
                print(a[i])
                break
else:
    print(a[0])

Submission status: Wrong Answer

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

s = list(map(int,S))
one_cnt = s.count(1)
s = list(set(s))
s.sort

min = 0
if len(s) == 1:
    min = s[0]
else:
    if s[0] == 1:
        min = s[1]
    else:
        min = s[0]

if (one_cnt >= K):
    print(1)
else:
    print(min)

Submission status: Wrong Answer

Solution code:
S, K = map(int, [input() for i in range(2)])
count = 0

for i in str(S):
    if i == 1:
        count += 1
        continue
    else:
        a = i
        break

if count >= K:
    print(1)
else:
    print(a)

Submission status: Wrong Answer

Solution code:
num = int(input())
num2 = int(input())
def gen(n):
    if n < 10:
        yield n
    else:
        for m in gen(n/10):
            yield m
        yield n%10
a = [int(i) for i in gen(num)]
for i in a:
    num2 -= 1
    if num2 == 0:
        print(i)
        break
    elif i != 1:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
s = list(input())
r = int(input())
ls = [1]+s[1:]
if r <= len(s) and (len(list(set(ls))) == 1):
    print(1)
else:
    for i in s:
        if(i!="1"):
            print(i)
            break

Submission status: Wrong Answer

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

if K == 1:
	print(S[0])
else:
	i = 0
	K -= 1
	while S[i] == "1" and K > 0:
		i += 1
		K -= 1
	print((i,S[i]))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
p=5000000000000000
s=input()
n=int(input())

ans=chk=1
f=0
for i in s:
    chk=1
    if i=="1": continue
    for j in range(2,p):
        chk*=int(i)
        #ans+=chk
        if ans+chk>=p:
            print(i)
            f=1
            break
    ans+=chk
    if f==1: break
if f==0: print(s[-1])

Submission status: Wrong Answer

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

if r <= len(s) and (len(list(set(s))) == 1):
    print(1)
else:
    for i in s:
        if(i!="1"):
            print(i)
            break

Submission status: Wrong Answer

Solution code:
import math
 
s = input()
k = math.log10(int(input()))
index_num = 0
pow_num = 5000000000000000
if k == 0:
  print(s[0])
  exit()
for i in s:
  new_index_num = index_num  + math.log10(int(i)) * pow_num
  if k > index_num and k <= new_index_num:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import sys
S=input()
li=''.join(S)
S1=len(li)
m=[]

K=int(input())
ans=str(K)
k1=''.join(ans)
k2=len(k1)

for i in range(0,S1):
    if li[i]!='1' and (i+1)<K:
        print(li[i])
        sys.exit()

print('1')

Submission status: Wrong Answer

Solution code:
# coding:utf-8
s=input()
k=int(input())
list=list(s)
ans=1
for i in range(k):
    if not list[i] == 1:
        ans=list[i]
        break
print(ans)