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: Accepted

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

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

print(1)

Submission status: Accepted

Solution code:
# coding: utf-8
s = input()
k = int(input())

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

print(1)

Submission status: Accepted

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

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

Submission status: Accepted

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

# 2の5000兆乗はlog10をとると5000兆*log_10(2)となり明らかに10**18より大きいと分かる
# よってSを左から見て1以外の数値がK番目以内にあればそれが答え。そうでなければ1が答え

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

Submission status: Accepted

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

# 2の5000兆乗はlog10をとると5000*log_10(2) ~ 1500となり明らかに10**18より大きいと分かる
# よってSを左から見て1以外の数値がK番目以内にあればそれが答え。そうでなければ1が答え

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

Submission status: Accepted

Solution code:
S = '0' + input()
K = int(input())
days = 5*(10**13)
idx1 = 1
idx2 = 0
while idx2 < K:
  ans = S[idx1]
  if int(S[idx1]) == 1:
    idx2 += 1
  else:
    tmp_idx = int(S[idx1])
    tmp_cnt = 1 
    while tmp_idx + idx2 < K and tmp_cnt <= days:
      tmp_idx *= int(S[idx1])
      tmp_cnt += 1
      #print(tmp_idx + idx2 , tmp_cnt)
    
    if tmp_cnt == days:
      print(S[idx1])
      eixt()
    else:
      idx2 += tmp_idx
  idx1 += 1
  #print(idx1,idx2)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    k = int(input().rstrip('\n'))
    cnt = 0
    for i in range(len(s)):
        if s[i] == "1":
            cnt += 1
        else:
            break
    print(1 if cnt >= k else s[cnt])


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
# coding: utf-8

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

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

Submission status: Accepted

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

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

if ct > k:
    print(1)
else:
    print(s[ct-1])

Submission status: Accepted

Solution code:

def solve(s, k):
    for si in s:
        if k == 1:
            return si
        elif si == '1':
            k -= 1
        else:
            return si


if __name__ == "__main__":
    s = input()
    k = int(input())
    print(solve(s, k))

Submission status: Accepted

Solution code:
S = str(input())
K = int(input())
N = len(S)
x = 1
i = 0
while int(x) == 1:
  x = S[i]
  #print(x)
  i += 1
  if (i == N) & (int(x) == 1):
    x = -1
i -= 1#while文を抜けるときに余計に+1されてるので、元に戻す

x = int(x)    
if x == -1:
  print(1)
  quit()
  
if i >= K:
  print(1)
else:
  print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S= input()
K = INT()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

    for c in s:
        if c == '1':
            k -= 1
            if k == 0:
                return c
        else:
            return c


if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
s = input()
k =int(input())
res = 1
for i in range(k):
    if s[i] != "1":
        res = s[i]
        break

print(res)

Submission status: Accepted

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

start = float('inf')
for i in range(len(s)):
    if s[i] != '1':
        start = i +1
        num = s[i]
        break
if k <start:
    print(1)
    exit()
else:
    print(num)
    exit()

Submission status: Accepted

Solution code:
S = input()
K = int(input())
for i in range(min(len(S),K)):
  if int(S[i]) >= 2:
    print(S[i])
    exit()
print(1)

Submission status: Accepted

Solution code:
S = input()
K = int(input())
key = []
if S.count("1") == len(S):
  print(1)
else:
  for i in range(len(S)):
    if S[i] != "1":
      key.append([i,S[i]])
      break
  if K - 1 < key[0][0]:
    print(1)
  else:
    print(key[0][1])

Submission status: Accepted

Solution code:
s  = list(map(int, input()))
k = int(input())
#print(s)
for i in range(len(s)):
    if s[i]!=1:
        print(s[i])
        exit()
    else:
        if k==i+1:
            print(1)
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s, k = input(), int(input())
cnt=0
for i in s:
  if i!="1":ans=i;break
  cnt+=1
