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

for i in range(n-1):
    if a[i] < a[i+1]:
        money += (a[i+1]-a[i])*(money//a[i])
print(money)


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

money = 1000
for i in range(n-1):
    if a[i] < a[i+1]:
        money += (a[i+1]-a[i])*(money//a[i])
print(money)
Buggy python submission (verdict: Runtime Error):
# 標準入力
range = int(input())
input = list(map(int, input().split()))

count = 0
for i in range(range):
    if (i+1) % 2 == 1 and list[i] % 2 == 1:
        count += 1
print(count)

Fixed submission:
# 標準入力
n = int(input())
input = list(map(int, input().split()))
count = 0
for i in range(n):
    if (i+1) % 2 == 1 and input[i] % 2 == 1:
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
# 標準入力
range = input()
input = list(map(int, input().split()))

count = 0
for i in range(range):
    if (i+1) % 2 == 1 and list[i] % 2 == 1:
        count += 1
print(count)


Fixed submission:
# 標準入力
n = int(input())
input = list(map(int, input().split()))
count = 0
for i in range(n):
    if (i+1) % 2 == 1 and input[i] % 2 == 1:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = [0 for x in range(10000)]

for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            v = i*i + j*j + k*k + i*j + i*k + j*k
            if v < 10000:
                ans[v] += 1
for i in range(n):
    print(ans[i+1])


Fixed submission:
n = int(input())
ans = [0 for x in range(10001)]

for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            v = i*i + j*j + k*k + i*j + i*k + j*k
            if v < 10001:
                ans[v] += 1
for i in range(n):
    print(ans[i+1])
Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
a = []
for i in range(m):
	a.append(int(input()))

mod = 1000000007

memo = [0]*(n+1)
memo[0] = 1


for i in range(1, n+1):
    memo[i] = memo[i-1] + memo[i-2]
    if i in a:
        memo[i] = 0

print(memo[-1]%mod)

Fixed submission:
n, m = list(map(int, input().split()))
a = []
for i in range(m):
    a.append(int(input()))

mod = 1000000007

memo = [-1]*(n+1)
memo[0] = 0

for k in range(m):
    memo[a[k]] = 0

for i in range(1, n+1):
    if memo[i] != -1:
        pass 
    elif i <= 2:
        memo[i] = memo[i-1] + 1
    else:
        memo[i] = memo[i-1] + memo[i-2]
print(memo[-1]%mod)

Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
a = []
for i in range(m):
	a.append(int(input())
mod = 1000000007

memo = [0]*(n+1)
memo[0] = 1


for i in range(1, n+1):
    memo[i] = memo[i-1] + memo[i-2]
    if i in a:
        memo[i] = 0

print(memo[-1]%mod)

Fixed submission:
n, m = list(map(int, input().split()))
a = []
for i in range(m):
    a.append(int(input()))

mod = 1000000007

memo = [-1]*(n+1)
memo[0] = 0

for k in range(m):
    memo[a[k]] = 0

for i in range(1, n+1):
    if memo[i] != -1:
        pass 
    elif i <= 2:
        memo[i] = memo[i-1] + 1
    else:
        memo[i] = memo[i-1] + memo[i-2]
print(memo[-1]%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
a = []
for i in range(m):
    a.append(int(input()))
mod = 1000000007

memo = [0]*(n+1)
memo[0] = 1


for i in range(1, n+1):
    memo[i] = memo[i-1] + memo[i-2]
    if i in a:
        memo[i] = 0

print(memo[-1]%mod)

Fixed submission:
n, m = list(map(int, input().split()))
a = []
for i in range(m):
    a.append(int(input()))

mod = 1000000007

memo = [-1]*(n+1)
memo[0] = 0

for k in range(m):
    memo[a[k]] = 0

for i in range(1, n+1):
    if memo[i] != -1:
        pass 
    elif i <= 2:
        memo[i] = memo[i-1] + 1
    else:
        memo[i] = memo[i-1] + memo[i-2]
print(memo[-1]%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))

a = []
for i in range(m):
    a.append(int(input()))

mod = 1000000007

memo = [0]*(n+1)
memo[1] = 1

for i in range(1, n+1):
    if i in a:
        memo[i] = 0
    elif i <= 2:
        memo[i] = memo[i-1] + 1
    else:
        memo[i] = memo[i-1] + memo[i-2]
print(memo[-1]%mod)

Fixed submission:
n, m = list(map(int, input().split()))
a = []
for i in range(m):
    a.append(int(input()))

mod = 1000000007

memo = [-1]*(n+1)
memo[0] = 0

for k in range(m):
    memo[a[k]] = 0

for i in range(1, n+1):
    if memo[i] != -1:
        pass 
    elif i <= 2:
        memo[i] = memo[i-1] + 1
    else:
        memo[i] = memo[i-1] + memo[i-2]
print(memo[-1]%mod)
Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
list = [list(map(int, input().split())) for x in range(m)]
list.sort(list, key=lambda x: x[1], reverse=True) # １番の要素で降順ソート

app_count = 0
for i in list:
    a += [i[1]]*i[0]
    app_count += i[0]
    if app_count>n:
        break

a.sort(reverse=True)

print(a[:n])

Fixed submission:
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
list = [list(map(int, input().split())) for x in range(m)]
list.sort(key=lambda x: x[1], reverse=True) # １番の要素で降順ソート

app_count = 0
for i in list:
    a += [i[1]]*i[0]
    app_count += i[0]
    if app_count>n:
        break

a.sort(reverse=True)

print(sum(a[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
list = [list(map(int, input().split())) for x in range(m)]
list.sort(key=lambda x: x[1], reverse=True) # １番の要素で降順ソート


for i in list:
    a+=[i[1]]*i[0]

a.sort(reverse=True)

print(sum(a[:n]))

Fixed submission:
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
list = [list(map(int, input().split())) for x in range(m)]
list.sort(key=lambda x: x[1], reverse=True) # １番の要素で降順ソート

app_count = 0
for i in list:
    a += [i[1]]*i[0]
    app_count += i[0]
    if app_count>n:
        break

a.sort(reverse=True)

print(sum(a[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
list = [list(map(int, input().split())) for x in range(m)]


for i in list:
    for j in range(i[0]):
        if i[1]>min(a):
            a[a.index(min(a))] = i[1]

print(sum(a))

Fixed submission:
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
list = [list(map(int, input().split())) for x in range(m)]
list.sort(key=lambda x: x[1], reverse=True) # １番の要素で降順ソート

app_count = 0
for i in list:
    a += [i[1]]*i[0]
    app_count += i[0]
    if app_count>n:
        break

a.sort(reverse=True)

print(sum(a[:n]))
Buggy python submission (verdict: Runtime Error):
s = input()

b = int(s[:2])
a = int(s[2:])

print(b)
print(a)

def yorm(i):
    flag = 'none'
    if 0<i<12:
        flag = 'MM'
    elif i<100:
        flag = 'YY'
    return flag
   
ans = bf+af
if len(ans) != 4:
    ans = 'NA'
if ans == 'MMMM':
    ans = 'AMBIGUOUS'
if ans == 'YYYY':
    ans = 'NA'
print(ans)

Fixed submission:
s = input()

b = int(s[:2])
a = int(s[2:])

def yorm(i):
    flag = 'none'
    if 0<i<=12:
        flag = 'MM'
    elif i<100:
        flag = 'YY'
    return flag

bf = yorm(b)
af = yorm(a)
   
ans = bf+af
if len(ans) != 4:
    ans = 'NA'
if ans == 'MMMM':
    ans = 'AMBIGUOUS'
if ans == 'YYYY':
    ans = 'NA'
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())

c = a*b

if c%2 == 0:
    print('Even')
else:
    print('Odd')

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

c = a*b

if c%2 == 0:
    print('Even')
else:
    print('Odd')
Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split()))
count = 0

for p in range(k+1):
    for q in range(min(k+1, s-p+1)):
        for r in range(min(k+1, s-p-q+1)):
            t = p + q + r
            if t == s:
                count += 1
                break
print(count)


Fixed submission:
k, s = list(map(int, input().split()))
count = 0

for p in range(k+1):
    for q in range(k+1):
        r = s-p-q
        if r>=0 and r<=k:
            count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split()))

count = 0

for p in range(k+1):
    if p > s:
        break
    for q in range(k+1):
        if p + q > s:
            break
        for r in range(k+1):
            t = p + q + r
            if t == s:
                count += 1
                break
print(count)


Fixed submission:
k, s = list(map(int, input().split()))
count = 0

for p in range(k+1):
    for q in range(k+1):
        r = s-p-q
        if r>=0 and r<=k:
            count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split()))

count = 0

for p in range(k+1):
    if p > s:
        break
    for q in range(k+1):
        if p + q > s:
            break
        for r in range(k+1):
            t = p + q + r
            if t == s:
                count += 1

print(count)

Fixed submission:
k, s = list(map(int, input().split()))
count = 0

for p in range(k+1):
    for q in range(k+1):
        r = s-p-q
        if r>=0 and r<=k:
            count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split()))

