Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def main():
    _, m, ab = map(int, open(0).read().split())
    ab = zip(ab[0::2], ab[1::2])
    pay = 0
    day = 0
    for t in reversed(sorted(ab, key=lambda x: (x[1], x[0]))):
        a, b = t

        # 目標日以降
        if day > m:
            break
        # 報酬が受け取れない
        if a > m or day+a > m:
            continue

        pay += b
        day += 1

    print(pay)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    from collections import defaultdict
    from heapq import heappush, heappop
    _, m, *ab = map(int, open(0).read().split())
    works = defaultdict(list)
    # == zip(ab[0::2], ab[1::2])
    for a, b in zip(*[iter(ab)]*2):
        # 最大値が欲しいが、heappopは最小値を取り出すので-1倍しておく
        works[a].append(-b)

    candidates, pay = [], []
    for day in range(1, m+1):
        for x in works[day]:
            heappush(candidates, x)
        if candidates:
            pay.append(heappop(candidates))
    print(-sum(pay))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    _ = input()
    A = map(int, input())
 
    B = tuple(map(abs, A))
    C = tuple(a for a in A if a < 0)
    print(sum(B) - min(B)*2*(len(C)%2))
 
 
if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin

readline = stdin.readline

_, *aa = map(int, open(0).read().split())
r = 0
mi = 1000000000
m = 0
for a in aa:
    if a < 0:
        m += 1
    b = abs(a)
    r += b
    mi = min(b, mi)
print(r - mi * 2 * (m % 2))

Buggy python submission (verdict: Runtime Error):
from sys import stdin
 
readline = stdin.readline
 
def main():
    _, *A = map(int, open(0).read().split())
 
    B = tuple(map(abs, A))
    C = (a for a in A if a < 0)
    print(sum(B) - min(B)*2*(len(C)%2))
 
 
if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin

readline = stdin.readline

_, *aa = map(int, open(0).read().split())
r = 0
mi = 1000000000
m = 0
for a in aa:
    if a < 0:
        m += 1
    b = abs(a)
    r += b
    mi = min(b, mi)
print(r - mi * 2 * (m % 2))

Buggy python submission (verdict: Runtime Error):
from sys import stdin

readline = stdin.readline

def main():
    _, *A = map(int, open(0).read().split())
 
    B = map(abs, A)
    C = [a for a in A if a < 0]
    print(sum(B) - min(B)*2*(len(C)%2))
 
 
if __name__ == "__main__":
    main()

Fixed submission:
from sys import stdin

readline = stdin.readline

_, *aa = map(int, open(0).read().split())
r = 0
mi = 1000000000
m = 0
for a in aa:
    if a < 0:
        m += 1
    b = abs(a)
    r += b
    mi = min(b, mi)
print(r - mi * 2 * (m % 2))

Buggy python submission (verdict: Runtime Error):
from sys import stdin

readline = stdin.readline

_, *a = map(int, open(0).read().split())
res = 0
mi = 1_000_000_000
rem = True
for v in a:
    if v < 0:
        rem = not rem
    b = abs(v)
    res += b
    mi = min(b, mi)
if rem:
    res -= mi*2
print(res)


Fixed submission:
from sys import stdin

readline = stdin.readline

_, *aa = map(int, open(0).read().split())
r = 0
mi = 1000000000
m = 0
for a in aa:
    if a < 0:
        m += 1
    b = abs(a)
    r += b
    mi = min(b, mi)
print(r - mi * 2 * (m % 2))

Buggy python submission (verdict: Runtime Error):
from sys import stdin

readline = stdin.readline

_, *a = map(int, open(0).read().split())
res = 0
mi = 1_000_000_000
rem = True
for v in a:
    if v < 0:
        rem != rem
    b = abs(v)
    res += b
    mi = min(b, mi)
if rem:
    res -= mi*2
print(res)


Fixed submission:
from sys import stdin

readline = stdin.readline