if cnt>=k: ans=1
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))


s = input()
k = inp()
n = min(len(s), k)
for i in range(n):
    if s[i] != '1':
        print(s[i])
        break
else:
    print(1)

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s=input()
k=int(input())
count=0
for i in s:
    if i=='1':
        count+=1
    else:
        ans=i
        break
if k<=count:
    print(1)
else:
    print(ans)

Submission status: Accepted

Solution code:
s = [int(_) for _ in input()]

k = int(input())

ans = 1
for i in range(k):
    if s[i] != 1:
        ans = s[i]
        break

print(ans)

Submission status: Accepted

Solution code:
def test():
    s = input()
    k = int(input())
    n = len(s)
    if n == 1:
        print(int(s))
        return
    else:
        if all(int(s[i])==1 for i in range(k)):
            print(1)
            return
        else:
            for i in range(k):
                if int(s[i]) != 1:
                    print(int(s[i]))
                    return


if __name__ == "__main__":
    test()

Submission status: Accepted

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

cnt1 = 0
last = ''
for s in S:
    if s == '1':
        cnt1 += 1
    else:
        last = s
        break

if K <= 100 and cnt1 >= K:
    print('1')
else:
    print(last)

Submission status: Accepted

Solution code:
s=list(x for x in input())
k=int(input())
for i in range(len(s)):
  if k > i+1:
    if s[i] != '1':
      print(s[i])
      break
    else:
      continue
  elif k == i+1:
    print(s[i])
    break

Submission status: Accepted

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

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

Submission status: Accepted

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

i=0
while i<K:
  if S[i]=='1':
    i+=1
  else:
    print(S[i])
    exit()

print(1)

Submission status: Accepted

Solution code:
# print('input >>')
S = input()
K = int(input())

s_left = '1'
num_1 = 0

for s in S:
    if s == '1':
        num_1 += 1
    else:
        s_left = s
        break

if K <= num_1:
    ans = '1'
else:
    ans = s_left

# print('----------output----------')
print(ans)

Submission status: Accepted

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

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

elif s[0] == "1" and k != 1:
    if len(s) < k:
        for i in s:
            if int(i) != 1:
                print(int(i))
                break

    else:
        for l in range(0, k):
            if int(s[l]) != 1:
                print(int(s[l]))
                break

            if l == k - 1:
                print(1)

elif s[0] == "1" and k == 1:
    print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(map(int,input()))
K = int(input())
a = []
for i in range(len(S)):
    a.append(S[i])
    if S[i] != 1:
        break
if K >= len(a):
    print(a[-1])
else: print(1)

Submission status: Accepted

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

Submission status: Accepted

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

S_set_under_K = set(S[:K])

if len(S) == 1:
    print(S)
elif len(S_set_under_K) == 1 and S_list[0] == 1:
    print(1)
else:
    for c in S:
        if c != "1":
            print(c)
            exit()

Submission status: Accepted

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

for i in range(min(len(S), K)):
    if S[i] > "1":
        print(S[i])
        exit()
print("1")

Submission status: Accepted

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

Submission status: Accepted

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

if K <= len(S):
    for i in range(K):
        if S[i] == '1':
            continue
        else:
            print(S[i])
            break
    else:
        print('1')
