Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from math import pi
from bisect import bisect
from itertools import repeat
def main():
    x1, y1, x2, y2 = map(int, stdin.readline().split())
    sx = 1
    if x1 > x2:
        x1, x2 = -x1, -x2
        sx = -1
    sy = 1
    if y1 > y2:
        y1, y2 = -y1, -y2
        sy = -1
    n = int(stdin.readline())
    dat = map(int, stdin.read().split(), repeat(10, 2 * n))
    a = []
    for i in xrange(n):
        x, y = dat[i*2:i*2+2]
        x *= sx
        y *= sy
        if x1 <= x <= x2 and y1 <= y <= y2:
            a.append((x, y))
    a.sort()
    c = pi * 5 - 10
    if x1 == x2 or y1 == y2:
        if a:
            print "%.12f" % ((x2 - x1 + y2 - y1) * 100 + 2 * c)
        else:
            print "%.12f" % ((x2 - x1 + y2 - y1) * 100)
        return
    b = [-10 ** 9] + [10 ** 9] * 200010
    m = 1
    for x, y in a:
        p = bisect(b, y, lo=0, hi=m)
        b[p] = y
        if p == m:
            m += 1
    c = pi * 5 - 20
    print "%.12f" % ((x2 - x1 + y2 - y1) * 100 + (m - 1) * c)
main()
from sys import stdin
from math import pi
from bisect import bisect
from itertools import repeat
def main():
    x1, y1, x2, y2 = map(int, stdin.readline().split())
    sx = 1
    if x1 > x2:
        x1, x2 = -x1, -x2
        sx = -1
    sy = 1
    if y1 > y2:
        y1, y2 = -y1, -y2
        sy = -1
    n = int(stdin.readline())
    dat = map(int, stdin.read().split(), repeat(10, 2 * n))
    a = []
    for i in xrange(n):
        x, y = dat[i*2:i*2+2]
        x *= sx
        y *= sy
        if x1 <= x <= x2 and y1 <= y <= y2:
            a.append((x, y))
    a.sort()
    c = pi * 5 - 10
    if x1 == x2 or y1 == y2:
        if a:
            print "%.12f" % ((x2 - x1 + y2 - y1) * 100 + 2 * c)
        else:
            print "%.12f" % ((x2 - x1 + y2 - y1) * 100)
        return
    b = [-10 ** 9] + [10 ** 9] * 200010
    m = 1
    for x, y in a:
        p = bisect(b, y, lo=0, hi=m)
        b[p] = y
        if p == m:
            m += 1
    c = pi * 5 - 20
    print "%.12f" % ((x2 - x1 + y2 - y1) * 100 + (m - 1) * c)
main()


Fixed submission:
from sys import stdin
from math import pi
from bisect import bisect
from itertools import repeat
def main():
    x1, y1, x2, y2 = map(int, stdin.readline().split())
    sx = 1
    if x1 > x2:
        x1, x2 = -x1, -x2
        sx = -1
    sy = 1
    if y1 > y2:
        y1, y2 = -y1, -y2
        sy = -1
    n = int(stdin.readline())
    dat = map(int, stdin.read().split(), repeat(10, 2 * n))
    a = []
    for i in xrange(n):
        x, y = dat[i*2:i*2+2]
        x *= sx
        y *= sy
        if x1 <= x <= x2 and y1 <= y <= y2:
            a.append((x, y))
    a.sort()
    c = pi * 10 - 20
    b = [-10 ** 9] + [10 ** 9] * 200010
    m = 1
    for x, y in a:
        p = bisect(b, y, lo=0, hi=m)
        b[p] = y
        if p == m:
            m += 1
    d = pi * 5 - 20
    if m <= min(x2 - x1 + 1, y2 - y1 + 1):
        c = d
    print "%.12f" % ((x2 - x1 + y2 - y1) * 100 + (m - 2) * d + c)
main()
Buggy python submission (verdict: Runtime Error):
nwin@linux-lqq3:~/atcoder/g16> cat b.py
n = int(raw_input())
a = map(int, raw_input().split())
b = max(a)
c = min(a)
if b - c > 1:
    print "No"
elif b == c:
    print "Yes" if b == n - 1 or 2 * b <= n else "No"