_, *aa = map(int, open(0).read().split())
r = 0
mi = 1000000000
m = 0
for a in aa:
    if a < 0:
        m += 1
    b = abs(a)
    r += b
    mi = min(b, mi)
print(r - mi * 2 * (m % 2))
Buggy python submission (verdict: Runtime Error):
lh, lw = input().split()
h, w = input().split()

print(lh * lw - lh * w - lw * h + h + w)


Fixed submission:
lh, lw = map(int, input().split())
h, w = map(int, input().split())

print(lh * lw - lh * w - lw * h + h * w)
Buggy python submission (verdict: Runtime Error):
from sys import stdin


def na():
    return map(int, stdin().split())


n, _, c = na()
bs = na()

cnt = 0
for _ in range(n):
    if sum(x * y for x, y in zip(na(), bs)) > -c:
        cnt += 1

print(cnt)


Fixed submission:
from functools import reduce

n, _, c = map(int, input().split())
bs = tuple(map(int, input().split()))

count = 0
for i in range(n):
    if reduce(
        lambda x, y: x + y[0] * y[1],
        zip(bs, map(int, input().split())),
        0,
    ) + c > 0:
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
from itertools import zip_longest


def main():
    _, *a = map(int, open(0))
    a = sorted(a, reverse=True)
    print(sum(i - j for i, j in zip_longest(*[iter(a)]*2, fillvalue=0)))


if __name__ == "__main__":
    main()


Fixed submission:
from itertools import zip_longest

def main():
    n, *a = map(int, open(0).read().split())
    a = reversed(sorted(a))
    res = sum(a - b for a, b in zip_longest(*[iter(a)]*2, fillvalue=0))
    print(res)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def sum_digits(number):
    total = 0
    while number > 0:
        total += n % 10
        n //= 10
    return total


def main():
    n, a, b = map(int, open(0).read().split())
    res = 0
    for i in range(1, n+1):
        total = sum_digits(i)
        if a <= total and total <= b:
            res += total
    print(res)


if __name__ == "__main__":
    main()


Fixed submission:
def sum_digits(n):
    total = 0
    while n > 0:
        total += n % 10
        n //= 10
    return total


def main():
    n, a, b = map(int, open(0).read().split())
    res = 0
    for i in range(1, n+1):
        total = sum_digits(i)
        if a <= total and total <= b:
            res += i
    print(res)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
for n in range(N):
    if A.count(n+1)+K-Q > 0:
        print('Yes')
    else:
        print('No')

Fixed submission:
import collections
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
cs = collections.Counter(A)
for n in range(N):
    if cs[n+1] > Q-K:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Runtime Error):
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
plus = np.array([A.count(n+1) for n in range(N)])
scores = plus+K-Q
for score in scores:
    if score>0:
        print('Yes') 
    else:
        print('No')

Fixed submission:
import collections
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
cs = collections.Counter(A)
for n in range(N):
    if cs[n+1] > Q-K:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Runtime Error):
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
plus = np.array([A.count(n+1) for n in range(N)])
scores = plus+K-Q
result = [print('Yes') if score>0 else print('No') for score in scores]

Fixed submission:
import collections
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
cs = collections.Counter(A)
for n in range(N):
    if cs[n+1] > Q-K:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
scores = [K] * N
for n in range(N):
    scores[n] = scores[n] + A.count(n+1)
    if scores[n] > Q:
        print('Yes')
    else:
        print('No')

Fixed submission:
import collections
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
cs = collections.Counter(A)
for n in range(N):
    if cs[n+1] > Q-K:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
scores = [K] * N
for n in range(N):
    scores[n] = scores[n] + A.count(n+1)
for n in range(N):
    if scores[n] > Q:
        print('Yes')
    else:
        print('No')

Fixed submission:
import collections
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
cs = collections.Counter(A)
for n in range(N):
    if cs[n+1] > Q-K:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())

C=A+B
D=A-B
E=A*B

print(max(C,D,E))


Fixed submission:
i=list(map(int,input().split()))
C=i[0]+i[1]
D=i[0]-i[1]
E=i[0]*i[1]