count = 0

for p in range(k+1):
    for q in range(k+1):
        if p + q > s:
            break
        for r in range(k+1):
            t = p + q + r
            if t == s:
                count += 1

print(count)

Fixed submission:
k, s = list(map(int, input().split()))
count = 0

for p in range(k+1):
    for q in range(k+1):
        r = s-p-q
        if r>=0 and r<=k:
            count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split()))

count = 0

for p in range(k+1):
    for q in range(k+1):
        for r in range(k+1):
            t = p + q + r
            if t == s:
                count += 1

print(count)

Fixed submission:
k, s = list(map(int, input().split()))
count = 0

for p in range(k+1):
    for q in range(k+1):
        r = s-p-q
        if r>=0 and r<=k:
            count += 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)+1
array = [0]*(N)
k = 0
for i in range(N-1):
  if S[i] == "<":
    array[i+1] = array[i] + 1
    k = i+1
  else:
    for j in reversed(range(k,i+1)):
      if array[j]<=array[j+1]:
        array[j] += 1
#print(array)
print(sum(array))

Fixed submission:
S = input()
N = len(S)+1
k = 0
score= 0
countup = 0
countdown = 0
final = None
for i in range(N-1):
  if S[i] == "<":
    if final == ">":
      score += int(countdown*(countdown-1)/2)
      if countup <= countdown:
        score += countdown - countup
      countup = 0
    countdown = 0
    final = "<"
    countup += 1
    score += countup
  elif S[i] == ">":
    final = ">"
    countdown += 1