else:
    t = sum(c == x for x in a)
    if t >= b:
        print "No"
    else:
        print "Yes" if (b - t) * 2 <= t else "No"


Fixed submission:
n = int(raw_input())
a = map(int, raw_input().split())
b = max(a)
c = min(a)
if b - c > 1:
    print "No"
elif b == c:
    print "Yes" if b == n - 1 or 2 * b <= n else "No"
else:
    t = sum(c == x for x in a)
    if t >= b:
        print "No"
    else:
        print "Yes" if (b - t) * 2 <= n - t else "No"
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin().readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    c = [0] * (n + 1)
    for x in dat:
        c[x] += 1
    for i in xrange(n + 1):
        if c[i] == 1:
            print "NO"
            return
    print "YES"
main()


Fixed submission:
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    c = [0] * (n + 1)
    for x in dat:
        c[x] += 1
    f = 0
    for i in xrange(n + 1):
        if c[i] & 1:
            print "NO"
            return
    print "YES"
main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin().readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    c = [0] * (n + 1)
    for x in dat:
        c[x] += 1
    for i in xrange(n + 1):
        if c[i] == 1:
            print "NO"
            return
    print "YES"
main()


Fixed submission:
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    c = [0] * (n + 1)
    for x in dat:
        c[x] += 1
    f = 0
    for i in xrange(n + 1):
        if c[i] & 1:
            print "NO"
            return
    print "YES"
main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin().readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    c = [0] * (n + 1)
    for x in dat:
        c[x] += 1
    for i in xrange(n + 1):
        if c[i] == 1:
            print "NO"
            return
    print "YES"
main()
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin().readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    c = [0] * (n + 1)
    for x in dat:
        c[x] += 1
    for i in xrange(n + 1):
        if c[i] == 1:
            print "NO"
            return
    print "YES"
main()


Fixed submission:
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    c = [0] * (n + 1)
    for x in dat:
        c[x] += 1
    f = 0
    for i in xrange(n + 1):
        if c[i] & 1:
            print "NO"
            return
    print "YES"
main()
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    la = [None] * (n + 1)
    xt = [None] * len(dat)
    j = 0
    for i in xrange(m):
        x, y = dat[j:j+2]
        xt[j] = la[y]
        xt[j+1] = la[x]
        la[y] = j
        la[x] = j + 1
        j += 2
    done = [None] * (n + 1)
    x = 1
    po = []
    while 1:
        po.append(x)
        done[x] = 1
        y = la[x]
        while y is not None:
            z = dat[y]
            if done[z] is None:
                x = z
                break
            y = xt[y]
        else:
            break
    pa = []
    while 1:
        pa.append(x)
        done[x] = 1
        y = la[x]
        while y is not None:
            z = dat[y]
            if done[z] is None:
                x = z
                break
            y = xt[y]
        else:
            break
    po = po[::-1] + pa[1:]
    print len(po)
    print ' '.join(map(str, po))
main()
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    la = [None] * (n + 1)
    xt = [None] * len(dat)
    j = 0
    for i in xrange(m):
        x, y = dat[j:j+2]
        xt[j] = la[y]
        xt[j+1] = la[x]
        la[y] = j
        la[x] = j + 1
        j += 2
    done = [None] * (n + 1)
    x = 1
    po = []
    while 1:
        po.append(x)
        done[x] = 1
        y = la[x]
        while y is not None:
            z = dat[y]
            if done[z] is None:
                x = z
                break
            y = xt[y]
        else:
            break
    pa = []
    while 1:
        pa.append(x)
        done[x] = 1
        y = la[x]
        while y is not None:
            z = dat[y]
            if done[z] is None:
                x = z
                break
            y = xt[y]
        else:
            break
    po = po[::-1] + pa[1:]
    print len(po)
    print ' '.join(map(str, po))
main()