print(max([C,D,E]))
Buggy python submission (verdict: Runtime Error):
i = list(map(int,input().split()))
K = i[0]
X = i[1]
print(int(range(X-K+1,X+K)))

Fixed submission:
i = list(map(int,input().split()))
K = i[0]
X = i[1]
C = range(X-K+1,X+K)
print(' '.join(map(str,list(C))))

Buggy python submission (verdict: Runtime Error):
i = list(map(int,input().split()))
K = i[0]
X = i[1]
print(range(X-K+1,X-K-1)

Fixed submission:
i = list(map(int,input().split()))
K = i[0]
X = i[1]
C = range(X-K+1,X+K)
print(' '.join(map(str,list(C))))
Buggy python submission (verdict: Runtime Error):
N, K = int(input().split())

ans = N - (K-1)
print(ans)


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

ans = N - (K-1)
print(ans)
Buggy python submission (verdict: Runtime Error):
#include <iostream>
using namespace std;

int main(){
    int a,b;
    cin >> a >> b;
    if(a*b % 2 == 0) cout << "Even\n";
    else cout << "Odd\n";
}

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

Buggy python submission (verdict: Runtime Error):
a,b = map(int, input.split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")

Fixed submission:
a,b = map(int, input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Runtime Error):
x = input()
if x < 1200:
  print("ABC\n")
else:
  print("ARC\n")
  

Fixed submission:
x = int(input())
if x < 1200:
  print("ABC")
else:
  print("ARC")
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
if a+b==c or a==b+c or a+c==b:
  print("Yes")
else:
  print("No")

Fixed submission:
a,b,c = map(int, input().split())
if a+b==c or a==b+c or a+c==b:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: UTF-8 -*-

n, k, q = map(int, input().split(" "))
a = []
points = []
for i in range(0,n):
  points.append(k)

for s in range(0,q):
  a = int(input()) - 1
  for l in range(0, len(points)):
    if l != a:
      points[l] = points[l]-1

for t in range(0, n):
  result = "Yes"
  if points[t] <= 0:
    result = "No"
  print(result)


Fixed submission:
n, k, q = map(int, input().split(" "))
a = []
points = []
for i in range(0,n):
  points.append(k - q)

for s in range(0,q):
  a = int(input()) - 1
  points[a] = points[a] + 1

for t in range(0, n):
  result = "Yes"
  if points[t] <= 0:
    result = "No"
  print(result)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())
B = map(int, input().split())
C = map(int, input().split())
add_s = 0
for order in range(N-1):
  cur_f = A[order]
  nxt_f = A[order+1]
  add_s += C[order] if nxt_f == cur_f + 1 else 0
  
print(sum(B) + add_s)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
add_s = 0
for idx in range(N-1):
  cur_f = A[idx]
  nxt_f = A[idx+1]
  add_s += C[cur_f-1] if nxt_f == cur_f + 1 else 0

print(sum(B) + add_s)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())
B = map(int, input().split())
C = map(int, input().split())

s = 0
prev = 0
for f in A:
  if prev != 0:
    s += B[f-1]
    s += C[prev-1]
  else:
    s += B[f-1]
  prev = f
print(s)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
add_s = 0
for idx in range(N-1):
  cur_f = A[idx]
  nxt_f = A[idx+1]
  add_s += C[cur_f-1] if nxt_f == cur_f + 1 else 0

print(sum(B) + add_s)
Buggy python submission (verdict: Runtime Error):
N = int(input())
B = list(map(int, input().split()))
s = 0
for i in range(B):
  if i == 0:
    s += B[0]
  else:
    s += min(B[i-1], B[i])
print(s + B[N-1])

Fixed submission:
N = int(input())
B = list(map(int, input().split()))
s = 0
for i in range(N-1):
  if i == 0:
    s += B[0]
  else:
    s += min(B[i-1], B[i])
print(s + B[N-2])
Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
P = list(map(int, input().split()))

