Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())

val = 0
for num in range(0,N):
    row = input().split()
    val = val + row[1] - row[0]

val = val - N
print(val)

Fixed submission:
N = int(input())

val = 0
for num in range(0,N):
    row = input().split()
    val = val + int(row[1]) - int(row[0])

val = val + N
print(val)
Buggy python submission (verdict: Runtime Error):
t, x = map(int, inupt().split())
print(t / x)

Fixed submission:
t, x = map(int, input().split())
print(t / x)
Buggy python submission (verdict: Runtime Error):
 x = list(map(int, input().split()))
print(x.index(0) + 1)

Fixed submission:
x = list(map(int, input().split()))
print(x.index(0) + 1)
Buggy python submission (verdict: Runtime Error):
import math

a, b = input().split()
A, B = [int(a), int(b.replace('.', '')]

print(A * B // 100)

Fixed submission:
import math

a, b = input().split()
A, B = [int(a), int(b.replace('.', ''))]

print(A * B // 100)

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

a, b = input().split()
A, B = [int(a), int(b * 100)]

print(A * B / 100)

Fixed submission:
import math

a, b = input().split()
A, B = [int(a), int(b.replace('.', ''))]

print(A * B // 100)
Buggy python submission (verdict: Runtime Error):
import math

A, B, H, M = map(int, input().split())

deg_long = M * 6
deg_short = 30 * H + M / 2

if abs(deg_long - deg_short) > 180:
    rad = math.radians(360 - abs(deg_long - deg_short))
else:
    math.radians(abs(deg_long - deg_short))

print(math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(rad)))

Fixed submission:
import math

A, B, H, M = map(int, input().split())

rad = 0
deg_long = M * 6
deg_short = 30 * H + M / 2

if abs(deg_long - deg_short) > 180:
    rad = math.radians(360 - abs(deg_long - deg_short))
else:
    rad = math.radians(abs(deg_long - deg_short))

print(math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(rad)))
Buggy python submission (verdict: Runtime Error):
S = str(input())
T = str(input())

if S == T[0:-1]:
    print('Yes')
else
    print('No')

Fixed submission:
S = str(input())
T = str(input())

if S == T[0:-1]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N,Q = [int(w) for w in input().split()]
i = 0
x = []
y = []
while i < N:
    a,b = [int(w) for w in input().split()]
    x.append(a)
    y.append(b)
    i +=1
for i in range(N):
    m = (x[i]**2 + y[i]**2)**(1/2)
    if  m <= Q:
        count += 1
    else:
        count += 0
print(count) = 0

Fixed submission:
N,Q = [int(w) for w in input().split()]
i = 0
x = []
y = []
count = 0
while i < N:
    a,b = [int(w) for w in input().split()]
    x.append(a)
    y.append(b)
    i +=1
for i in range(N):
    m = (x[i]**2 + y[i]**2)**(1/2)
    if  m <= Q:
        count += 1
    else:
        count += 0
print(count)

Buggy python submission (verdict: Runtime Error):
N,Q = [int(w) for w in input().split()]
i = 0
x = []
y = []
while i < N:
    a,b = [int(w) for w in input().split()]
    x.append(a)
    y.append(b)
    i +=1
for i in range(N):
    m = (x[i]**2 + y[i]**2)**(1/2)
    if  m <= Q:
        count += 1
    else:
        count += 0
print(count)ount = 0

Fixed submission:
N,Q = [int(w) for w in input().split()]
i = 0
x = []
y = []
count = 0
while i < N:
    a,b = [int(w) for w in input().split()]
    x.append(a)
    y.append(b)
    i +=1
for i in range(N):
    m = (x[i]**2 + y[i]**2)**(1/2)
    if  m <= Q:
        count += 1
    else:
        count += 0
print(count)

Buggy python submission (verdict: Runtime Error):
N,Q = [int(w) for w in input().split()]
i = 0
x = []
y = []
cile i < N:
    a,b = [int(w) for w in input().split()]
    x.append(a)
    y.append(b)
    i +=1
for i in range(N):
    m = (x[i]**2 + y[i]**2)**(1/2)
    if  m <= Q:
        count += 1
    else:
        count += 0
print(count)ount = 0

Fixed submission:
N,Q = [int(w) for w in input().split()]
i = 0
x = []
y = []
count = 0
while i < N:
    a,b = [int(w) for w in input().split()]
    x.append(a)
    y.append(b)
    i +=1
for i in range(N):
    m = (x[i]**2 + y[i]**2)**(1/2)
    if  m <= Q:
        count += 1
    else:
        count += 0
print(count)
Buggy python submission (verdict: Runtime Error):
N = input()
N = int(N)
ans = 0
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = 1000 - int(str(N)[1:])
    else:
        ans = 0
else:
    ans = "choose another number"
print(int(ans))

Fixed submission:
N = int(input())
ans = 0
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = ((N//1000) + 1)*1000 - N
    else:
        ans = 0
else:
    ans = "choose another number"
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
if N%1000 != 0:
    ans = 1000 - int(str(N)[1:])
    print(ans)
else:
    print(int(ans))

Fixed submission:
N = int(input())
ans = 0
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = ((N//1000) + 1)*1000 - N
    else:
        ans = 0
else:
    ans = "choose another number"
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = 1000 - int(str(N)[1:])
    else:
        ans = 0
else:
    ans = "choose another number"
print(ans)

Fixed submission:
N = int(input())
ans = 0
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = ((N//1000) + 1)*1000 - N
    else:
        ans = 0
else:
    ans = "choose another number"
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = 1000 - int(str(N)[1:])
    else:
        ans = 0
else:
    ans = "choose another number"
print(ans)

Fixed submission:
N = int(input())
ans = 0
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = ((N//1000) + 1)*1000 - N
    else:
        ans = 0
else:
    ans = "choose another number"
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
if N%1000 != 0:
    ans = 1000 - int(str(N)[1:])
    print(ans)
else:
    print(ans)

Fixed submission:
N = int(input())
ans = 0
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = ((N//1000) + 1)*1000 - N
    else:
        ans = 0
else:
    ans = "choose another number"
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
if N%1000 != 0:
    ans = 1000 - int(str(N)[1:])
    print(ans)
else:
    print(ans)

Fixed submission:
N = int(input())
ans = 0
if 1 <= N <= 10000:
    if N%1000 != 0:
        ans = ((N//1000) + 1)*1000 - N
    else:
        ans = 0
else:
    ans = "choose another number"
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import cos, pi

value = input().split()
A = int(value[0])
B = int(value[1])
H = int(value[2])
M = int(value[3])

if 1 <= A <= 1000 and 1 <= B <= 1000 and 0 <= H <=11 and 0 <= M <= 59:
    if abs(float(H)*30 - float(M)*6) == 90 :
        print(pow(float(A)**2 + float(B)**2, 0.5))
    else:
        print(pow(float(A)**2 + float(B)**2 - 2*float(A)*float(B)*cos(pi*(float(H)*30 - float(M)*6)/180),0.5))
else:
    print("Choose value in interval define on the exercise")

Fixed submission:
N = int(input())

if N < 1000:
    num = str(N)
    if num[-1] == "3":
        print("bon")
    elif num[-1] in ["0", "1", "6", "8"]:
        print("pon")
    else:
        print("hon")
else:
    print("Please enter an interger between not exceeding 999")

Buggy python submission (verdict: Runtime Error):
K = int(input(), 10)
S = input().lower()

if 0 < K < 101 and 0 < len(S) < 101:
    if len(S) < K:
        print(S)
    else:
        print(S[:K] + "...") 
else:
    print("Try again with K and length of S between 1 and 100")


Fixed submission:
N = int(input())

if N < 1000:
    num = str(N)
    if num[-1] == "3":
        print("bon")
    elif num[-1] in ["0", "1", "6", "8"]:
        print("pon")
    else:
        print("hon")
else:
    print("Please enter an interger between not exceeding 999")
Buggy python submission (verdict: Runtime Error):
K = int(input())
S = str(input()).lower()

if 0 < K < 101 and 0 < len(S) < 101:
    if len(S) =< K:
        print(S)
    else:
        print(S[:K] + "...") 
else:
    print("Try again with K and length of S between 1 and 100 ")

Fixed submission:
K = int(input())
S = str(input()).lower()

if 0 < K < 101 and 0 < len(S) < 101:
    if len(S) <= K:
        print(S)
    else:
        print(S[:K] + "...") 
else:
    print("Try again with K and length of S between 1 and 100 ")
Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
 
a, b = [0], [0]
for i in range(N):
	a.append(a[i] + A[i])
for i in range(M):
	b.append(b[i] + B[i])
 
ans, j = 0, M
for i in range(N + 1):
	if a[i] > K:
 		break
 	while b[j] > K - a[i]:
 		j -= 1
 		ans = max(ans, i + j)
print(ans)

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

a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)
Buggy python submission (verdict: Runtime Error):
L, R, d = input().split()

L = int()
R = int()
d = int()

ans = 0

for i in range(L, R+1):
    if i % d == 0:
        ans = ans + 1
        
print(ans)

Fixed submission:
L, R, d = map(int,input().split())



ans = 0

for i in range(L, R+1):
    if i % d == 0:
        ans = ans + 1
        
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

a = 0
w = 0
t = 0
r = 0

for i in range(n):
    b = input()
    if b == "AC":
        a += 1
    if b == "WA":
        w += 1
    if b == "TLE":
        t += 1
    if b == "RE":
        r += 1
print("AC x", a)
print("WA x", w)
print("TLE x", t)
print("RE x", r)




Fixed submission:
a = input()
a= int(a)

if 1<= a < 1000:
    print(1000 - a)
if 1000 < a < 2000:
    print(2000 - a)
if 2000 < a < 3000:
    print(3000 - a)
if 3000 < a < 4000:
    print(4000 - a)
if 4000< a < 5000:
    print(5000 - a)
if 5000< a < 6000:
    print(6000 - a)
if 6000< a < 7000:
    print(7000 - a)
if 7000 < a < 8000:
    print(8000 - a)
if 8000 < a < 9000:
    print(9000 - a)
if 9000 < a <10000:
    print(10000 - a)
if a == 1000:
    print(0)
if a == 2000:
    print(0)
if a == 3000:
    print(0)
if a == 4000:
    print(0)
if a == 5000:
    print(0)
if a == 6000:
    print(0)
if a == 7000:
    print(0)
if a == 8000:
    print(0)
if a == 9000:
    print(0)
if a == 10000:
    print(0)

# (物の値段/入力)a + （おつり）N = 1000?
#Nは整数だから　print(おつり)
#　N　＝　1000? - a

#input 1900  print 100 (2000)
# input 1525 print 475 (2000)
# input 2500 print 500 (3000)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
import operator

n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt, precnt = 0, reduce(operator.mul, a[:k])

for i in range(1, n-k+1):
    cnt = reduce(operator.mul, a[i:k+i])
    if cnt > precnt:
        print("Yes")
    else:
        print("No")
    precnt = cnt



Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(n-k):
    if a[i] >= a[k+i]:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))

for i in range(a):
    if (i+1) * a[i] % 2 != 1:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
ans = 0

for i in range(n):
    if ((i+1) * a[i]) % 2 != 0:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy

n,m,k = map(int,input().split())
li_a = list(map(int,input().split()))
li_b = list(map(int,input().split()))

li_A = numpy.cumsum(li_a)
li_B = numpy.cumsum(li_b)

ans, j = 0,m
for i in range(n + 1):
    if li_A[i] > k:
        break
    while li_B[j] + li_A[i]> k:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Fixed submission:
import numpy

n,m,k = map(int,input().split())
li_a = list(map(int,input().split()))
li_b = list(map(int,input().split()))

li_A = [0] + list(numpy.cumsum(li_a))
li_B = [0] + list(numpy.cumsum(li_b))

ans, j = 0,m
for i in range(n+1):
    if li_A[i] > k:
        break
    while li_B[j] + li_A[i]> k:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import deque
import math

n,m,k = map(int,input().split())
li_a = deque(list(map(int,input().split())))
li_b = deque(list(map(int,input().split())))
ans,cnt = 0,0

for i in range(n+m+1):
    if n != 0:
        a_num = li_a[0]
    else:
        a_num = math.inf

    if m != 0:
        b_num = li_b[0]
    else:
        b_num = math.inf

    if a_num <= b_num:
        temp = a_num
        li_a.popleft()
        n -= 1
    else:
        temp = b_num
        li_b.popleft()
        m -= 1

    if cnt + temp > k:
        break
    else:
        cnt += temp
        ans += 1

print(ans)

Fixed submission:
import numpy

n,m,k = map(int,input().split())
li_a = list(map(int,input().split()))
li_b = list(map(int,input().split()))

li_A = [0] + list(numpy.cumsum(li_a))
li_B = [0] + list(numpy.cumsum(li_b))

ans, j = 0,m
for i in range(n+1):
    if li_A[i] > k:
        break
    while li_B[j] + li_A[i]> k:
        j -= 1
    ans = max(ans, i + j)
print(ans)
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
li = list(map(int,input().split()))
q = int(input())
num_li=[list(map(int,input().split())) for i in range(q)]

c = collections.Counter(li)

li_sum = sum(li)

for i,j in num_li:
    s = 0
    if i in c:
        cnt = c.pop(i)
        c[j] += cnt
    
    li_sum = li_sum - (i*cnt) + (j*cnt)
    print(li_sum)

Fixed submission:
import collections
n = int(input())
li = list(map(int,input().split()))
q = int(input())
num_li=[list(map(int,input().split())) for i in range(q)]

c = collections.Counter(li)

li_sum = sum(li)

for i,j in num_li:
    s = 0
    if i in c:
        cnt = c.pop(i)
        c[j] += cnt
        li_sum = li_sum - (i*cnt) + (j*cnt)
    print(li_sum)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())
li = list(map(int,input().split()))
q = int(input())
num_li=[list(map(int,input().split())) for i in range(q)]


c = collections.Counter(li)

for i,j in num_li:
    s = 0
    if i in c:
        cnt = c.pop(i)
        c[j] += cnt
    for k, v in c.items():
        s += k * v
    print(s)

Fixed submission:
import collections
n = int(input())
li = list(map(int,input().split()))
q = int(input())
num_li=[list(map(int,input().split())) for i in range(q)]

c = collections.Counter(li)

li_sum = sum(li)

for i,j in num_li:
    s = 0
    if i in c:
        cnt = c.pop(i)
        c[j] += cnt
        li_sum = li_sum - (i*cnt) + (j*cnt)
    print(li_sum)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())
li = list(map(int,input().split()))
q = int(input())
num_li=[list(map(int,input().split())) for i in range(q)]


c = collections.Counter(li)

for i,j in num_li:
    s = 0
    if i in c:
        cnt = c.pop(i)
        c[j] += cnt
    for k, v in c.items():
        s += k * v
    print(s)

Fixed submission:
import collections
n = int(input())
li = list(map(int,input().split()))
q = int(input())
num_li=[list(map(int,input().split())) for i in range(q)]

c = collections.Counter(li)

li_sum = sum(li)

for i,j in num_li:
    s = 0
    if i in c:
        cnt = c.pop(i)
        c[j] += cnt
        li_sum = li_sum - (i*cnt) + (j*cnt)
    print(li_sum)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())
li = list(map(int,input().split()))
q = int(input())
num_li=[list(map(int,input().split())) for i in range(q)]

li.sort()
for i,j in num_li:
    if i in li:
        cnt = li.count(i)
        li = [k for k in li if k != i] + [j]*cnt
    print(sum(li))

Fixed submission:
import collections
n = int(input())
li = list(map(int,input().split()))
q = int(input())
num_li=[list(map(int,input().split())) for i in range(q)]

c = collections.Counter(li)

li_sum = sum(li)

for i,j in num_li:
    s = 0
    if i in c:
        cnt = c.pop(i)
        c[j] += cnt
        li_sum = li_sum - (i*cnt) + (j*cnt)
    print(li_sum)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print(a * b)

Fixed submission:
a,b = map(int,input().split())
print(a * b)

Buggy python submission (verdict: Runtime Error):
print(int(input()) * int(input()))

Fixed submission:
a,b = map(int,input().split())
print(a * b)
Buggy python submission (verdict: Runtime Error):
s=input()
if s="ABC":
    print("ARC")
else:
    print("ABC")

Fixed submission:
s=input()
if s=="ABC":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Runtime Error):
s = input()
cnt=0
for i in range(len(s)-3):
    for j in range(i+4,len(s)):
        if int(s[i:j+1]) % 2019 == 0:
            cnt+= 1
print(cnt)

Fixed submission:
s,w = map(int,input().split())
if w>=s:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = input()
li = list(map(int,input().split()))
l_set = set(li)
ans_dic = {}
for i in l_set:
    temp = 0
    li2 = li[:]
    li2.remove(i)
    c = collections.Counter(li2)
    c_items = list(c.items())
    for j in c_items:
        temp += ((j[1] * (j[1]-1)) // 2)
    ans_dic[i] = temp
for k in li:
    print(ans_dic[k])

Fixed submission:
import collections
temp = 0
n = input()
li = list(map(int,input().split()))
c = collections.Counter(li)
c_items = list(c.items())
for j in c_items:
    temp += ((j[1] * (j[1]-1)) // 2)
for i in li:
    print(temp - (c[i]-1))

Buggy python submission (verdict: Time Limit Exceeded):
import collections
import copy
n = input()
li = list(map(int,input().split()))
for i in range(len(li)):
    ans = 0
    li2 = copy.copy(li)
    li2[i] = 0
    c = collections.Counter(li2)
    c_key = list(c.values())
    for j in c_key:
        ans += ((j * (j-1)) // 2)
    print(ans)

Fixed submission:
import collections
temp = 0
n = input()
li = list(map(int,input().split()))
c = collections.Counter(li)
c_items = list(c.items())
for j in c_items:
    temp += ((j[1] * (j[1]-1)) // 2)
for i in li:
    print(temp - (c[i]-1))
Buggy python submission (verdict: Runtime Error):
h, w = map(int,input().split())
masu = h*w
if h == 1 or w == 1:
    print(1)
elif masu % 2 == 0:
    print(masu//2)
else:
    print(masu//2 + 1)

Fixed submission:
li= [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(li[int(input())-1])
Buggy python submission (verdict: Runtime Error):
s=input().split()
if s[0] != s[1] or s[1] != s[2]:
    print("Yes)
else:
    print("No)

Fixed submission:
s=list(input())
if s[0] != s[1] or s[1] != s[2]:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
s=list(input())
if s[0] != s[1] or s[1] != s[2]:
  print("Yes)
else:
        print("No)

Fixed submission:
s=list(input())
if s[0] != s[1] or s[1] != s[2]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
x = int(input())
kosuu, amari = x // 100, x % 100
ans = 0

for i in kosuu:
    amari -= 5
    if amari <= 0:
        ans = 1
        break

print(ans)

Fixed submission:
x = int(input())
kosuu, amari = x // 100, x % 100
ans = 0

for i in range(kosuu):
    amari -= 5
    if amari <= 0:
        ans = 1
        break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
toko_li = list(map(int,input().split()))
ans = [0] * n
for i in toko_li:
    ans[i - 1] = toko_li.index(i) + 1
print(*ans)

Fixed submission:
n = int(input())
toko_li = list(map(int,input().split()))
ans = [0] * n
for i in range(n):
    ans[toko_li[i]-1] = i+1
print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
input = sys.stdin.readline
n , m = map(int,input().split())
price_li = list(map(int,input().split()))
np_li = np.array(price_li) 
for i in range(m):
    np_li[np_li.argmax()] = np.amax(np_li) // 2
print(sum(np_li))

Fixed submission:
import heapq
n, m = map(int,input().split())
price_li = [-int(i) for i in input().split()]
heapq.heapify(price_li)
for _ in range(m):
    j = -heapq.heappop(price_li)
    j //= 2
    heapq.heappush(price_li,-j)
print(-sum(price_li))

Buggy python submission (verdict: Time Limit Exceeded):
n , m = map(int,input().split())
price_li = list(map(int,input().split()))
for i in range(m):
    price_li[price_li.index(max(price_li))] = max(price_li) // 2
print(sum(price_li))

Fixed submission:
import heapq
n, m = map(int,input().split())
price_li = [-int(i) for i in input().split()]
heapq.heapify(price_li)
for _ in range(m):
    j = -heapq.heappop(price_li)
    j //= 2
    heapq.heappush(price_li,-j)
print(-sum(price_li))
Buggy python submission (verdict: Time Limit Exceeded):
li = [i for i in range(1, int(input())+ 1)]
print(sum(li[:-1]))

Fixed submission:
n = int(input())
print((n * (n - 1)) // 2)

Buggy python submission (verdict: Time Limit Exceeded):
li = [i for i in range(1, int(input())+ 1)]
print(sum(li[:-1]))

Fixed submission:
n = int(input())
print((n * (n - 1)) // 2)

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

Fixed submission:
n = int(input())
print((n * (n - 1)) // 2)
Buggy python submission (verdict: Runtime Error):
n, q = map(int,input().split())
top_list = [list(map(int,input().split())) for i in range(n - 1)]
ope_list = [list(map(int,input().split())) for i in range(q)]
ans = [0] * n

"""
for i in ope_list:
    ans[i[0] - 1] += i[1]

for j in range(n):
    for k in top_list:
        if j + 1 == k[1]:
            ans[j] += ans[k[0] - 1]
"""

print(*ans)

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
    print(s)
else:
    print('red')
Buggy python submission (verdict: Runtime Error):
s = list(input())
cnt, i = 0, 0
l = len(s)

while i < l:
    if s[i] == s[i+1]:
        cnt += 1
        i += 2
    i += 1

print(l-cnt)

Fixed submission:
s = list(input())
cnt, i = 0, 1
l = len(s)

while i < l:
    if s[i] == s[i-1]:
        cnt += 1
        i += 2
    i += 1

print(l-cnt)

Buggy python submission (verdict: Runtime Error):
from collections import deque
s = deque(list(input()))
cnt, i = 0, 0
l = len(s)

while i < l:
    if s[i] == s[i+1]:
        cnt += 1
        i += 2
    i += 1

print(l-cnt)

Fixed submission:
s = list(input())
cnt, i = 0, 1
l = len(s)

while i < l:
    if s[i] == s[i-1]:
        cnt += 1
        i += 2
    i += 1

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

Fixed submission:
a, b, c = map(int,input().split())
print(max(c-a+b,0))
Buggy python submission (verdict: Time Limit Exceeded):
import copy
n = int(input())
string_list = [int(input()) for i in range(n)]

max_num = max(string_list)

for j in string_list:
    if j != max_num:
        print(max_num)
    else:
        templist = copy.deepcopy(string_list)
        templist.remove(j)
        print(max(templist))

Fixed submission:
import copy
n = int(input())
string_list = [int(input()) for i in range(n)]

sorted_list = sorted(string_list)
max_num = max(string_list)

for j in string_list:
    if j != max_num:
        print(max_num)
    else:
        print(sorted_list[-2])

Buggy python submission (verdict: Time Limit Exceeded):
import copy
n = int(input())
string_list = [input() for i in range(n)]

j = 0

for j in range(n):
    temp_list = copy.deepcopy(string_list)
    temp_list.pop(j)
    j += 1
    print(max(temp_list))

Fixed submission:
import copy
n = int(input())
string_list = [int(input()) for i in range(n)]

sorted_list = sorted(string_list)
max_num = max(string_list)

for j in string_list:
    if j != max_num:
        print(max_num)
    else:
        print(sorted_list[-2])
Buggy python submission (verdict: Runtime Error):
s = list(input())
s.sort()

if s[0] == s[1] and s[2] == s[3] and s[0] != s[3]
    print("Yes")
else:
    print("No")

Fixed submission:
s = list(input())
s.sort()

if s[0] == s[1] and s[2] == s[3] and s[0] != s[3]:
    print("Yes")
else:
    print("No")