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:
import sys
def input(): return sys.stdin.readline().strip()

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

    for c in S:
        if c != '1':
            print(int(c))
            return
    print(1)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

    for c in S:
        if c != '1':
            print(int(c))
            return



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()+"2"
k = int(input())

for i,j in enumerate(s):
    if j != "1":
        now = i
        break

if s == "1"*len(s):
    print(1)
else:
    if k < now:
        print(1)
    else:
        print(s[now])

Submission status: Wrong Answer

Solution code:
s = list(input())

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def examA():
    N = I()
    V = LI()
    C = LI()
    ans = 0
    for i in range(N):
        ans += max(0,V[i]-C[i])
    print(ans)
    return

def examB():
    S = SI()
    K = I()
    ans = "1"
    for s in S:
        if s!="1":
            ans = s
            break
    print(ans)
    return

def examC():

    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = list(input())
k = int(input())
if n.count('1') == len(n):
    print(1)
else:
    for i in n:
        if i != '1':
            print(i)
            exit()

Submission status: Wrong Answer

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

if S[0] != '1' or len(S) == 1:
  print(S[0])
elif S[0] == '1' and K >= 1:
  print(S[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if S[0] != 1:
  print(S[0])
elif S[0] == 1 and K > 1:
  print(S[1])
else:
  print(1)

Submission status: Wrong Answer

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

if S[0] != 1 and len(S) != 1:
  print(S[0])
elif S[0] != 1 and len(S) == 1:
  print(S[0])
else:
  print(1)

Submission status: Wrong Answer

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

if S[0] != 1 and len(S) != 1:
  print(S[1])
elif S[0] != 1 and len(S) == 1:
  print(S[0])
else:
  print(1)

Submission status: Wrong Answer

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

if S[0] != 1:
  print(S[0])
else:
  print(1)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline


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

    ans = 1
    for s in S:
        if s != "1":
            ans = int(s)
            break

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
for e in s:
  if e != "1":
    print(e)
    break
else:
  print("1")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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
if K <= cnt:
    print(1)
else:
    print(S[cnt])

Submission status: Wrong Answer

Solution code:
S = list(map(int, input()))
K = int(input())
#num = [pow(S[i], 10**12) for i in range(len(S))]
if len(S) == 1:
    print(S[0])
    exit()
if S[0] == 1:
    print(S[1])
else:
    print(S[0])

Submission status: Wrong Answer

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

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

first_number=0
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: Wrong Answer

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

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

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)
    else:
        print(a)
        exit()

Submission status: Wrong Answer

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: 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:
S = input()
for s in S:
  if s != '1':
    print(s)
    exit()
    
print('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])
    exit()

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

Submission status: Wrong Answer

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

Solution code:
import sys
s = str(input())
n = int(input())
i = 0
print(s[i])
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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def resolve():
	s = list(input())
	k = int(input()) - 1
	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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def resolve():
	s = input()
	k = int(input())
	if len(s) == 1:
		print(s)
		return

	for i in s:
		if int(i) == 1:
			continue
		print(i)
		return
	print(s[0])
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
	s = input()
	k = int(input())
	if len(s) == 1:
		print(s)
		return

	for i in s:
		if int(i) == 1:
			continue
		print(i)
		return
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
	s = input()
	k = int(input())
	for i in s:
		if int(i) == 1:
			continue
		print(i)
		return
resolve()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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(1)
      exit()
  print(1)
  
else:
  for i in s[:k]:
    if i != '1':
      print(i)
      exit()
  print(1)
  exit()

Submission status: Wrong Answer

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(1)
      exit()
  print(1)
  
else:
  for i in s:
    if i != '1' and i not in s[:k]:
      print(1)
      exit()
    elif i != '1' and i in s[:k]:
      print(i)
      exit()

Submission status: Wrong Answer

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(1)
      exit()
else:
  for i in s:
    if i != '1' and i not in s[:k+1]:
      print(1)
      exit()
    elif i != '1' and i in s[:k+1]:
      print(i)
      exit()

Submission status: Wrong Answer

Solution code:
S = list(map(int,list(input())))
K = int(input())
if sum(S[:K]) == K:
    print('1')
else:
    for s in S:
        if s == 1:
            continue
        else:
            print(s)
            break

Submission status: Wrong Answer

Solution code:
S = list(input())
for i in S:
    if i == "1":
        continue
    else:
        print(i)
        break

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:
S = input()
k = int(input())
for s in S:
    if s != '1':
        print(s)
        exit()
print(1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()

k=int(input())

cnt=0
c=""
for i in s:
    cnt+=1
    if i != "1":
        c=i
        break

if cnt > k :
    print("1")
else:
    print(c)

Submission status: Wrong Answer

Solution code:
s=input()

k=int(input())

cnt=0
c=""
for i in s:
    if i != "1":
        c=i
        break
    cnt+=1

if cnt > k :
    print("1")
else:
    print(c)

Submission status: Wrong Answer

Solution code:
s=input()

k=int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
ns = list(map(int,input()))
n = int(input())

ans = 0

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

Submission status: Wrong Answer

Solution code:
ns = list(map(int,input()))
n = int(input())

ans = 0

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

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())
m = 5*10**15

if len(s)==1:
    print(s[0])
    quit()

for c in s:
    if c != '1':
        print(c)
        quit()

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())
m = 5*10**15

for c in s:
    if c != '1':
        print(c)
        quit()

print(s[-1])

Submission status: Wrong Answer

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

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

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

print(1)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

for i in range(len(s)):
    if s[i] == "1" and i == k-1:
        print(1)
    if s[i] != "1" and i > k:
        print(s[i])
        exit()
    if i == len(s):
        print(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])
        exit()
    if i == len(s):
        print(1)

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())-1
if S[0] == '1' and K == 0:
    print('1')
