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:
import sys

sys.setrecursionlimit(10 ** 6)


def input(): return sys.stdin.readline().rstrip()


S = input()
K = int(input())
if all(c == '1' for c in S[:K]):
    print(1)
else:
    print(list(c for c in S if c != '1')[0])

Submission status: Accepted

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

def check(i):
    global k
    global s
    
    if i==k-1:
        print(s[i])
    elif s[i]!="1":
        print(s[i])
    else:
        check(i+1)
check(0)

Submission status: Accepted

Solution code:
line = input()
N = int(input())
for i in range(len(line)):
  if not line[i] == '1':
    print(line[i])
    break
  elif i+1 == N:
    print("1")
    break

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())
k = int(input())
ans=0
m=0
for x in s:
  if(int(x)==1):
    m+=1
    continue
  else:
    ans=int(x)
    break

if m<k:
  print(ans)
else:
  print(1)

Submission status: Accepted

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

one = 0

for i in S:
    if i != '1':
        c = i
        break
    else:
        one += 1

if K <= one:
    print(1)
else:
    print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
S = input()
K = int(input())
N = min(K,len(S))
for i in range(N):
    if S[i] != '1':
        print(S[i])
        sys.exit()
print('1')

Submission status: Accepted

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

Submission status: Accepted

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

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

print(1)

Submission status: Accepted

Solution code:
s = input()
k = int(input())
l = len(s)
pos = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

s, k = sys.stdin.read().split()
k = int(k)

def main():
    for i in range(min(k, len(s))):
        if s[i] != '1':
            print(s[i])
            return
    print(1)

if __name__ ==  '__main__':
    main()

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    s = input()
    k = int(input())

    ichi = 0
    for i in range(len(s)):
        if s[i] == '1':
            ichi += 1
        else:
            break
    if ichi >= k:
        print(1)
    else:
        print(s[ichi])



if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
s = input()
k = int(input())
num = 0
for i in s:
    if i == "1":
        num +=1
        if num == k:
            print(1)
            exit()
    else:
        print(i)
        exit()

Submission status: Accepted

Solution code:
from itertools import groupby
n = list(input())
k = int(input())
if n == 1:
    print(1)
    exit()
li = []
for key,v in groupby(n):
    li.append(list(v))

if li[0][0] == "1":
    if len(li[0])>= k:
        print(1)
        exit()