else:
    S = S.strip('1')
    print(S[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    K = int(input())
    for i in range(len(S)):
        if S[i] != '1':
            can = S[i]
            cannum = i + 1
            break
    print('1' if set(S) == {'1'} or K < cannum else can)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    S = input()
    K = int(input())
    N = len(S)
    for i in range(N):
        if S[i] != '1':
            can = S[i]
            cannum = i + 1
            break
    if set(S) == {'1'} or K < cannum:
        print(1)
    else:
        print(can)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

answer = 0
for i in S:
    i_int = int(i)
    t = K**(1/5000000000000000)
    if t <= i_int:
        answer = i_int
        break
    else:
        K = K - 1
print(answer)

Submission status: Accepted

Solution code:
s=input()
lists=[int(integer)for integer in s] 
nums=int(input())

numbers=0 
strong=0 
#sに位置が初め何個ついているのかをnumbers変数に代入する
#もしｓが1で始まらなかった場合、その初めの文字を出力して終了する
for j in lists:
    if lists[0]!=1:
        break
    else:
        if j==1:
            numbers+=1
        else:
            break
#startで場合分け            
if lists[0]==1:
    if numbers>=nums:
        print(1)
        
    elif numbers<nums:
        print(lists[numbers])
else:
    print(lists[0])

Submission status: Accepted

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

for i in s:
  if i == "1":
    k-=1
  else:
    print(i)
    exit()
  if k == 0:
    print(i)
    exit()

Submission status: Accepted

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

limit = n if n < k else k

ans = 1
for i in range(limit):
  if s[i] != "1":
    ans = s[i]
    break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ck = 0
for i in S:
  if i == '1':
    K -= 1
  else:
    print(i)
    exit()
  if K == 0:
    print(i)
    exit()

Submission status: Accepted

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

Submission status: Accepted

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

if(k == 1):
    print(n[0])
elif(len(n)==1):
    print(n)
elif(n[0]== '1'):
    i = 1
    while(n[i] == '1'):
        i += 1
        if(i == len(n)):
            break
    if(k <= i):
        print(1)
    else:
        print(n[i])
else:
    print(n[0])

Submission status: Accepted

Solution code:
N = list(input())
K = int(input())
for i in range(K) :
  a = int(N[i])
  if a!=1:
    print(a)
    exit()
print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
string = input()
pos = int(input())

while pos > 1 and (len(string) > 0 and string[0] == '1'):
  pos -= 1
  string = string[1:]
  
if len(string) == 0:
  print('1')
elif pos == 1:
  print(string[0])
elif string[0] == '1' and len(string) > 1:
  print(string[1])
else:
  print(string[0])

Submission status: Accepted

Solution code:
s = input()
k = int(input())
index = 0
c = s[0]
for i, a in enumerate(s):
  if a != '1':
    index = i
    c = s[i]
    break
if index < k:
  print(c)
else:
  print(1)

Submission status: Accepted

Solution code:
s=input()
k=int(input())
for i in s[:k]:
    if i=="1":continue
    else:print(i);exit()
print("1")

Submission status: Accepted

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

is_one = True
for i,c in enumerate(s[:k]):
  if c!='1':
    is_one = False
    break
    
if is_one:
  print(1)
else:
  print(int(s[i]))

Submission status: Accepted

Solution code:
s=input()
k=int(input())
for i in s[:k]:
    if i=="1":continue
    else:print(i);exit()
print(1)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

s = input().split() 
s = list(s[0])
s = list(map(int,s))

K = int(input())
cnt=0
for i in range(len(s)):
    if s[i]==1:
        cnt+=1
        if cnt==K:
            print(1)
            break
    else:
        print(s[i])
        break

Submission status: Accepted

Solution code:
# ABC106 C - To Infinity
s = input()
k = int(input())

idx = 0
last = 0
a11_one = True

for i in range(len(s)):
    if s[i:i+1] == '1':
        idx = i
    else:
        last = s[i:i+1]
        a11_one = False
        break
if k==1:
    print(s[0:1])
    exit()
if a11_one:
    print('1')
else:
    print('1' if k-1 <= idx else last)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
ans = []
ln = list(map(int, list(str(n))))
for i,name in enumerate(ln):
    ans.append(name)
    if name != 1:
        break

ans_len = len(ans)

print(ans[min((k-1), (ans_len - 1))])

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
S = [int(s) for s in input()]
K = int(input())
if set(S[:K]) == {1}:
    print(1)
else:
    for i in S:
        if i != 1:
            print(i)
            break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=list(input())
K=int(input())
one=0
for s in S:
  if int(s)==1:one+=1
  else:break
if K<=one:print(1)
else:print(s)

Submission status: Accepted

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

Submission status: Accepted

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

a = [int(c) for c in s]
for i in range(len(a)):
  if a[i] != 1:
    break
if k > i:
  print(a[i])
else:
  print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=input()
K=int(input())
i=0
for i in range(len(S)):
  if int(S[i])>1:
    c=i
    break
if K>i:
  print(int(S[i]))
else:
  print(1)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007



s = S()
k = I()

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


if  k > index >= 0:
    print(ans)
else:
    print(1)

Submission status: Accepted

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

count = 0
for i in range(min(len(s), k)):
    c = s[i]
    if c != '1':
        print(c)
        break
    else:
        count += 1
else:
    print('1')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

index = -1
r = -1
for i in range(len(S)):
    if index == -1:
        if S[i] == '1':
            index = i
            r = 1
            continue

    if index != -1 and r != 0:
        if S[i] == '1':
            r += 1
        else:
            break
if index == -1:
    print(S[0])
elif index != 0:
    print(S[0])
elif r >= N:
    print(1)
else:
    print(S[r])

Submission status: Accepted

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

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

print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import os, sys, re, math

def oneidx(S):
    idx = -1
    for s in S:
        if s == '1':
            idx += 1
        else:
            break
    return idx

S = input()
N = int(input()) - 1
idx = oneidx(S)

if idx >= N:
    print('1')
else:
    print(S[idx+1])

Submission status: Accepted

Solution code:
import sys

s = input()
k = int(input())
target = '1'

s2 = s[:k]

if all(c == '1' for c in s2):
    print(1)
    sys.exit()

# if len(s) >= k and all(s[i] == '1' for i in range(k-1)):
#     print(1)
#     sys.exit()

for c in s:
    if c != '1':
        target = c
        break

print(target)

Submission status: Accepted

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

for i, v in enumerate(s):
  if i + 1 == k or v > 1:
    print(v)
    break

Submission status: Accepted

Solution code:
n = input()
k = int(input())
for i in range(len(n)):
    if(n[i]=='1'):
        if k==i+1:
            print(1)
            break
    else:
        print(n[i])
        break

Submission status: Accepted

Solution code:
S = str(input())
K = int(input())
for i in range(0, K):
    if S[i] != "1":
        print(S[i])
        exit()
print(1)

Submission status: Accepted

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

    Slen = len(S)

    ans = 1
    for i in range(K):
        if i == Slen:
            break

        if S[i] != "1":
            ans = S[i]
            break

    print(ans)


if __name__ == '__main__':
    func()

Submission status: Accepted

Solution code:
s = input()
k = int(input())
flag = False
ret = 1
for i in s[0:k]:
    if (i != '1'):
        flag = True
        ret = i
        break
print (ret)

Submission status: Accepted

Solution code:
line = raw_input()
s = line
line = raw_input()
k = int(line)

ret = '1'
head = 0
for c in s:
    if c == '1':
        head += 1
        continue
    if head >= k:
        ret = '1'
    else:
        ret = c
    break    

print ret

Submission status: Accepted

Solution code:
import os, sys, re, math

lines = sys.stdin.readlines()

S = lines[0]
K = lines[1]

for i in range(len(S)):
    c = S[i]
    if i + 1 == int(K):
        print (c)
        break
    else:
        if c != '1':
            print (c)
            break

Submission status: Accepted

Solution code:
nums = input()
k = int(input()) - 1
for oneone in range(len(nums)):
    if nums[oneone] != '1':
        break
print(nums[k] if int(k) <= oneone else nums[oneone])

Submission status: Accepted

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

T = ""
for i in S:
    if i != "1":
        T += i
        break
    else:
        T += i
L = len(T)-1

if L >= K:
    print(1)
else:
    print(T[-1])

Submission status: Accepted

Solution code:
S=input()
k=int(input())
b=1
for s in S:
  if s!='1':
    a=s
    break
  elif b==k:
    a=s
    break
  else:
    b+=1
print(a)

Submission status: Accepted

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

for cnt, s_ in enumerate(s):
    if s_ == '1':
        if cnt+1 == k:
            print(1)
            break
    else:
        print(s_)
        break

Submission status: Accepted

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

c = "1"

for i in range(K):
  if S[i] != "1":
    c = S[i]
    break
print(c)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
text=input()
x=0
for i in range(len(text)):
  if text[i]=='1':
    x+=1
  else:
    y=text[i]
    break
K=int(input())
if K<=x:
  print('1')
else:
  print(y)

Submission status: Accepted

Solution code:
S = input()
K = int(input())
for i in range(K):
    if S[i] != "1":
        print(S[i])
        exit()
print("1")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
K = int(input())
c = "1"
for i in range(K):
  if S[i] != "1":
    c = S[i]
    break
print(c)

Submission status: Accepted

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

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

if k-1 < i:
    print(1)
else:
    print(s[i])

Submission status: Accepted

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

c = 0
for s in S:
    if s == "1":
        c += 1
    else:
        break

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

Submission status: Accepted

Solution code:
S = input()
K = int(input())
day = 5 * 10 ** 15

for i in S:
    if i == '1':
        K -= 1
        if K == 0:
            print(1)
            exit()
        else:
            continue
    else:
        print(i)
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


S =  sys.stdin.readline().rstrip()
K =  int(sys.stdin.readline())

L = min(len(S), K)
S = S[:L]

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

Submission status: Accepted

Solution code:
S = raw_input()
K = int(raw_input())
list_S = list(S)
for i in range(0,len(list_S)):
        if list_S[i] == "1":
                if i == (K-1):
                        del list_S[:]
                        list_S = ["1"]
                        break
        elif list_S[i] != "1":
                break

for i in range(0,len(list_S)):
        if list_S[i] != "1":
               print list_S[i]
               break
        if i == len(list_S)-1:
                print "1"

Submission status: Accepted

Solution code:
S = input()
K = int(input())
f = True
for i in range(K):
  if S[i] != "1":
    print(S[i])
    f = False
    break
if f:
  print(1)

Submission status: Accepted

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

pos1 = len(s)
for i, v in enumerate(s):
  if v != "1":
    pos1 = i
    break
  
if k < pos1 + 1:
  print(1)
else:
  print(s[pos1])

Submission status: Accepted

Solution code:
import sys
S = input()
k = int(input())
cnt1 = 0
for s in S:
  if s != '1':
    print(int(s))
    sys.exit()
  else:
    cnt1 += 1
    if cnt1 >= k:
      print(1)
      sys.exit()
    continue
print(S[-1])

Submission status: Accepted

Solution code:
def resolve():
    s = input()
    k = int(input())
    num_one = 0
    for i in range(len(s)):
        if s[i]=="1":
            num_one += 1
        else:
            left = s[i]
            break
    if k <= num_one:
        print("1")
    else:
        print(left)
        
resolve()

Submission status: Accepted

Solution code:
def main():
    s = input()
    K = int(input())

    for i in range(min(len(s), K)):
        if s[i] != "1" or i == K-1:
            print(s[i])
            break

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

s = input()
k = ni()
keta = 0
for i in range(len(s)):
    if s[i] == "1":
        continue
    else:
        keta = i
        break
if k < keta + 1:
    print("1")
else:
    print(s[keta])

Submission status: Accepted

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

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

print("1")

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

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

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

    else:
        print(S[i])
        exit()

Submission status: Accepted

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

for i, si in enumerate(s):
    if si > 1:
        break

if k <= i + 1:
    print(s[k - 1])
else:
    print(si)