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())
S=list(map(int,S))
K=int(input())

i=0
while i<K:
    if S[i]>1:
        ans=S[i]
        break
    else:
        ans=1
        i+=1
print(ans)

Submission status: Accepted

Solution code:
# For taking integer inputs.
import math


def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


a = input()
k = inp()
i = 0
while i < len(a) and a[i] == '1':
    i += 1

if i >= k:
    print(1)
elif len(a) == i:
    print(1)
else:
    print(a[i])

Submission status: Accepted

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

days = 5*10*15

for s in S:
    si = int(s)
    if si == 1:
        k -= 1
    else:
        k -= si**days

    if k <= 0:
        print(si)
        break

Submission status: Accepted

Solution code:
S=input()
K=int(input())
k=0
for s in S:
    k+=1
    if k==K:
        print(s)
        exit()
    if s!="1":
        print(s)
        break
else:
    print(1)

Submission status: Accepted

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

flag = 0

if(K<= len(lista)):
  for i in range(K):
    if(lista[i] != "1"):
      flag = 1
      ans = lista[i]
      break
  if(flag == 0):
    print(1)
  else:
    print(ans)

else:
  i = 0
  while True:
    if(lista[i] != "1"):
      print(lista[i])
      break
    i+= 1

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

    ans = 1
    for k in range(K):
        if S[k] != "1":
            ans = int(S[k])
            break

    print(ans)


if __name__ == "__main__":
    main()

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())
for i in range(min(len(S), K)):
  if(S[i] != '1' and S[i] != '0'):
    print(int(S[i]))
    exit()
print(1)

Submission status: Accepted

Solution code:
S = list(map(int, input()))
K = int(input())
if len(S) == 1:
    print(S[0])
    exit()

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

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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())

not_1_idx = -1
not_1_num = 1
for i, c in enumerate(S):
    if c != "1":
        not_1_idx = i
        not_1_num = c
        break
if not_1_idx >= 0:
    print(1) if K < not_1_idx + 1 else print(not_1_num)
else:
    print(not_1_num)

Submission status: Accepted

Solution code:
S = list(map(int, input()))
K = int(input())
count = 0
for a in S:
    if a == 1:
        count += 1
        if count == K:
            print(1)
            exit()
    else:
        print(a)
        exit()

Submission status: Accepted

Solution code:
s=input()
k=int(input())
cnt=0
for ss in s:
  if ss=='1':
    cnt+=1
  else:
    break
if cnt==0:
  print(s[0])
  exit()
if k<=cnt:
  print(1)
else:
  print(s[cnt])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
K = int(input())
n = 0
if K <= len(S) and all([s == '1' for s in S[:K]]):
  print('1')
else:
  for s in S:
    if s != '1':
      print(s)
      exit()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def I(): return int(sys.stdin.readline().rstrip())
def S(): return sys.stdin.readline().rstrip()
S,K = S(),I()
count_1 = 0
for x in S:
    if x=='1':
        count_1 += 1
    else:
        if K>count_1:
            print(x)
            break
else:
    print(1)

Submission status: Accepted

Solution code:
import sys
s = str(input())
n = int(input())
i = 0
while True:
    if int(s[i]) == 1:
        if (n-1) == i:
            print("1")
            sys.exit()
        else:
            i += 1
    else:
        print(s[i])
        sys.exit()

Submission status: Accepted

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

if len(s) >= k and s[:k] == '1'*k:
    print(1)
else:
    for i in s:
        if i != '1':
            print(i)
            exit()

Submission status: Accepted

Solution code:
def resolve():
	s = list(input())
	k = int(input())
	for i in range(len(s)):
		if int(s[i]) == 1:
			continue
		else:
			for j in range(i, len(s)):
				s[j] = s[i]
	if k < len(s):
		print(s[k-1])
		return
	print(s[-1])
resolve()

Submission status: Accepted

Solution code:
s = input()
n = int(input())
i = 0
while s[i]=="1":
    if n==i+1:
        print(1)
        exit()
    i+=1
    if i==len(s):
        break

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

Submission status: Accepted

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

if k <= 100:
  for i in range(k):
    coun += 1
    if s[i] != '1':
      print(s[i])
      exit()
    if coun == k:
      print(1)
      exit()
else:
  for i in range(k):
    coun += 1
    if s[i] != '1':
      print(s[i])
      exit()
    if coun == 100:
      print(1)
      exit()

Submission status: Accepted

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

if s[0] == '1' and len(s) == 1:
  print(1)
  exit()
elif s[0] != '1':
  print(s[0])
  exit()

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

Submission status: Accepted

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

