Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = (n+1000)//1000*1000-n
if x==1000:
  print(0)
  else:
    print(x)

Fixed submission:

from collections import deque



# for #!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
from bisect import bisect_left as bl
from math import log2,ceil
from heapq import heappush, heappop
from itertools import permutations 
def main():
    # for t in range(int(input())):
        n = int(input())
        x = (n+1000)//1000*1000-n
        if x==1000:
            print(0)
        else:
            print(x)

            # heappush(h, l[i])

        


        
        




# endregion

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    # n = int(input())
    # l = [int(j) for j in input().split()]
    

    for t in range(int(input())):
        #n,m = [int(j) for j in input().split()]
        n = int(input())
        print(n+n**2+n**3)
# endregion

if __name__ == "__main__":
    main()


Fixed submission:
n = int(input())
print(n+n**2+n**3)
Buggy python submission (verdict: Runtime Error):
n = input()
if n.count("7")>0:
  print("Yes")
  else:
    print("No")

Fixed submission:
# for #!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


def main():
	# for t in range(int(input())):
		n = input()
		if n.count("7")>0:
			print("Yes")
		else:
			print("No")
		
		


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = "x" in file.mode or "r" not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b"\n") + (not b)
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode("ascii"))
		self.read = lambda: self.buffer.read().decode("ascii")
		self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
	main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(2,10):
  while n%i == 0:
    n = n/i