if final == ">":
  score += int(countdown*(countdown-1)/2)
  if countup <= countdown:
    score += countdown - countup
print(score)

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)+1
array = [0]*(N)
for i in range(N-1):
  if S[i] == "<":
    array[i+1] = array[i] + 1
    k = i+1
#  elif array[i] > array[i+1]:
#    k = i+1
  else:
    for j in reversed(range(k,i+1)):
      if array[j]<=array[j+1]:
        array[j] += 1
#print(array)
print(sum(array))

Fixed submission:
S = input()
N = len(S)+1
k = 0
score= 0
countup = 0
countdown = 0
final = None
for i in range(N-1):
  if S[i] == "<":
    if final == ">":
      score += int(countdown*(countdown-1)/2)
      if countup <= countdown:
        score += countdown - countup
      countup = 0
    countdown = 0
    final = "<"
    countup += 1
    score += countup
  elif S[i] == ">":
    final = ">"
    countdown += 1
if final == ">":
  score += int(countdown*(countdown-1)/2)
  if countup <= countdown:
    score += countdown - countup
print(score)
Buggy python submission (verdict: Runtime Error):
from operator import itemgetter
n = int(input())
A = input().split()
for i in range(n):
  A[i] = [int(A[i]),i+1]
A = sorted(A, key=itemgetter(0))
for a in A[:-1]:
  print(a[1],end=" ")
