Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
H,W = map(int, input().split())

C = []

for _ in range(H):
    l = list(input()
    C.append(l)
D = []
for i in range(2*H):
    l = []
    for j in range(W):
        l.append(C[i//2][j])

    D.append(l)

for i in range(len(D)):
    print(*D[i],sep="")

Fixed submission:
H,W = map(int, input().split())

C = []

for _ in range(H):
    l = list(input())
    C.append(l)
D = []
for i in range(2*H):
    l = []
    for j in range(W):
        l.append(C[i//2][j])

    D.append(l)

for i in range(len(D)):
    print(*D[i],sep="")
Buggy python submission (verdict: Runtime Error):
A,B,C = input()

print("A"+B[0]+"C")

Fixed submission:
S = input().split()

print(S[0][0]+S[1][0]+S[2][0])
Buggy python submission (verdict: Runtime Error):
import sys
import copy



S = input()
op_list = ["+"]*(len(S)-1)

sum = 0
for i in range(2**len(op_list)):

    for j in range(len(op_list)):

        if (i >> j) & 1:
            op_list[j] = ""
    s = ""
    for k in range(len(op_list)):
        s = s + S[k] + op_list[k]
    sum = sum + eval(s)


print(sum)
    




Fixed submission:
import sys
import copy



S = input()
op_list = ["+"]*(len(S)-1)

sum = 0
for i in range(2**len(op_list)):
    op_list = ["+"]*(len(S)-1)
    for j in range(len(op_list)):

        if (i >> j) & 1:
            op_list[j] = ""
    s = ""
    for k in range(len(op_list)):
        s = s + S[k] + op_list[k]
    s = s + S[len(S)-1]
    sum = sum + eval(s)


print(sum)
Buggy python submission (verdict: Runtime Error):
import sys

S = input()

N = len(S)-1
sum = 0

for i in range(2**N):

    op = [""]*(N)
    for j in range(N):
        if (i>>j)&1:
            op[j] = "+"
    s = ""
    for j in range(N):
        s = s + S[j] + op[j]
    s = s + S[j]
    sum = sum + eval(s)
print(sum)

Fixed submission:
import sys

S = list(input())

sum = 0
for i in range(2**(len(S)-1)):

    op_list = ['+']*(len(S)-1)

    for j in range(len(S)-1):
        if (i>>j) & 1:
            op_list[j] = ''


    s = ""
    for st_index in range(len(op_list)):
        s = s + S[st_index] + op_list[st_index]
    s = s + S[len(S)-1]
    result = eval(s)
    
    sum = sum + result

print(sum)
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())

A    = sorted([input for _ in range(N)])

print(*A, sep="")

Fixed submission:
n, l = map(int, input().split())
s=sorted([input() for i in range(n)])
print(*s,sep="")
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3


N = int(input())
A = [int(s) for s in input().split()]

ans = 1
for a in A:
    ans *= a

if ans > 10**18:
    print(-1)
else:
    print(ans)




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

def solve():
    N = int(input())
    A = list(map(int, input().split()))
    for a in A:
        if a == 0:
            return 0
    ans = 1
    for a in A:
        ans *= a
        if ans > 10**18:
            return -1
    return ans

def main():
    print(solve())

main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

(x, y, z) = input().strip().split()
(x,y) = (y,x)
(x,z) = (z,x)
print(f'{x} {y} {z}')


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

(x, y, z) = input().strip().split()
(x,y) = (y,x)
(x,z) = (z,x)
print('{} {} {}'.format(x, y, z))
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

S = input()
n = len(S)
ss = [s for s in S]
answer = 0
while True:
    numThis = 0
    for i in range(n-1):
        if ss[i] == 'B' and ss[i+1] == 'W':
            ss[i] = 'W'
            ss[i+1] = 'B'
            numThis += 1
    answer += numThis
    if numThis == 0:
        break
print(answer)


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

S = input()
numB = 0
answer = 0
for c in S:
    if c == 'B':
        numB += 1
    else:
        answer += numB
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    ans = 0
    for k in range(30):
        C = [x & ((1 << (k+1)) - 1) for x in A]
        D = [x & ((1 << (k+1)) - 1) for x in B]
        C.sort()
        D.sort()
        # print(f'k = {k}')
        # print(f'C = {C}')
        # print(f'D = {D}')
        p, q, r = 0, 0, 0
        for i in range(N-1, -1, -1):
            while p < N:
                if C[i] + D[p] >= 1 << k: break
                p += 1
            while q < N:
                if C[i] + D[q] >= 2 << k: break
                q += 1
            while r < N:
                if C[i] + D[r] >= 3 << k: break
                r += 1
            x = ((q - p) + (N - r)) % 2
            # print(p, q, r, x)
            ans = ans ^ (x << k)
    print(ans)

main()


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

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    ans = 0
    for k in range(30):
        C = [x & ((1 << (k+1)) - 1) for x in A]
        D = [x & ((1 << (k+1)) - 1) for x in B]
        C.sort()
        D.sort()
        # print(f'k = {k}')
        # print(f'C = {C}')
        # print(f'D = {D}')
        p, q, r = 0, 0, 0
        for i in range(N-1, -1, -1):
            while p < N:
                if C[i] + D[p] >= 1 << k: break
                p += 1
            while q < N:
                if C[i] + D[q] >= 2 << k: break
                q += 1
            while r < N:
                if C[i] + D[r] >= 3 << k: break
                r += 1
            x = ((q - p) + (N - r)) % 2
            # print(p, q, r, x)
            ans = ans ^ (x << k)
    print(ans)

main()
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = input()
C = (B[0]-'0')*100+(B[2]-'0')*10+(B[3]-'0')
ans = A*C/100
print(ans)

Fixed submission:
A,B = map(str,input().split())
A = int(A)
B = int(B.replace(".",""))
ans = A*B//100
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

if N % 2 == 1:
  print("No")
  return
for i in range(N/2):
  if S[i] != S[N/2 + i]:
    print("No")
    return
print("Yes")


Fixed submission:
N = int(input())
S = input()

ans = 1
if N % 2:
  ans = 0
else:
  for i in range(N//2):
    if S[i] != S[N//2 + i]:
      ans = 0
if ans:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

if N % 2:
  print("No")
else:
  for i in range(N/2):
    if S[i] != S[N/2 + i]:
      print("No")
      return
  print("Yes")

Fixed submission:
N = int(input())
S = input()

ans = 1
if N % 2:
  ans = 0
else:
  for i in range(N//2):
    if S[i] != S[N//2 + i]:
      ans = 0
if ans:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import math

ans = 1000000000000000000
N = int(input())
for i in range(math.sqrt(N+1000)):
  if i > 0 and N % i == 0:
    ans = min(i + N/i - 2, ans)
print(ans)

Fixed submission:
import math

ans = 1000000000000000000
N = int(input())
for i in range(math.ceil(math.sqrt(N+1000))):
  if i > 0 and N % i == 0:
    ans = min(i + N/i - 2, ans)
print(int(ans))
Buggy python submission (verdict: Runtime Error):
import math
from fractions import Fraction

ans = 0
N, K = map(int, input().split())
for i in range(1,N+1):
	ans += Fraction(1,2**(math.ceil(math.log2(max(1,K/i)))))
ans = float(ans/N)
print(ans)


Fixed submission:
import math
from fractions import Fraction

ans = 0
N, K = map(int, input().split())
for i in range(1,N+1):
	ans += Fraction(1,2**(math.ceil(math.log2(max(1,K/i)))))
ans = float(ans/N)
print('{:.10f}'.format(ans))

Buggy python submission (verdict: Runtime Error):
import math
from fractions import Fraction

ans = 0
N, K = map(int, input().split())
for i in range(N):
	ans += Fraction(1,N)*Fraction(1,2**math.ceil(math.log2(K/(i+1))))
print(float(ans))


Fixed submission:
import math
from fractions import Fraction

ans = 0
N, K = map(int, input().split())
for i in range(1,N+1):
	ans += Fraction(1,2**(math.ceil(math.log2(max(1,K/i)))))
ans = float(ans/N)
print('{:.10f}'.format(ans))

Buggy python submission (verdict: Runtime Error):
import math

ans = 0
N,K = input().split()
for i in range(N):
	ans += Fraction(1,N)*Fraction(1,math.ceil(math.log2(K/(i+1))))
print(float(ans))


Fixed submission:
import math
from fractions import Fraction

ans = 0
N, K = map(int, input().split())
for i in range(1,N+1):
	ans += Fraction(1,2**(math.ceil(math.log2(max(1,K/i)))))
ans = float(ans/N)
print('{:.10f}'.format(ans))

Buggy python submission (verdict: Runtime Error):
import math

ans = 0
N,K = input().split()
for i in range(N)
	ans += Fraction(1,N)*Fraction(1,math.ceil(math.log2(K/(i+1))))
print(float(ans))

Fixed submission:
import math
from fractions import Fraction

ans = 0
N, K = map(int, input().split())
for i in range(1,N+1):
	ans += Fraction(1,2**(math.ceil(math.log2(max(1,K/i)))))
ans = float(ans/N)
print('{:.10f}'.format(ans))
Buggy python submission (verdict: Runtime Error):
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
ans = 0
for i in range(N):
  A = list(map(int,input().split()))
  tmp = 0
  for j in range(M):
    tmp += A[i]*B[i]
  if tmp + C > 0:
    ans += 1
print(ans)


Fixed submission:
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
ans = 0
for i in range(N):
  A = list(map(int,input().split()))
  tmp = 0
  for j in range(M):
    tmp += A[j]*B[j]
  if tmp + C > 0:
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
ans = 0
for i in range(N):
  A = list(map(int,input().split()))
  if sum(A*B) + C > 0:
    ans += 1
print(ans)

Fixed submission:
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
ans = 0
for i in range(N):
  A = list(map(int,input().split()))
  tmp = 0
  for j in range(M):
    tmp += A[j]*B[j]
  if tmp + C > 0:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input())
print(max(B//A,C))


Fixed submission:
A,B,C = map(int,input().split())
print(min(B//A,C))

Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input())
print(B//A,C)

Fixed submission:
A,B,C = map(int,input().split())
print(min(B//A,C))
Buggy python submission (verdict: Runtime Error):
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')


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

ans = 0
i = 0
while i < N:
    if S[i] == "A":
        i += 1
        if S[i] == "B":
            i += 1
            if S[i] == "C":
                ans += 1
                i+=1
            else:
                continue
        else:
            continue
    else:
        i += 1
        continue


print(ans)




Fixed submission:
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')


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

ans = 0
i = 0
while i < N:
    if S[i] == "A":
        if i +1 < N:
            i += 1
            if S[i] == "B":
                if i + 1 < N:
                    i += 1
                    if S[i] == "C":
                        ans += 1
                        if i + 1 < N:
                            i+=1
                        else:
                            break
                    else:
                        continue
                else:
                    break
            else:
                continue
        else:
            break
    else:
        i += 1
        continue


print(ans)
Buggy python submission (verdict: Runtime Error):
H,W,A,B = map(int,input().split())
temp = ""
for l in range(0,W):
    temp = temp + "0"


Alist = list()
for k in range(0,H):
    Alist.append(list(temp))


for i in range(0,H):
    for j in range(0,W):
        if i < B and j < A :
            Alist[i][j] = 1
        elif j >= A and i<B:
            Alist[i][j] = 0
        elif i >= B and j < A :
            Alist[i][j] = 0
        else:
            Alist[i][j] = 1

for a in Alist:
    print(''.join(a))


Fixed submission:
H,W,A,B = map(int,input().split())
temp = ""
for l in range(0,W):
    temp = temp + "0"


Alist = list()
for k in range(0,H):
    Alist.append(list(temp))


for i in range(0,H):
    for j in range(0,W):
        if i < B and j < A :
            Alist[i][j] = "1"
        elif j >= A and i<B:
            Alist[i][j] = "0"
        elif i >= B and j < A :
            Alist[i][j] = "0"
        else:
            Alist[i][j] = "1"

for a in Alist:
    print(''.join(a))
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int,input().split())

Answer_list = list()
point_list = [K] *N
for i in range(0,Q):
    Answer_list.append(int(input()))

for j in Answer_list:
    for k in range(0,N):
        if k != j-1:
            point_list[k] -= 1

for l in point_list:
    if l <= 0:
        print("No")
    else:
        print("Yes")


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

Answer_list = list()
point_list = [0] *N
for i in range(0,Q):
    Answer_list.append(int(input()))

for j in Answer_list:
    point_list[j-1] += 1

for l in point_list:
    if Q - l >= K:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
import  copy

N, M = map(int, input().split())

Alist = list(map(int,input().split()))

Alist_B = copy.copy(Alist)
Alist_C = [1]*N

for i in range(0,M):
    temp = Alist_B.index(max(Alist_B))
    Alist_B[temp] = Alist[temp] // (2 ** Alist_C[temp])
    Alist_C[temp] +=1

ans = 0
for j in Alist_B:
    ans +=j

print(ans)

Fixed submission:
import  heapq

N, M = map(int, input().split())

Alist = list(map(lambda x : x * (-1), map(int, input().split())))
heapq.heapify(Alist)

for i in range(0,M):
    a = - (-heapq.heappop(Alist) // 2)
    heapq.heappush(Alist,a)

ans = 0
for j in Alist:
    ans += j * (-1)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Hlist = list(map(int, input().split()))

Last_move_num = 0

for i in range(0,N):
    move_num = 0
    for j in range(i,N-1):
        if Hlist[j] >= Hlist[j+1]:
            move_num = move_num+1
        else:
            break
    if move_num > Last_move_num:
        Last_move_num = move_num

print(Last_move_num)

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

Last_move_num = 0
move_num = 0
for i in range(0,N-1):

    if Hlist[i] >= Hlist[i+1]:
        move_num = move_num+1
    else:
        move_num = 0
    if move_num > Last_move_num:
        Last_move_num = move_num

print(Last_move_num)
Buggy python submission (verdict: Time Limit Exceeded):
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = int(input())

S = list()

for i in range(N):
    S.append(list(input()))
    S[i].sort()

S.sort()
ans = 0
for j in range(N):
    k = 1
    while j+k < N and S[j][0] == S[j+k][0]:
        if "".join(S[j]) == "".join(S[j+k]):
            ans += 1
        k += 1

print(ans)

Fixed submission:
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = int(input())

S = list()
num = {}
ans = 0

for i in range(N):
    S.append(list(input()))
    S[i].sort()
    if "".join(S[i]) in num:
        num["".join(S[i])] += 1
        ans += num["".join(S[i])]
    else:
        num["".join(S[i])] = 0

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = int(input())

S = list()

for i in range(N):
    S.append(list(input()))
    S[i].sort()

ans = 0
for j in range(N):
    k = 1
    while j+k < N:
        if "".join(S[j]) == "".join(S[j+k]):
            ans += 1
        k += 1


print(ans)

Fixed submission:
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = int(input())

S = list()
num = {}
ans = 0

for i in range(N):
    S.append(list(input()))
    S[i].sort()
    if "".join(S[i]) in num:
        num["".join(S[i])] += 1
        ans += num["".join(S[i])]
    else:
        num["".join(S[i])] = 0

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')

N,M = inpl()

alist = list()
for _ in range(M):
    alist.append(int(input()))

dp = [0]*(N+1)
dp[0] = 1
if 1 not in alist:
    dp[1] = 1
for i in range(2,N+1):
    if i <= N and i not in alist:
        dp[i] += dp[i-1] + dp[i-2]

print(dp[N]%1000000007)


Fixed submission:
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')

N,M = inpl()

alist = [False for _ in range(N+1)]
for _ in range(M):
    alist[int(input())] = True

dp = [0 for _ in range(N+1)]
dp[0] = 1
if not alist[1]:
    dp[1] = 1
for i in range(2,N+1):
    if alist[i]:
        continue
    dp[i] += dp[i-1] + dp[i-2]

print(dp[N]%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')

N,M = inpl()

alist = list()
for _ in range(M):
    alist.append(int(input()))

dp = [0]*(N+1)

for i in range(N+1):
    if i <= N and i not in alist:
        if i == 0 :
            dp[i] = 1
        elif i < 2:
            dp[i] += dp[i-1]
        elif i <= N:
            dp[i] += dp[i-1]
            dp[i] += dp[i-2]


print(dp[N]%1000000007)


Fixed submission:
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')

N,M = inpl()

alist = [False for _ in range(N+1)]
for _ in range(M):
    alist[int(input())] = True

dp = [0 for _ in range(N+1)]
dp[0] = 1
if not alist[1]:
    dp[1] = 1
for i in range(2,N+1):
    if alist[i]:
        continue
    dp[i] += dp[i-1] + dp[i-2]

print(dp[N]%1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
import heapq


X,Y,Z,K = map(int,input().split())
Alist = list( map(int, input().split()))
Blist = list(map(int, input().split()))
Clist = list( map(int, input().split()))

sum =[]
heapq.heapify(sum)

for i in range(0,X):
    for j in range(0,Y):
        for k in range(0,Z):
            heapq.heappush(sum,(Alist[i]+Blist[j]+Clist[k])*(-1))

for i in range(0,K):
    print(-1*heapq.heappop(sum))

Fixed submission:
import heapq


X,Y,Z,K = map(int,input().split())

Alist = list( map(int, input().split()))
Blist = list(map(int, input().split()))
Clist = list( map(int, input().split()))
Alist.sort(reverse=True)
Blist.sort(reverse=True)
Clist.sort(reverse=True)

sum =[]
heapq.heapify(sum)

arg_hash = {}
heapq.heappush(sum,((Alist[0]+Blist[0]+Clist[0])*(-1),(0,0,0)))

for i in range(0,K):
    ans,(a,b,c) = heapq.heappop(sum)
    print(-ans)

    arg_a = a+1,b,c
    arg_b = a,b+1,c
    arg_c = a,b,c+1

    if a < X-1 and arg_a not in arg_hash:
        heapq.heappush(sum,((Alist[a+1]+Blist[b]+Clist[c])*(-1),arg_a))
        arg_hash[arg_a]=1
    if b < Y-1 and arg_b not in arg_hash:
        heapq.heappush(sum,((Alist[a]+Blist[b+1]+Clist[c])*(-1),arg_b))
        arg_hash[arg_b]=1
    if c < Z - 1 and arg_c not in arg_hash:
        heapq.heappush(sum, ((Alist[a] + Blist[b] + Clist[c+1]) * (-1), arg_c))
        arg_hash[arg_c] = 1
Buggy python submission (verdict: Runtime Error):
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())


def frog(i, now_cost):
    if dp[i][now_cost] != 10**5:
        dp[i][now_cost] = min(dp[i][now_cost], now_cost)
    else:
        dp[i][now_cost] = now_cost
        if i+1 < N:
            frog(i+1,now_cost+abs(hlist[i+1]-hlist[i]))
        if i+2 < N:
            frog(i+2,now_cost+abs(hlist[i+2]-hlist[i]))


N = int(input())
hlist = inpl()
dp=list()
for _ in range(N):
    dp.append([10 ** 5] * sum(hlist))

frog(0,0)

print(min(dp[N-1]))



Fixed submission:
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')

N = int(input())

hlist = inpl()

dp = [INF]*N

for i in range(N):
    if i == 0 :
        dp[i] = 0
    elif i < 2:
        dp[i] = dp[i-1]+abs(hlist[i]-hlist[i-1])
    elif i < N:
        dp[i] = min(dp[i-1]+abs(hlist[i]-hlist[i-1]),dp[i-2]+abs(hlist[i]-hlist[i-2]))

print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
import itertools

def input_ints():
    return list(map(int, input().split()))

def output_list(v):
    print(' '.join(str(x) for x in v))

def main():
    n, l = input_ints()
    a = [*range(l, l + n)]
    ans = sum(a)
    if a[-1] < 0:
        ans -= a[-1]
    if a[0] > 0:
        ans -= a[0]
    print(ans)

if __name__ == '__main__':
    main()


Fixed submission:
import itertools

def input_ints():
    return list(map(int, input().split()))

def output_list(v):
    print(' '.join(str(x) for x in v))

def main():
    n, l = input_ints()
    a = [x for x in range(l, l + n)]
    ans = sum(a)
    if a[-1] < 0:
        ans -= a[-1]
    if a[0] > 0:
        ans -= a[0]
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
from fraction import gcd

def input_ints():
    return list(map(int, input().split()))

def main():
    n = int(input())
    a = input_ints()
    x = [a[0]]
    y = [a[-1]]
    for i in range(n-1):
        x.append(gcd(x[-1], a[i + 1]))
        y.append(gcd(y[-1], a[n - i - 2]))
    ans = max(x[-2],y[-2])
    for i in range(1, n-1):
        ans = max(ans,gcd(x[i-1],y[-i-1]))
    print(ans)
    

if __name__ == '__main__':
    main()


Fixed submission:
from fractions import gcd

def input_ints():
    return list(map(int, input().split()))

def main():
    n = int(input())
    a = input_ints()
    x = [a[0]]
    y = [a[-1]]
    for i in range(n-1):
        x.append(gcd(x[-1], a[i + 1]))
        y.append(gcd(y[-1], a[n - i - 2]))
    ans = max(x[-2],y[-2])
    for i in range(1, n-1):
        ans = max(ans,gcd(x[i-1],y[-i-2]))
    print(ans)
    

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n,m = list(map(int, input().split()))
a=list(map(int, input().split()))
a.sorted()
d=[a[i+1]-a[i] for i in range(m-1)]
d.sorted()
print(sum(d[:m-n]) if m>n else 0)

Fixed submission:
n,m = list(map(int, input().split()))
a=list(map(int, input().split()))
a.sort()
d=[a[i+1]-a[i] for i in range(m-1)]
d.sort()
print(sum(d[:m-n]) if m>n else 0)

Buggy python submission (verdict: Runtime Error):
n,m = list(map(int, input().split()))
a=list(map(int, input().split()))
a.sorted()
d=[a[i+1]-a[i] for i in range(n-1)]
d.sorted()
print(sum(d[:m-n]) if m>n else 0)

Fixed submission:
n,m = list(map(int, input().split()))
a=list(map(int, input().split()))
a.sort()
d=[a[i+1]-a[i] for i in range(m-1)]
d.sort()
print(sum(d[:m-n]) if m>n else 0)

Buggy python submission (verdict: Runtime Error):
n,m = list(map(int, input().split()))
a=list(map(int, input().split()))
a.sorted()
d=[a[i+1]-a[i] for i in range(n)]
d.sorted()
print(sum(d[:m-n]) if m>n else 0)

Fixed submission:
n,m = list(map(int, input().split()))
a=list(map(int, input().split()))
a.sort()
d=[a[i+1]-a[i] for i in range(m-1)]
d.sort()
print(sum(d[:m-n]) if m>n else 0)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input.split())
if (a * b) % 2 == 0:
  print("No")
else:
  print("Yes")

Fixed submission:
a, b = map(int, input().split())
if (a * b) % 2 == 0:
  print("No")
else:
  print("Yes")