elif S[0] == '1':
    print(S[1])
else:
    print(S[0])

Submission status: Wrong Answer

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("AAA")
    print(1)
else:
    print(S[limit])

Submission status: Wrong Answer

Solution code:
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"ABC106C-ToInfinity.ipynb","provenance":[],"authorship_tag":"ABX9TyNX8Ir2ZzuscRLajj/o6IUg"},"kernelspec":{"name":"python3","display_name":"Python 3"}},"cells":[{"cell_type":"code","metadata":{"id":"3ke4UMpfQZna","colab_type":"code","outputId":"b7f58493-9947-42d9-8953-9dfad87c6dad","executionInfo":{"status":"ok","timestamp":1589608511500,"user_tz":-540,"elapsed":5594,"user":{"displayName":"Taishi","photoUrl":"","userId":"11736711679866118393"}},"colab":{"base_uri":"https://localhost:8080/","height":72}},"source":["s = str(input())\n","k = int(input())\n","if int(s[0]) == 1:\n","  print(s[1])\n","else:\n","  print(s[0])"],"execution_count":3,"outputs":[{"output_type":"stream","text":["3\n","157\n","3\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"id":"G05wyz9VTQI9","colab_type":"code","colab":{"base_uri":"https://localhost:8080/","height":35},"outputId":"8368a8c5-f413-4a10-c257-1f3791af6cf0","executionInfo":{"status":"ok","timestamp":1589608502261,"user_tz":-540,"elapsed":575,"user":{"displayName":"Taishi","photoUrl":"","userId":"11736711679866118393"}}},"source":["3\n","157"],"execution_count":2,"outputs":[{"output_type":"execute_result","data":{"text/plain":["157"]},"metadata":{"tags":[]},"execution_count":2}]},{"cell_type":"code","metadata":{"id":"TmcZoyerDNFs","colab_type":"code","colab":{}},"source":[""],"execution_count":0,"outputs":[]}]}

Submission status: Wrong Answer

Solution code:
s = str(input())
k = int(input())
i = 0
n = s[0]
m = len(s)
while (i < m):
  if int(s[i]) ** 2 >= k:
    n = s[i]
    break
  else:
    k -= int(s[i])
  i += 1
print(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"name":"ABC106C-ToInfinity.ipynb","provenance":[],"authorship_tag":"ABX9TyNRoFVf941vEvQ2RLhFUphc"},"kernelspec":{"name":"python3","display_name":"Python 3"}},"cells":[{"cell_type":"code","metadata":{"id":"3ke4UMpfQZna","colab_type":"code","colab":{"base_uri":"https://localhost:8080/","height":72},"outputId":"99180d89-276e-4fd8-b2c6-02e5a651ee14","executionInfo":{"status":"ok","timestamp":1589596953669,"user_tz":-540,"elapsed":15115,"user":{"displayName":"Taishi","photoUrl":"","userId":"11736711679866118393"}}},"source":["s = str(input())\n","k = int(input())\n","i = 0\n","n = s[0]\n","while (i < len(s)):\n","  if int(s[i]) ** 2 >= k:\n","    n = s[i]\n","    break\n","  else:\n","    k -= int(s[i])\n","  i += 1\n","print(n)"],"execution_count":17,"outputs":[{"output_type":"stream","text":["299792458\n","9460730472580800\n","2\n"],"name":"stdout"}]},{"cell_type":"code","metadata":{"id":"G05wyz9VTQI9","colab_type":"code","colab":{}},"source":["299792458\n","9460730472580800"],"execution_count":0,"outputs":[]}]}

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    K = int(input())
    # 10**15
    if S[0] == '1':
        if K == 1:
            print(S[0])
        else:
            print(S[1])
    else:
        print(S[0])


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if len(S) >= K and len(set(S[:K])) == 1 and 1 in set(S[:K]):
    print(1)
else:
    for c in S:
        if c != '1':
            print(c)
            break
    else:
        print(1)

Submission status: Wrong Answer

Solution code:
S = input()
for c in S:
    if c != '1':
        print(c)
        break
else:
    print(1)

Submission status: Wrong Answer

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

if len(S) == 1:
    print(S[0])
elif K == 1:
    print(S[0])
elif S[0] == '1':
    print(S[1])
else:
    print(S[0])

Submission status: Wrong Answer

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:
        break
    if pos==s_len:
        pos -= 1
        break

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

Submission status: Wrong Answer

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:
        break
    if pos==s_len:
        pos -= 1
        break

# output
print(S[pos])

Submission status: Wrong Answer

Solution code:
s = str(input())
k = int(input())
num = 1
for i in s:
    if i != '1':
        num = i
        break
print(num)

Submission status: Wrong Answer

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 i=='1':
                    cnt+=1
                else:
                    if cnt>=k:
                        return 1
                    else:
                        return i
    print(main())
resolve()

Submission status: Wrong Answer

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]
    
    return S[head]


print(main())

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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()
t = 5*10**15

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(map(int, input()))
k = int(input())
res = int()
n = int()
for i in range(len(s)):
    if s[i] != 1:
        res = s[i]
        n = i + 1
        break
if k > n:
    print(res)
else:
    print(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])
    exit()

print("1")

Submission status: Wrong Answer

Solution code:
def main():
    S=input()
    K=int(input())
    for i in S:
        if i!='1':
            print(i)
            exit()
    print(1)
main()

Submission status: Wrong Answer

Solution code:
def main():
    S=input()
    K=int(input())
    for i in S:
        if i!='1':
            print(i)
            exit()
main()

Submission status: Wrong Answer

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

flag  = 0

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(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 = int(input())
K = int(input())
ans = 0
if int(str(S)[0]) == 1 and K == 1:
    ans = 1
elif int(str(S)[0]) != 1:
    ans = int(str(S)[0])
else:
    ans = int(str(S)[1])
print(ans)

Submission status: Wrong Answer

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

if S[0]=='1':
  if k==1:
    print(S[0])  
  elif k<(10**14+1):
    print(S[2])
  else:
    print(S[1])

elif S[0]=='2':
  if k<(10**14+1):
    print(S[0])
  else:
    if S[1]!=1:
      print(S[1])
    else:
      print(S[2])#1が続く場合は次の1以外の数字
      
else:
  print(S[0])

Submission status: Wrong Answer

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


def solve(S: int, K: int):
    for s in str(S):
        if s != '1':
            return s

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
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
    print(solve(S, K))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Submission status: Wrong Answer

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

if K==1:
    print(S[0])
else:
    for s in S:
        if s!="1":
            print(s)
            exit()

Submission status: Wrong Answer

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

ans = 1
index = 0
for j in range(len(S)):
    if S[j] != '1':
        ans = int(S[j])
        index = j
        break

if ans == 1:
    print(ans)
elif index >= K-1:
    print(1)
else:
    print(ans)

Submission status: Wrong Answer

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

ans = 1
index = 0
for j in range(len(S)):
    if S[j] != '1':
        ans = int(S[j])
        index = j
        break

if ans == 1:
    print(ans)
elif index < K-1:
    print(ans)
else:
    print(1)

Submission status: Wrong Answer

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

for i in S:
    if i != "1":
        print(i)
        quit()

print(1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

first_not_1=-1
for i,s in enumerate(S):
    if s=="1":
        continue
    else:
        first_not_1=i
        break

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

Submission status: Wrong Answer

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

if N == 1 or len(S) == 1:
    print(S[0])
    
elif S[0] == "1":
    print(S[1])
    
else:
    print(S[0])

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = input()
    k = int(input())

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


if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

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

if S[0] == '1' and K == 1: print(1)
else:
    for s in S:
        if s != '1': 
            print(s)
            break