uf = uf(N)

for _ in range(1,M+1):
    x,y = map(int, input().split())
    uf.unite(x,y)

count = 0
for n in range(N):
    if uf.is_same_group(P[n-1],n+1):
        count += 1

print(count)


Fixed submission:
class uf():
    def __init__(self,n):
        self.root = [-1] * (n+1)

    def findroot(self,x):
        if self.root[x] < 0:
            return x
        else:
            self.root[x] = self.findroot(self.root[x])
            return self.root[x]

    def unite(self,x,y):
        rootx = self.findroot(x)
        rooty = self.findroot(y)
        if rootx == rooty:
            return
        else:
            self.root[rootx] += self.root[rooty]
            self.root[rooty] = rootx
            return

    def is_same_group(self,x,y):
        return self.findroot(x) == self.findroot(y)

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

uf = uf(N)

for _ in range(M):
    x,y = map(int, input().split())
    uf.unite(x,y)

count = 0
for n in range(N):
    if uf.is_same_group(P[n],n+1):
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
n, k = [int(x) for x in (input().split())]
a = [int(x) for x in (input().split())]

for i in range(n):
	if a[i] == 1:
		print(i)


Fixed submission:
s = input()

if s == 'Rainy':
	s = 'Sunny'
elif s == 'Cloudy':
	s = 'Rainy'
else:
	s = 'Cloudy'
print(s)
Buggy python submission (verdict: Runtime Error):
L1 = input().split(" ")
score = [int(L1[1])-int(L1[2])]*(int(L1[0])-1)
for i in range(int(L1[2])):
    A = int(input()) - 1
    score[A] += 1

for j in score:
    if j > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
L1 = input().split(" ")
L12 = int(L1[2])
score = [int(L1[1])-L12]*(int(L1[0]))
for i in range(L12):
    A = int(input()) - 1
    score[A] += 1

for j in score:
    if j > 0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
import heapq

L1 = input().split(" ")
L2 = input().split(" ")
tickets = int(L1[1])
L2int = [-int(s) for s in L2]

heapq.heapify(L2int)

