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:
def CountOne_NextDigit(numbers):
    if len(numbers) == 0:
        return 0, 0
    count = 0
    i = 0
    while numbers[i] == 1:
        count +=1
        i +=1
    return count, numbers[i]

x = raw_input()
K = int(raw_input())

if len(x) > 100:
    x = x[:100]
numbers = map(int, [n for n in x])
nOnes, d = CountOne_NextDigit(numbers)

if nOnes >= K:
    print 1
else:
    print d

Submission status: Runtime Error

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

ans = 0
if len(S) == 1:
    ans = S[0]
else:
    i = 0
    while S[i] == '1':
        i += 1
    ans = S[i]
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
# import math

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

ps = []

for s in S:
    i = int(s)
    if(i == 1):
        p = -1
    else:
        p = 5*(10**15) * math.log2(i)
    ps.append(p)

sum = 0
index = 0
    
if K == 1:
    print(S[0])
else:
    for p in ps:

        if not p == -1:
            sum += p
        else:
            K -= 1

        if math.log2(K) < sum:
            #print(index)
            print(S[index])
            break
        index += 1

Submission status: Runtime Error

Solution code:
def CountOne_NextDigit(numbers):
    count = 0
    i = 0
    while numbers[i] == 1:
        count +=1
        i +=1
    return count, numbers[i]

x = raw_input()
K = int(raw_input())

assert len(x)>0
if len(x) > 100:
    x = x[:100]
numbers = map(int, [n for n in x])
nOnes, d = CountOne_NextDigit(numbers)

if nOnes >= K:
    print 1
else:
    print d

Submission status: Runtime Error

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

if int(S[0]) != 1:
  Ans = S[0]
elif int(S[1]) !=1:
  Ans = S[1]
elif int(S[2]) !=1:
  Ans = S[2]
elif int(S[3]) !=1:
  Ans = S[3]
elif int(S[4]) !=1:
  Ans = S[4]
else:
  Ans = S[5]

print(Ans)

Submission status: Runtime Error

Solution code:
# your code goes here
S = str(input())
K = int(input())
#print(S, K)
count = 0
while(S[count] == "1" and count < len(S)):
	count += 1
if(K <= count):
	print("1")
else:
	print(S[count])

Submission status: Runtime Error

Solution code:
# your code goes here
S = str(input())
K = int(input())
#print(S, K)
count = 0
while(S[count] == "1" and count <= len(S)):
	count += 1
if(K <= count):
	print("1")
else:
	print(S[count])

Submission status: Runtime Error

Solution code:
n=int(input())
k=int(input())
j=0
for i in range(100,-1,-1):
  if(int(n%pow(10,i))==0):
  else:
    s.append(int(n%pow(10,i)))
    n-=s[j]
    j+=1
if(s[0]=1):
  print(s[1])
else:
  print(s[0])

Submission status: Runtime Error

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

if k==1:
    print(s[0])
    
else:
    for i in range(len(s)):
        if s[i]!="1":
            break
    if i!=1 and k<=i:
        print(1)
    elif i!=1 and k>i:    
        print(s[i+1])
        
    elif s[0]=="1" and s[1]!="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:
S = input()
K = input()
count = 0
for i in range(len(S)):
    if S[i]=="1":
        count+=1
    else:
        break
        
print(1) if K <= count else print(S[count])

Submission status: Runtime Error

Solution code:
# your code goes here
S = str(input())
K = int(input())
#print(S, K)
count = 0
while(S[count] == "1" and count <= K):
	count += 1
if(K <= count):
	print("1")
else:
	print(S[count])

Submission status: Runtime Error

Solution code:
def CountOne_NextDigit(numbers):
    count = 0
    i = 0
    while numbers[i] == 1:
        count +=1
        i +=1
    return count, numbers[i]

x = raw_input()
K = int(raw_input())

numbers = map(int, [n for n in x])
nOnes, d = CountOne_NextDigit(numbers)

if nOnes >= K:
    print 1