if n==1:
  print("Yes)
else:
        print("No")

Fixed submission:
n = int(input())
for i in range(1,10):
    if n%i == 0:
        if n//i in range(1,10):
            print("Yes")
            break
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import math
a,h,x = [int(j) for j in input().split()]
y = (h*a - x/a)*(2/a**2)
print(90-math.degrees(math.atan(1/y)))

Fixed submission:
import math
a,h,x = [int(j) for j in input().split()]
# y = (h*a - x/a)*(2/a**2)
# y = a**2/(2*h*a-2*x)
y = 2*h/a - 2*x/a**3
z = (h**2)*a/(2*x)
# try:
# print(y)
b = x/(a**2)
if b>h/2:
    print(math.degrees(math.atan(y)))
else:
    print(math.degrees(math.atan(z)))
Buggy python submission (verdict: Runtime Error):
a,b = [int(j) for j in input().split()]
print(max(a-2*b, 0)

Fixed submission:
a,b = [int(j) for j in input().split()]
print(max(a-2*b, 0))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = ""
curr_set = ""
for i in range(n):
    if s[i] == curr_set:
        continue
    else:
        curr_set = s[i]
        ans=ans+s[i]
print(len(ans))

    


Fixed submission:
n = int(input())
s = raw_input()
ans = 0
curr_set = ""
for i in range(n):
    if s[i] == curr_set:
        continue
    else:
        curr_set = s[i]
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
  s=input()
  t=input()

  sd=list(s)
  sd.sort()
  td=list(t)
  td.sort(reverse=True)

  for (sc,tc) in zip(sd,td):
    if sc<tc:
      print("Yes")
      return
  if len(sd)<len(td) and sd[len(sd)-1]==td[len(sd)-1]:
    print("Yes")
    return
  print("No")

main()


Fixed submission:
import math
a,b=map(int,input().split())
x=(a+b)/2

print(math.ceil(x))
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
a=list(map(int,input().split()))

answer=0
count_sum=0

counter = Counter(a)
for num, cnt in counter.most_common():
#  print (num, cnt)
  count_sum+=cnt
  if cnt>num:
    answer += cnt-i
  elif cnt<num:
    answer += cnt
answer+=N-count_sum
print(answer)


Fixed submission:
from collections import Counter
N=int(input())
a=list(map(int,input().split()))

answer=0
count_sum=0

counter = Counter(a)
for num, cnt in counter.most_common():
#  print (num, cnt)
  count_sum+=cnt
  if cnt>num:
    answer += cnt-num
  elif cnt<num:
    answer += cnt
answer+=N-count_sum
print(answer)
Buggy python submission (verdict: Runtime Error):
print(int(input()**2-int(input()))

Fixed submission:
print(int(input())**2-int(input()))
Buggy python submission (verdict: Time Limit Exceeded):
[X, K, D] = list(map(int, input().split()))
X = abs(X)
Y = K%2
for i in range(K):
    X -= D
    if X<0:
        if (i+1)%2 != Y:
            X += D
        else:
            X = abs(X)
        break
print(X)

Fixed submission:
[X, K, D] = list(map(int, input().split()))
X = abs(X)
Y = K%2
if X//D < K:
    if (X//D)%2 == Y:
        X = X%D
    else:
        X = D-X%D
else:
    X=X-K*D

print(X)
Buggy python submission (verdict: Time Limit Exceeded):
[N, K] = list(map(int, input().split()))
A = list(map(int, input().split()))
P = 1

for i in range(K):
    P = P*A[i]

st = 0
la = K

for i in range(N-K):
    P2 = (P/A[st])*A[la]
    if P2 > P:
        print('Yes')
    else:
        print('No')
    st += 1
    la += 1
    P = P2

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

st = 0
la = K

for i in range(N-K):
    if A[la] > A[st]:
        print('Yes')
    else:
        print('No')
    st += 1
    la += 1

Buggy python submission (verdict: Time Limit Exceeded):
[N, K] = list(map(int, input().split()))
A = list(map(int, input().split()))
P = 1

for i in range(K):
    P = P*A[i]

st = 0
la = K

for i in range(N-K):
    if A[st] != 0:
        P2 = (P/A[st])*A[la]
    else:
        P2 = 1
        for j in range(K):
            P2 *= A[i-j+1]
    if P2 > P:
        print('Yes')
    else:
        print('No')
    st += 1
    la += 1
    P = P2


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

st = 0
la = K

for i in range(N-K):
    if A[la] > A[st]:
        print('Yes')
    else:
        print('No')
    st += 1
    la += 1
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
answer = 1
for i in range(N):
    answer *= A[i]
if answer > 10 ** 18:
    print(-1)
else:
    print(answer)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
answer = 1
for i in A:
    answer *= i
    if answer > 10 ** 18:
        break

if answer > 10 ** 18:
    print(-1)
else:
    print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
answer = []
for i in range(N):
    for j in range(N):
        if A[j] == i+1:
            answer.append(j+1)
print(' '.join(map(str, answer)))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = {}
for i in range(N):
    B[A[i]] = i+1
answer = sorted(B.items())
ac=[]
for i in range(N):
    ac.append(answer[i][1])
print(' '.join(map(str, ac)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
B = {}
answer = []
for i in range(N):
    B[i+1] = A[i]
for i in range(N):
    for j in range(1, N+1):
        if B[j] == i+1:
            answer.append(j)
print(' '.join(map(str,answer)))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = {}
for i in range(N):
    B[A[i]] = i+1
answer = sorted(B.items())
ac=[]
for i in range(N):
    ac.append(answer[i][1])
print(' '.join(map(str, ac)))
Buggy python submission (verdict: Time Limit Exceeded):
[N, K, Q] = map(int, input().split())
A = [int(input()) for i in range(Q)]
B = [K for i in range(N)]
for i in range(Q):
    for j in range(N):
        if j != A[i]-1:
            B[j] -= 1
for i in range (N):
    if B[i] <=0:
        print('No')
    else:
        print('Yes')


Fixed submission:
[N, K, Q] = map(int, input().split())
A = [int(input()) for i in range(Q)]
B = [0 for i in range(N)]
for i in range(Q):
    B[A[i]-1] += 1
for i in range(N):
    if K + B[i] - Q > 0:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = list(map(int, input().split()))
def move_right(i):
    count = 0
    for j in range(i, N-1):
        if H[j+1]<=H[j]:
            count += 1
        else:
            break
    return count

answer=0

for i in range(N-1):
    answer=max(answer,move_right(i))

print(answer)


Fixed submission:
N = int(input())
H = list(map(int, input().split()))
count = 0
answer = 0
for j in range(N-1):
    if H[j+1] <= H[j]:
        count += 1
    else:
        answer = max(count, answer)
        count = 0
answer = max(count, answer)
print(answer)

Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
def move_right(i):
    count = 0
    for j in range(i, N-1):
        if H[j+1]<=H[j]:
            count += 1
        else:
            break
    return count
A = [move_right(i) for i in range(N-1)]
print(max(A))

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
count = 0
answer = 0
for j in range(N-1):
    if H[j+1] <= H[j]:
        count += 1
    else:
        answer = max(count, answer)
        count = 0
answer = max(count, answer)
print(answer)
Buggy python submission (verdict: Runtime Error):
num_list = list(map(int, input().split()))
N = num_list[0]
L = num_list[1]
S = [input(i) for i in range(N)]
for i in range(N):
        for j in range(N):
                if i < j:
                        for k in range(L):
                                if S[i][k] > S[j][k]:
                                        S[i], S[j] = S[j], S[i]
                                        break
                                else:
                                        continue
print(''.join(S))


Fixed submission:
x = list(map(int, input().split()))
a = 0
for i in x:
        if i != 5 and i != 7:
                a = 1
        break
if a == 0:
        if sum(x) == 17:
                print('YES')
        else:
                print('NO')
else:
        print('NO')
Buggy python submission (verdict: Runtime Error):
n=input()
x=int(n)
b=0
for i in n:
  b+=int(i)

if x%b==0:
  print("Yes")
else:
  print("No")

Fixed submission:
s=list(input())
p=0
for i in  range(4):
  if s[i]=="+":
    p=p+1
  else:
    p=p-1
print(p)
Buggy python submission (verdict: Runtime Error):
s=input()
p=0
for i in s:
  if i=='o':
  	p++ 

print(p)

Fixed submission:
s=input()
p=0
#print(s)
for i in s:
  if i=='o':
  	p+=1 

    
print(100*int(p)+700)
"""
oxo

900

ooo

1000

xxx

700
"""
Buggy python submission (verdict: Runtime Error):

##Just for prctice
n=int(input())

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

A.sort()
A.reverse()
a=0
b=0
for i in range(n):
    if i%2==0:
        a+=A[i]
    else:
        b+=A[i]

print(a-b)

"""
2
3 1

2

3
2 7 4

5

4
20 18 2 18

18
"""




Fixed submission:

##Just for prctice
N=int(input())

A=int(input())

for i in range(A+1):
    if (N-i)%500==0:
        print("Yes")
        break
    elif i==A:
        print("No")


"""
2018
218

Yes

2763
0

No

37
514

Yes
"""
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
ans="Odd"
product=a*b

if product%2==0:
  ans="Even
print(ans)

Fixed submission:
a,b=map(int,input().split())
ans="Odd"
product=a*b

if product%2==0:
  ans="Even"
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
s[3]='8'
print(s)

Fixed submission:


"""
2017/01/31

2018/01/31

"""

date=input()

dates=date.split('/')
dates[0]='2018'
print('/'.join(dates))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())

print(ceil(a+b)/2)

Fixed submission:
import math
a,b=map(int,input().split())
x=math.ceil((a+b)/2)
print(x)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
d,e,f=map(int,input().split())
ans="NO"
if a==f and b==e and c==d:
  ans="YES"
print(ans)


Fixed submission:
a = input()
b = input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a,b,c=map(str,input().split())
d,e,f=map(str,input().split())
ans="NO"
if a==f and b==e and c==d:
  ans="YES"
print(ans)

Fixed submission:
a = input()
b = input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
X,K,D = map(int,input().split())
A = abs(X)
ans = 0
if A >= D*K:
    print( A - (D * K))
else :
    e = A//D
    K -= e
    x %= D
    if K%2 == 0:
        print(x)
    else:
        print(D-x)

Fixed submission:
X,K,D = map(int,input().split())
A = abs(X)
ans = 0
if A >= D*K:
    print( A - (D * K))
else :
    e = A//D
    K -= e
    A %= D
    if K%2 == 0:
        print(A)
    else:
        print(D-A)

Buggy python submission (verdict: Time Limit Exceeded):
X,K,D = map(int,input().split())

A = abs(X)
while A > D:
    A -= D
    K -= 1
    if K == 0:
        break

if K > 0:
    if K%2 == 1:
        A = A - D

print(abs(A))

Fixed submission:
X,K,D = map(int,input().split())
A = abs(X)
ans = 0
if A >= D*K:
    print( A - (D * K))
else :
    e = A//D
    K -= e
    A %= D
    if K%2 == 0:
        print(A)
    else:
        print(D-A)

Buggy python submission (verdict: Time Limit Exceeded):
X,K,D = map(int,input().split())

if X>0:
    p = True
else:
    p = False
c = 0
while abs(X)> D:
    if p :
        X -= D
        K -= 1
    else:
        X += D
        K -= 1
    if K == 0:
        break

if K > 0:
    if K%2 == 1 and p == True:
        X = X - D
    if K%2 == 1 and p == False:
        X = X + D

print(abs(X))

Fixed submission:
X,K,D = map(int,input().split())
A = abs(X)
ans = 0
if A >= D*K:
    print( A - (D * K))
else :
    e = A//D
    K -= e
    A %= D
    if K%2 == 0:
        print(A)
    else:
        print(D-A)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ls = [0]*(N+2)

for i in range(1,151):
    for j in range(1,151):
        for k in range(1,151):
            t = i**2 + j**2 + k**2 + i*j + j*k + k*i 
            if t <= N :
                ls[t] += 1

for p in range(1,N+1):
    print(ls[p])

Fixed submission:
N = int(input())
ls = [0]*(N+2)

for i in range(1,151):
    for j in range(1,151):
        for k in range(1,151):
            t = i*i + j*j + k*k + i*j + j*k + k*i 
            if t <= N :
                ls[t] += 1

for p in range(1,N+1):
    print(ls[p])

Buggy python submission (verdict: Runtime Error):
N = int(input())
ls = [0]*10000


for i in range(1,42):
    for j in range(1,42):
        for k in range(1,42):
            t = i**2 + j**2 + k**2 + i*j + j*k + k*i 
            ls[t-1] = ls[t-1] + 1

for p in range(0,N):
    print(ls[p])

Fixed submission:
N = int(input())
ls = [0]*(N+2)

for i in range(1,151):
    for j in range(1,151):
        for k in range(1,151):
            t = i*i + j*j + k*k + i*j + j*k + k*i 
            if t <= N :
                ls[t] += 1

for p in range(1,N+1):
    print(ls[p])
Buggy python submission (verdict: Runtime Error):
import sys

def main():
  H,W,K = map(int,input().split())
  a = []
  for i in range(H):
    a.append(sys.stdin.read())
    
  ans = 0
  for i in range(2**H):
    for j in range(2**W):
      cnt = 0
      for s in range(H):
        for t in range(W):
          if(i >> s) & 1 and (j >> t) & 1 and a[s][t] == "#":
            cnt += 1
      if cnt == K :
        ans += 1
  print(ans)
  
if __name__ == "__main__":
  main()

Fixed submission:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


H,W,K = map(int,readline().split())
C = [readline().strip() for _ in range(H)]

ans = 0
for i in range(2**H):
    for j in range(2**W):
        cnt = 0
        for s in range(H):
            for t in range(W):
                if (i >> s) & 1 and (j >> t) & 1 and C[s][t] == "#":
                    cnt += 1
        if cnt == K:
            ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M,K = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

A = [0]
B = [0]

for i in range(N):
    A.append(A[i]+a[i])

for i in range(M):
    B.append(B[i]+b[i])
ans = 0

for i in range(0,N+1):
    p = M
    if A[i] > K:
        break
    while B[p] > K - A[i]:
        p -= 1
    ans = max(ans,i+p)

print(ans)

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

A = [0]
B = [0]

for i in range(N):
    A.append(A[i]+a[i])

for i in range(M):
    B.append(B[i]+b[i])
ans = 0

p = M
for i in range(0,N+1):
    if A[i] > K:
        break
    while B[p] > K - A[i]:
        p -= 1
    ans = max(ans,i+p)

print(ans)
Buggy python submission (verdict: Runtime Error):
from math import floor
A= input().split()
p = int(A[0])
q = float(A[1]*100)
t = p*q
p //= 100
print(p)

Fixed submission:
from math import floor
A= input().split()
p = int(A[0])
q = round(float(A[1])*100)
t = p*q
t //= 100
print(t)

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

def Div():
    N = int(input())
    c = 0
    k = N//2 + 1
    for i in range(2,k):
        if(prime(i)):
            for j in range(1,int(m.sqrt(N))+1):
                p = i ** j
                if(p>N):
                    break
                if(N%p==0):
                    N = N //p
                    c = c + 1
    
    return c

print(Div())

Fixed submission:
from math import floor
A= input().split()
p = int(A[0])
q = round(float(A[1])*100)
t = p*q
t //= 100
print(t)

Buggy python submission (verdict: Runtime Error):
def multi3():
    nums = list(map(float,input().split()))
    return m.floor(nums[0] * nums[1])


if __name__ == "__main__":
    print(multi3())

Fixed submission:
from math import floor
A= input().split()
p = int(A[0])
q = round(float(A[1])*100)
t = p*q
t //= 100
print(t)
Buggy python submission (verdict: Runtime Error):
x1 = input()
x2 = input()
x3 = input()
x4 = input()
x5 = input()

if (x1==0):
  print(1)
if (x2==0):
  print(2)
if (x3==0):
  print(3)
if (x4==0):
  print(4)
if (x5==0):
  print(5)

Fixed submission:
a = input().split()
for i in range(5):
  if (a[i]=='0'):
    print(i+1)
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main(){
    int N;
    long long ans = 0, sum =0;
    int mod = 1000000000+7;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a.at(i);
        sum += a.at(i);
        sum %= mod;
    }
    for (int i = 0; i < N; i++) {
        sum -= a.at(i);
        if(sum<0) sum += mod;
        ans += sum * a.at(i);
        ans %= mod;
    }
    cout << ans << endl;
}


Fixed submission:
def main():
    n = int(input())
    a = []
    sum = 0             #longの気持ち
    ans = 0             #long long の気持ち
    mod = 1_000_000_000 + 7
    x = list(map(int, input().split()))
    for i in range(n):
        sum += x[i]           
        a.append(x[i])
    
    for i in range(n):
        sum -= a[i]
        ans += sum * a[i]
        ans %= mod
    print(ans)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main(){
    int N;
    long long ans = 0, sum =0;
    int mod = 1000000000+7;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a.at(i);
        sum += a.at(i);
    }
    for (int i = 0; i < N-1; i++) {
        sum -= a.at(i);
        if(sum<0) sum += mod;
        ans += sum * a.at(i);
        ans %= mod;
    }
    cout << ans << endl;
}
/*

*/


Fixed submission:
def main():
    n = int(input())
    a = []
    sum = 0             #longの気持ち
    ans = 0             #long long の気持ち
    mod = 1_000_000_000 + 7
    x = list(map(int, input().split()))
    for i in range(n):
        sum += x[i]           
        a.append(x[i])
    
    for i in range(n):
        sum -= a[i]
        ans += sum * a[i]
        ans %= mod
    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def solve():
    N = int(input())
    X = int(input())
    T = int(input())
    try_num = N // X
    print(try_num)
    if N % X != 0 :
        try_num += 1
    total_time = try_num * T
    print(total_time)

if __name__ == "__main__":
    solve()

Fixed submission:

def main() :
    N, X, T= list(map(int, input().split()))
    print((N + X - 1) // X * T)

if __name__ == "__main__":
    main()