Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = [list(input().split()) for i in range(m)]
wa = [0]*(10**5)
ac = [0]*(10**5)
WA = 0
for i in range(m):
    p, s = input().split()
    P = int(p)
    if ac[P] != 1:
        if s == "WA":
            wa[P] += 1
        else:
            ac[P] += 1
            WA += wa[P]
print(sum(ac), WA)

Fixed submission:
n, m = map(int, input().split())
wa = [0]*(10**5)
ac = [0]*(10**5)
WA = 0
for i in range(m):
    p, s = input().split()
    P = int(p)
    if ac[P] != 1:
        if s == "WA":
            wa[P] += 1
        else:
            ac[P] += 1
            WA += wa[P]
print(sum(ac), WA)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
a, b = map(int, input().split())
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
print(lcm(a, b))

Fixed submission:
from fractions import gcd
a, b = map(int, input().split())
def lcm(x, y):
    return (x * y) // gcd(x, y)
print(lcm(a, b))

Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
print(lcm(a, b))

Fixed submission:
from fractions import gcd
a, b = map(int, input().split())
def lcm(x, y):
    return (x * y) // gcd(x, y)
print(lcm(a, b))
Buggy python submission (verdict: Runtime Error):
n = int(input())
def F(n):
    if n < 2:
        return 1
    return n*F(n-2)
i = 0
f = F(n)
while f%2==0:
    f=f/2
    i += 1

j = 0
while f%5==0:
    f=f/5
    j += 1
print(min(i,j))

Fixed submission:
N = int(input())
n = N
count = 0
i = 0
if n%2 == 0:
    while n >= 10*(5**i):
        count += n//(10*(5**i))
        n = N
        i += 1
    print(count)
else:
    print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())

for i in range(1, n+1):
    if 100*i <= n <= 105*i:
        print(1)
        exit()

print(0)

Fixed submission:
m1, d2 = map(int, input().split())
m2, d2 = map(int, input().split())

if m2 - m1 == 1:
    print(1)

if m2 - m1 == 0:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(1, n):
    ans += i
print(ans)