Fixed submission:
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    la = [None] * (n + 1)
    xt = [None] * len(dat)
    j = 0
    for i in xrange(m):
        x, y = dat[j:j+2]
        xt[j] = la[y]
        xt[j+1] = la[x]
        la[y] = j
        la[x] = j + 1
        j += 2
    done = [None] * (n + 1)
    x = 1
    po = []
    while 1:
        po.append(x)
        done[x] = 1
        y = la[x]
        while y is not None:
            z = dat[y]
            if done[z] is None:
                x = z
                break
            y = xt[y]
        else:
            break
    x = 1
    pa = []
    while 1:
        pa.append(x)
        done[x] = 1
        y = la[x]
        while y is not None:
            z = dat[y]
            if done[z] is None:
                x = z
                break
            y = xt[y]
        else:
            break
    po = po[::-1] + pa[1:]
    print len(po)
    print ' '.join(map(str, po))
main()
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
from itertools import repeat
def main():
    r, c = map(int, stdin.readline().split())
    n = int(stdin.readline())
    a = map(int, stdin.read().split(), repeat(10, 3 * n))
    rs = [[] for i in xrange(c)]
    cs = [[] for i in xrange(r)]
    for i in xrange(n):
        a[i*3] -= 1
        y = a[i*3]
        a[i*3+1] -= 1
        x = a[i*3+1]
        rs[x].append((y, a[i*3+2]))
        cs[y].append((x, a[i*3+2]))
    v = [None] * c
    rd = [None] * r
    st = []
    pu = st.append
    po = st.pop
    for i in xrange(c):
        if v[i] is not None:
            continue
        if not rs[i]:
            continue
        mnc = v[i] = rs[i][0][1]
        pu((rs[i][0][0], rs[i][0][1], i, 0))
        mnr = 0
        while st:
            y, base, x, dr = po()
            for nx, val in cs[y]:
                tmp = val - dr
                if v[nx] is None:
                    v[nx] = tmp
                    if mnc > tmp:
                           mnc = tmp
                elif v[nx] != tmp:
                    print "No"
                    return
                for ny, nval in rs[nx]:
                    if not rd[ny]:
                        rd[ny] = 1
                        if 0 > nval - tmp < -mnr:
                            mnr = tmp - nval
                        pu((ny, nval, nx, nval - tmp))
        if mnc < mnr:
            print "No"
            return
    print "Yes"
main()

Fixed submission:
from sys import stdin
from itertools import repeat
def main():
    r, c = map(int, stdin.readline().split())
    n = int(stdin.readline())
    a = map(int, stdin.read().split(), repeat(10, 3 * n))
    rs = [[] for i in xrange(c)]
    cs = [[] for i in xrange(r)]
    for i in xrange(n):
        a[i*3] -= 1
        y = a[i*3]
        a[i*3+1] -= 1
        x = a[i*3+1]
        rs[x].append((y, a[i*3+2]))
        cs[y].append((x, a[i*3+2]))
    v = [None] * c
    rd = [None] * r
    st = []
    pu = st.append
    po = st.pop
    for i in xrange(c):
        if v[i] is not None:
            continue
        if not rs[i]:
            continue
        mnc = rs[i][0][1]
        pu((rs[i][0][0], rs[i][0][1], i, 0))
        mnr = 0
        while st:
            y, base, x, dr = po()
            for nx, val in cs[y]:
                tmp = val - dr
                if v[nx] is None:
                    v[nx] = tmp
                    if mnc > tmp:
                           mnc = tmp
                    for ny, nval in rs[nx]:
                        if not rd[ny]:
                            rd[ny] = 1
                            if 0 > nval - tmp < -mnr:
                                mnr = tmp - nval
                            pu((ny, nval, nx, nval - tmp))
                elif v[nx] != tmp:
                    print "No"
                    return
        if mnc < mnr:
            print "No"
            return
    print "Yes"
main()
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    q = int(stdin.readline())
    a = map(int, stdin.readline().split(), repeat(10, q))
    a = [x - 1 for x in a]
    l = [[] for i in xrange(q)]
    la = []
    for i in xrange(q - 1, -1, -1):
        x = a[i]
        if not l[x]:
            la.append(x)
        l[x].append(i)
    ok = 1
    b = [q] * n
    f = [0] * m
    xt = 0
    for i, x in enumerate(la):
        j = 0
        for y in l[x]:
            if j < n and y < b[j]:
                b[j] = y
                j += 1
        if j < n:
            ok = 0
            b[j] = -1
        if not ok:
            while f[xt]:
                  xt += 1
            if x != xt:
                print "No"
                return
            f[xt] = 1
        else:
            f[x] = 1
    print "Yes"