print(A[-1][1])

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

Buggy python submission (verdict: Runtime Error):
from operator import itemgetter
n = int(input())
A = input().split()
for i in range(n):
  A[i] = [int(A[i]),i+1]
A = sorted(A, key=itemgetter(0))
for a in A:
  print(a[1],end=" ")

Fixed submission:
n = int(input())
print( int((n+1)/2)/n )
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
maxs = 0
for x in range(len(S)-len(T)+1):
    for y in range(len(T)):
        if T[y] == S[x+y]:
            count += 1
        else:
            count = 0
        maxs = max(count,maxs) 

print(len(T)-maxs)

Fixed submission:
S = input()
T = input()
maxs = 0
for x in range(len(S)-len(T)+1):
    count=0
    for y in range(len(T)):
        if T[y] == S[x+y]:
            count += 1
        maxs = max(count,maxs) 

print(len(T)-maxs)
Buggy python submission (verdict: Time Limit Exceeded):
import math

N = int(input())
for i in range(1,N+1):
    count = 0
    for x in range(1,int(math.sqrt(i))+1):
        for y in range(x,int(math.sqrt(i))+1):
            for z in range(y,int(math.sqrt(i))+1):
                if x**2+y**2+z**2+x*y+y*z+z*x != i:
                    continue
                if x == y and x == z:
                    count += 1
                elif x == y or x == z or y == z:
                    count += 3
                else:
                    count += 6
    print(count) 

Fixed submission:
import math

N = int(input())
for i in range(1,N+1):
    count = 0
    for x in range(1,int(math.sqrt(i/6))+2):
        for y in range(x,int(math.sqrt(i/3))+2):
            for z in range(y,int(math.sqrt(i))+1):
                if x**2+y**2+z**2+x*y+y*z+z*x != i:
                    continue
                if x == y and x == z:
                    count += 1
                elif x == y or x == z or y == z:
                    count += 3
                else:
                    count += 6
    print(count)
Buggy python submission (verdict: Runtime Error):
import random

D = int(input())
C = list(map(int,input().split()))
S = []
for i in range(D):
    S.append(list(map(int,input().split())))
t = [0]*365
lastds = [0]*26
satisfaction = [0]*26
for d in range(D):
    ans = 0
    for j in range(1,27):
        if d != 0:
            satisfaction[d] = satisfaction[d-1]
        else:
            satisfaction[d] = 0
        escape = lastds[j-1]
        lastds[j-1] = d+1
        satisfaction[d] += S[d][j-1]
        for i in range(26):
            satisfaction[d] -= C[i] * (d+1-lastds[i])
        if ans < satisfaction[d]:
            ans = satisfaction[d]
            t[d] = j
        lastds[j-1] = escape
    lastds[t[d]-1] = d+1
    print(t[d])


Fixed submission:
import random

D = int(input())
C = list(map(int,input().split()))
S = []
for i in range(D):
    S.append(list(map(int,input().split())))
t = []
for i in range(D):
    t.append(int(random.uniform(1,27)))
    print(t[i])
Buggy python submission (verdict: Runtime Error):
def dokusyo(A,B,i,j,K,total):
    a = A[i]
    b = B[j]
    if total+min(a,b)>K:
        return 0
    if a<b:
        return 1+dokusyo(A,B,i+1,j,K,total+a)
    elif a>b:
        return 1+dokusyo(A,B,i,j+1,K,total+b)
    else:
        return 1+max(dokusyo(A,B,i+1,j,K,total+a),dokusyo(A,B,i,j+1,K,total+b))
       


if __name__ == "__main__":
    (N,M,K) = map(int,input().split())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    A.append(10**10)
    B.append(10**10)
    i=0
    j=0
    total = 0
    print(dokusyo(A,B,i,j,K,total))