else:
    print d

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
#include<stdio.h>
int main(void)
{
    char s[101]; 
    unsigned long k;
    scanf("%s",&s);
    scanf("%u,&k);
    int len=0;
    int i;
    char ans[2]="1";
    while(s[len++])
    int c=len<k?k:len;
    for(i=0;i<c;i++)
    {
        if(s[i]!='1')
            {ans[0]=s[i];  break;}
    }
    printf("%s",ans);
return 0;
}

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

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

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
flag = False
for x,i in enumerate(S):
    if(5000000000000000<=K):
        if(int(i) != 1):
            print(i)
            flag = True
            break
    else:
        if(int(i)!=1):
            print(S[x+1])
            flag = True
            break
if(flag == False):
    print("1")

Submission status: Runtime Error

Solution code:
def mrinfinit(a):
    if len(a) > 1:
        if '1' in a:
            a = a.replace('1', '')
            return a[0]
        else:
            return a[0]
    return a[0]


if __name__ == '__main__':
    la = input()
    lb = int(input())
    print(mrinfinit(la))

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):
  m += a[-i]*5000000000000000
  if m>=K:
    ans=i
    break
print(a[-ans])

Submission status: Runtime Error

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


def main():
    s = input()
    k = int(input())
    one_count = 0

    for si in s:
        if si == '1':
            one_count += 1
        else:
            break

    if s[0] == '1':
        if k == 1:
            print(s[0])
        elif one_count >= k:
            print(1)
        elif one_count < k:
            print(s[k - 1])
        else:
            print(s[1])
    else:
        print(s[0])


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
# coding:utf-8
s=input()
k=int(input())
list=list(s)
ans=1
for i in range(min(k,list.len())):
    if not list[i] == 1:
        ans=list[i]
        break
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

def moji(d):
    n = int(d)
    mojiretsu = str(d)
    mojiretsu = mojiretsu * n
    return mojiretsu

if int(len(S)) != 1:
    s = [S]
    for i in range(0,20):
        m_kari = ''
        for j in s[i]:
            m_kari += moji(int(j))
        s.append(m_kari)        
    print(s[19][K])
else:
    print(S)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def mrinfinit(a, b):
    if len(a) > 1:
        if '1' in a:
            a = a.replace('1', '')
            return a[0]
        else:
            return a[0]
    return a[0]


if __name__ == '__main__':
    la = input()
    lb = int(input())
    print(mrinfinit(la, lb))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import logging
import time
import math


class Solver:
    def __init__(self):
        self.s = ''
        self.k = 0

    # 入力
    def input_value(self):
        # self.n = int(input())
        # self.A, self.B = map(int, input().split())
        # self.A = list(map(int, input().split()))
        # self.a, self.b, self.c = map(int, [input() for i in range(4)])
        # self.t = [None] * self.n
        self.s = input()
        self.k = int(input())


    @staticmethod
    def run(s, k):
        # count = [None] * len(s)
        sum = 0
        for i in range(len(s) + 1):
            # count[i] = int(s[i]) ** (5 * 10 ** 15)
            # sum += int(s[i]) ** (5 * 10 ** 15)
            sum += (5 * 10 ** 15) * math.log10(int(s[i]))
            if sum >= math.log10(k):
                return s[i]
        return s[len(s)]

    @staticmethod
    def test():
        start_time = time.time()

        assert Solver.run('1214', 4) == '2', 'Error.'
        assert Solver.run('3', 157) == '3', 'Error.'
        assert Solver.run('299792458', 9460730472580800) == '2', 'Error.'

        elapsed_time = time.time() - start_time
        logging.debug('elapsed_time: {0}'.format(elapsed_time) + '[sec]')


if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)

    solver = Solver()
    # Solver.test()

    solver.input_value()
    ans = solver.run(solver.s, solver.k)
    print(ans)

Submission status: Runtime Error

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

value = 5000000000000000
pos = 0

if k <= value:
     while True:
         if s[pos] != '1':
             print(s[pos])
             break
         else:
             pos += 1

else:
    tmp = 0
    pos = 0
    while True:
        if s[pos] != '1':
            if int(s[pos]) + tmp > k // value:
                print(s[pos])
                break
            else:
                pos += 1
                tmp += int(s[pos])

Submission status: Runtime Error

Solution code:
def mrinfinit(a, b):
    if len(a) >= 1:
        if '1' in a:
            a = a.replace('1', '')
            return a[0]
        else:
            return a[0]
    return a[0]