Fixed submission:
n = int(input())
if n%2 != 0:
    print(n*(n//2))
else:
    print(n*(n//2) - n//2)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(1, n):
    ans += i%(i+1)
print(ans)

Fixed submission:
n = int(input())
if n%2 != 0:
    print(n*(n//2))
else:
    print(n*(n//2) - n//2)
Buggy python submission (verdict: Time Limit Exceeded):
import copy

n = int(input())
l = [int(input()) for i in range(n)]
for i in range(n):
    s = l[:i]+l[i+1:]
    print(sorted(s)[-1])

Fixed submission:
import copy

n = int(input())
l = [int(input()) for i in range(n)]
Max1 = sorted(l)[-1]
Max2 = sorted(l)[-2]
for i in range(n):
    if l[i] == Max1:
        print(Max2)
    else:
        print(Max1)

Buggy python submission (verdict: Time Limit Exceeded):
import copy

n = int(input())
l = [int(input()) for i in range(n)]
for i in range(n):
    s = l[:i]+l[i+1:]
    print(max(s))

Fixed submission:
import copy

n = int(input())
l = [int(input()) for i in range(n)]
Max1 = sorted(l)[-1]
Max2 = sorted(l)[-2]
for i in range(n):
    if l[i] == Max1:
        print(Max2)
    else:
        print(Max1)

Buggy python submission (verdict: Time Limit Exceeded):
import copy

n = int(input())
l = [int(input()) for i in range(n)]
for i in range(n):
    s = copy.copy(l)
    s.pop(i)
    print(max(s))

Fixed submission:
import copy

n = int(input())
l = [int(input()) for i in range(n)]
Max1 = sorted(l)[-1]
Max2 = sorted(l)[-2]
for i in range(n):
    if l[i] == Max1:
        print(Max2)
    else:
        print(Max1)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
mod = 10**9+7
dp = [0]*(n+1)
dp[0], dp[1] = 1, 1
if 1 in a:
    dp[1] = 0
for i in range(2, n+1):
    if i not in a:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
print(dp[n])

Fixed submission:
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
mod = 10**9+7
dp = [1]*(n+1)
for i in a:
    dp[i] = 0
for i in range(2, n+1):
    if dp[i] > 0:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
ss = s
for i in range(len(s)):
    if "10" or "01" in s:
        s = s.replace("10", "")
        s = s.replace("01", "")
print(len(ss)-len(s))

Fixed submission:
s = input()
c1, c2 = 0, 0
for i in s:
    if i == "0":
        c1 += 1
    else:
        c2 += 1
print(min(c1, c2)*2)
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = [input() for i in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j]=="#":
            ans = "No"
            for x, y in [(-1, 0), (0, -1), (0, 1), (1, 0)]:
                if  0<=i+x<h and 0<=j+y<w and s[i+x][j+y]=="#":
                    ans = "Yes"
            if ans == "No":
                print(ans)
                exit()
print(ans)

Fixed submission:
h, w = map(int, input().split())
s = ["."*(w+2)]+["."+input()+"." for i in range(h)]+["."*(w+2)]
for i in range(1, h+1):
    for j in range(1, w+1):
        if s[i][j]=="#" and s[i-1][j]==s[i][j-1]==s[i][j+1]==s[i+1][j]==".":
            print("No")
            exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(map(int, input().split()))

if "Y" in s:
    print("Four")
else:
    print("Three")

Fixed submission:
n = int(input())
s = list(input().split())

if "Y" in s:
    print("Four")
else:
    print("Three")
Buggy python submission (verdict: Runtime Error):
n, Y = map(int, input())
for x in range(2001):
    for y in range(2001):
        z = n-x-y
        if (x*10000 + y*5000 + z*1000) == Y:
            print(x, y, z)
            exit()
print(-1, -1, -1)

Fixed submission:
n, Y = map(int, input().split())
for x in range(n+1):
    for y in range(n-x+1):
        z = n-x-y
        if (x*10000 + y*5000 + z*1000) == Y:
            print(x, y, z)
            exit()
print(-1, -1, -1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 31):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
            break
print(min(l))

Fixed submission:
s = input()
print(s.count("1"))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 30):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
            break
print(min(l))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 31):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
            break
print(min(l))

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 20):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
            break
print(min(l))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 31):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
            break
print(min(l))

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 11):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
            break
print(min(l))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 31):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
            break
print(min(l))

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 10):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
print(min(l))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
l = []
for i in a:
    count = 0
    for j in range(1, 31):
        if i%(2**j) == 0:
            count += 1
        else:
            l.append(count)
            break
print(min(l))
Buggy python submission (verdict: Runtime Error):
a.sort(reverse=True)
ans = []
for i in range(n-1):
    if a[i] == a[i+1]:
        ans.append(a[i])
ans1 = set(ans)
ans2 = sorted(ans1, reverse=True)
if len(ans1) == 1 and a.count(ans[0]) >= 4:
    print(ans[0]**2)
elif len(ans1) >= 2:
    print(ans2[0]*ans2[1])
else:
    print(0)

Fixed submission:
import collections
n = int(input())
a = list(map(int, input().split()))
a = collections.Counter(a)
ans = []
for i, j in a.items():
    if j >= 2:
        for _ in range(j):
            ans.append(i)
ans.sort(reverse=True)
if len(ans) == 0:
    print(0)
else:
    print(ans[0]*ans[3])
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())

alice = []
bob = []
for i in range(a, b+1):
    alice.append(i)
#print(alice)
for j in range(c, d+1):
    bob.append(j)
#print(bob)

combine_alice_bob = alice + bob
#print(combine_alice_bob)
for i in range(len(alice)):
    for j in range(len(bob)):
        if (alice[i]==bob[j] and alice[i+1]==bob[j+1]) or (bob[i]==alice[j] and bob[i+1]==alice[j+1]):
            alice_bob = set(combine_alice_bob)
            print(len(combine_alice_bob)-len(alice_bob)-1)
            exit()
        elif alice[0]==bob[j] and alice[-1]==bob[j]:
            print(len(alice)-1)
            exit()
        elif bob[0]==alice[j] and bob[-1]== alice[j]:
            print(len(bob)-1)
            exit()
