Problem:


﻿Score: 300 points

Problem Statement

Mr. Infinity has a string S consisting of digits from 1 to 9. Each time the date changes, this string changes as follows:

Each occurrence of 2 in S is replaced with 22. Similarly, each 3 becomes 333, 4 becomes 4444, 5 becomes 55555, 6 becomes 666666, 7 becomes 7777777, 8 becomes 88888888 and 9 becomes 999999999. 1 remains as 1.

For example, if S is 1324, it becomes 1333224444 the next day, and it becomes 133333333322224444444444444444 the day after next.
You are interested in what the string looks like after 5 \times 10^{15} days. What is the K-th character from the left in the string after 5 \times 10^{15} days?

Constraints

S is a string of length between 1 and 100 (inclusive).

K is an integer between 1 and 10^{18} (inclusive).

The length of the string after 5 \times 10^{15} days is at least K.

Input

Input is given from Standard Input in the following format:

S
K

Output

Print the K-th character from the left in Mr. Infinity's string after 5 \times 10^{15} days.

Sample Input 1

1214
4

Sample Output 1

2

The string S changes as follows:  

Now: 1214

After one day: 12214444

After two days: 1222214444444444444444

After three days: 12222222214444444444444444444444444444444444444444444444444444444444444444

The first five characters in the string after 5 \times 10^{15} days is 12222. As K=4, we should print the fourth character, 2.

Sample Input 2

3
157

Sample Output 2

3

The initial string is 3. The string after 5 \times 10^{15} days consists only of 3.

Sample Input 3

299792458
9460730472580800

Sample Output 3

2



Sample input:
1214
4


Sample output:
2

Submission status: Wrong Answer

Solution code:
def main():
  S = map(int,list(input()))
  K = int(input())
  for i,n in enumerate(S):
    if n == 1:
      K -= n
    else:
      return n
  return n

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

Submission status: Wrong Answer

Solution code:
def main():
  S = map(int,list(input()))
  K = int(input())
  for n in S:
    
    if n == 1:
      K -= n
    else:
      return n
  return 1

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

Submission status: Wrong Answer

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

for i in S:
    if i == '1':
        continue
    else:
        print(i)
        quit()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def solve(s, k):
    for i, d in enumerate(map(int, list(s))):
        if i+1 == k:
            return 1
        if d > 1:
            return d
    return 1

s = input()
k = int(input())
print(solve(s, k))

Submission status: Wrong Answer

Solution code:
def solve(s, k):
    for d in map(int, list(s)):
        if d > 1:
            return d
    return 1

s = input()
k = int(input())
print(solve(s, k))

Submission status: Wrong Answer

Solution code:
import numpy as np
def solve(s, k):
    cur = 0
    th = np.log10(k)
    for c in s:
        d = int(c)
        cur += (5000 * (10**12)) * np.log10(d)
        if cur >= th:
            return d
    return -1

s = input()
k = int(input())
print(solve(s, k))

Submission status: Wrong Answer

Solution code:
import numpy as np
def solve(s, k):
    cur = 0
    th = np.log10(k)
    for c in s:
        d = int(c)
        cur += (5000 * (10**12)) * np.log10(d)
        if cur > th:
            return d
    return -1

s = input()
k = int(input())
print(solve(s, k))

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
S_list = []
infinity = 50000000000000
S_str = str()
for i in range(len(S)):
    if int(S[i]) != 1:
        S_list.append(int(S[i]))
        if i + 1 >= K:
            S_list[0] = 1
        break
    else:
        pass
if len(S_list) > 0:
    print(S_list[0])
else:
    print(1)

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
S_list = []
infinity = 50000000000000
S_str = str()
for i in range(len(S)):
    if int(S[i]) != 1:
        S_list.append(int(S[i]))
        break
    else:
        pass
if len(S_list) > 0:
    print(S_list[0])
else:
    print(1)

Submission status: Wrong Answer

Solution code:
def solve(s, k):
    cur = 0
    for c in s:
        d = int(c)
        if d > 1:
            return d
    return -1
s = input()
k = int(input())
print(solve(s, k))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
import itertools
import collections
import functools
import math
from queue import Queue
# import numpy as np
INF = float("inf")


def solve(S: int, K: int):
    n = -1
    nc = 1
    for i, c in enumerate(str(S)):
        if c != "1":
            n = i+1
            nc = c
            break
    # print(n, nc, K)
    if n == -1:
        print(1)
        return

    if K <= n:
        print(1)
    else:
        print(nc)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(S, K)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = str(input())
k = int(input())
if len(S) == 1:
    print(S)
    exit()