main()

Fixed submission:
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    q = int(stdin.readline())
    a = map(int, stdin.readline().split(), repeat(10, q))
    a = [x - 1 for x in a]
    l = [[] for i in xrange(m)]
    la = []
    for i in xrange(q - 1, -1, -1):
        x = a[i]
        if not l[x]:
            la.append(x)
        l[x].append(i)
    ok = 1
    b = [q] * n
    f = [0] * m
    xt = 0
    for i, x in enumerate(la):
        j = 0
        for y in l[x]:
            if j < n and y < b[j]:
                b[j] = y
                j += 1
        if j < n:
            ok = 0
            b[j] = -1
        if not ok:
            while f[xt]:
                  xt += 1
            if x != xt:
                print "No"
                return
            f[xt] = 1
        else:
            f[x] = 1
    print "Yes"
main()
Buggy python submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
if a <= 0 <= b:
    print 'Zero'
elif a > 0:
    print 'Positive'
elif (b - a) % 2:
    print 'Positive'
else:
    print 'Negative'
a, b = map(int, raw_input().split())
if a <= 0 <= b:
    print 'Zero'
elif a > 0:
    print 'Positive'
elif (b - a) % 2:
    print 'Positive'
else:
    print 'Negative'


Fixed submission:
a, b = map(int, raw_input().split())
if a <= 0 <= b:
    print 'Zero'
elif a > 0:
    print 'Positive'
elif (b - a) % 2:
    print 'Positive'
else:
    print 'Negative'
Buggy python submission (verdict: Runtime Error):
def main():
    n, m = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    a = [0] + [2] * n
    a[1] = 1
    for i in xrange(m):
        x, y = dat[i*2], dat[i*2+1]
	if a[x] == 0:
            continue
        a[y] += 2
        if a[x] & 1 and a[y] & 1 ^ 1:
            a[y] -= 1
        a[x] -= 2
	if a[x] < 0:
            a[x] = 0
    print sum(x & 1 for x in a)
main()


Fixed submission:
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    a = [0] + [2] * n
    a[1] = 1
    for i in xrange(m):
        x, y = dat[i*2], dat[i*2+1]
	if a[x] == 0:
            continue
        a[y] += 2
        if a[x] & 1 and a[y] & 1 ^ 1:
            a[y] -= 1
        a[x] -= 2
	if a[x] < 0:
            a[x] = 0
    print sum(x & 1 for x in a)
main()
Buggy python submission (verdict: Runtime Error):
n, x = map(int, raw_input().split())
g = gcd(n, x)
n /= g
x /= g
print 3 * (n - 1) * g


Fixed submission:
from fractions import gcd
n, x = map(int, raw_input().split())
g = gcd(n, x)
n /= g
x /= g
print 3 * (n - 1) * g
Buggy python submission (verdict: Runtime Error):
input()
a=input()
a=a[a.index('W'):]
b=a.count('R')
print(b-a[:b].count('R'))

Fixed submission:
input()
a=input()
if 'W'not in a:print(0);exit()
a=a[a.index('W'):]
b=a.count('R')
print(b-a[:b].count('R'))

Buggy python submission (verdict: Time Limit Exceeded):
input()
a=list(input())
while a[0]=="R":
  del a[0]
  if a==[]:break
b=a.count('R')
print(b-a[:b].count('R'))

Fixed submission:
input()
a=input()
if 'W'not in a:print(0);exit()
a=a[a.index('W'):]
b=a.count('R')
print(b-a[:b].count('R'))
Buggy python submission (verdict: Runtime Error):
print(''.join([input(),input()][::-1]))

Fixed submission:
print(''.join(input().split()[::-1]))
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input())
if a+b<=k:print(0,0)
elif a<=k:print(0,a+b-k)
else:print(a-k,b)

Fixed submission:
a,b,k=map(int,input().split())
if a+b<=k:print(0,0)
elif a<=k:print(0,a+b-k)
else:print(a-k,b)
Buggy python submission (verdict: Runtime Error):
a=[int(input())for i in[0]*int(input())]
b=max(a)
if a.count(b)>1:print('\n'.join([str(b)]*len(a)))
else:
  c=[b for i in a]
  c[a.index(b)]=max(a[:a.index(b)]+a[a.index(b)+1:])

