Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a, b, k = (int(x) for x in input().split())
for i in reversed(range(min(a, b))):
    if a % i == 0 and b % i == 0: k -= 1
    if k == 0:
        print(i)
        break


Fixed submission:
a, b, k = (int(x) for x in input().split())
l = [i for i in range(1, min(a, b)+1) if a % i == 0 and b % i == 0]
print(l[-k])

Buggy python submission (verdict: Runtime Error):
a, b, k = (int(x) for x in input().split())
c = max(a, b)
l = [1]
for i in range(2, int(c/2)+1):
    if a % i == 0 and b % i == 0: l.append(i)
print(l[-k])

Fixed submission:
a, b, k = (int(x) for x in input().split())
l = [i for i in range(1, min(a, b)+1) if a % i == 0 and b % i == 0]
print(l[-k])

Buggy python submission (verdict: Runtime Error):
a, b, k = (int(x) for x in input().split())
if a > b:
    c = b
    b = a
    a = c
l = [1]
for i in range(2, int(b/2)+1):
    if a % i == 0 and b % i == 0: l.append(i)
print(l[-k])


Fixed submission:
a, b, k = (int(x) for x in input().split())
l = [i for i in range(1, min(a, b)+1) if a % i == 0 and b % i == 0]
print(l[-k])
Buggy python submission (verdict: Time Limit Exceeded):
n, m = (int(x) for x in input().split())
x = [int(x) for x in input().split()]
if n >= m:
    print(0)
else:
    x.sort()
    dis = [abs(x[i+1] - x[i]) for i in range(m-1)]
    for _ in range(n-1): dis.remove(max(dis))
    print(sum(dis))

Fixed submission:
n, m = (int(x) for x in input().split())
x = [int(x) for x in input().split()]
if n >= m:
    print(0)
else:
    x.sort()
    dis = [abs(x[i+1] - x[i]) for i in range(m-1)]
    dis.sort()
    ans = dis[::-1]
    for _ in range(n-1): ans.pop(0)
    print(sum(ans))

Buggy python submission (verdict: Runtime Error):
n, m = (int(x) for x in input().split())
x = [int(x) for x in input().split()]
if m == 1: print(0)
else:
    x.sort()
    dis = [abs(x[i+1] - x[i]) for i in range(m-1)]
    dis.sort()
    ans = dis[::-1]
    for _ in range(n-1): ans.pop(0)
    print(sum(ans))

Fixed submission:
n, m = (int(x) for x in input().split())
x = [int(x) for x in input().split()]
if n >= m:
    print(0)
else:
    x.sort()
    dis = [abs(x[i+1] - x[i]) for i in range(m-1)]
    dis.sort()
    ans = dis[::-1]
    for _ in range(n-1): ans.pop(0)
    print(sum(ans))

Buggy python submission (verdict: Runtime Error):
n, m = (int(x) for x in input().split())
if m == 1: print(0)
else:
    x = [int(x) for x in input().split()]
    x.sort()
    dis = [abs(x[i+1] - x[i]) for i in range(m-1)]
    dis.sort()
    ans = dis[::-1]
    for _ in range(n-1): ans.pop(0)
    print(sum(ans))

Fixed submission:
n, m = (int(x) for x in input().split())
x = [int(x) for x in input().split()]
if n >= m:
    print(0)
else:
    x.sort()
    dis = [abs(x[i+1] - x[i]) for i in range(m-1)]
    dis.sort()
    ans = dis[::-1]
    for _ in range(n-1): ans.pop(0)
    print(sum(ans))
Buggy python submission (verdict: Time Limit Exceeded):
s = [s_i for s_i in input()]
i = ans = 0
while i < len(s) - 1:
    if s[i] == "B" and s[i+1] == "W":
        ans += 1
        s[i] = "W"
        s[i+1] = "B"
        if i == 0: continue
        else: i -= 1
    else: i += 1
print(ans)