for i in range(len(S)):
    if S[i] == "1" and i == k:
        print("1")
        break
    elif S[i] != "1":
        print(S[i])
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
L = [int(i) for i in S]
count = 0
for i in L:
    if i != 1:
        if count <= K:
            print(i)
        else:
            print(1)
        exit()
    else:
        count += 1
print(1)

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
L = [int(i) for i in S]
count = 0
for i in L:
    if i != 1:
        if count >= K:
            print(i)
        else:
            print(1)
        exit()
    else:
        count += 1
print(1)

Submission status: Wrong Answer

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

print(S[0])

Submission status: Wrong Answer

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

print(1)

Submission status: Wrong Answer

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

print(1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
K = input()
if S == "1"*len(S):
  print(1)
else:
  for i in S:
    if i != "1":
      print(i)
      break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
str=input()
k=int(input())
lst=list(str)
flag=True

for x in lst:
    if x!="1":
        flag=False

if flag:
    print(1)
else:
    for x in lst:
        if x!='1':
            print(x)
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=list(map(int,input().split()))
k=int(input())
count=0
for i in range(100):
  if count==k:
    print(1)
    exit()
  if s[i]==1:
    count+=1
  else:
    print(s[i])
    exit()

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
on=[int(j) for j in range(2,10)]
for i in range(k):
    if int(s[i]) in on:
        print(s[i])
        break
    else:
        i+=1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
on=[int(j) for j in range(2,10)]
i=0
if int(s[0]) in on:
    print(s[0])

while int(s[i]) not in on:
    if s[i] in on:
        print(s[i])
        break
    elif i==k-1:
        print(s[k-1])
        break
    i+=1

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
i=0
ints=[int(x) for x in s]
if sum(ints[:k])==k:
    print(1)
else:
    while True:
        if s[i]=='1':
            i+=1
        else:
            print(s[i])
            break

Submission status: Wrong Answer

Solution code:
S = input()

K = int(input())

index = 0
res = ""

while K - 1 > index and index < len(S):
    if S[index] == "1":
        res = "1"
    else:
        res = S[index]
        break;
    index += 1

print(res)

Submission status: Wrong Answer

Solution code:
S = input()

K = int(input())

tmp = 0
index = 0
res = ""

while K > tmp and index < len(S):
    if S[index] == "1":
        res = "1"
    else:
        res = S[index]
        break;
    index += 1

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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])
    break
    
  if cnt == len(S):
    print(1)
    break

Submission status: Wrong Answer

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

'''
パターンは下記の通りか。
A.K=1
1桁目を表示する

B.K>=2
1でない値で、かつK以下の値、最初に出てきた値を出力
（1桁目が1でないなら、1桁目を表示）

'''


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

Submission status: Wrong Answer

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

'''
パターンは下記の通りか。
A.K=1
1桁目を表示する

B.K>=2
1でない値で、かつK以下の値、最初に出てきた値を出力
（1桁目が1でないなら、1桁目を表示）

'''

# A
if K == 1:
  print(S[0]) 
    
# B
elif K >= 2:
  cnt = 0
  while cnt <= len(S):
    ans = S[cnt]
    if ans != '1':
      print(ans)
      break
    
    if cnt == len(S) - 1:
      print(S[cnt])
      break
      
    cnt += 1

Submission status: Wrong Answer

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

'''
パターンは下記の通りか。
A.K=1
1桁目を表示する

B.K>=2
1でない値で、かつK以下の値、最初に出てきた値を出力
（1桁目が1でないなら、1桁目を表示）

'''

# A
if K == 1:
  print(S[0]) 
    
# B
cnt = 0
while cnt <= len(S):
  ans = S[cnt]
  if ans != '1':
    print(ans)
    break
  
  if cnt == len(S) - 1:
    print(S[cnt])
    break
    
  cnt += 1

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(input())
K = int(input())
S = [int(i) for i in S]
if K == 1 or len(S)==1:
    print(S[0])
else:
    if S[0] == 1:
        print(1)
    else:
        print(S[0])

Submission status: Wrong Answer

Solution code:
S = list(input())
K = int(input())
S = [int(i) for i in S]
if K == 1 or len(S)==1:
    print(S[0])
else:
    print(S[1])

Submission status: Wrong Answer

Solution code:
s = raw_input()
k = int(raw_input())
count = 0
for n in s:
	count += int(n)**50000*(10**10)
	if count>=k:
		print n
		break

Submission status: Wrong Answer

Solution code:
s = raw_input()
k = int(raw_input())
count = 0
for n in s:
	count += int(n)**500*(10**12)
	if count>=k:
		print n
		break

Submission status: Wrong Answer