if __name__ == '__main__':
    la = input()
    lb = int(input())
    print(mrinfinit(la, lb))

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
if K == 1:
	print(S[0])
	exit()
i = 0
while S[i] == "1":
	i += 1
print(S[i])

Submission status: Runtime Error

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

if int(s[0]) == 1:
  one_count = 0
  i = 0
  while int(s[i]) == 1:
    one_count += 1
    i += 1
  if k <= one_count:
    print(1)
  else:
    print(s[one_count])
else:
  print(s[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = int(input())
K = int(input())
if K == 1:
	print(S[0])
	exit()
i = 0
while S[i] == "1":
	i += 1
print(S[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
time = 5 * 10**15

num = list(input())
k = int(input())

chk = 0
count = 0
while chk == 0:
    if num[0] == '1':
        num.pop(0)
        count += 1
    else:
        chk = 1

if k <= count:
    print(1)
else:
    print(num[0])

Submission status: Runtime Error

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

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

def moji(d):
    n = int(d)
    mojiretsu = str(d)
    mojiretsu = mojiretsu * n
    return mojiretsu

s = [S]
for i in range(0,20):
    m_kari = ''
    if int(len(s[i])) < 20:
        for j in s[i]:
            m_kari += moji(int(j))
        s.append(m_kari)
    else:
        for j in range(0,21):            
            m_kari += moji(int(s[i][j]))
        s.append(m_kari)

print(s[19][K])

Submission status: Runtime Error

Solution code:
import collections

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

tmp = []
cum_p = [0.0]

for s in S:
    tmp.append(int(s))
total = sum(tmp)

for p in tmp:
    cum_p.append(cum_p[-1] + (p / total))

prob = K / (5*10e16)

for i in range(1, len(S) + 1):
    if prob < cum_p[i]:
        if S[i-1] == '1':
            print(S[i])
        else:
            print(S[i-1])
        break

Submission status: Runtime Error

Solution code:
def main():
    s = input().rstrip()
    k = int(input().rstrip())

    if s[0] != '1':
        print(s[0])
        return

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

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

Submission status: Runtime Error

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

S = input()
N = int(input())

def moji(d):
    n = int(d)
    mojiretsu = str(d)
    mojiretsu = mojiretsu * n
    return mojiretsu

s = [S]
for i in range(0,10):
    m_kari = ''
    if int(len(s[i])) < 20:
        for j in s[i]:
            m_kari += moji(int(j))
        s.append(m_kari)
    else:
        for j in range(0,21):            
            m_kari += moji(int(s[i][j]))
        s.append(m_kari)

print(s[9][N])

Submission status: Runtime Error

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

ok = True
for a in range(k):
    if int(s[a]) != 1:
        print(s[a])
        ok = False
        break

if ok:
    print(s[k])

Submission status: Runtime Error

Solution code:
import math

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

ps = []

for s in S:
    i = int(s)
    if(i == 1):
        p == -1
    else:
        p = 5*(10**15) * math.log2(i)
    ps.append(p)

sum = 0
index = 0
for p in ps:
    if not p == -1:
        sum += p
    else:
        K -= 1
        
    if math.log2(K) < sum:
        print(S[index])
        break
        
    index += 1

Submission status: Runtime Error

Solution code:
s=input()
k=input()
a=int(s[0])

for num in range(0,max(len(s),k)):
    if int(s[num])==1:
        print(1)
    else:
        print(s[num])

Submission status: Runtime Error

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

if all(s[i] == '1' for i in range(k + 1)):
    print(1)

print(s.replace('1', '')[0])

Submission status: Runtime Error

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

for i in range(len(S)):
    if (int(S[i]) == 1):
        continue
    if (int(S[i]) >= 2):
        ans = int(S[i])
    break

print(ans)

Submission status: Runtime Error

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

s = list(set(map(int,S)))
s.sort

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

Submission status: Runtime Error

Solution code:
inp = [input() for _ in range(2)]
s = inp[0]
k = int(inp[1])
i = 0

while True:
  if s[i] == "1":
    i += 1
  else:
    ans = int(s[i])
    break

if i >= k:
  print(1)
else:
  print(ans)

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
it=int(-1)
sum=int(0)
for i in s:
    if i == '1':
        sum+=1
    else:
        it=i

if k<=int(it):
    print(1)
elif it == int(-1):
    print(1)
else:
    print(s[it])

Submission status: Runtime Error

Solution code:
def main():
    s = input().rstrip()
    k = int(input().rstrip())

    if s[0] != '1':
        print(s[0])
        return

    cnt = 0
    for a in s:
        if a == '1':
            cnt += 1

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

Submission status: Runtime Error

Solution code:
S = int(input())
K = int(input())
l = [int(x) for x in list(str(S))]
length = len(l)
flag=0
i=0
ans = 0
while flag ==0:
    if l[i] == 1 or l[i]==0:
        i = i + 1
    else:
        flag=1
        ans = l[i]
if len(l)>=K:
    ans = l[K-1]
print(ans)

Submission status: Runtime Error

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

s = input().strip()
k = int(input().strip())

flag = True
for i in range(k):
    if s[i] == '1':
        print(s[i])
        flag = False

if flag:
    print(s[1])

Submission status: Runtime Error

Solution code:
S = input()
K = input()
if len(K) > 100:
    K = 110
else:
    K = int(K)


def main():
    if S[0] != '1':
        print(S[0])
        return

    i = 0
    while S[i] == '1':
        i += 1

    if K < i:
        print('1')
        return

    print(S[i])


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
it=int(-1)
sum=int(0)
for i in s:
    if i == '1':
        sum+=1
    else:
        it=i

if k<=it:
    print(1)
elif it is -1:
    print(1)
else:
    print(s[it])

Submission status: Runtime Error

Solution code:
from fractions import gcd
from sys import stdin
import math 
S = str(input())
K = int(input())
ans = 1

for itr in range(100):
    if S[itr] != '1':
        ans = int(S[itr])  
        break
    if itr == K:
        break

print(ans)

Submission status: Runtime Error

Solution code:
S = int(input())
K = int(input())
l = [int(x) for x in list(str(S))]
length = len(l)
flag=0
i=0
ans = 0
while flag ==0:
    if l[i] == 1 or l[i]==0:
        i = i + 1
    else:
        flag=1
        ans = l[i]
if len(l)>=K:
    ans = S[K-1]
print(ans)

Submission status: Runtime Error

Solution code:
S = list(input())
N, = list(map(int,input().split()))

ans = 1

for i in range(len(S)):
    if  not S[i] == '1':
        ans = int(S[i])
        break

if  len(S) == 1:
    ans = int(S[1])
        
print(ans)

Submission status: Runtime Error

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

s = input().strip()
k = input().strip()

flag = True
for i in range(k):
    if s[i] == '1':
        print(s[i])
        flag = False

if flag:
    print(s[1])

Submission status: Runtime Error

Solution code:
s = list(map(int, list(str(input()))))
k = int(input())
i = 0
while s[i] == 1:
  i += 1
if k <= i:
  print(1)
else:
  print(s[i])

Submission status: Runtime Error

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

S = input()
N = int(input())

def moji(d):
    n = int(d)
    mojiretsu = str(d)
    mojiretsu = mojiretsu * n
    return mojiretsu

s = [S]
for i in range(0,10):
    m_kari = ''
    for j in s[i]:
        m_kari += moji(int(j))
    s.append(m_kari)

print(s[9][N])

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
if s[:k]=="1"*k:
    print("1")
else:
    i=0
    while True:
        if s[i]!="1":
            print(s[i])
            break
        i+=1

Submission status: Runtime Error

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

Submission status: Runtime Error

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


def main():
    if S[0] != '1':
        print(S[0])
        return

    i = 0
    while S[i] == '1':
        i += 1

    if K < i:
        print('1')
        return

    print(S[i])


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
S = int(input())
l = [int(x) for x in list(str(S))]
K = int(input())
length = len(l)
flag=0
i=0
ans = 0
while flag ==0:
    if l[i] == 1:
        i = i + 1
    else:
        flag=1
        ans = l[i]
if len(S)>=K:
    ans = S[K-1]
print(ans)

Submission status: Runtime Error

Solution code:
s = input()
k = input()
M = 5000000000000000
nlen = 0
i = 0
if s[i] != "1":
    print(s[i])
else:
    while s[i] == "1":
        i += 1
        nlen += 1
        if nlen == (int(k)-1):
            break
    print(s[i])

Submission status: Runtime Error

Solution code:
#C
S=input()
K=int(input())
num='23456789'
if S[0]!='1':
    print(1)
else:
    n=1
    while True:
        if n==len(S):
            n-=1
            break
        elif S[n]!='1':
            break
        n+=1
if K-1<n:
    print(1)
else:
    print(int(S[n]))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#C
S=input()
K=int(input())
num='23456789'
if S[0]!='1':
    print(1)
else:
    n=1
    while True:
        if n==len(S):
            n-=1
            break
        elif S[n]!='1':
            break
        n+=1
if K-1<n:
    print(1)
else:
    print(S[n])

Submission status: Runtime Error

Solution code:
S=list(input())
K=int(input())
idx=[-1]*10
for i in '123456789':
    if i in S:
        idx[int(i)] = S.index(i)+1
if K < max(idx[2:]):
    print(1)
else:
    print(S[min(i for i in idx[2:]if i>0)-1])

Submission status: Runtime Error

Solution code:
S=str(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])
else:
    print(S[4])

Submission status: Runtime Error

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

s = input().strip()
k = input().strip()

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

Submission status: Runtime Error

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

x = 0
ans1 = []
while True:
    if s[x] == '1':
        ans1.append(x+1)
        x += 1
    else:
        break

if k in ans1:
    print('1')
else:
    print(s[x])

Submission status: Runtime Error

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

i = 0
while s[i] == 1 and k > 0:
    k -= 1
    i += 1
print(s[i])

Submission status: Runtime Error

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

A = S.count('1')

for i in range(0,A):
    S.remove('1')

print(S[0])

Submission status: Runtime Error

Solution code:
s = input()
k = input()
M = 5000000000000000
nlen = 0
i = 0
if s[i] != "1":
    print(s[i])
else:
    while s[i] == "1":
        i += 1
        nlen += 1
        if nlen == int(k):
            break
    print(s[i])

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
long long ta[399999];

int main()
{
    string str;
    cin >> str; 
    long long n;
    cin >> n;
    int ii;
    int a=0;
    for(int i=0; i<str.size(); i++){
        if(str[i] != '1'){
            ii = i;
            a =  str[i] - 48;
            break;
        }
    }
    if(n <= ii){ cout << 1 <<endl;}
    else{ cout << a <<endl;}
}

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

ans()

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
s = input()
k = int(input())

ones = 0
i = 0
while s[i] == '1':
    ones += 1
    i += 1

if ones >= k:
    print('1')
else:
    print(s[i])

Submission status: Runtime Error

Solution code:
S = list(input())
K = int(input())
if K == 1:
    print(S[0])
else:
    x = 0
    while int(S[x]) == 1:
        x += 1
    print(S[x])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
s=list(input())
for i in range(100):
    if s[i] == '1':
        continue
    else :
        print(s[i])
        break

Submission status: Runtime Error

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

st=str(s)
l=len(st)
i=0
a=0
n=0
m=0

while n<1:
    if int(st[m])==1:
        m+=1
        a+=1
    else:
        n=1

if a>=k:
    print(1)

else:
    while i<=l:
        if int(st[i])!=1:
            print(int(st[i]))
            i=l+1
        else:
            i+=1

Submission status: Runtime Error

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

for (i, s) in enumerate(S):
    if s != '1':
        one_length = i
        next_num = s
        break

if one_length < K:
    print(str(next_num))
else:
    print('1')

# 1 or 一つ目の1以外

Submission status: Runtime Error

Solution code:
import math
N = 5000000000000000
print(N)
S = input()
K = int(input())
for i in S:
  num = int(i)
  if N * math.log(num) > math.log(K):
    print(num)
    break
  else:
    K -= num

Submission status: Runtime Error

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

s = ''
for i in S:
    s += i
    if i != '1':
        break

if K > len(s):
    print(s[-1])
else:
    print(s[K])

Submission status: Runtime Error

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

for i,a in enumerate(s):
    if (a != '1' and k>i) or k==i:
        ans = int(a)
        break

print (ans)

Submission status: Runtime Error

Solution code:
A = raw_input()
C = raw_input()

B = int(C)

num = map(int, str(A))

i = 0

while num[i] == 1:
  i = i +1

  
if i < B:
  print num[i]
elif i > B-1:
  print 1

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

st=str(s)
l=len(st)
i=0
a=0
n=0
m=0

while n<1:
    if int(st[m])==1:
        m+=1
        a+=1
    else:
        n=1

if a==k:
    print(1)

else:
    while i<=l:
        if int(st[i])!=1:
            print(int(st[i]))
            i=l+1
        else:
            i+=1

Submission status: Runtime Error

Solution code:
i = int(input())
K=int(input())
lst = []
while i > 0:
    lst.append(i%10)
    i //= 10 # 必須
lst.reverse()
j=0
while 1:
    if lst[j] == 1 and j == K:
        print(1)
        break
    if not lst[j] == 1:
        print(lst[j])
        break
    if j == 100:
        print(1)
        break
    j+=1

Submission status: Runtime Error

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

if k == '1':
    print(s[0])
else:
    n = int(k)-1
    f = True
    for i in range(n):
        if s[i] != '1':
            print(s[i])
            f = False
    if f:
        print(s[n])

Submission status: Runtime Error

Solution code:
S = list(input().split())

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

Submission status: Runtime Error

Solution code:
ss=input()
l=len(s)
if s=="1"*l:
    print("1")
else:
    i=0
    while True:
        if s[i]!="1":
            print(s[i])
            break
        i+=1

Submission status: Runtime Error

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

# 文字列を一文字ずつのリストに代入 test は['t', 'e', 's', 't']
mojiretsu = list(input())

# いっこ入力
k =int(input())

ii=0

#print(len(mojiretsu))
for i in range(0,len(mojiretsu)):
    if mojiretsu[i] != '1':
        ii = i
        a = mojiretsu[i]
        break

# print(i)

if k <= ii:
    print(1)
else:
    print(a)

Submission status: Runtime Error

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

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

if S[x]=="1":
    print(1)

elif K<x+1:
    print(1)

else:
    print(S[x])

Submission status: Runtime Error

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

i=0
while(s[i]=="1"):
    if i==99:
        break
    i +=1
    
if k<i:
    print(1)
else:
    print(s[i])

Submission status: Runtime Error

Solution code:
import sys

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


i=0
while i<=k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        sys.exit()
print("1")

Submission status: Runtime Error

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


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

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


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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


def solve():
    s = input()
    n = int(input())
    idx = 0
    while s[idx] == "1":
        idx += 1
    if idx == len(s):
        print(1)
    else:
        print(s[idx])


if __name__ == "__main__":
    solve()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
key = 1
i = 0
while True:
    if i > 100:
        break
    if int(S[i]) != 1:
        print(S[i])
        key = 1
        break
    i += 1

if key == 0:
    print(S[0])

Submission status: Runtime Error

Solution code:
# your code goes here
S = str(input())
K = int(input())
#print(S, K)
count = 0
while(S[count] == "1"):
	count += 1
if(K <= count):
	print("1")
else:
	print(S[count])

Submission status: Runtime Error

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

while s[0] == 1 and k > 0:
    k -= 1
    s = s[1:]
print(s[0])

Submission status: Runtime Error

Solution code:
import sys

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


i=0
while i<k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        sys.exit()
print(s[i])

Submission status: Runtime Error

Solution code:
s =  int(input())
k =  int(input())
#print(pow(10, 12))
def main(string_s):
    if str(s).lstrip('1')[0] == '2':
        print('2')
    elif str(s).lstrip('1')[0] == '3':
        print('3')
    elif str(s).lstrip('1')[0] == '4':
        print('4')
    elif str(s).lstrip('1')[0] == '5':
        print('5')
    elif str(s).lstrip('1')[0] == '6':
        print('6')
    elif str(s).lstrip('1')[0] == '7':
        print('7')
    elif str(s).lstrip('1')[0] == '8':
        print('8')
    elif str(s).lstrip('1')[0] == '9':
        print('9')
    else:
        print('1')

main(s)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

if key == 0:
    print(S[0])

Submission status: Runtime Error

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

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