Fixed submission:
s = [1 if x == "B" else 0 for x in input()]
ans = cnt = 0
for s_i in s:
    if s_i == 1: cnt += 1
    else: ans += cnt
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = [s_i for s_i in input()]
i = ans = 0
while i < len(s) - 1:
    if s[i] == "B" and s[i+1] == "W":
        ans += 1
        s[i] = "W"
        s[i+1] = "B"
        i = 0
    else: i += 1
print(ans)

Fixed submission:
s = [1 if x == "B" else 0 for x in input()]
ans = cnt = 0
for s_i in s:
    if s_i == 1: cnt += 1
    else: ans += cnt
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = (int(x) for x in input().split())
h = []
for _ in range(n):
    h.append(int(input()))
h.sort()
ans = []
for i in range(n-k-1):
    ans.append(h[i+k-1]-h[i])
print(min(ans))

Fixed submission:
n, k = (int(x) for x in input().split())
h = []
for _ in range(n):
    h.append(int(input()))
h.sort()
ans = []
for i in range(n-k+1):
    ans.append(h[i+k-1]-h[i])
print(min(ans))
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 111
print([111*i for i in range(9) if 111*i>=n][0])

Fixed submission:
n = int(input())
ans = 111
print([111*i for i in range(1, 10) if 111*i>=n][0])
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
gcd = lambda l: reduce(math.gcd, l)
n, x = map(int, input().split())
c = [abs(x-int(i)) for i in input().split()]
print(gcd(c))