Solution code:
s = raw_input()
k = int(raw_input())
for n in s:
	if k<=int(n)**(5*(10**14)):
		print n
		break
	else:
		k+=int(n)**(5*(10**14))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 500000000000000回繰り返したあとだと最低増加数の2でも2^50000000000000個になってるので
# 1000000000000000000を余裕で超える
# 1から1000000000000000000まで同じ数が並ぶので、増加しない1なら1、それ以外なら2番目の数値

# ↑でやったら1WA そういえば最初に1が並ぶ場合があった
# ぜんぶ1の場合は題意からs.size>=kで明らかに1
s = list(input())
k = int(input())
if (s[0] == "1" and k == 1) or list(set(s)) == [1]:
    print(1)
else:
    for sv in s:
        if sv != "1":
            print(sv)
            break

Submission status: Wrong Answer

Solution code:
# 500000000000000回繰り返したあとだと最低増加数の2でも2^50000000000000個になってるので
# 1000000000000000000を余裕で超える
# 1からk(<=1000000000000000000)まで同じ数が並ぶので、増加しない1なら1、それ以外なら2番目の数値
s = list(input())
k = int(input())
if s[0] == "1" and k == 1:
    print(1)
elif s[0] == "1":
    print(s[1])
else:
    print(s[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for s in S:
    if s == "1":
        K -= 1
    if K <= 0:
        print(s)
        exit()
    else:
        print(s)
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

result = "1"
for i in range( min(len(s),k) ):
    if s[i] != "1":
        result = s[i]
        
print(result)

Submission status: Wrong Answer

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

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

print("1")

Submission status: Wrong Answer

Solution code:
try:print([i for i in input()[:int(input())]][0])
except:print(1)

Submission status: Wrong Answer

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

mark = 0
cnt = 0
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()
    else:
        cnt += 1
        if K == cnt:
            print('1')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
ans = 1
for i in range(min(len(S), K)):
  if S[i] == 1:
    continue
  else:
    ans = int(S[i])
    break
print(ans)

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
s, k = input(), input()
if all(c for c in s) == '1':
    print(1)
else:
    if k == 1:
        print(s[0])
    else:
        for c in s:
            if c != '1':
                print(c)
                exit()

Submission status: Wrong Answer

Solution code:
s, k = input(), input()
if all(c for c in s) == '1':
    print(1)
else:
    for c in s:
        if c != '1':
            print(c)
            exit()

Submission status: Wrong Answer

Solution code:
s=input()
t=input()
if s[0]=="1":
    if t=="1":
        print(1)
    else:
        if set(list(s)[:int(t)])=={"1"}:
            print(1)
        else:
            print(s[1])
else:
    print(s[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def to_infinity(S: str, K: int) -> str:
    """5000兆 = 5e15 であり、文字 n は 5e15 日後には n^(5e15) の長さになっている。
    これは 2^100 = 10^30 より、K の範囲には確実に治らない。
    したがって、SとKの条件より、S[0] or S[1] かを決定すれば良い。
    """
    if K == 1:
        return S[0]
    if len(S) == 1:
        return S[0]
    if S[0] != '1':
        return S[0]
    return S[1]


if __name__ == "__main__":
    S = input()
    K = int(input())
    ans = to_infinity(S, K)
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in n:
    if i != "1":
        print(int(i))
        exit()

Submission status: Wrong Answer

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

for i in n:
    if i != "1":
        print(int(i))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if s[0]==1 and k!=1:
    print(s[1])
else:
    print(s[0])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def solve(string):
    s, k = string.split()
    if len(s) == 1:
        return s
    k = int(k)
    for _s in s[:k]:
        if _s != "1":
            return s
    else:
        return "1"


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Submission status: Wrong Answer

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

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

print(answer)

Submission status: Wrong Answer

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

if len(S) >= int(K):
    if S[int(K)-1] == '1':
        print('1')
        exit()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
if s.count("1")==len(s):
    t=k
    print(1)
else:
    i=0
    while s[i]=="1":
        i+=1
    if k<i:
        print(1)
    else:
        print(s[i])

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
if s.count("1")==len(s):
    print(s[k-1])
else:
    i=0
    while s[i]=="1":
        i+=1
    print(s[i])

Submission status: Wrong Answer

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

lst = []
while S > 0:
    lst.append(S%10)
    S //= 10 
lst.reverse()

if len(lst) == lst.count(1):
	print(1)

elif K == 1:
	print(lst[0])
  
else:
	for i in range(K):
		if lst[i] != 1:
			print(lst[i])
			break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if len(S) >= K and set(S[:K]) == {'1'}:
    print(1)
else:
    if sorted(list(set(S)))[0] != '1':
        print(sorted(list(set(S)))[0])
    else:
        print(sorted(list(set(S)))[1])

Submission status: Wrong Answer

Solution code:
for i,n in enumerate(input()):
  if n!= 1:
    break
print(n if i<int(input()) else 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input())
k = int(input())
for i,s_ in enumerate(s):
  if not s_=='1' or i==k:
    print(s_)
    break

Submission status: Wrong Answer

Solution code:
s = list(input())
k = int(input())
for s_ in s:
  if not s_=='1':
    print(s_)
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

p = 0
for i in s:
    if p == k:
        print(i)
        exit()
    if i != '1':
        print(i)
        exit()
    p += 1
print(i)

Submission status: Wrong Answer

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

for i in s:
    if i != '1':
        print(i)
        exit()

print(i)

Submission status: Wrong Answer

Solution code:
n = [int(i) for i in input()]
k = int(input())

for i in n:
    if i != 1:
        break

print(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
if N < 105:
    print("0")
elif N < 135:
    print("1")
elif N < 165:
    print("2")
elif N < 189:
    print("3")
elif N < 195:
    print("4")
else:
    print("5")

Submission status: Wrong Answer

Solution code:
import math
string = raw_input()
k = raw_input()
string = [int(i) for i in string]
k = int(k)

if len(string)==1:
	print(string[0])
elif string[0]==1:
	print(string[1])
else:
	print(string[0])

Submission status: Wrong Answer

Solution code:
import sys

def main():
  input = sys.stdin.readline
  S = str(input().strip())
  K = int(input())
  
  f = int(S[0])
  if f == 1:
    if K == 1:
      print(1)
    else:
      print(int(S[1]))
  else:
    print(f)


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

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

flag=0
tmp=1
if k<=len(s):
  for i in range(k):
    tmp=tmp*int(s[i])
  if tmp==1:
    ans=1
  else:
    for i in range(len(s)):
      if int(s[i]) > 1 and flag==0:
        ans = s[i]
        flag=1

if k==1:
  ans=s[0]
else: 
    for i in range(len(s)):
      if int(s[i]) > 1 and flag==0:
        ans = s[i]
        flag=1

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
#print(s,k)
#500000000000000
#5000*10**12
flag=0
ans=1

tmp=1
if k <= len(s):
  for i in range(k):
    tmp=tmp*int(s[i])
if k <=int(s) and tmp==1:
  ans=1
  flag=1
  
  
if k==1:
  ans=s[0]
else:
  for i in range(len(s)):
    if int(ans) < int(s[i]) and flag==0:
      ans = s[i]
      flag=1
    
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
#print(s,k)
#500000000000000
#5000*10**12

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

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
#print(s,k)
#500000000000000
#5000*10**12
ans=0

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

Submission status: Wrong Answer

Solution code:
s, _ = [input() for _ in range(2)]
s = s.rstrip("1")
print(s[0] if s else "1")

Submission status: Wrong Answer

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

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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

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

Submission status: Wrong Answer

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

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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

if min(S) == max(S) == '1':
    print(1)
else:
    for ch in S:
        if ch != '1':
            print(ch)
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
result=True
for i in s:
    if i!="1":
        print(i)
        result=False
        break
if result:
    print("1")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=input()
k=int(input())
if int(a)<10:
    a=str(int(a)*11)
i=0
x=0
while k>0:
    if a[i]=='1':
        k-=1
        i+=1
        x=1
    else: k=-1   
print(a[i-x])

Submission status: Wrong Answer

Solution code:
class Solver(object):
    def __init__(self):
        self.s = input()
        self.k = int(input())
        self.compressed = self.to_compressed_format(self.s)

    def solve(self):
        if (self.compressed[0][0] == 1) and (self.k < self.compressed[0][1]):
            print(1)
            return
        else:
            for i in self.s:
                if int(i) != 1:
                    print(i)
                    return
            print(1)
            return

    def wrong_solve(self):
        print(self.compressed)
        counter = 0
        for (n, count) in self.compressed:
            print(n, count)
            counter += self.length_after(n, count)
            print("chk")
            if counter >= self.k:
                return n

    @staticmethod
    def length_after(n, count):
        return count * (n ** (5 * (10 ** 15)))

    @staticmethod
    def to_compressed_format(s):
        res = []
        counter = 1
        prev = int(s[0])
        for c in s[1:]:
            n = int(c)
            if n == prev:
                counter += 1
            else:
                res.append((prev, counter))
                prev = int(n)
                counter = 1
        res.append((prev, counter))
        return res


if __name__ == "__main__":
    s = Solver()
    s.solve()