for i in range(len(n)):
    if n[i] != "1":
        print(n[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:
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 i < len(s):
    if s[i] == '1':
        i += 1
    else:
        ans = int(s[i])
        break

if k <= i:
    ans = 1

print(ans)

Submission status: Accepted

Solution code:
s = input()
n = int(input())
k = 0
for i in s:
    if i == "1":
        k += 1
    else:
        break
for i in s:
    if n <= k:
        print(i)
        exit()
    else:
        if i == "1":
            continue
        else:
            print(i)
            exit()

Submission status: Accepted

Solution code:
s=input()
n=int(input())
l=[]
for x in s:
    l.append(x)
    if x!="1":break
print(l[min(len(l)-1,n-1)])

Submission status: Accepted

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

for i, s in enumerate(S):
    if s != '1':
        print(s)
        break
    if i + 1 == K:
        print('1')
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    k=int(input())
    for i in range(min(100,k)):
        if s[i]!='1':
            print(s[i])
            break
    else:print(1)

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
k = int(input())
cnt1 = 0
for i in range(k):
    if s[i] == '1':
        cnt1+=1
    else:
        not1ind = i
        break
if cnt1 >= k:
    print(1)
else:
    print(s[not1ind])

Submission status: Accepted

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

cnt = 0
tmp = 0
for i in range(K):
    if S[i] == '1':
        cnt += 1
    else:
        tmp = S[i]
        break
if K <= cnt:
    print(1)
else:
    print(tmp)

Submission status: Accepted

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

sum1 = 0
for i in s:
    if(int(i) == 1):
        sum1 += 1
    else:
        ans = int(i)
        break

if(sum1 >= k):
    print("1")
else:
    print(ans)

Submission status: Accepted

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

Solution code:
def main():
  from itertools import groupby
  s, n = list(input()), int(input())
  f = False
  for k,v in groupby(s):
    if f:
      print(k)
      break
    if k == '1' and len(list(v)) >= n:
      print(1)
      break
    elif k != '1':
      print(k)
      break
    else:
      f = True

if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
def main():
  s, k = input(), int(input())
  
  count_1 = 0
  tmp = ''
  for l in s:
    if l == '1':
      count_1 += 1
    else:
      tmp = l
      break
  if count_1 < k:
    ans = tmp
  else:
    ans = 1
    
  print(ans)

if __name__ == '__main__':
  main()

Submission status: Accepted

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

T = "N"
for i in range(len(S)):
  if S[i] != "1":
    T = "Y"
    k = i+1
    x = int(S[i])
    break
if T == "N":
  print(1)
else:
  if K < k:
    print(1)
  else:
    print(x)

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 = 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 = list(str(input()))
k = int(input())
ans = '1'

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

Submission status: Accepted

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

ans = '1'
k = 0
for s in S:
    if s == '1':
        k += 1
        if k >= K:
            ans = '1'
            break
    else:
        ans = s
        break

print(ans)

Submission status: Accepted

Solution code:
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = list(map(int, iss()))
    K = ii()

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:


import collections


def solve():

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

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


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

i = 0
p = 0
for i in range(len(s)):
    s[i] = int(s[i])
i = 0
while  i < len(s):
    if s[i] == 1:
        p = i + 1
    else:
        q = s[i]
        break
    i = i+1
if K < p + 1:
    print(1)
else:
    print(q)

Submission status: Accepted

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

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

Submission status: Accepted

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(min(len(S),K)):
    if S[i] != 1 and count == 0:
        ans = S[i]
        count += 1
        break
print(ans)

Submission status: Accepted

Solution code:


import collections


def solve():

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

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


if __name__ == "__main__":
    solve()

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:

from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from functools import reduce

from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n = input()
  k = int(input())
  l = len(n)
  for i in range(min(k,l)):
    if n[i] == '1':
      ans = '1'
    else:
      ans = n[i]
      break
  print(ans)
  
  
  
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
s=list(input())
k=int(input())
tmp=0
for i in s:
    ans=i
    if ans!="1":
        break
    else:
        tmp+=1
if tmp>=k:
    print("1")
else:
    print(ans)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc106/tasks/abc106_c

s = list(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_list = list(input())
k = int(input())
for s in s_list[:k]:
    if s != "1":
        print(s)
        exit()
print(1)

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False



s = STR()
k = INT()
tmp = 0
for i in range(len(s)):
    if s[i] != '1':
        tmp = i
        break
debug(tmp)
if tmp > k - 1:
    print(1)
else:
    print(s[tmp])

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 = input()
k = int(input())
cnt = 0
x = 0
for i in s:
    if i == "1":
        cnt += 1
    else:
        x = int(i)
        break
if k<=cnt:
    print(1)
else:
    print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = input()
k = int(input())
count = 1
for i in a:
  if i != "1":
    break
  count += 1
if k >= count:
  print(a[count-1])
else:
  print("1")

Submission status: Accepted

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

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

 
for i in range(0,K):
    if S[i] == "1":
        pass
    else:
        print(S[i])
        sys.exit()
print("1")

Submission status: Accepted

Solution code:
n = input()
k = int(input())
count = 0
flag = True 
while n[count] == '1':
    if count == k - 1:
        print('1')
        flag = False
        break
    count += 1
if flag:
    print(n[count])

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:
import sys
input = sys.stdin.readline
s = list(input())[:-1]
k = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
n = 0
while n < len(s) and n < k:
    if s[n] != '1':
        print(s[n])
        break
    n += 1
else:
    print('1')

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 = input()
K = int(input())

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

Submission status: Accepted

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

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Accepted

Solution code:
S = list(input())
K = int(input())
for i in S:
    if i != "1":
        break
i = S.index(i)
if K <= i:
    print(1)
else:
    print(S[i])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
K = int(input())
if len(S) == 1:
  print(S)  
else:
  if S[:K].count('1') == K:
    print(1)
  else:
    print(list(filter(lambda x: x!= '1', S))[0])

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans,pt = "1",0
for i in range(len(S)):
    if S[i] != "1":
        ans,pt = S[i],i
        break

if pt < K:
    print(ans)
else:
    print(1)

Submission status: Accepted

Solution code:
import sys
s = list(input())
k = int(input())
if len(s) == 1:
    print(s[0])
elif k == 1:
    print(s[0])
else:
    for i in range(k):
        if s[i] != "1":
            print(s[i])
            sys.exit()
    print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
5*10**15
S=input()
K=int(input())
if set(list(S[:K]))=={'1'}:
    print('1')
else:
    for i in range(len(S)):
        if S[i]!='1':
            print(S[i])
            break

Submission status: Accepted

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

count=0

for s in S:
    if int(s)==1:
        count+=1
        if count>=K:
            print(s)
            break
    else:
        print(s)
        break

Submission status: Accepted

Solution code:
s=list(input())
k=int(input())
cnt=0
ans=0
flag=0
for i in s:
    if i =="1":
        cnt+=1
        continue
    else:
        if cnt<k:
            print(i)
        else:
            print("1")
        flag+=1
        break
if flag==0:
    print("1")

Submission status: Accepted

Solution code:
s = str(input())
k = int(input())
if k <= len(s) and s[:k] == '1' * k:
  ans = 1
else:
  ans = s.replace('1', '')[0]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
c = 5*pow(10, 14)
list_N = list(input())
k = int(input())
cnt = 0
ans = 0

for i in list_N:
    i = int(i)
    if i != 1:
        ans = i
        break
    else:
        cnt += 1
        if cnt == k:
            ans = 1
            break

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

for i, s in enumerate(S, 1):
  if s != '1':
    print(s)
    quit()
  elif i >= K:
    print(s)
    quit()

Submission status: Accepted

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

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

if k < idx:
    print(1)
else:
    print(res)

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 

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

    all1flg = True
    for i in range(min(len(S), K-1)):
        if S[i]!='1':
            ans = S[i]
            all1flg = False
            break
    if all1flg:
        print(S[K-1])
    else:
        print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(S)):
  si=int(S[i])
  if si>1:
    print(si)
    break
  elif i==K-1:
    print(si)
    break

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())
flag = False
 
for i in range(min(len(s), k)):
    if s[i] != '1':
        ans = int(s[i])
        flag = True
        break
if flag == True:
    print(ans)
else:
    print(1)

Submission status: Accepted

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 == K - 1:
            print(1)
            break
        else:
            continue

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if s[0] != "1":
    print(s[0])
else:
    flag = True
    for i in range(min(len(s),k)):
        if s[i] != "1":
            print(s[i])
            flag = False
            break
    if flag:
        print(1)

Submission status: Accepted

Solution code:
#!python3

# input
S = input()
K = int(input())


def main():
    n = 1
    for s in S:
        if s != '1':
            print(int(s))
            return
        if n == K:
            print(1)
            return
        n += 1


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()
k = int(input())
flag = False
 
for i in range(min(len(s), k)):
    if s[i] != '1':
        ans = int(s[i])
        flag = True
        break

if flag == True:
    print(ans)
else:
    print(1)

Submission status: Accepted

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

if "1" not in s[:k]:
	print (s[0])
	exit()
first = "1"
t = 0
for i in range(len(s)):
	if s[i] != "1":
		first = s[i]
		break
	else:
		t += 1
if k <= t:
	print ("1")
else:
	print (first)

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	s=input()
	k=int(input())
	for c in list(s)[:k]:
		if c != '1':
			print(c)
			return 
	print('1')
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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()
n = int(input())

i = 0
while i != len(s) and s[i] == '1':
    i += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys

sys.setrecursionlimit(10 ** 5 + 10)


# input = sys.stdin.readline

def resolve():
    S = input()
    s = [int(c) for c in S]
    K = int(input())

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


resolve()

Submission status: Accepted

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

Submission status: Accepted

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

t=0
ans=1

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

if k>=t:
    print(ans)
else:
    print("1")

Submission status: Accepted

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

for i in range(min(len(s),k)):
#「Sの長さ」と「K」の少ない方の回数分ループを回す
    if s[i] != '1':#Kまで１が続かなかったら
        print(s[i])#最初に出てきた１以外の数が出力される
        exit()#ループを抜けて終了

print('1')#Kまで１が続けば、１が出力される

Submission status: Accepted

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

for i in range(min(len(s), k)):
    if s[i] != '1':
        ans = int(s[i])
        flag = True
        break

if flag:
    print(ans)
else:
    print(1)

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    S=readline().strip()
    K=int(readline())

    count1=0
    for i in range(len(S)):
        if S[i]=="1": count1+=1
        else: break

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

if __name__=="__main__":
    main()

Submission status: Accepted

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

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