Fixed submission:
if __name__ == "__main__":
    (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, 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: Time Limit Exceeded):
import math

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]



if __name__ == "__main__":
    N = int(input())
    total = 0
    for i in range(1,N+1):
        Y = math.floor(N/i)
        total += int(Y*(Y+1)*i/2)
    print(total)

Fixed submission:
import math

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]



if __name__ == "__main__":
    N = int(input())
    total = 0
    for i in range(1,N+1):
        Y = math.floor(N/i)
        total += int(Y*(Y+1)*i/2)
    print(total)
Buggy python submission (verdict: Runtime Error):
(X,N) = map(int,input().split())
p = list(map(int,input().split()))
if N == 0:
    print(X)
else:
    for i in range N:
        if (X - i) not in p:
            print(X-i)
            break
        elif(X+i) not in p:
            print(X+i)
            break


Fixed submission:
(X,N) = map(int,input().split())
if N == 0:
    print(X)
else:
    p = list(map(int,input().split()))
    for i in range(N+1):
        if (X - i) not in p:
            print(X-i)
            break
        elif(X+i) not in p:
            print(X+i)
            break
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
Ans = 1
for a in A:
    Ans *= a
if Ans>10**18:
    print("-1")
else:
    print(Ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
Ans = 1
for a in A:
    if a == 0:
        print("0")
        break
else:
    for a in A:
        Ans *= a
        if Ans>10**18:
            print("-1")
            break
    else:
        print(Ans)
Buggy python submission (verdict: Time Limit Exceeded):
(N,K) = map(int,input().split())
A = list(map(int,input().split()))
route = [1]
past = 1
for i in range(K):
    past = A[past-1]
    if past in route:
        loop = (route.index(past),i+1)
        flag = 0
        break
    else:
        flag = 1
        route.append(past)
if flag == 1:
    print(route[-1])
else:
    print(route[loop[0]+(K-loop[0])%(loop[1]-loop[0])])


Fixed submission:
(N,K) = map(int,input().split())
A = list(map(int,input().split()))
route = [1]
App = [0]*N
past = 1
for i in range(K):
    past = A[past-1]
    if App[past-1]==1:
        loop = (route.index(past),i+1)
        flag = 0
        break
    else:
        App[past-1] = 1
        flag = 1
        route.append(past)
if flag == 1:
    print(route[-1])
else:
    print(route[loop[0]+(K-loop[0])%(loop[1]-loop[0])])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
gacha_list = []
count = 0
for i in range(N):
    S = input()
    if S not in gacha_list:
        gacha_list.append(S)
        count += 1

print(count)

Fixed submission:
N = int(input())
gacha_list = []
count = 0
for i in range(N):
    S = input()
    gacha_list.append(S)
gacha_list = list(set(gacha_list))

print(len(gacha_list))
Buggy python submission (verdict: Runtime Error):
S = input()
MOD =2019
count = [0]*MOD
r = 0
t = 1
for i in reversed(S):
    r += int(i) * t
    r %= MOD
    t *= 10
    t %= MOD
    count[r] += 1

d[0] += 1
print(sum(i*(i-1)/2 for i in count))

Fixed submission:
S = input()
MOD =2019
count = [0]*MOD
r = 0
t = 1
for i in reversed(S):
    r += int(i) * t
    r %= MOD
    t *= 10
    t %= MOD
    count[r] += 1

count[0] += 1
print(int(sum(i*(i-1)/2 for i in count)))

Buggy python submission (verdict: Runtime Error):
S = input()
MOD =2019
count = [0]*MOD
r = 0
t = 1
for i in reversed(S):
    r += int(i) * t
    r %= MOD
    t *= 10
    t %= MOD
    d[r] += 1

d[0] += 1
print(sum(i*(i-1)/2 for i in count))

Fixed submission:
S = input()
MOD =2019
count = [0]*MOD
r = 0
t = 1
for i in reversed(S):
    r += int(i) * t
    r %= MOD
    t *= 10
    t %= MOD
    count[r] += 1

count[0] += 1
print(int(sum(i*(i-1)/2 for i in count)))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
count = 0
S_len = len(S)
for i in range(S_len):
    for j in range(i+4,S_len+1):
        if int(S[i:j]) % 2019 == 0:
            count += 1

print(count)

Fixed submission:
S = input()
MOD =2019
count = [0]*MOD
r = 0
t = 1
for i in reversed(S):
    r += int(i) * t
    r %= MOD
    t *= 10
    t %= MOD
    count[r] += 1

count[0] += 1
print(int(sum(i*(i-1)/2 for i in count)))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
count = 0
S_len = len(S)
for i in range(S_len):
    for j in range(i+4,S_len+1):
        if int(S[i:j]) % 2019 == 0:
            count += 1

print(count)

Fixed submission:
S = input()
MOD =2019
count = [0]*MOD
r = 0
t = 1
for i in reversed(S):
    r += int(i) * t
    r %= MOD
    t *= 10
    t %= MOD
    count[r] += 1

count[0] += 1
print(int(sum(i*(i-1)/2 for i in count)))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
count = 0
for i in range(len(S)):
    for j in range(i+4,len(S)+1):
        if int(S[i:j]) % 2019 == 0:
            count += 1

print(count)

Fixed submission:
S = input()
MOD =2019
count = [0]*MOD
r = 0
t = 1
for i in reversed(S):
    r += int(i) * t
    r %= MOD
    t *= 10
    t %= MOD
    count[r] += 1

count[0] += 1
print(int(sum(i*(i-1)/2 for i in count)))
Buggy python submission (verdict: Runtime Error):
import np

N,K = map(int,input().split())
p = 10**9+7
Nlist = []
ReNlist =[]
Ans = 0
for i in range(N+1):
    Nlist.append(i)
    ReNlist.append(N-i)
Nlist = np.array(Nlist).cumsum
ReNlist = np.array(ReNlist).cumsum
for i range(K,N+1):
    Ans += ReNlist[K-1]-Nlist[K-1]
    Ans = Ans % p
print(Ans)


Fixed submission:
import numpy as np

N,K = map(int,input().split())
p = 10**9+7
Nlist = []
ReNlist =[]
Ans = 0
for i in range(N+1):
    Nlist.append(i)
    ReNlist.append(N-i)
Nlist = np.array(Nlist).cumsum()
ReNlist = np.array(ReNlist).cumsum()
for i in range(K,N+1):
    Ans += ReNlist[i-1]-Nlist[i-1] +1
    Ans = Ans % p
print(Ans+1)
Buggy python submission (verdict: Runtime Error):
N = input()
for i in range(len(N)):
    if N[i] = '7':
        print('Yes')
        break
else:
    print('No')

Fixed submission:
N = input()
for i in range(len(N)):
    if N[i] == '7':
        print('Yes')
        break
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = input()
for i in range(N):
    if N[i] = '7':
        print('Yes')
        break
else:
    print('No')

Fixed submission:
N = input()
for i in range(len(N)):
    if N[i] == '7':
        print('Yes')
        break
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
FBSum = 0
for i in N:
    j = i+1
    if j % 3 != 0 and j % 5 != 0:
    FBSum +=j

print(FBSum)

Fixed submission:
N = int(input())
FBSum = 0
for i in range(N):
    j = i+1
    if j % 3 != 0 and j % 5 != 0:
        FBSum +=j

print(FBSum)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())
SUM = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            SUM += gcd(i,j,k)
print(SUM)

Fixed submission:
import math

K = int(input())
SUM = 0
gcdlist = []
for i in range(1,K+1):
    for j in range(i,K+1):
        for k in range(j,K+1):
            gcd1 = math.gcd(i,j)
            gcd2 = math.gcd(gcd1,k)
            if i == j and j== k:
                SUM += gcd2
            elif i == j or j == k or k == i:
                SUM += gcd2*3
            else:
                SUM += gcd2*6

print(SUM)