Submission status: Accepted

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

# map(int, input().rstrip().split())

def VI(N, init=0):
  return [init for _ in range(N)]
def VVI(N, M, init=0):
  return [[init for _ in range(M)] for _ in range(N)]

def VD(N, init=0.0):
  return [init for _ in range(N)]
def VVD(N, M, init=0.0):
  return [[init for _ in range(M)] for _ in range(N)]

LINF = int(1e18+7)
S = input().rstrip()
K = int(input().rstrip())

tmp = LINF
ch = '1'
for i in range(len(S)):
  if S[i] != '1':
    tmp = i
    ch = S[i]
    break

if tmp >= K:
  print(1)
else:
  print(ch)

Submission status: Accepted

Solution code:
s=input()
k=int(input())
if s.count('1') == len(s):
  print(1)
else:
  count = 0
  for i in s:
    if i != '1':
      print(i)
      break
    else:
      count+=1
      if count == k:
        print(1)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()#1~100時
k=int(input())#sの5*10^16日後の k番目
for i in range(len(s)):
    if s[i]!="1":
        if i+1<=k:
            print(s[i])
            exit()
        else:
            print(1)
            exit()
print(1)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(1)

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors

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

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

S = S()
K = I()
n = len(S)
ind = 0
num = 1
for i in range(n):
  if S[i] != "1":
    ind = i
    num = S[i]
    break
if K>ind:
  P(num)
else:
  P(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:
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())
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())
ans=1
for i in range(K):
    if (S[i]!='1'):
        ans=S[i]
        break
print(ans)

Submission status: Accepted

Solution code:
s = list(input())

k = int(input())

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

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

Submission status: Accepted

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

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())
one = 0
for i in range(len(S)):
  tmp = S[i]
  if(tmp == "1"):
    one += 1
  else:
    ans = tmp
    if(one >= K):
      print("1")
      exit()
    else:
      print(str(ans))
      exit()
print("1")

Submission status: Accepted

Solution code:
ns = list(map(int,input()))
n = int(input())
cnt = 1
ans = 0

for i in range(len(ns)):
  if (ns[i] == 1 and n == cnt) or ns[i] != 1:
    ans = ns[i]
    break
  else:
    cnt += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
K = int(input())
flag = False
if set(S[:K]) == set(['1']):
    print(1)
else:
    for i in range(K):
        if S[i] != '1':
            print(S[i])
            break

Submission status: Accepted

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

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

i=0
while i<len(S) and i<K:
    if S[i]!="1":
        print(S[i])
        quit()
    i+=1

print(1)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

s = S()
k = I()
ans = 1
for i in range(k):
    if i < len(s) and 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
  if i == k-1:
    print(1)

Submission status: Accepted

Solution code:
from collections import deque
d = deque(list(input()))
k = int(input())

while len(d)!= 0:
    x = d.popleft()
    if x != '1':
        print(x)
        exit()
    else:
        k -= 1
        if k == 0:
            print(1)
            exit()

Submission status: Accepted

Solution code:
s = input()
k = int(input())
if s[0] != "1":
  print(s[0])
  quit()
c = 0
while s[c] == "1":
  c += 1
  if c == len(s):
    print(1)
    quit()
if c < k:
  print(s[c])
else:
  print(s[k-1])

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = np.array(list(sr()))
K = ir()
S = S[:K]
if np.all(S == '1'):
    answer = '1'
else:
    i = np.where(S != '1')[0][0]
    answer = S[i]

print(answer)

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
K = ir()
S = S[:K]
if len(set(S)) == 1 and S[0] == '1':
    answer = 1
else:
    for s in S:
        if s != '1':
            answer = s
            break

print(answer)

Submission status: Accepted

Solution code:
S = input()
K = int(input())
if S[:K].count('1') == K:
    print('1')
else:
    print(S.replace('1','')[0])

Submission status: Accepted

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

for i in range(min(len(s), k)):
    if int(s[i]) > 1:
        print(s[i])
        exit(0)

print(1)

Submission status: Accepted

Solution code:
# ABC 106 
S = input()
K = int(input())
limit=0
for i in range(len(S)):
    if S[i] !='1':
        limit =i
        break
if limit>=K:
    print(1)
else:
    print(S[limit])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
S = np.array(list(map(str, input().rstrip())))
K = int(input())

cnt = 0
ans = 1

for i, s in enumerate(S):
    if s != "1":
        cnt = i+1
        ans = s
        break

if cnt > K:
    print(1)
else:
    print(int(ans))

Submission status: Accepted

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

if cou >= k:
    print(1)
elif cou < k:
    print(p)

