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: Runtime Error

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

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    s = input()
    _ = input()
    if s[0] == '1':
        print(s[1])
    else:
        print(s[0])


if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

if k==1 or int(s[0])!=1:
    print(int(s[0]))

else:
    if s[:k]=="1"*k:
        print(1)
    else:
        for i in range(1, len(s)):
            num=int(s[i])
            if num!=1:
                break
        print(num)

Submission status: Runtime Error

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

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

elif int(s[0])==1:
    if s[:k]=="1"*k:
        print(1)
    else:
        num=1
        for i in range(1, len(s)):
            if int(s[i])!=1:
                num=int(s[i])
                break
        print(num)

elif int(s[0])!=1:
    print(int(s[0]))

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
for i, c in enumerate(s):
    if int(c)>1:
        ind = i+1
        n = int(c)
        break
else:
    ind = len(s)

if k<ind:
    print(1)
else:
    print(n)

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
for i, c in enumerate(s):
    if int(c)>1:
        ind = i+1
        n = int(c)
        break

if k<ind:
    print(1)
else:
    print(n)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
if len(S) > K and S[:K].count(1) == K:
    print(1)
else:
    for c in S:
        if c != '1':
            print(c)
            break

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

counter = 0
for i in range(len(s)):
  if s[i] == "1":
    counter += 1
  else:
    ans = i
    break
  
if k <= i:
  ans = 1
else:
  ans = s[ans]
  
print(ans)

Submission status: Runtime Error

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

if sum(map(int, list(s))) == k:
    print('1')
else:
    ans = s.replace('1', '')[0]
    print(ans)

Submission status: Runtime Error

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

if s[:k] in '1' * k:
    print('1')
else:
    ans = s.replace('1', '')[0]
    print(ans)

Submission status: Runtime Error

Solution code:
S = input()
K = input() 
if S[int(K)-1] == '1':
    ans = 1
else:
    for i in range(len(S)):
        if S[i] != '1':
            ans = int(S[i])
            break
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

answer = S[1]
print(answer)

Submission status: Runtime Error

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

if n.count("1") == len(k):
  print(1)
  exit()

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
def resolve():
    s = input()
    k = int(input())
    cnt = -1
    for i in range(len(s)):
        if s[i] != '1':
            break
        cnt = i + 1
    if cnt > k:
        print(1)
    else:
        print(s[cnt] if cnt > -1 else s[0])

if __name__ == '__main__':
    resolve()

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
s = input()
print(1 if s.startswith("1"*int(input())) else s.replace("1","")[0])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
s = list(input())
k = int(input())
flag = False
for i in range(k):
    if s[i]!='1':
        ans = s[i]
        break
    else:
        continue
        
    if i==k-1:
        flag = True