print(0)

Fixed submission:
a, b, c, d = map(int, input().split())

alice = []
bob = []
for i in range(a, b+1):
    alice.append(i)
#print(alice)
for j in range(c, d+1):
    bob.append(j)
#print(bob)

count=0
for i in range(len(alice)):
    if alice[i] in bob:
        count += 1

if count>0:
    print(count-1)
else:
    print(count)

Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())

alice = []
bob = []
for i in range(a, b+1):
    alice.append(i)
#print(alice)
for j in range(c, d+1):
    bob.append(j)
#print(bob)

combine_alice_bob = alice + bob
#print(combine_alice_bob)
for i in range(len(alice)):
    for j in range(len(bob)):
        if (alice[i]==bob[j] and alice[i+1]==bob[j+1]) or (bob[i]==alice[j] and bob[i+1]==alice[j+1]):
            alice_bob = set(combine_alice_bob)
            print(len(combine_alice_bob)-len(alice_bob)-1)
            exit()

print(0)

Fixed submission:
a, b, c, d = map(int, input().split())

alice = []
bob = []
for i in range(a, b+1):
    alice.append(i)
#print(alice)
for j in range(c, d+1):
    bob.append(j)
#print(bob)

count=0
for i in range(len(alice)):
    if alice[i] in bob:
        count += 1

if count>0:
    print(count-1)
else:
    print(count)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
t = [int(input()) for i in range(n)]
print(lcm_list(t))