for t in range(tickets):
    heapq.heappush(L2int,heapq.heappop//2)
print(-sum(L2int))

Fixed submission:
import heapq
 
L1 = input().split(" ")
L2 = input().split(" ")
tickets = int(L1[1])
L2int = [-int(s) for s in L2]
 
heapq.heapify(L2int)
 
for t in range(tickets):
    heapq.heappush(L2int,-(-heapq.heappop(L2int)//2))
print(-sum(L2int))

Buggy python submission (verdict: Time Limit Exceeded):
L1 = input().split(" ")
L2 = input().split(" ")
tickets = int(L1[1])
L2int = [int(s) for s in L2]

for t in range(tickets):
    M = max(L2int)
    L2int[L2int.index(M)] = M//2
print(sum(L2int))

Fixed submission:
import heapq
 
L1 = input().split(" ")
L2 = input().split(" ")
tickets = int(L1[1])
L2int = [-int(s) for s in L2]
 
heapq.heapify(L2int)
 
for t in range(tickets):
    heapq.heappush(L2int,-(-heapq.heappop(L2int)//2))
print(-sum(L2int))

Buggy python submission (verdict: Time Limit Exceeded):
L1 = input().split(" ")
L2 = input().split(" ")
tickets = int(L1[1])
L2int = [int(s) for s in L2]

for t in range(tickets):
    M = max(L2int)
    L2int[L2int.index(M)] = M//2
print(sum(L2int))

Fixed submission:
import heapq
 
L1 = input().split(" ")
L2 = input().split(" ")
tickets = int(L1[1])
L2int = [-int(s) for s in L2]
 
heapq.heapify(L2int)
 
for t in range(tickets):
    heapq.heappush(L2int,-(-heapq.heappop(L2int)//2))
print(-sum(L2int))

Buggy python submission (verdict: Time Limit Exceeded):
L1 = input().split(" ")
L2 = input().split(" ")
tickets = int(L1[1])
L2int = [int(s) for s in L2]

for t in range(tickets):
    M = max(L2int)
    L2int[L2int.index(M)] = M//2
print(sum(L2int))

Fixed submission:
import heapq
 
L1 = input().split(" ")
L2 = input().split(" ")
tickets = int(L1[1])
L2int = [-int(s) for s in L2]
 
heapq.heapify(L2int)
 
for t in range(tickets):
    heapq.heappush(L2int,-(-heapq.heappop(L2int)//2))
print(-sum(L2int))
Buggy python submission (verdict: Time Limit Exceeded):

def resolve():
    ks = input().split(" ")
    k = int(ks[0])
    s = int(ks[1])

    n = 0

    for zz in range(k+1):
        for yy in range (k+1):
            for xx in range (k+1):
                if (xx+yy+zz == s):
                    n += 1

    print(n)

if __name__ == "__main__":
    resolve()

Fixed submission:

def resolve():
    ks = input().split(" ")
    k = int(ks[0])
    s = int(ks[1])

    n = 0

    for zz in range(k+1):
        for yy in range (k+1):
                if (0 <= s-(yy+zz) <= k):
                    n += 1

    print(n)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
input0=input("")
b=2
i=0

c=input0[::2]
d=input0[1::2]

for a in c:
    if(a=="L"):
        b=1
    else:
        b=0
    e=+b
    
for a in d:
    if(a=="R"):
        b=1
    else:
        b=0
    f=+b

g=e+f
if(g==0):
    print("Yes")
else:
    print("No")

Fixed submission:
input0=input("")
e=0
f=0
g=0
i=0

c=input0[::2]
d=input0[1::2]

for a in c:
    b=2
    if(a=="L"):
        b=1
    else:
        b=0
    e=e+b
    
for a in d:
    b=2
    if(a=="R"):
        b=1
    else:
        b=0
    f=f+b

g=e+f

if(g==0):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
member = [K] * N
flag = False

for i in range(0, Q):
    n = int(input())

    for j in range(0, N):
        member[j] = member[j] - 1
    member[n-1] = member[n-1] + 1

for i in range(0, N):
    if member[i] <= 0:
        print("No")
    else:
        print("Yes")


Fixed submission:
N, K, Q = map(int, input().split())
member = [K] * N
flag = False

for i in range(0, Q):
    n = int(input())
    member[n-1] = member[n-1] + 1

for j in range(0, N):
    member[j] = member[j] - Q
    if member[j] <= 0:
        print("No")
    else:
        print("Yes")

Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
member = [K] * N
flag = False


for i in range(0, Q):
    n = int(input())

    for j in range(0, N):
        if not j == n-1:
            member[j] = member[j] - 1

for i in range(0, N):
    if member[i] <= 0:
        print("No")
    else:
        print("Yes")


Fixed submission:
N, K, Q = map(int, input().split())
member = [K] * N
flag = False

for i in range(0, Q):
    n = int(input())
    member[n-1] = member[n-1] + 1

for j in range(0, N):
    member[j] = member[j] - Q
    if member[j] <= 0:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
ss = [0]*N

ss[0] += S[1:].count('E')
ss[N-1] += S[:N-1].count('W')

for i in range(1, N-1):
  ss[i] += S[:i].count('W')
  ss[i] += S[i+1:].count('E')
  
print(max(min(ss), 1))

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

ss1 = S[1:].count('E')
ss = ss1

for i in range(1, N):
  ss1 = ss1 + (S[i-1]=='W') - (S[i]=='E')
  if ss1 < ss:
    ss = ss1
  
print(ss)
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
result = []
p = 0
q = 0
    
for q in range(N):
    for i in range(N-1):     
        if H[i-1] >= H[i+p]:
            p += 1 
            q += 1
        else:
            result.append(q)
            break


print(max(result))

Fixed submission:
def solve():
    
    N = int(input())
    H = list(map(int, input().split()))
    result = []
    p = 0
    q = 0
    
    for i in range(N-1):     
        if H[i] >= H[i+1]:
            q += 1
        else:
            p = max(p, q)
            q = 0
    p = max(p, q)
    print(p)

solve()
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
import numpy as np
import sys


def main():
    N, K, Q = map(int, input().split())
    score = []
    for i in range(Q):
        score.append(int(input())-1)
    score = np.array(score)
    for i in range(N):
        if K - Q +len(score[score==i]) > 0:
            print("Yes")
        else:
            print("No")




if __name__ =='__main__':
    main()

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np
import sys


def main():
    N, K, Q = map(int, input().split())
    score = np.zeros(N)
    for i in range(Q):
        score[int(input())-1] += 1
    for i in range(N):
        if K - Q +score[i] > 0:
            print("Yes")
        else:
            print("No")








if __name__ =='__main__':
    main()

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
import sys


def main():
    N, K, Q = map(int, input().split())
    score = np.ones(N*Q).reshape(Q,N)
    for i in range(Q):
        score[i,int(input())-1] = 0
    score = np.sum(score,axis=0).reshape(-1,)
    score -= K
    for i in range(N):
        if score[i] <0:
            print("Yes")
        else:
            print("No")








if __name__ =='__main__':
    main()


Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np
import sys


def main():
    N, K, Q = map(int, input().split())
    score = np.zeros(N)
    for i in range(Q):
        score[int(input())-1] += 1
    for i in range(N):
        if K - Q +score[i] > 0:
            print("Yes")
        else:
            print("No")








if __name__ =='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = list(map(int, input().split()))

X = []
for i in range(N):
    x = [0 for _ in range(N)]
    for j in range(i, i+2):
        if j >= N:
            continue
        x[j] = 1
    if i == N - 1:
        x[0] = 1
    X.append(x)

Y = A
X = np.matrix(X)
Y = np.matrix(Y).reshape(-1, 1)
ans = np.linalg.solve(X,Y) * 2
ans = list(map(lambda x: str(int(x)), ans))
print(' '.join(ans).strip())


Fixed submission:
N,A,B = map(int, input().split())
print(N*A if N*A <= B else B)

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

if R - L >= 2019:
    print(0)
else:
    m = 2020
    for i in range(L, R):
        m = min(m, i % 2019)
    print(m * (m+1))


Fixed submission:
N,A,B = map(int, input().split())
print(N*A if N*A <= B else B)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = list(map(int, input().split()))

X = []
for i in range(N):
    x = [0 for _ in range(N)]
    for j in range(i, i+2):
        if j >= N:
            continue
        x[j] = 1
    if i == N - 1:
        x[0] = 1
    X.append(x)

Y = A
X = np.matrix(X)
Y = np.matrix(Y).reshape(-1, 1)
ans = np.linalg.solve(X,Y) * 2
ans = list(map(lambda x: str(int(x)), ans))
print(' '.join(ans).strip())


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
X = []
for i in range(N):
    X.append(sum(A) - 2 * sum([x for j, x in enumerate(A) if j % 2 != 0]) if i == 0 else 2 * A[i-1] - X[i-1])
print(' '.join(list(map(str, X))).strip())

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
A = list(map(int, input().split()))

X = []
for i in range(N):
    x = [0 for _ in range(N)]
    for j in range(i, i+2):
        if j >= N:
            continue
        x[j] = 1
    if i == N - 1:
        x[0] = 1
    X.append(x)

Y = A
X = np.matrix(X)
Y = np.matrix(Y).reshape(-1, 1)
ans = np.linalg.solve(X,Y) * 2
ans = list(map(lambda x: str(int(x)), ans))
print(' '.join(ans).strip())


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
X = []
for i in range(N):
    X.append(sum(A) - 2 * sum([x for j, x in enumerate(A) if j % 2 != 0]) if i == 0 else 2 * A[i-1] - X[i-1])
print(' '.join(list(map(str, X))).strip())