Fixed submission:
print(3*int(input())**2)

Buggy python submission (verdict: Runtime Error):
a=[int(input())for i in[0]*int(input())]
b=max(a)
if a.count(b)>1:print('\n'.join([b for i in a]))
else:
  c=[b for i in a]
  c[a.index(b)]=max(a[:a.index(b)]+a[a.index(b)+1:])

Fixed submission:
print(3*int(input())**2)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split(' '))
print(-(-a//(1+2*b)))

Fixed submission:
print(3*int(input())**2)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split(' '))
print(-(-a//(1+2*b)))

Fixed submission:
print(3*int(input())**2)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split(' '))
print(0-(-a//b))

Fixed submission:
print(3*int(input())**2)

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(0--a//b)

Fixed submission:
print(3*int(input())**2)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())
print(0--a//b)

Fixed submission:
a,b=map(int,input().split(' '))
print(-(-a//(1+2*b)))
Buggy python submission (verdict: Runtime Error):
a=[int(input())for i in[0]*int(input())]
b=max(a)
if a.count(b)>1:print('\n'.join([b for i in range(len(a))]))
else:
  c=[b for i in a]
  c[a.index(b)]=max(a[:a.index(b)]+a[a.index(b)+1:])

Fixed submission:
a=[int(input())for i in[0]*int(input())]
b=max(a)
if a.count(b)>1:print('\n'.join([str(b)]*len(a)))
else:
  c=[b for i in a]
  c[a.index(b)]=max(a[:a.index(b)]+a[a.index(b)+1:])
  print('\n'.join([str(i)for i in c]))
Buggy python submission (verdict: Runtime Error):
a,*_,e,k=eval('int(input()),'*6);print(':('*(e-a>k)|'Yay!')

Fixed submission:
a=int(input())
input()
input()
input()
e=int(input())
k=int(input())
print(':('if e-a>k else 'Yay!')
Buggy python submission (verdict: Time Limit Exceeded):
a=sorted(list(map(int,[input()for i in range(5)])),key=lambda x:x%10)
while str(a[0])[-1]=='0':
  a+=[a[0]]
  del a[0]
print(sum([a[0]]+[10*(0--i//10)for i in a[1:]]))

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
li=[a,b,c,d,e]
li=sorted(li,key=lambda x:10 if x%10==0 else x%10)
print(li[0]+sum(map(lambda x:x+((10-x%10)if x%10 else 0),li[1:])))
Buggy python submission (verdict: Runtime Error):
from math import factorial as f;b,w=map(int,input().split());gcd=lambda a,b:gcd(max(a,b)%min(a,b),min(a,b))if max(a,b)%min(a,b)else min(a,b);p=f(b+w)//f(b)//f(w)
def g(x,y):print((1000000008*x)//y)
q=2
for i in range(min(b,w)):g(1,2);q*=2
x,y=1,2
for i in range(b+w-min(b,w)-1):bunbo=q;bunsi=q//2+1;x,y=bunbo,bunsi;g(y,x);q*=2
g(y,x)

Fixed submission:
a,b,c=map(int,input().split())
if a==b and b==c:print('Yes')
else:print('No')

Buggy python submission (verdict: Runtime Error):
b,w=map(int,input().split())
from math import factorial as f
from math import gcd
p=f(b+w)//f(b)//f(w)
def g(x,y):print((1000000008*x)//y)
q=2
for i in range(min(b,w)):
    g(1,2)
    q*=2
x,y=1,2
for i in range(b+w-min(b,w)-1):
 bunbo=q
 bunsi=q//2+1
 x,y=bunbo,bunsi
 g(y,x)
 q*=2
g(y,x)

Fixed submission:
a,b,c=map(int,input().split())
if a==b and b==c:print('Yes')
else:print('No')
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input())
c,d=map(int,input())
print((a-c)*(b-d))

Fixed submission:
a,b=map(int,input().split())
c,d=map(int,input().split())
print((a-c)*(b-d))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input());print(min(b//a,c))

Fixed submission:
a,b,c=map(int,input().split());print(min(b//a,c))
Buggy python submission (verdict: Runtime Error):
print('TBD'if int(input().split()[1])>4 else 'Heisei')

Fixed submission:
print('TBD'if int(input().split('/')[1])>4 else 'Heisei')
Buggy python submission (verdict: Runtime Error):
a=0
for i in range(int(input())):
  b=input().split()
  if b[1]=='JPY':
    a+=int(b[0])
  else:
    a+=int(b[0])*380000
print(a)

Fixed submission:
a=0
for i in range(int(input())):
  b=input().split()
  if b[1]=='JPY':
    a+=eval(b[0])
  else:
    a+=eval(b[0])*380000
print(a)
Buggy python submission (verdict: Runtime Error):
a=input()
b=int(input())
if a[:b]=='1'*b:print(1)
else:
  k=0
  while a[k]=='1':k+=1
  print(a[k])

Fixed submission:
a=input()
b=int(input())
if b<101:
  if a[:b]=='1'*b:print(1)
  else:
    k=0
    while a[k]=='1':k+=1
    print(a[k])
else:
  k=0
  while a[k]=='1':k+=1
  print(a[k])

Buggy python submission (verdict: Runtime Error):
a=input()
k=0
while a[k]=='1'and len(a)>k:
  k+=1
b=int(input())
if b<k or a=='1'*len(a):print(1)
else:print(a[k])

Fixed submission:
a=input()
b=int(input())
if b<101:
  if a[:b]=='1'*b:print(1)
  else:
    k=0
    while a[k]=='1':k+=1
    print(a[k])
else:
  k=0
  while a[k]=='1':k+=1
  print(a[k])
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=[list(map(int,input().split()))for i in[0]*b]
print(({i[1]for i in c if c[0]==1}&{i[0]for i in c if c[1]==a}=={})*'IM'+'POSSIBLE')

Fixed submission:
a,b=map(int,input().split())
c=[list(map(int,input().split()))for i in[0]*b]
d=[]
e=[]
for i in c:
  if i[0]==1:d+=[i[1]]
  elif i[1]==a:e+=[i[0]]
print((set(d)&set(e)==set())*'IM'+'POSSIBLE')
Buggy python submission (verdict: Runtime Error):
a,b=map(input().split())
print('error'if a+b>=10 else a+b)

Fixed submission:
a,b=map(int,input().split())
print('error'if a+b>=10 else a+b)
Buggy python submission (verdict: Runtime Error):
x = input()
a = input()
b = input()
print (x - a) % b

Fixed submission:
x = input()
a = input()
b = input()
print (x - a) % b
Buggy python submission (verdict: Runtime Error):
max_test = 100000
for i in range(max_test):
  if i * X % 360 == 0:
    break

return I+1

Fixed submission:
X= int(input())
max_test = 100000
for i in range(1,max_test):
  if i * X % 360 == 0:
    break

print(i)
Buggy python submission (verdict: Runtime Error):
while B <= A:
    B = B * 2
    N = N + 1

while C <= B:
    C = C * 2
    N = N + 1

if K >= N:
    print('Yes')
else:
    print('No')

Fixed submission:
A, B, C = list(map(int, input().split())) 
K = int(input())
N = 0

while B <= A:
    B = B * 2
    N = N + 1

while C <= B:
    C = C * 2
    N = N + 1

if K >= N:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N, K = list(map(int, input().split())) 
A = list(map(int, input().split())) 

H0 = 1
H1 = 1

for i in range(N-K):
    for j in range(K):
        H0 = int(H0 * A[j])

    H1 = int(H0/A[i] * A[K+i])

    if H1 > H0:
        print('Yes')
    else:
        print('No')

Fixed submission:
N, K = list(map(int, input().split())) 
A = list(map(int, input().split())) 

H0 = 1
H1 = 1

for i in range(N-K):
    # for j in range(K):
    #     H0 = int(H0 * A[j])
    # H1 = int(H0/A[i] * A[K+i])
    H0 = A[i]
    H1 = A[K+i]

    if H1 > H0:
        print('Yes')
    else:
        print('No')