Fixed submission:
from fractions import gcd
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
t = [int(input()) for i in range(n)]
print(lcm_list(t))
Buggy python submission (verdict: Runtime Error):
a,b,x = map(int, input().split())
b_num = int(b//x)
a_num = int((a-1)//x)
ans = b_num - a_num
print(ans)
          


Fixed submission:
a, b, c = input().split()
print(a[0]+b[0]+c[0])

Buggy python submission (verdict: Runtime Error):
a, b, x = map(int, input().split())

count = 0
if a == 0:
    count = 1

#print((a/x).is_integer())

if (a/x).is_integer() == True:
    #print("BBBBBBBBBB")
    print((b//x)-(a//x)+1)

if (a/x).is_integer() == False:
    #print("aaaaaaaaaaaaaa")
    print((b//x)-(a//x))


Fixed submission:
a, b, c = input().split()
print(a[0]+b[0]+c[0])
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

print(k*(k-1)**(n-1))

Fixed submission:
a,b,x = map(int, input().split())
b_num = int(b//x)
a_num = int((a-1)//x)
ans = b_num - a_num
print(ans)
Buggy python submission (verdict: Runtime Error):
w, h, n = map(int, input().split())
ans_list = [0,0,w,h]
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        ans_list[0] = x
    elif a == 2:
        ans_list[2] = x
    elif a == 3:
        ans_list[1] = y
    else:
        ans_list[3] = y
print(max((ans_list[2]-ans_list[0])*(ans_list[3]-ans_list[1])),0)

Fixed submission:
w, h, n = map(int, input().split())
ans_list = [0,0,w,h]
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1 and ans_list[0]<x:
        ans_list[0] = x
    elif a == 2 and ans_list[2]>x:
        ans_list[2] = x
    elif a == 3 and ans_list[1]<y:
        ans_list[1] = y
    elif a == 4 and ans_list[3]>y:
        ans_list[3] = y
    ans = (ans_list[2]-ans_list[0])*(ans_list[3]-ans_list[1])
    if ans <= 0:
        print(0)
        exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
s = [list(input()) for i in range(3)]
turn = s[0]
for i in range(300):
    if "a" == turn.pop(0):
        turn = s[0]
    elif "b" == turn.pop(0):
        turn = s[1]
    else:
        turn = s[2]
    
    if not s[0]:
        print("A")
        exit()
    if not s[1]:
        print("B")
        exit()
    if not s[2]:
        print("C")
        exit()

Fixed submission:
ABC = "ABC"
s = [input()+ABC[i] for i in range(3)]
turn = s[0]
card = 0
count = [1, 0, 0]

for i in range(305):
    if turn[card] == "a":
        turn = s[0]
        card = count[0]
        count[0] += 1
    elif turn[card] == "b":
        turn = s[1]
        card = count[1]
        count[1] += 1
    else:
        turn = s[2]
        card = count[2]
        count[2] += 1
    
    if turn[card] == "A":
        print("A")
        exit()
    if turn[card] == "B":
        print("B")
        exit()
    if turn[card] == "C":
        print("C")
        exit()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]
m = 1;
for i in range(n):
  m *= a[i];
if m > 1e+18: print(-1)
else: print(m)

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
if 0 in a: print(0)
else:
    m = 1
    flag = 0
    for i in a:
        m *= i
        if m > 1e+18:
            print(-1)
            flag = 1
            break
    if flag == 0: print(m)
Buggy python submission (verdict: Runtime Error):
# your code goes here
import numpy as np

def a(s, w, ans):
	if(s == ""):
		return ans
	elif(s[-1] == 'B'):
		if(w == 0):
			return a(s[:-1], 0, ans)
		else:
			return a(s[:-1], w, ans+w)
	else:
		return a(s[:-1], w+1, ans)

def main():
	s = input()
	print(a(s, 0, 0))
	
main()

Fixed submission:
# your code goes here
import numpy as np

def main():
	s = input()
	ans = 0
	w = 0
	for i in range(len(s)):
		c = s[len(s)-1-i]
		if(c == 'B'):
			if(w > 0):
				ans += w
		else:
			w += 1
	
	print(ans)
	
main()

Buggy python submission (verdict: Runtime Error):
# your code goes here
import numpy as np

def a(s, w):
	if(s == ""):
		return 0
	elif(s[-1] == 'B'):
		if(w == 0):
			return a(s[:-1], 0)
		else:
			return a(s[:-1], w)+w
	else:
		return a(s[:-1], w+1)

def main():
	s = input()
	print(a(s, 0))
	
	
	
	
	
main()

Fixed submission:
# your code goes here
import numpy as np

def main():
	s = input()
	ans = 0
	w = 0
	for i in range(len(s)):
		c = s[len(s)-1-i]
		if(c == 'B'):
			if(w > 0):
				ans += w
		else:
			w += 1
	
	print(ans)
	
main()
Buggy python submission (verdict: Runtime Error):
import numpy as np
def niku(level, num):
	maisu = 2**(level+2)-3
	if(num <= level):
		return 0
	elif(num < (maisu+1)/2):
		return niku(level-1, num-1)
	elif(num == (maisu+1)/2):
		return 2**(level+1-1)-1+1
	else:
		return 2**(level+1-1)-1+1+niku(level-1, num-((maisu+1)/2))

def main():
	
	buf = input().split()
	n = int(buf[0])
	x = int(buf[1])
	print(niku(n, x))
		
main()

Fixed submission:
import numpy as np
def niku(level, num):
	maisu = 2**(level+2)-3
	if(num <= level):
		return 0
	elif(level == 0):
		return 1
	elif(num < (maisu+1)/2):
		return niku(level-1, num-1)
	elif(num == (maisu+1)/2):
		return 2**(level+1-1)-1+1
	else:
		return 2**(level+1-1)-1+1+niku(level-1, num-((maisu+1)/2))

def main():
	
	buf = input().split()
	n = int(buf[0])
	x = int(buf[1])
	print(niku(n, x))
		
main()
Buggy python submission (verdict: Runtime Error):
import numpy as np
 
def main():
	n = int(input())
	s = input()
	q = int(input())
	klist = list(map(int, input().split()))
	
	for times in range(q):
		r = 0
		k = klist[times]
		nowd, nowm, nowdm = 0, 0, 0
		for i in range(n):
			c = s[i]
			if (c == "D"):
				nowd += 1
			elif (c == "M"):
				nowm += 1
				nowdm += nowd
			elif(c == "C"):
				r += nowdm
			if(i >= k-1):
				cc = s[i-k+1]
				if (cc == "D"):
					nowd -= 1
					nowdm -= nowm
				elif (cc == "M"):
					nowm -= 1
		print(r)
main()

Fixed submission:
# your code goes here
import numpy as np

def main():
	n = int(input())
	a = list(map(int, input().split()))
	m = np.mean(a)
	r = 0
	
	for i in range(n):
		if ((a[i]-m)**2 < (a[r]-m)**2):
			r = i
	print(r)
	
main()
Buggy python submission (verdict: Runtime Error):
import numpy as np# your code goes here
def eucrid(a, b):
	if (a > b):
		buf = a
		a = b
		b = buf
	if (b % a == 0):
		return a
	else:
		return eucrid(b%a, a)
		
def main():
	buf = input().split()
	s = input()
	t = input()
	n = len(s)
	m = len(t)
	
	big = n*m//eucrid(n, m)
	flag = big
	for i in range(big):
		if (i%(big//n) == 0 and i%(big//m) == 0):
			#print(i, n, m)
			#print((i+1)//(big//n), (i+1)//(big//m))
			if(s[(i+1)//(big//n)] != t[(i+1)//(big//m)]):
				flag = -1
				
	print(flag)
	#print(s, t, n, m)
	
	
main()

Fixed submission:
import numpy as np# your code goes here
def eucrid(a, b):
	if (a > b):
		buf = a
		a = b
		b = buf
	if (b % a == 0):
		return a
	else:
		return eucrid(b%a, a)
		
def main():
	buf = input().split()
	s = input()
	t = input()
	n = len(s)
	m = len(t)
	
	big = n*m//eucrid(n, m)
	flag = big
	"""
	for i in range(big):
		if (i%(big//n) == 0 and i%(big//m) == 0):
			#print(i, n, m)
			#print((i+1)//(big//n), (i+1)//(big//m))
			if(s[(i+1)//(big//n)] != t[(i+1)//(big//m)]):
				flag = -1
	"""			
	for i in range(n):
		if((i*(big//n))%(big//m) == 0):
			if(s[i] != t[(i*(big//n))//(big//m)]):
				flag = -1

	print(flag)
	#print(s, t, n, m)
	
	
main()

Buggy python submission (verdict: Runtime Error):
import numpy as np# your code goes here
def eucrid(a, b):
	if (a > b):
		buf = a
		a = b
		b = buf
	if (b % a == 0):
		return a
	else:
		return eucrid(b%a, a)
		
def main():
	buf = input().split()
	s = input()
	t = input()
	n = len(s)
	m = len(t)
	
	big = n*m//eucrid(n, m)
	flag = big
	for i in range(big):
		if (i%(big//n) == 0 and i%(big//m) == 0):
			print(i, n, m)
			print((i+1)//(big//n), (i+1)//(big//m))
			if(s[(i+1)//(big//n)] != t[(i+1)//(big//m)]):
				flag = -1
				
	print(flag)
	#print(s, t, n, m)
	
	
main()

Fixed submission:
import numpy as np# your code goes here
def eucrid(a, b):
	if (a > b):
		buf = a
		a = b
		b = buf
	if (b % a == 0):
		return a
	else:
		return eucrid(b%a, a)
		
def main():
	buf = input().split()
	s = input()
	t = input()
	n = len(s)
	m = len(t)
	
	big = n*m//eucrid(n, m)
	flag = big
	"""
	for i in range(big):
		if (i%(big//n) == 0 and i%(big//m) == 0):
			#print(i, n, m)
			#print((i+1)//(big//n), (i+1)//(big//m))
			if(s[(i+1)//(big//n)] != t[(i+1)//(big//m)]):
				flag = -1
	"""			
	for i in range(n):
		if((i*(big//n))%(big//m) == 0):
			if(s[i] != t[(i*(big//n))//(big//m)]):
				flag = -1

	print(flag)
	#print(s, t, n, m)
	
	
main()
Buggy python submission (verdict: Runtime Error):
# 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])

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

Buggy python submission (verdict: Runtime Error):
# 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])

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

Buggy python submission (verdict: Runtime Error):
# 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])

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

Buggy python submission (verdict: Runtime Error):
# 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])

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