Submission status: Accepted

Solution code:
def main():
    S = input()
    K = int(input())
    one_seq = sum([int(c) for c in S[:min([K, len(S)])]])
    if one_seq == min([K, len(S)]):
        print(1)
    else:
        for c in S:
            if c != '1':
                print(c)
                return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(len(s)):
    if s[i]!="1":
        nextone=s[i]
        break
if s.count("1")==len(s):
    print(1)
elif i>=k:
    print(1)
else:
    print(nextone)

Submission status: Accepted

Solution code:
# Problem C - To Infinity

# input
S = list(input())
s_len = len(S)
K = int(input())

# initialization
pos = 0
while K>0:
    K -= 1
    if int(S[pos])==1:
        pos += 1
    else:
        K += 1
        break
    if pos==s_len:
        pos -= 1
        break

# output
if K==0:
    print(S[pos-1])
else:
    print(S[pos])

Submission status: Accepted

Solution code:
inf = 10 ** 15
mod = 10 ** 9 + 7

s = input()
k = int(input())
count1 = 0
other = ''
for c in s:
    if c == '1':
        count1+=1
    else:
        other = c
        break
if other == '':
    print(1)
else:
    if k <= count1:
        print(1)
    else:
        print(other)

Submission status: Accepted

Solution code:
import sys


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


def resolve():
    def main():
        s = input()
        k = int(input())
        if int(s[0]) != 1:
            return s[0]
        else:
            cnt = 0
            for i in s:
                if int(i) == 1:
                    cnt += 1
                    if cnt >= k:
                        return 1
                else:
                    if cnt >= k:
                        return 1
                    else:
                        return i

    print(main())
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

# https://atcoder.jp/contests/abc106


def main():
    S = list(map(int, input()))
    K = int(input())

    head = 0
    for i in range(len(S)):
        if S[i] > 1:
            head = i
            break
    
    if K == 1:
        return S[0]
    
    if K >= head+1:
        return S[head]
    else:
        return S[0]


print(main())

Submission status: Accepted

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

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())

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

Submission status: Accepted

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

# In[40]:


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


# In[41]:


min_idx = min((i for i in range(len(S)) if S[i] != "1"), default=-1)

if min_idx > K-1:
    print("1")
else:
    print(S[min_idx])


# In[ ]:

Submission status: Accepted

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

tmp = 0
for each in s:
  if int(each) > 1:
    print(each)
    break
  tmp += 1
  if tmp == k:
    print(1)
    break

Submission status: Accepted

Solution code:
s = input()
k = int(input())
i = 0
while True:
  if i == k-1:
    break
  elif s[i] == '1':
    pass
  else:
    break
  i += 1
print(s[i])

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
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:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = input()
K = INT()


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

Submission status: Accepted

Solution code:
S = list(str(input()))
K = int(input())
#rint(S)
ans = 1
for i in range(K):
    #print(i)
    if S[i] != '1' :
        ans = S[i]
        break
print(ans)

Submission status: Accepted

Solution code:
n_l=list(input())
now=0
N=int(input())
if n_l[:N].count("1") == len(n_l[:N]):
   print(1)
else:
   for i in range(len(n_l)):
      if n_l[i] != "1":
         print(n_l[i])
         exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(map(int, input()))
k = int(input())
res = 1
n = 0
for i in range(len(s)):
    if s[i] != 1:
        res = s[i]
        n = i + 1
        break
if k < n:
    print(1)
else:
    print(res)

Submission status: Accepted

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from itertools import accumulate
def resolve():
    S=input()
    K,=pin()
    cnt=0
    for s in S:
        if s=="1":
            cnt+=1
            if cnt>=K:
                print(1)
                return
        else:print(s);return
#%%submit!
resolve()

Submission status: Accepted

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

print("1")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    S=input()
    K=int(input())
    for s in S:
        if s=='1':
            if K==1:
                print(1)
                exit()
            K -= 1
            continue
        print(s)
        exit()
main()

Submission status: Accepted

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

flag  = 0

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

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

Submission status: Accepted

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

for i in range(K):
  if int(S[i]) != 1:
    print(S[i])
    exit()
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(int(S[i]))
        exit()
print(1)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()
k = int(input())
for c in s:
    if c != "1":
        break

    k -= 1
    if k == 0:
        break
print(c)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import re
S=str(input())
k=int(input())

if set(S)=={'1'}:
  print(1)
  
else:
  x=re.search(r'[2-9]',S).start()
      
  if S[0]=='1':
    if k<=x:
      print(S[0])
    else:
      print(S[x])     
  else:
    print(S[0])