Fixed submission:
import fractions
n, x = map(int, input().split())
idx = [abs(int(i) - x) for i in input().split()]
ans = idx[0]
if n == 1: pass
else:
    for i in range(1, n):
        ans = fractions.gcd(ans, idx[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
_ = int(input())
print(s[1]) if s[0] == "1" else print(s[0])

Fixed submission:
s = input()
k = int(input())
if k == 1: print(s[0])
else:
    for i in range(k):
        if s[i] != "1":
            print(s[i])
            break
        else:
            if i == k - 1:
                print(s[i])
                break

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
i = 0
while s[i] == "1":
    i += 1
print(s[i])

Fixed submission:
s = input()
k = int(input())
if k == 1: print(s[0])
else:
    for i in range(k):
        if s[i] != "1":
            print(s[i])
            break
        else:
            if i == k - 1:
                print(s[i])
                break
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
def b(x, y):
    return (x * y) // math.gcd(x, y)
_ = int(input())
a = [int(x) for x in input().split()]
m = reduce(b, a, 1) - 1
print(sum([m % a_i for a_i in a]))

Fixed submission:
import fractions
from functools import reduce
def b(x, y):
    return (x * y) // fractions.gcd(x, y)
_ = int(input())
a = [int(x) for x in input().split()]
m = reduce(b, a, 1) - 1
print(sum([m % a_i for a_i in a]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = str(input())
s = [str(i) for i in s]
ans = s[1:].count("E")
if ans > s[:n-1].count("W"): ans = s[:n-1].count("W")
for i in range(1, n-1):
    sp = s[:i]
    ss = s[i+1:]
    count = sp.count("W") + ss.count("E")
    if ans > count: ans = count
print(ans)


Fixed submission:
n = int(input())
s = str(input())
s = [str(i) for i in s]
d = int(n/2)
w, e = [], []
w.append(1) if s[0] == "W" else w.append(0)
e.append(1) if s[-1] == "E" else e.append(0)
for i in range(1, n):
    w.append(w[i-1] + 1) if s[i] == "W" else w.append(w[i-1])
    e.append(e[i-1] + 1) if s[n-1-i] == "E" else e.append(e[i-1])
e.reverse()
ans = [w[i-1] + e[i+1] for i in range(1, n-1)]
ans.insert(0, e[0])
ans.insert(-1, w[-1])
print(min(ans))
Buggy python submission (verdict: Runtime Error):
s = input()
ans = list(s)
alpha = [chr(i) for i in range(97, 97+26)]
if len(s) == 26 and s == "".join(alpha): print(-1)
else:
    for i in range(len(s)):
        if alpha[i] == ans[i]:
            if i == len(s) - 1:
                ans.append(alpha[i+1])
            else: continue
        else:
            ans = alpha[:i]
            ans[-1] = alpha[i]
            break
    print("".join(ans))

Fixed submission:
# coding: utf-8
# Your code here!
 
S=list(input())
 
 
S=list(map(lambda x : ord(x)-97,S))
 
alpha=[0]*26
for s in S:
    alpha[s]=1
 
if len(S)!=26:
    for i in range(26):
        if alpha[i] == 0:
            S.append(i)
            ans=S[:]
            ans=list(map(lambda x :chr(x+97), ans))
            print("".join(ans))
            exit()
else:
    for i in range(26)[::-1]:
        if alpha[S[i]:].count(0)>0:
            for j in range(S[i],26):
                if alpha[j]==0:
                    ans=S[:i]+[j]
                    ans=list(map(lambda x :chr(x+97), ans))
                    print("".join(ans))
                    exit()
        else:
            alpha[S[i]]=0
 
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
def prime(x):
    for i in range(2, int(x**0.5+1)):
        if x % i == 0:
            return False
    return True
q = int(input())
l, r = [], []
for _ in range(q):
    l_, r_ = map(int, input().split())
    l.append(l_)
    r.append(r_)
mi, ma = min(l), max(r)
if mi == 1: mi += 2
p = [0 for _ in range(ma)]
for i in range(mi, ma+1, 2):
    if prime(i) and prime((i+1)//2):
        p[i-1] = 1
for i in range(q):
    print(sum(p[l[i]-1:r[i]]))

Fixed submission:
import itertools
n = int(input())
lr = [[int(i) for i in input().split()] for _ in range(n)]
m = 101010
p = [1]*m
p[0] = p[1] = 0
for i in range(2, m):
    if p[i] == 0: continue
    else:
        for j in range(2*i, m, i):
            p[j] = 0
a = [0]*m
for i in range(1, m, 2):
    if p[i] == p[(i+1)//2] == 1: a[i] = 1
a = list(itertools.accumulate(a))
for l, r in lr:
    print(a[r] - a[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for ai in a:
    idx_b = bisect.bisect_right(b, ai)
    if idx_b == n:
        break
    for bi in b[idx_b:]:
        ans += n - bisect.bisect_right(c, bi)
print(ans)

Fixed submission:
from itertools import accumulate
import bisect
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
b_ = []
for bi in reversed(b):
    b_.append(n - bisect.bisect_right(c, bi))
b_ = list(accumulate(b_))[::-1]
for ai in a:
    idx_b = bisect.bisect_right(b, ai)
    if idx_b == n:
        break
    ans += b_[idx_b]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
d = [int(i) for i in input().split()]
m = int(input())
t = [int(i) for i in input().split()]
d.sort()
t.sort()
idx = 0
while len(t) != 0 and idx < n:
    if d[idx] == t[0]:
        t.pop(0)
    elif d[idx] > t[0]:
        print("NO")
        exit()
    idx += 1
print("YES") if len(t) == 0 else print("NO")

Fixed submission:
import collections
n = int(input())
d_ = [int(i) for i in input().split()]
m = int(input())
t_ = [int(i) for i in input().split()]
d = collections.Counter(d_)
t = collections.Counter(t_)
for ti in t_:
    if d[ti] == 0:
        print("NO")
        exit()
    else:
        d[ti] -= 1
print("YES")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]
ans = []
if n % 2 == 0:
    for i in range(0, n, 2):
        ans.append(a[i])
    for i in range(1, n, 2):
        ans.insert(0, a[i])
else:
    ans.append(a[0])
    for i in range(1, n, 2):
        ans.append(a[i])
    for i in range(2, n, 2):
        ans.insert(0, a[i])
print(*ans)

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
ans = []
if n == 1: print(a[0])
else:
    for i in a[::-2]:
        ans.append(i)
    if n % 2 == 0:
        for i in a[::2]:
            ans.append(i)
    else:
        for i in a[1::2]:
            ans.append(i)
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]
ans = []
if n % 2 == 0:
    for i in range(n):
        if i % 2 == 1: ans.insert(0, a[i])
        else: ans.append(a[i])
else:
    ans.append(a[0])
    for i in range(1, n):
        if i % 2 == 1: ans.append(a[i])
        else: ans.insert(0, a[i])
print(*ans)

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
ans = []
if n == 1: print(a[0])
else:
    for i in a[::-2]:
        ans.append(i)
    if n % 2 == 0:
        for i in a[::2]:
            ans.append(i)
    else:
        for i in a[1::2]:
            ans.append(i)
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]
ans = []
for i in range(n):
    ans.append(a[i])
    ans.reverse()
print(*ans)

Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]
ans = []
if n == 1: print(a[0])
else:
    for i in a[::-2]:
        ans.append(i)
    if n % 2 == 0:
        for i in a[::2]:
            ans.append(i)
    else:
        for i in a[1::2]:
            ans.append(i)
print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
r = []
idx = 0
cnt = 0
for i in range(n):
    w = a[idx]
    cnt += 1
    if w in r:
        cnt = -1
        break
    elif w == 2:
        break
    elif i == n - 1:
        cnt = -1
        break
    else:
        r.append(w)
        idx = w - 1
print(cnt)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
cnt = idx = 0
for i in range(n):
    cnt += 1
    if a[idx] == 2:
        break
    if a[a[idx] - 1] == idx + 1:
        cnt = -1
        break
    if i == n - 1:
        cnt = -1
        break
    idx = a[idx] - 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
r = [i for i in range(n) if s[i] == "("]
l = [i for i in range(n) if s[i] == ")"]
if r == []: print(n*"(" + s)
elif l == []: print(s + n*")")
elif min(r) > max(l):
    print(len(l)*"(" + s + len(r)*")")
else:
    cnt = 0
    for i in reversed(range(len(r))):
        if r[i] < max(l):
            cnt += 1
            l.pop(-1)
    print((len(l)) * "(" + s + (len(r) - cnt) * ")")

Fixed submission:
n = int(input())
s = str(input())
r = [i for i in range(n) if s[i] == "("]
l = [i for i in range(n) if s[i] == ")"]
if r == []: print(n*"(" + s)
elif l == []: print(s + n*")")
elif min(r) > max(l):
    print(len(l)*"(" + s + len(r)*")")
else:
    cnt = 0
    for i in reversed(range(len(r))):
        if r[i] < max(l):
            cnt += 1
            l.pop(-1)
        if l == []: break
    print((len(l)) * "(" + s + (len(r) - cnt) * ")")

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
r = [i for i in range(n) if s[i] == "("]
l = [i for i in range(n) if s[i] == ")"]
if min(r) > max(l):
    print(len(l)*"(" + s + len(r)*")")
else:
    cnt = 0
    for i in range(len(r)):
        if r[i] < max(l):
            cnt += 1
            l.pop(-1)
    print((len(l)) * "(" + s + (len(r) - cnt) * ")")

Fixed submission:
n = int(input())
s = str(input())
r = [i for i in range(n) if s[i] == "("]
l = [i for i in range(n) if s[i] == ")"]
if r == []: print(n*"(" + s)
elif l == []: print(s + n*")")
elif min(r) > max(l):
    print(len(l)*"(" + s + len(r)*")")
else:
    cnt = 0
    for i in reversed(range(len(r))):
        if r[i] < max(l):
            cnt += 1
            l.pop(-1)
        if l == []: break
    print((len(l)) * "(" + s + (len(r) - cnt) * ")")
Buggy python submission (verdict: Time Limit Exceeded):
s = [i for i in input()]
idx = 0
ans = len(s)
while idx < len(s) - 1:
    if s[idx] == "S" and s[idx+1] == "T":
        ans -= 2
        s.pop(idx)
        s.pop(idx)
        idx -= 1
    else:
        idx += 1
print(ans)

Fixed submission:
s = input()
s_cnt = puyo = 0
for si in s:
    if si == "S": s_cnt += 1
    elif s_cnt > 0:
        s_cnt -= 1
        puyo += 1
print(len(s) - puyo * 2)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3


def main():
    MOD = 10 ** 18
    n = int(input())
    A = list(map(int, input().split()))
    ans = 1
    for a in A:
        ans *= a

    if ans <= MOD:
        print(ans)
    else:
        print('-1')


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3


def main():
    n = int(input())
    A = list(map(int, input().split()))
    MOD = 10 ** 18
    ans = 1
    if 0 in A:
        print('0')
        return
    for i in range(n):
        ans *= A.pop(0)
        if ans > MOD:
            print('-1')
            return
    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-*-

from sys import stdin
import numpy as np
from scipy.sparse.csgraph import shortest_path


class Dijkstra:
    def __init__(self, num_of_nodes):
        n = np.full((num_of_nodes, num_of_nodes), float('inf'))
        for i in range(num_of_nodes):
            n[i][i] = 0
        self.graph = n

    def add_node(self, node_u, node_v, cost=1):
        self.graph[node_u][node_v] = cost
        self.graph[node_v][node_u] = cost

    def search_shotest_path(self, method='auto'):
        return shortest_path(self.graph, method=method, directed=False, return_predecessors=False, unweighted=False, overwrite=False)


def main():
    N, X, Y = list(map(int, stdin.readline().split()))

    d = Dijkstra(N)
    for i in range(N - 1):
        d.add_node(i, i + 1)
    d.add_node(X - 1, Y - 1)
    result = d.search_shotest_path()
    for i in range(N - 1):
        print(np.count_nonzero(result == i + 1) // 2)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-*-

from sys import stdin
import collections


def main():
    N, X, Y = list(map(int, stdin.readline().split()))
    X -= 1
    Y -= 1

    cost = collections.defaultdict(lambda: 0)
    for i in range(N):
        for j in range(i + 1, N):
            # 左/右/中で完結
            min1 = j - i
            # ショトカを跨ぐ/# 始まりが中
            min2 = abs(X - i) + 1 + abs(j - Y)
            # 終わりが中
            min3 = abs(Y - i) + 1 + abs(X - j)
            shortest = min(min1, min2, min3)
            cost[shortest] = cost[shortest] + 1
    for i in range(1, N):
        print(cost[i])


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import numpy as np


def main():
    n = int(input())
    abc = [list(map(int, input().split() )) for _ in range(n)]
    abc = np.array(abc, dtype='int')

    dp = np.empty((n, 3), dtype='int')
    dp[0, :] = abc[0, :]

    for i in range(1, n):
        dp[i, 0] = abc[i, 0] + np.max(dp[i - 1, 1:3])
        dp[i, 1] = abc[i, 1] + np.max(dp[i - 1, 0:3:2])
        dp[i, 2] = abc[i, 2] + np.max(dp[i - 1, 0:2])
    print(max(dp[-1, :]))


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    n = int(input())
    abc = [list(map(int, input().split())) for _ in range(n)]

    dp = [[- float('inf') for i in range(3)] for j in range(n + 1)]
    dp[0] = [0] * 3
    for i in range(n):
        for j in range(3):
            for k in range(3):
                if (j == k):
                    continue
                dp[i + 1][k] = max(dp[i + 1][k],
                                   dp[i][j] + abc[i][k])
    print(max(dp[-1]))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
X = int(input())
if X >= 30:
  print(Yes)
else:
  print(No)

Fixed submission:
X = int(input())
if X >= 30 :
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import math
def find(a):
    ans = a[0]
    for i in range(1,len(a)):
        ans = ((ans)//(math.gcd(ans,a[i])) * a[i])
    return ans            
	


n = int(input())
a = list(map(int,input().split()))

lcm = find(a)
ans = 0
mod = pow(10,9)+7
for i in a:
	ans = ans + lcm//i
	
print(ans%mod)	


Fixed submission:
from fractions import gcd
def find(a):
    ans = a[0]
    for i in range(1,len(a)):
        ans = ((ans)//(gcd(ans,a[i])) * a[i])
    return ans            
	


n = int(input())
a = list(map(int,input().split()))

lcm = find(a)
ans = 0
mod = pow(10,9)+7
for i in a:
	ans = ans + lcm//i
	
print(ans%mod)

Buggy python submission (verdict: Runtime Error):
import math
def find(a):
    ans = a[0]
    for i in range(1,len(a)):
        ans = (ans*a[i])//(math.gcd(ans,a[i]))
    return ans



n = int(input())
a = list(map(int,input().split()))

lcm = find(a)
ans = 0
mod = pow(10,9)+7
for i in a:
        ans = (ans + (lcm//i)%mod)%mod

print(ans)


Fixed submission:
from fractions import gcd
def find(a):
    ans = a[0]
    for i in range(1,len(a)):
        ans = ((ans)//(gcd(ans,a[i])) * a[i])
    return ans            
	


n = int(input())
a = list(map(int,input().split()))

lcm = find(a)
ans = 0
mod = pow(10,9)+7
for i in a:
	ans = ans + lcm//i
	
print(ans%mod)
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
print(max(a*b,c*d))

Fixed submission:
H,A=map(int,input().split())
count=0
while H>0:
  H-=A
  count+=1
print(count)

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

Fixed submission:
H,A=map(int,input().split())
count=0
while H>0:
  H-=A
  count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for i in range(n):
	for j in range(i):
		ans += (sum((a-b)**2 for a,b in zip(x[i],x[j]))**0.5).is_integer()
print(ans)

Fixed submission:
N,A,B=map(int,input().split())
print(min(N*A,B))
Buggy python submission (verdict: Runtime Error):
n,d=map(int,input().split())
x=[list(map(int,input().split()))for _ in range(n)]
ans=0
for i in range(n):
    for j in range(i):
        ans+=(sum((a-b)**2 for a,b in zip(x[i],x[j])**0.5)).is_integer()
print(ans)

Fixed submission:
n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for i in range(n):
	for j in range(i):
		ans += (sum((a-b)**2 for a,b in zip(x[i],x[j]))**0.5).is_integer()
print(ans)
Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
total=0
count=0
for i in range(N+1):
    if total<=X:
        total+=L[i]
        count+=1
print(count)

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split()))
total=0
count=1
for i in range(N):
    total+=L[i]
    if total<=X:
        count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
total=0
count=0
for i in range(N+1):
    if total<=X:
        total+=L[i]
        count+=1
    else:
        break
print(count)

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split()))
total=0
count=1
for i in range(N):
    total+=L[i]
    if total<=X:
        count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
total=0
count=0
i=0
while total<=X:
    if i<=len(L):
        total+=L[i]
        i+=1
        count+=1
    else:
        break
print(count)

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split()))
total=0
count=1
for i in range(N):
    total+=L[i]
    if total<=X:
        count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
total=0
count=0
i=0
while total<=X:
    total+=L[i]
    i+=1
    count+=1
print(count)

Fixed submission:
N,X=map(int,input().split())
L=list(map(int,input().split()))
total=0
count=1
for i in range(N):
    total+=L[i]
    if total<=X:
        count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
r1=[i for i in range(a,min(b+1,a+k))]
r2=[i for i in range(max(a,b-k+1),b+1)]
r1.extend(r2)
result=set(r1)
for i in sorted(result):
    print(i)

Fixed submission:
S=str(input())
if 'a' in S and 'b' in S and 'c' in S:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
A,B,K=map(int,input().split())
L=list(i for i in range(A,B+1))
for i in range(B-A+1):
    if L[i] in L[:K] or L[i] in L[-K:]:
        print(L[i])

Fixed submission:
a,b,k=map(int,input().split())
r1=[i for i in range(a,min(b+1,a+k))]
r2=[i for i in range(max(a,b-k+1),b+1)]
r1.extend(r2)
result=set(r1)
for i in sorted(result):
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,K=map(int,input().split())
L=list(i for i in range(A,B+1))
for i in range(B-A+1):
    if L[i] in L[:K] or L[i] in L[-K:]:
        print(L[i])

Fixed submission:
a,b,k=map(int,input().split())
r1=[i for i in range(a,min(b+1,a+k))]
r2=[i for i in range(max(a,b-k+1),b+1)]
r1.extend(r2)
result=set(r1)
for i in sorted(result):
    print(i)