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: Runtime Error

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

for k in range(len(S)):
    if s_list[k] != 1:
        flag = True
        break

if flag:
    print(s_list[k])
else:
    print(1)

Submission status: Runtime Error

Solution code:
s = list(map(int,input().split()))
result = 1
for i in s:
 if s != 1:
  result = s[i]
  break
print(result)

Submission status: Runtime Error

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

i=0

while i <= k:
	if s[i] =='1':
		ans = 1
		i += 1
	else:
		ans = s[i]
		break

print(ans)

Submission status: Runtime Error

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

t = 0
u = s[0]

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

Submission status: Runtime Error

Solution code:
list_s = list(str(input()))
k = int(input())
for i in range(len(list_s)):
    if list_s[i] != "1":
        bord = i
        break
if k <= bord:
    print(1)
else:
    print(list_s[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
i = 0
while i < len(S) and S[i] == "1":
    i += 1

if i != len(S) - 1:
    ans = S[i]

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
inp1 = input()
inp1 = list(inp1)
inp2 = input()

ans = 1
for i in inp1:
    if i != '1'
        ans = int(i)
        break

print(ans)

Submission status: Runtime Error

Solution code:
inp1 = input()
inp1 = int(inp1)
inp2 = input()
inp2 = list(inp2)

ans = 1
for i in inp2:
    if i != '1'
        ans = int(i)
        break

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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


a=0
b=0
for i in range(len(S)):
    if int(S[i]) > 1:
        a=i
        b=S[i]
        break
# print(a)
# print(b)
if K< a:
    print (S[a])
    
else:
    print (b)
    
else:
    print (b)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
i = 0
while 1:
    if S[i] != '1':
        print(S[i])
        break
    else:
        i += 1

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
if (S.count('1') == len(S)):
  print('1')
else:
  p = 0
  if (len(S) == 1):
    print(S[0])
    exit()
  else:  
    while (S[p] == S[p+1] == '1'):
      p += 1
if (p+1 >= K):
  print('1')
else:
  if (p == 0):
    if (S[0] == '1'):
      print(S[1])
    else:
      print(S[0])
  else:
    print(S[p+1])

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
if (S.count('1') == len(S)):
  print('1')
else:
  p = 0
  while (S[p] == S[p+1] == '1'):
    p += 1
if (p+1 >= K):
  print('1')
else:
  if (p == 0):
    if (S[0] == '1'):
      print(S[1])
    else:
      print(S[0])
  else:
    print(S[p+1])

Submission status: Runtime Error

Solution code:
#coding:utf-8
s = input()
k = int(input())
for i,char in enumerate(s):
    if int(char)>1:
        x = char
        idx = i
        break
#print (x,idx)
if k>idx:
    print (x)
else:
    print (1)

Submission status: Runtime Error

Solution code:
if __name__ == '__main__':
    # AB = [int(i) for i in input().split()]
    S = str(input())
    K = int(input())
    for i, n in enumerate(S):
        if n+1 == K:
            print(i)
            break
        if i != '1':
            print(i)
            break

Submission status: Runtime Error

Solution code:
if __name__ == '__main__':
    #AB = [int(i) for i in input().split()]
    S = input()
    K = int(input())
    for i in S:
        if i == K:
            print(n)
            break
        if i != '1':
	    print(n)
	    break

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
saf = []
for i in s:
  for j in range(int(i)**5000000000000000):
    saf.append(i)
    if len(saf) > k:
      break

print(saf[k])

Submission status: Runtime Error

Solution code:
# coding: utf-8

s = input()
k = int(input())

not_one_index = 0
i = 0
while True:
    if s[i] == '1':
        not_one_index = not_one_index + 1
        i = i + 1
    else:
        break

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

Submission status: Runtime Error

Solution code:
# coding: utf-8

s = input()
k = int(input())

not_one_index = 0
for i in range(k):
    if s[i] == '1':
        not_one_index = not_one_index + 1
    else:
        break

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

Submission status: Runtime Error

Solution code:
def logic(S, K):
    if len(S) == 1:
        return int(S)
    if S[0:5] == "11111":
        return 1
    a = S.replace("1", "")
    return int(a[0])


if __name__ == '__main__':
    print(logic(input(), input()))

Submission status: Runtime Error

Solution code:
print([input(),input()][0].strip('1')[0])

Submission status: Runtime Error

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

index = 0
while s[index] == "1":
    index += 1
if k <= index:
    print('1')
else:
    print(s[index])

Submission status: Runtime Error

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

index = 0
while s[index] == "1":
    index += 1
if k <= index + 1:
    print('1')
else:
    print(s[index])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = raw_input()
k = input()
index = -1
for i in xrange(len(s)):
	if s[i] > '1':
		index = i
		break
index += 1
if k >= index:
	print s[index]
else:
	print 1

Submission status: Runtime Error

Solution code:
S = input()
K = input()
s = len(str(S))
i=0

while i < s-1:
  if S[i] == '1':
    i = i + 1
  else:
    break
if int(K) > i:
  print(S[k])
else:
  print(1)

Submission status: Runtime Error

Solution code:
S = input()
K = input()
s = len(str(S))
i=0

while i < s-1:
  if S[i] == '1':
    i = i + 1
  else:
    break
if K > i:
  print(S[k])
else:
  print(1)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
s = len(str(S))
l = [str(x) for x in S]
i = 0
while i <= s - 1:
  if l[i] == '1':
    i = i + 1
  else:
    break
if i >= K:
  print(l[K])
else:
  print(l[i])

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
s = len(str(S))
l = [str(x) for x in S]
i = 0
while i <= s - 1:
  if l[i] == '1':
    i = i + 1
  else:
    break

if i == 100:
  print(1)
if K < 99:
  print(l[K-1])
else:
  print(l[i-1])

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
s = len(str(S))
l = [str(x) for x in S]
i = 0
while i <= s - 1:
  if l[i] == '1':
    i = i + 1
  else:
    break

if i == 100:
  print(1)
if K < 99:
  print(l[K-1])
else:
  print(l[i-1])

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
s = len(str(S))
l = [str(x) for x in S]
i = 0
while i <= s - 1:
  if l[i] == '1':
    i = i + 1
  else:
    break

if i == s:
  print(1)
else:
  print(l[K-1])

Submission status: Runtime Error

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

l = [str(x) for x in S]
i = 0
while i <= s - 1:
  if l[i] == '1':
    i = i + 1
  else:
    break
if i == s:
  print(1)
if i >= K:
  print(l[K])
else:
  print(l[i])

Submission status: Runtime Error

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

l = [str(x) for x in S]
i = 0
while i <= s - 1:
  if l[i] == '1':
    i = i + 1
  else:
    break
if i == s:
  print(1)
else:
  print(l[K])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys


S = [int(_) for _ in list(input())]
K = int(input())
t = 0
while t <= len(S):
    if S[t] == 1:
        t += 1
    else:
        break

if K <= t:
    print(1)
    sys.exit()
else:
    print(S[t])
    sys.exit()

Submission status: Runtime Error

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

if S[K - 1] == '1':
    print(S[K - 1])

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

Submission status: Runtime Error

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

if K == 1 or S[0] == 1:
    print(S[1])
for i,s in enumerate(S):
    if i + 1 == K:
        print(S[i])
        exit()
    if S[i] != 1:
        print(S[i])
        exit()

Submission status: Runtime Error

Solution code:
S = input()

K = int(input()) - 1

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

Submission status: Runtime Error

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

ones = 0
for st in S:
    if st != '1':
        break
    else:
        ones += 1

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

Submission status: Runtime Error

Solution code:
a=input()
b=int(input())
i=0
while t==0:
    if a[i]!=1:
        t=1
    i+=1
if i<b:
    print(a[i])
else:
    print(1)

Submission status: Runtime Error

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

l=len(S)
memo=[0 for _ in range(l)]
pre=0
for i in range(l):
    x=int(S[i])
    pre+=(int(i)**5000000000000000)-1
    if pre<=K:
        print(S[i])
        break

Submission status: Runtime Error

Solution code:
def c_to_infinity(S, K):
    for k, s in enumerate(S, 1):
        if k > K:
            ans = '1'  # K文字目まで1しかなかった
            break
        if s != '1':
            ans = s  # 現れた数字が5000兆回の操作によってK文字目に必ず現れる
            break
    return ans

S = input().strip()
K = int(input())
print(c_to_infinity(S, K))

Submission status: Runtime Error

Solution code:
# coding:utf-8

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

if K == 1:
    print(S[0])
else:
    S5000 = ''
    for i in range(len(S)):
        s = S[i]
        if s == '1':
            continue
        else:
            digit = i
            tmp = s
            break
    else:
        digit = len(S)

if K <= digit:
    print('1')
else:
    print(tmp)

Submission status: Runtime Error

Solution code:
# coding:utf-8

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

if K == 1:
    print(S[0])
else:
    S5000 = ''
    for i in range(len(S)):
        s = S[i]
        if s == '1':
            continue
        else:
            digit = i
            tmp = s
            break

if K <= digit:
    print('1')
else:
    print(tmp)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

s = input()
k = int(input())

slist = list(s)
i = 0
count = 0
while slist[i] == "1":
    count += 1
    i += 1
    
if count >= k:
    print(1)
else:
    print(slist[i])

Submission status: Runtime Error

Solution code:
S, K = map(int, input().split())
for i =1; i <= 5000000000000000; i++:
  S = S.replace("2", "22")
  S = S.replace("3", "333")
  S = S.replace("4", "4444")
  S = S.replace("5", "55555")
  S = S.replace("6", "666666")
  S = S.replace("7", "7777777")
  S = S.replace("8", "88888888")
  S = S.replace("9", "999999999")
numbers = list(S)
print(S[K - 1])

Submission status: Runtime Error

Solution code:
#abc106c
import sys

s=raw_input()
k=int(raw_input())
while True:
 if s:
  if s[0]=='1':
   s=s[1:]
  print s[0]
  sys.exit()
 else:
  print '1'
  sys.exit()

Submission status: Runtime Error

Solution code:
S = int(input())
K = int(input())
numbers = (int(x) for x in str(S))
for i in range(5*(10**15)):
    times = 0
    temporary = []
    while times <= K:
        for a in numbers:
            times += a
            for j in renge(a):
                temporary.append(a)
    numbers = temporary
print(numbers[K-1])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
count=0
for one in s:
  if one=="1":
    count+=1
  else:
    break
print(int(s.replace("1","")[0]) if k>=count else 1)

Submission status: Runtime Error

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

ans = '1'

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

print ans

Submission status: Runtime Error

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

if K == 1:
    print(S[0])
elif K >= 2:
    if S[0] != "1":
        print(S[0])
        quit()
    elif S[0:K] == "1" * K:
        print(S[0])
        quit()
    else:
        i = 1
        while S[i] == "1" and len(S) - 2 >= i:
            i += 1
        print(S[i])

Submission status: Runtime Error

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

if K == 1:
    print(S[0])
elif K >= 2:
    if S[0] != "1":
        print(S[0])
    elif S[0:K] == "1" * K:
        print("1")
    else:
        i = 1
        while S[i] == "1" and len(S) - 2 >= i:
            i += 1
        print(S[i])

Submission status: Runtime Error

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

if K == 1:
    print(S[0])
elif K >= 2:
    if S[0] != "1":
        print(S[0])
    else:
        i = 1
        while S[i] == "1":
            i += 1
        print(S[i])

Submission status: Runtime Error

Solution code:
main():
    S = input()
    K = int(input())
    output = solve(S, K)
    return output

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

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
main():
    S = input()
    K = int(input())
    output = solve(S, K)
    return output

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

Submission status: Runtime Error

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

ans = 1

for i in range(len(S)):
    if int(S[i]) == 1:
        pass
    else:
        ans = int(S[i])
        ones = i
        break

if not ones:
    ones = len(S) + 1
elif K <= ones:
    ans = 1

print(ans)

Submission status: Runtime Error

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

# S = "9999"
# K = 1

ans = 1

for i in range(len(S)):
    if int(S[i]) == 1:
        pass
    else:
        ans = int(S[i])
        ones = i
        break

if not ones:
    ans = 1
elif K <= ones:
    ans = 1

print(ans)

Submission status: Runtime Error

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

# S = "11132"
# K = 2

ans = 1

for i in range(len(S)):
    if int(S[i]) == 1:
        pass
    else:
        ans = int(S[i])
        ones = i
        break

if K <= ones:
    ans = 1

print(ans)

Submission status: Runtime Error

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

ans = 1

for i in range(K):
    if S[i] == 1:
        pass
    else:
        ans = S[i]

print(ans)

Submission status: Runtime Error

Solution code:
# coding: utf-8

s,k = [ input() for i in range(2) ]

count = 0
while s[count]=="1":
    count += 1

if int(k) <= count:
    print(1)
else:
    print(s[count])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

while s[0] == "1":
    del s[0]
    o += 1

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

print(S[1])

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

Submission status: Runtime Error

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

for i in range(K):
    if S[i] != '1':
        print(S[i])
        exit()
elif len(S) > K:
    print(S[K])
else:
    print(S[K-1])

Submission status: Runtime Error

Solution code:
S=str(input())
K=int(input())
if S[0]!= '1':
    print(S[0])
    exit()
    
else:
    count=0
    i=0
    while S[i] == '1':
        count += 1
        i += 1

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
MOD = 1000000007
def fast_power(base, power):
    """
    Returns the result of a^b i.e. a**b
    We assume that a >= 1 and b >= 0

    Remember two things!
     - Divide power by 2 and multiply base to itself (if the power is even)
     - Decrement power by 1 to make it even and then follow the first step
    """

    result = 1
    while power > 0:
        # If power is odd
        if power % 2 == 1:
            result = (result * base) % MOD

        # Divide the power by 2
        power = power / 2
        # Multiply base to itself
        base = (base * base) % MOD

    return result


s = input()
k = int(input())

tyo = 5e15

char = [int(ss) for ss in s]

res = 0

_sum = 0
ok = 0

for i in range(k):
    _sum = _sum + (fast_power(int(s[i]), tyo))
    if _sum >= k and ok == 0:
        res = s[i]
        ok = 1

# for num in char:
#     _sum = _sum + (fast_power(num, tyo))
#     if _sum >= k and ok == 0:
#         res = num
#         ok = 1

print(res)

Submission status: Runtime Error

Solution code:
MOD = 1000000007
def fast_power(base, power):
    """
    Returns the result of a^b i.e. a**b
    We assume that a >= 1 and b >= 0

    Remember two things!
     - Divide power by 2 and multiply base to itself (if the power is even)
     - Decrement power by 1 to make it even and then follow the first step
    """

    result = 1
    while power > 0:
        # If power is odd
        if power % 2 == 1:
            result = (result * base) % MOD

        # Divide the power by 2
        power = power / 2
        # Multiply base to itself
        base = (base * base) % MOD

    return result


s = input()
k = int(input())

tyo = 5e15

char = [int(ss) for ss in s]

res = 0

_sum = 0
ok = 0

for i in range(k):
    _sum = _sum + (fast_power(s[i], tyo))
    if _sum >= k and ok == 0:
        res = s[i]
        ok = 1

# for num in char:
#     _sum = _sum + (fast_power(num, tyo))
#     if _sum >= k and ok == 0:
#         res = num
#         ok = 1

print(res)

Submission status: Runtime Error

Solution code:
s = input()
k,a = int(input()),list()
for c in range(len(s)):
    if s[c] == "1":
        k -= 1
        if k < 0:
            print(1)
            break
    else:
        a.append(s[c])
print(a[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
a=input().split("¥n")
S_len=len(a[0])
K=int(a[1])
for i in range(S_len):
  if(int(a[0][i])==1):
    K-=1
    if(K<=1):
      print("1")
      break
  else:
    print(a[0][i])
    break

Submission status: Runtime Error

Solution code:
    a=input().split("¥n")
    goal=int(a[1])
    keta=len(a[0])
    for i in range(keta):
        if(int(a[0][i])==1):
            goal-=1
            if(goal<0):
                print("1")
                break
        else:
            print(a[0][i])
            break

Submission status: Runtime Error

Solution code:
    a=input().split("¥n")
    goal=int(a[1])
    keta=len(a[0])
    for i in range(keta):
        if(int(a[0][i])==1):
            goal-=1
            if(goal<=0):
                print("1")
                break
        else:
            print(a[0][i])
            break

Submission status: Runtime Error

Solution code:
S=input()
K=int(input())
co=0
for j in S:
	if j!='1' and j<=K:
		print(j)
		co=1
		break
if co==0:
	print('1')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
l=list(map(int,input().split()))
n=l[0]
m=l[1]
q=l[2]
lr=[]
pq=[]
for i in range(m):
    lr.append(input())
for i in range(q):
    pq.append(input())
w=0    
for i in range(q):
    ppqq=list(map(int,pq[i].split()))
    w=0
    for j in range(m):
        llrr=list(map(int,lr[j].split()))
        if llrr[0]>= ppqq[0] and llrr[1]<=ppqq[1]:
            w+=1
    print(w)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S=input()
K=int(input())
for j in S:
	if j=='1':
		if j==K:
			co='1'
			break
	else:
		co=j
		break
print(co)

Submission status: Runtime Error

Solution code:
S = list(map(int,input().split()))
K=int(input())
x=0
i=0
while i in len(S):
  x += pow(S[i],5000000000000000)
  if x<K:
    i=i+1
  elif x==K:
    print(S[i])
  else:
    print(S[i-1])

Submission status: Runtime Error

Solution code:
x=int(input())
k=int(input())
s=0
for i in range(0,20):
    b=int(str(x)[i:i+1])
    if b==1:
        s=s+1
    elif(b>1):
        s=s+1
        c=b
        break;
if (k<s):
    print("1")
else:
    print(c)

Submission status: Runtime Error

Solution code:
s = int(input())
k = int(input())
 
ans=0
 
n  = 5000000000000000
 
S = str(s) #文字列にする
saisho = 0
L = len(S)
 
for i in range(L):
  N = int(S[i])
  if k <= saisho+1:#最初からの文字数
    ans = N
    break
    
  else:
    if N == 1:
      Nn == 1
    else:
      Nn = N**n
    saisho += N**n
    
print(ans)

Submission status: Runtime Error

Solution code:
S = list(map(int,input().split()))
K=int(input())
x=0
i=0
while i in len(S):
  x += pow(S[i],5000000000000000)
    if x<K:
      i=i+1
    elif x==K:
      print(S[i])
    else:
      print(S[i-1])

Submission status: Runtime Error

Solution code:
s = int(input())
k = int(input())
 
ans=0
 
n  = 5000000000000000
 
S = str(s) #文字列にする
L = len(S)
saisho = 0
 
for i in range(L):
  N = int(S[i])
  if N == 1:
    Nn == 1
  else:
    Nn = N**n
    
  if saisho <= k <= saisho + Nn:#最初からの文字数
    ans = N
    break
    
  else:
    saisho += Nn
    
print(ans)

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
import re
s1,s2=re.match('^(1*)([2-9])?',s).groups()
if(s1 and k<=len(s1)):
  print(1)
  else:
    print(s2)

Submission status: Runtime Error

Solution code:
s = int(input())
k = int(input())
 
ans=0
 
n  = 5000000000000000
 
S = str(s) #文字列にする
L = len(S)
saisho = 0
 
for i in range(L):
  N = int(S[i])
  if N == 1:
    Nn == 1
  else:
    Nn = N**n
    
  if saisho <= k <= saisho + Nn:#最初からの文字数
    ans = N
    break
    
  else:
    if N ==1
      Nn ==
    saisho += Nn
    
print(ans)

Submission status: Runtime Error

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

print(n[c])

Submission status: Runtime Error

Solution code:
reina@v157-7-237-130:~/magic/kyogi/Atcoder/abc/b101_125/b106$ cat ./c1.py
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
p=5000000000000000
s=input()
n=int(input())

chk=1
ans=f=0
for i in s:
    chk=1
    if i=="1": 
        ans+=1
        continue
    for j in range(p-1):
        chk*=int(i)
        if ans+chk>=p:
            print(i)
            f=1
            break
    ans+=chk
    if f==1: break
if f==0: print(s[-1])

Submission status: Runtime Error

Solution code:
#107c
s=int(input())
k=int(input())
ans=[]

for i in range(k)
    if s[i]=='1':
        ans.append('1')
    elif s[i]=='2':
        ans.extend('2'*2)
    elif s[i]=='3':
        ans.extend('3'*3)
    elif s[i]=='4':
        ans.extend('4'*4)
    elif s[i]=='5':
        ans.extend('5'*5)
    elif s[i]=='6':
        ans.extend('6'*6)
    elif s[i]=='7':
        ans.extend('7'*7)
    elif s[i]=='8':
        ans.extend('8'*8)
    elif s[i]=='9':
        ans.extend('9'*9)
print(ans[k-1])

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
num = int(S[0])^(5*10^16)
if len(S) > 1:
    i = 1
    while num < K:
        num += int(S[i]) ^ (5 * 10 ^ 16)
        i += 1
    print(S[i])
elif len(S) == 1:
    print(S)

Submission status: Runtime Error

Solution code:
reina@v157-7-237-130:~/magic/kyogi/Atcoder/abc/b101_125/b106$ cat ./c1.py
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
p=5000000000000000
s=input()
n=int(input())

chk=1
ans=f=0
for i in s:
    chk=1
    if i=="1": 
        ans+=1
        continue
    for j in range(p-1):
        chk*=int(i)
        if ans+chk>=p:
            print(i)
            f=1
            break
    ans+=chk
    if f==1: break
if f==0: print(s[-1])
reina@v157-7-237-130:~/mag

Submission status: Runtime Error

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

if k==1:
    print(s[0])
elif s[0]=="1" and s[1]=="1":
    if s[2]=="1":    
        if k<3:
            print("1")
        else:
            print(s[3])
    else:
        if k<2:
            print("1")
        else:
            print(s[2])
elif s[1]!="1" and s[2]!=1:
    if s[0]=="1" :
        if k <= (10**18):
            print(s[1])
        else :
            print(s[2])
    else:
        if k <= (10**18):
            print(s[0])
        else:
            print(s[1])

Submission status: Runtime Error

Solution code:
#107c
s=int(input())
k=int(input())
ans=[]

for i in range(1e*18)
    if s[i]=='1':
        ans.append('1')
    elif s[i]=='2':
        ans.extend('2'*2)
    elif s[i]=='3':
        ans.extend('3'*3)
    elif s[i]=='4':
        ans.extend('4'*4)
    elif s[i]=='5':
        ans.extend('5'*5)
    elif s[i]=='6':
        ans.extend('6'*6)
    elif s[i]=='7':
        ans.extend('7'*7)
    elif s[i]=='8':
        ans.extend('8'*8)
    elif s[i]=='9':
        ans.extend('9'*9)
print(ans[k-1])

Submission status: Runtime Error

Solution code:
c = copy.deepcopy(b)
d = 0
if k < len(b):
  c.sort()
  print(b)
  for i in range(k):
    if b[i] > 1 :
      print(b[i])
      d = 1
    if d == 0 and i == k-1:
      print(1)
else:
  for i in range(len(b)):
    if b[i] > 1 :
      print(b[i])
      break

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
flag = False
check = True
for i in S:
    if(int(i) != 1):
        check = False
        print(i)
        flag = True
        break
    else:
        if(check == True and S[K-1]==1):
            break

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

Submission status: Runtime Error

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

a=[]
while S !=0:
  s=S%10
  a.append(s)
  S //=10
m=0

for i in range(1,len(a)+1):
  if a[-i]!=1:
    ans=i
    break

print(a[-ans])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if s[0] != "1":
  print(s[0])
elif s[1] != "1":
  print(s[1])
elif s[2] != "1":
  print(s[2])
elif s[3] != "1":
  print(s[3])

Submission status: Runtime Error

Solution code:
n=input()
k=int(input())
for i in range(k):
	n=n.strip('1')
print(n[0])

Submission status: Runtime Error

Solution code:
a=input().split("¥n")
K=int(a[1])
S_len=len(a[0])
for i in range(S_len):

    if(int(a[0][i])==1):
        K-=1
        if(K<=0):
            print("1")
            break

    elif(int(a[0][i])==2):
        K2=format(K,'b')
        K2_len=len(K2)
        K2_len-=5000*10000*10000*10000
        if(K2_len<=0):
            print("2")
            break
        K=pow(2, K2_len)

    else:
        print(a[0][i])
        break