print(1 if flag==True else ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

s = ns()
k = ni()
i = 0
while True:
    if s[i] == '1':
        i += 1
    else:
        break

if k <= i:
    ans = 1
else:
    ans = int(s[i])

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
S = input()
K = int(input())
for i in range(len(S)):
    if K>int(math.log10(int(S[i]))*(10**15*5))+1:
        K -= int(math.log10(int(S[i]))*(10**15*5))+1
    elif 0<K<int(math.log10(int(S[i]))*(10**15*5))+1:
        Answer = S[i]
        break

print(Answer)

Submission status: Runtime Error

Solution code:
import sys
S = input()
K = int(input())
result = [0,0]
for i in len(s):
  if S[i] != 1:
    result[0] = i+1
    result[1] = S[i]
print(1 if K<result[0] else result[1] )

Submission status: Runtime Error

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

if s[0] != '1':
    print(s[0])
    exit()
else:
    pos = re.search(r'1+',s).end()
    if k < pos:
        print(1)
    else:
        print(s[pos])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
print(input().replace("1","")[0])

Submission status: Runtime Error

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

for i in range(K):
    if S[i] != '1':
        ans = s
        break
    else:
        ans = 1
        continue
print(ans)

Submission status: Runtime Error

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

for s in S:
    if s != '1':
        ans = s
        break
    else:
        continue
print(ans)

Submission status: Runtime Error

Solution code:
s = str(input())
S = [int(s[i]) for i in range(len(s))]
K = int(input())
ans = 1
count = 0
for i in range(K):
    if S[i] != 1 and count == 0:
        ans = S[i]
        count += 1
print(ans)

Submission status: Runtime Error

Solution code:
s = str(input())
S = [int(s[i]) for i in range(len(s))]
K = int(input())
ans = 1
for i in S:
    if S[i] != 1:
        ans = S[i]
        break
print(ans)

Submission status: Runtime Error

Solution code:
s = str(input())
S = [int(s[i]) for i in range(len(s))]
K = int(input())
ans = 1
for i in S:
    if S[i] != 1:
        print(S[i])
        break

Submission status: Runtime Error

Solution code:


import collections


def solve():

    S = list(input())
    K = int(input())

    passed = 5000000000000000

    if K < passed:
        if S[0] != "1":
            print(S[0])
        else:
            print(S[1])
        exit()

    for s in S:
        if K < int(s) * passed:
            print(s)
            break
        K = K - (int(s) * passed)


if __name__ == "__main__":
    solve()

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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=list(0:K)
    S=''.join(ss)

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input().strip()
k = int(input())
for i, c in enumerate(S, 1):
  if c != '1' or i == k:
print(c)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
if S[0] != "1":
    print(S[0])
else:
    ind = 1
    while S[ind] == "1" and ind < len(S) - 1:
        ind += 1
    if ind < K:
        print(S[ind])
    else:
        print("1")

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
if S[0] != "1":
    print(S[0])
else:
    ind = 1
    while S[ind] == "1" and ind < len(S) - 1:
        ind += 1
    print(S[ind])

Submission status: Runtime Error

Solution code:
def To_Infinity(s , k):

    ans = ""

    s1 = s.lstrip("1")

    if k - (len(s) - len(s1)) >= 0:
        ans = s1[0]
    else:
        ans = "1"

    return ans
def main():
    s = str(input())
    k = int(input())
    print(To_Infinity(s , k))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def To_Infinity(s , k):

    ans = 0

    if s[0] == 1:
        if k == 1:
            ans = 1
        else:
            ans = s[1]
    else:
        ans = s[0]

    return ans
def main():
    s = list(int(input()))
    k = int(input())
    print(To_Infinity(s , k))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def resolve():
    S = input()
    K = int(input())
    cnt = 0
    
    for s in S:
        if s != "1":
            break
        cnt += 1
    if cnt > K:
        print("1")
    else:
        print(S[cnt])


if '__main__' == __name__:
    resolve()

Submission status: Runtime Error

Solution code:
a = input()
k = int(input())
b = list(a)
if k == 1:
    print(b[0])
else:
    for i in range(100):
        if int(b[i]) != 1:
            print(b[i])
            break

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
n=len(a)
j=0
k=0
for i in range(n):
    while j<n and b[j]<=a[i]:
        j+=1
    while k<n and c[k]<=b[j]:
        k+=1

Submission status: Runtime Error

Solution code:
S = input()
if S[0] == '1':
  print(S[1])
else:
  print(S[0])

Submission status: Runtime Error

Solution code:
#--------------------------------------------
#ライブラリ呼び出し
import sys
import math
#--------------------------------------------
S = input()
K = int(input())
count=0
for i in S:
    if i == "1":
        count += 1 
    else:
        notone_time = count
        notone = i 
        break

if K < notone_time:
    print(1) 
else: 
    print(i)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
if set(S) == "1":
    print(1)
elif S[0] == "1" and K > 1:
    ind = 1
    while S[ind] == "1":
        ind += 1
    print(S[ind])
else:
    print(S[0])

Submission status: Runtime Error

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

for i in range(len(S)):
    if S[i] != '1':
        print(int(S[i]))
        break
    else:
        if i == N - 1:
            print(1)
            break
        else:
            continue

Submission status: Runtime Error

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

for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        break
    else:
        if i == N - 1:
            print(1)
            break
        else:
            continue

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
if S[0] == "1" and K > 1:
    ind = 1
    while S[ind] == "1":
        ind += 1
    print(S[ind])
else:
    print(S[0])

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
if S[0] == "1":
    ind = 1
    while S[ind] == "1":
        ind += 1
    print(S[ind])
else:
    print(S[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

s = input()
n = int(input())

i = 0
while s[i] == '1':
    i += 1

if n <= i:
    print(1)
else:
    print(s[i])

Submission status: Runtime Error

Solution code:
S=input()
K=int(input())
cnt=0
i=0
while S[i]=='1':
  cnt+=1
  i+=1
if cnt>K:
  ans=1
else:
  ans=S[cnt]
print(ans)

Submission status: Runtime Error

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

if len(s)==1:
    print(int(s))
    exit()

new = ''
for i in len(k):
    if s[i]!='1':
        flag = False
        new += i

if flag:
    print(1)
else:
    print(new[0])

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
lc1 = -1
while S[lc1 + 1] == '1':
    lc1 += 1

if lc1 == -1:
    print(S[0])
else:
    print("1" if lc1 + 1 >= K else S[lc1 + 1])

Submission status: Runtime Error

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    S = input()
    K = int(input())
    if S[K-1] == '1':
        print('1')
    for i in list(S):
        if i != '1':
            print(i)
            exit()
    print('1')

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
S=input()
K=float(input())
lis=list(S)
ss=set(lis)

if len(ss)==1:
  print(S[0])
else:
  if K<=len(S):
    check_list=lis[:K]
    check_set=set(check_list)
    if len(check_set)==1:
      print(check_list[0])
    else:
      for num in lis:
        if int(num)!=1:
          print(int(num))
        break            
  else:
    for num in lis:
      if int(num)!=1:
        print(int(num))
        break

Submission status: Runtime Error

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

if len(set(s)) == 1 and set(s)[0] == set(['1']):
  print(1)
else:
  for elem in s:
    if int(elem) == 1:
      pass
    else:
      print(elem)
      break

Submission status: Runtime Error

Solution code:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    S = input().strip()
    n = int(input().strip()) - 1
    m=0
    for i in range(len(S)):
        if S[i] != '1':
            m = i
            s = S[i]
            break
    if n < m:
        print("1")
        return
    else:
        print(s)
        return


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    S = input().strip()
    n = int(input().strip())
    for i in range(len(S)):
        if S[i]!='1':
            m=i
            s=S[i]
            break
    if n<m:
        print("1")
        return
    else:
        print(s)
        return


    


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

count = 0
while True:
    if S[count] == "1":
        count += 1
    else:
        break

if K > count:
    print(S[count])
else:
    print(1)

Submission status: Runtime Error

Solution code:
import sys
S = input()
K = int(input())
if len(S) == 1:
  print(S)
  sys.exit(0)
if K == 1:
  print(S[0])
i = 0
while i<len(S):
  if S[i] == '1':
  	i += 1
  else:
    break
keep = S[i]
if K <= i:
  print(1)
  sys.exit(0)
else:
  if S[0] != '1':
    print(S[0])
  else:
	  print(keep)

Submission status: Runtime Error

Solution code:
x=input()
x=list(x)
t=0
k=0
while t==0:
	if x[k]!="1":
		t=x[k]
	k=k+1
print(t)

Submission status: Runtime Error

Solution code:
x=input()
x=list(x)
t=0
k=0
while t==0:
	if x[k]!="1":
		t=x[k]
	k=k+1
t=int(t)
print(t)

Submission status: Runtime Error

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

if int(S[0]) > 1:
  ans = S[0]
elif K>=100:
  for i in range(len(S)):
    if int(S[i]) > 1:
      ans = S[i]
      break
    elif i==S-1:
      ans = 1
else:
  for i in range(len(S)):
    if int(S[i]) > 1:
      if i+1 <= K:
        ans = S[i]
        break
      else:
        ans = 1
        break
    elif i==S-1:
      ans = 1
print(ans)

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=str(input())
n = int(input())
for i in range(n):
    if s[i] != "1":
        print(int(s[i]))
        break
	else:
    	print("1")

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
lengh = 0
ans = '1'
for i in list(s):
    if i != '1':
        ans = i
        break
if k <= len(s) and s[k-1] == '1': ans = s['k-1']
print(ans)

Submission status: Runtime Error

Solution code:
S=list(input())
K=int(input())
c=[]
d=[]
if K==1:
  print(S[0])
  exit()
for i in range(len(S)):
  if S[i]!='1':
    c.append(S[i])
    d.append(i)
    break
if K>=d[0]+1:
  print(int(c[0]))
else:
  print(1)

Submission status: Runtime Error

Solution code:
S=list(input())
K=int(input())
c=[]
d=[]
for i in range(len(S)):
  if S[i]!='1':
    c.append(S[i])
    d.append(i)
    break
if K>=d[0]+1:
  print(int(c[0]))
else:
  print(1)

Submission status: Runtime Error

Solution code:
s = input()
_ = int(input())
print(s[1]) if s[0] == "1" else print(s[0])

Submission status: Runtime Error

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

if all(s[i]=="1" for i in range(min(len(s),k))):
    print(1)
else:
    while s[0]=="1":
        s.pop(0)
    print(s[0])

Submission status: Runtime Error

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

if len(s)>k and all(s[i]=="1" for i in range(k)):
    print(1)
else:
    while s[0]=="1":
        s.pop(0)
    print(s[0])

Submission status: Runtime Error

Solution code:
s =input()
n = len(s)+1
k = int(input())

for i in range(n):
    if s[i] == '1':
        continue
    else:
        print(int(s[i]))
        break
else:
    print(1)

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
for i in range(len(s)):
        if s[i] != "1":
                not1=i
                break
if k > not1:
        print(s[not1])
else:
        print(1)

Submission status: Runtime Error

Solution code:
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations
    #from itertools import accumulate, product, permutations
    from math import floor, ceil

    #mod = 1000000007

    s = input()
    k = int(input())
    n = 0
    while n<=k:
        if not s[n]=='1':
            print(s[n])
            exit()
        else:
            n += 1
    print('1')


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations
    #from itertools import accumulate, product, permutations
    from math import floor, ceil

    #mod = 1000000007

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

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys
import itertools
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = readline().decode().strip()
K = int(readline())
cnt = 0
tmp = 0

for i in N:
    if i == '1':
        cnt += 1
        continue
    else:
        tmp = i
        break
ans = N[tmp-1] if K <= cnt else tmp

print(ans)

Submission status: Runtime Error

Solution code:
s = input()

k = int(input())

ichi = -1
for i in s:
    if int(i) == 1:
        ichi = ichi +1
    else:
        break



if ichi >= k:
    print(1)
else:
    print(s[ichi+1])

Submission status: Runtime Error

Solution code:
import math

s=input()
k=int(input())

ss=[]
cont0=0
cont1=0
for i in range(len(s)):
    if s[i]!="1":
        ss.append(int(s[i]))
    else:
        if len(ss)==0:
            cont0=cont0+1
        else:
            cont1=cont1+1
        
k=k-cont0
logk=math.log10(k)
    
n=5000*10000**3

if len(ss)==0:
    print(1)
else:
    logketa=n*math.log10(ss[0])
    if logketa>logk:
        print(ss[0])
    else:
        print(ss[1])

Submission status: Runtime Error

Solution code:
import math

s=input()
k=int(input())

logk=math.log10(k)

ss=[]
for i in range(len(s)):
    if s[i]!="1":
        ss.append(int(s[i]))
    
n=5000*10000**3

logketa=n*math.log10(ss[0])
if logketa>logk:
    print(ss[0])
else:
    print(ss[1])

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
OK = True
for i in range(K):
    if S[i] != '1':
        OK = False
if OK:
    print('1')
    exit()
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()

Submission status: Runtime Error

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

print(list(filter(lambda c: c != '1', list(s)))[0])

Submission status: Runtime Error

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

for i in range(len(S)):
    num = int(S[i])
    if (num != 1):
        num = i
        break

if (S[0] == '1'):
    ans = S[num]
else:
    ans = S[0]

print(ans)

Submission status: Runtime Error

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

for i in range(len(s)):
    if s[i] != "1" and i + 1 < k:
        print(s[i])
        sys.exit(0)
print(1)

Submission status: Runtime Error

Solution code:
S=input()
K=int(input())
tmp = 0
for i in S:
    if i=='1':
        tmp += 1
    else:
        break
if K >= tmp:
    print(1)
else:
    print(S[tmp])

Submission status: Runtime Error

Solution code:
#106_C
S=input()
K=int(input())
for i in range(len(S)):
    if S[i]!='1':
        ans=i
        break

print('1' if K<=ans else S[ans])

Submission status: Runtime Error

Solution code:
#106_C
S=input()
K=int(input())
for i in range(len(S)):
    if S[i]!='1':
        ans=i
        break
print(ans)
print('1' if K<=ans else S[ans])

Submission status: Runtime Error

Solution code:
#106_C
S=input()
K=int(input())
for i in range(len(S)):
    if S[i]!='1':
        ans=i
        break

print(1 if K<=ans else S[ans])

Submission status: Runtime Error

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

cnt=0 #1の個数
i=0
while True:
    if s[i]!='1': break
    else:
        cnt+=1
        i+=1
        
print(1 if k<=cnt else s[cnt])

Submission status: Runtime Error

Solution code:
s=input()[:int(input())].replace('1','')
print([s[0],1][s==''])

Submission status: Runtime Error

Solution code:
print(input()[:int(input())].replace('1','')[0]or 1)

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
i = 0
while s[i] == "1":
    i += 1
print(s[i])