Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [1]
for _ in range(n):
    a.append(int(input()))
for i in range(1, n+1):
    a[i] = lcm(a[i-1], a[i])
print(a[-1])

Fixed submission:
def gcd(a,b):
    while b:
        a, b = b, a%b
    return a

def lcm(a,b):
    return a * b // (gcd(a,b))
n = int(input())
a = [1]
for _ in range(n):
    a.append(int(input()))
for i in range(1, n+1):
    a[i] = lcm(a[i-1], a[i])
print(a[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
b = []
for i in a:
    b.append(i)
    b = list(reversed(b))
b = [str(b_) for b_ in b]
ans = " ".join(b)
print(ans)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
e = [a[i] for i in range(n) if i % 2 == 1]
o = [a[i] for i in range(n) if i % 2 == 0]
if (n % 2 == 1):
    ans = o[::-1] + e
else:
    ans = e[::-1] + o
ans = [str(i) for i in ans]
ans = " ".join(ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
dp = [0] * (2**n)
s = []
for _ in range(n):
    s.append(int(input()))
for i in range(n):
    k = 2 ** i
    for j in range(k):
        dp[k+j] = dp[j] + s[i]
dp = [i if (i%10 != 0) else 0 for i in dp]
print(max(dp))

Fixed submission:
n = int(input())
s = []
for _ in range(n):
    s.append(int(input()))
sum_s = sum(s)
if sum_s % 10 != 0:
    ans = sum_s
else:
    s_10 = [i for i in s if (i%10 != 0)]
    s_10.sort()
    if len(s_10) > 0:
        ans = sum_s - s_10[0]
    else:
        ans = 0
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = []
for i in range(n):
    s.append(int(input()))
temp = [0]
for s_ in s:
    ans = temp.copy()
    for t in ans:
        tt = t + s_
        temp.append(tt)
temp = list(set(temp))
temp = [t for t in temp if t%10 != 0]
temp.sort()
if len(temp) > 0:
    print(temp[-1])
else:
    print(0)

Fixed submission:
n = int(input())
s = []
for _ in range(n):
    s.append(int(input()))
sum_s = sum(s)
if sum_s % 10 != 0:
    ans = sum_s
else:
    s_10 = [i for i in s if (i%10 != 0)]
    s_10.sort()
    if len(s_10) > 0:
        ans = sum_s - s_10[0]
    else:
        ans = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = h * w
if (h == 2) & (w == 2):
    ans = 1
if s % 3 == 0:
    ans = 0
else:
    c = []
    for i in range(1, h-1):
        sa = i * w
        sb = (h - i) * (w // 2)
        sc = (h - i) * (w - (w // 2))
        min_s = min(sa, min(sb, sc))
        max_s = max(sa, max(sb, sc))
        c.append(max_s - min_s)
    for i in range(1, w-1):
        sa = i * h
        sb = (w - i) * (h // 2)
        sc = (w - i) * (h - (h // 2))
        min_s = min(sa, min(sb, sc))
        max_s = max(sa, max(sb, sc))
        c.append(max_s - min_s)
    ans = min(c)
print(ans)

Fixed submission:
h, w = map(int, input().split())
s = h * w
if s % 3 == 0:
    ans = 0
else:
    c = []
    for i in range(1, h):
        sa = i * w
        sb = (h - i) * (w // 2)
        sc = (h - i) * (w - (w // 2))
        min_s = min(sa, min(sb, sc))
        max_s = max(sa, max(sb, sc))
        c.append(max_s - min_s)
        sb = ((h - i) // 2) * w
        sc = s - sa - sb
        min_s = min(sa, min(sb, sc))
        max_s = max(sa, max(sb, sc))
        c.append(max_s - min_s)
    for i in range(1, w):
        sa = i * h
        sb = (w - i) * (h // 2)
        sc = (w - i) * (h - (h // 2))
        min_s = min(sa, min(sb, sc))
        max_s = max(sa, max(sb, sc))
        c.append(max_s - min_s)
        sb = ((w - i) // 2) * h
        sc = s - sa - sb
        min_s = min(sa, min(sb, sc))
        max_s = max(sa, max(sb, sc))
        c.append(max_s - min_s)
    ans = min(c)
print(ans)

Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
s = h * w
if s % 3 == 0:
    ans = 0
else:
    c = []
    for i in range(1, h-1):
        sa = i * w
        sb = (h - i) * (w // 2)
        sc = (h - i) * (w - (w // 2))
        min_s = min(sa, min(sb, sc))
        max_s = max(sa, max(sb, sc))
        c.append(max_s - min_s)
    for i in range(1, w-1):
        sa = i * h
        sb = (w - i) * (h // 2)
        sc = (w - i) * (h - (h // 2))
        min_s = min(sa, min(sb, sc))
        max_s = max(sa, max(sb, sc))
        c.append(max_s - min_s)
    ans = min(c)
print(ans)

Fixed submission:
h, w = map(int, input().split())
s = h * w
if s % 3 == 0:
    ans = 0
else:
    c = []
    for i in range(1, h):
        sa = i * w
        sb = (h - i) * (w // 2)
        sc = (h - i) * (w - (w // 2))
        min_s = min(sa, min(sb, sc))
        max_s = max(sa, max(sb, sc))
        c.append(max_s - min_s)
        sb = ((h - i) // 2) * w
        sc = s - sa - sb
        min_s = min(sa, min(sb, sc))
        max_s = max(sa, max(sb, sc))
        c.append(max_s - min_s)
    for i in range(1, w):
        sa = i * h
        sb = (w - i) * (h // 2)
        sc = (w - i) * (h - (h // 2))
        min_s = min(sa, min(sb, sc))
        max_s = max(sa, max(sb, sc))
        c.append(max_s - min_s)
        sb = ((w - i) // 2) * h
        sc = s - sa - sb
        min_s = min(sa, min(sb, sc))
        max_s = max(sa, max(sb, sc))
        c.append(max_s - min_s)
    ans = min(c)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
c = []
for _ in range(n):
    a, b = map(int, input().split())
    c.extend([a]*b)
c.sort()
print(c[k-1])

Fixed submission:
n, k = map(int, input().split())
aa = []
for _ in range(n):
    a, b = map(int, input().split())
    aa.append([a, b])
aa.sort()
c = 0
for a, b in aa:
    if c < k:
        c += b
        if c >= k:
            ans = a
            break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, w = map(int, input().split())
a = []
for _ in range(n):
    w_in, v_in = map(int, input().split())
    a.append([w_in, v_in])

dp = [[0 for _ in range(w + 1)] for _ in range(n + 1)]
for j in range(w + 1):
    for i in range(n):
        w_in, v_in = a[i]
        if j + w_in <= w:
            dp[i + 1][j + w_in] = max(dp[i + 1][j + w_in], dp[i][j] + v_in)
            if i + 2 <= n:
                dp[i + 2][j + w_in] = dp[i + 1][j + w_in]
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
print(max([max(d) for d in dp]))

Fixed submission:
from itertools import accumulate
n, w = map(int, input().split())
w_0, v_0 = map(int, input().split())
v_list = [[] for _ in range(4)]
v_list[0].append(v_0)
for _ in range(n - 1):
    w_in, v_in = map(int, input().split())
    v_list[w_in - w_0].append(v_in)
v_list = [[0] + list(accumulate(sorted(v, reverse=True))) for v in v_list]
ans = 0
for i in range(len(v_list[0])):
    for j in range(len(v_list[1])):
        for k in range(len(v_list[2])):
            for l in range(len(v_list[3])):
                if ((i) * w_0) + ((j) * (w_0 + 1)) + ((k) * (w_0 + 2)) + (((l) * (w_0 + 3))) <= w:
                    ans = max(ans, v_list[0][i] + v_list[1][j] + v_list[2][k] + v_list[3][l])
                else:
                    break
print(ans)

Buggy python submission (verdict: Runtime Error):
n, w = map(int, input().split())
a = []
for _ in range(n):
    w_in, v_in = map(int, input().split())
    a.append([w_in, v_in])

dp = [[0 for _ in range(w + 1)] for _ in range(n + 1)]
for j in range(w + 1):
    for i in range(n):
        w_in, v_in = a[i]
        if j + w_in <= w:
            dp[i + 1][j + w_in] = max(dp[i + 1][j + w_in], dp[i][j] + v_in)
            if i + 2 <= n:
                dp[i + 2][j + w_in] = max(dp[i + 2][j + w_in], dp[i + 1][j + w_in])
        dp[i + 2][j] = max(dp[i + 2][j], dp[i + 1][j])
print(max([max(d) for d in dp]))

Fixed submission:
from itertools import accumulate
n, w = map(int, input().split())
w_0, v_0 = map(int, input().split())
v_list = [[] for _ in range(4)]
v_list[0].append(v_0)
for _ in range(n - 1):
    w_in, v_in = map(int, input().split())
    v_list[w_in - w_0].append(v_in)
v_list = [[0] + list(accumulate(sorted(v, reverse=True))) for v in v_list]
ans = 0
for i in range(len(v_list[0])):
    for j in range(len(v_list[1])):
        for k in range(len(v_list[2])):
            for l in range(len(v_list[3])):
                if ((i) * w_0) + ((j) * (w_0 + 1)) + ((k) * (w_0 + 2)) + (((l) * (w_0 + 3))) <= w:
                    ans = max(ans, v_list[0][i] + v_list[1][j] + v_list[2][k] + v_list[3][l])
                else:
                    break
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
if a[1] > a[0]:
    temp = 1
elif a[1] < a[0]:
    temp = -1
else:
    temp = 0
ans = 1
for i in range(1, n-1):
    if a[i+1] > a[i]:
        if temp >= 0:
            temp = 1
        elif temp == -1:
            ans += 1
            temp = 0
    elif a[i+1] < a[i]:
        if temp <= 0:
            temp = -1
        elif temp == 1:
            ans += 1
            temp = 0
print(ans)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
if n == 1:
    ans = 1
else:
    if a[1] > a[0]:
        temp = 1
    elif a[1] < a[0]:
        temp = -1
    else:
        temp = 0
    ans = 1
    for i in range(1, n-1):
        if a[i+1] > a[i]:
            if temp >= 0:
                temp = 1
            elif temp == -1:
                ans += 1
                temp = 0
        elif a[i+1] < a[i]:
            if temp <= 0:
                temp = -1
            elif temp == 1:
                ans += 1
                temp = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
a = []
for i in range(1, math.ceil(n**(1/2))):
    if n % i == 0:
        a.append(max(len(str(i)), len(str(n // i))))
print(min(a))

Fixed submission:
import math
n = int(input())
a = []
for i in range(1, math.ceil(n**(1/2))+1):
    if n % i == 0:
        a.append(max(len(str(i)), len(str(n // i))))
print(min(a))

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(1, n//2):
    if n % i == 0:
        a.append(max(len(str(i)), len(str(n // i))))
print(min(a))

Fixed submission:
import math
n = int(input())
a = []
for i in range(1, math.ceil(n**(1/2))+1):
    if n % i == 0:
        a.append(max(len(str(i)), len(str(n // i))))
print(min(a))
Buggy python submission (verdict: Runtime Error):
import bisect
x = int(input())
num_list = list(range(x))
a = [0]*x
a[0] = num_list[0]
for i in range(1,x):
    a[i] = a[i-1] + num_list[i]
print(bisect.bisect_left(a, x))

Fixed submission:
x = int(input())
for i in range(x+10):
    if (i*(i+1) / 2 < x) & (((i+1)*(i+2)) / 2 >= x):
        break
ans = i+1
print(ans)

Buggy python submission (verdict: Runtime Error):
import bisect
x = int(input())
num_list = list(range(x))
a = [0]*x
a[0] = num_list[0]
for i in range(1,x):
    a[i] = a[i-1] + num_list[i]
print(bisect.bisect_left(a, x))

Fixed submission:
x = int(input())
for i in range(x+10):
    if (i*(i+1) / 2 < x) & (((i+1)*(i+2)) / 2 >= x):
        break
ans = i+1
print(ans)

Buggy python submission (verdict: Runtime Error):
import bisect
x = int(input())
num_list = list(range(x))
a = [0]*x
a[0] = num_list[0]
for i in range(1,x):
    a[i] = a[i-1] + num_list[i]
print(bisect.bisect_left(a, x))

Fixed submission:
x = int(input())
for i in range(x+10):
    if (i*(i+1) / 2 < x) & (((i+1)*(i+2)) / 2 >= x):
        break
ans = i+1
print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = []
for _ in range(n):
    a.append(list(input()))
b = []
for _ in range(m):
    b.append(list(input()))
ans = "No"
for i in range(n-m+1):
    for j in range(n-m+1):
        aaa = 0
        for k in range(m):
            if b[k] == a[i][j:j+2]:
                i += 1
                aaa += 1
            else:
                break
        if aaa == m:
            ans = "Yes"
            break
print(ans)

Fixed submission:
n, m = map(int, input().split())
a = []
for _ in range(n):
    a.append(list(input()))
b = []
for _ in range(m):
    b.append(list(input()))
ans = "No"
for i in range(n-m+1):
    for j in range(n-m+1):
        aaa = 0
        for k in range(m):
            if b[k] == a[i+k][j:j+m]:
                aaa += 1
            else:
                break
        if aaa == m:
            ans = "Yes"
            break
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
a = [int(i) for i in input().split()]
k = Counter(a)
b = list(k.values())
over_2 = [bb for bb in b if bb >= 2]
if sum(over_2) % 2 == 1:
    print(len(b))
else:
    if len(over_2 == 0):
        print(len(b))
    else:
        print(len(b) - 1)

Fixed submission:
from collections import Counter
n = int(input())
a = [int(i) for i in input().split()]
k = Counter(a)
b = list(k.values())
b = [1 if bb % 2 == 1 else 2 for bb in b]
over_2 = [bb for bb in b if bb >= 2]
if len(over_2) == 0:
    print(len(b))
elif len(over_2) % 2 == 0:
    print(len(b))
else:
    print(len(b) - 1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = []
b_list = []
for _ in range(n):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)
a_list = list(reversed(a_list))
b_list = list(reversed(b_list))
ans = 0
for i in range(n):
    a = a_list[i]
    b = b_list[i]
    a += ans
    while (a % b != 0):
        a += 1
        ans += 1
print(ans)

Fixed submission:
n = int(input())
a_list = []
b_list = []
for _ in range(n):
    a, b = map(int, input().split())
    a_list.append(a)
    b_list.append(b)
a_list = list(reversed(a_list))
b_list = list(reversed(b_list))
ans = 0
for i in range(n):
    a = a_list[i]
    b = b_list[i]
    a += ans
    if (a % b) != 0:
        ans += b - (a % b)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
a = list(range(k+1))
c = 0
for i in a:
    for j in a:
        for k in a:
            if (i+j+k) == s:
                c += 1
print(c)

Fixed submission:
k, s = map(int, input().split())
c = 0
for x in range(k+1):
    for y in range(k+1):
        if ((s-x-y) <= k) & ((s-x-y) >= 0):
            c += 1
print(c)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
A = 'ABCDEFGHIJKLMN'
ans = ""
for i in range(a):
  t = list(input().split())
  if 'snuke' in t:
    ans += A[t.index("snuke")]
    ans += str(i + 1)
print(ans)


Fixed submission:
a, b = map(int, input().split())
A = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = ""
for i in range(a):
  t = list(input().split())
  if 'snuke' in t:
    ans += A[t.index("snuke")]
    ans += str(i + 1)
print(ans)
Buggy python submission (verdict: Runtime Error):
t = s.find("C")
if s[t:].find("F") > 0:
    print("Yes")
else:
    print("No")

Fixed submission:
s = input()
t = s.find("C")
if s[t:].find("F") > 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n, A, B = map(int, input().split())
a, b = 0
s = input()
for i in range(n):
    s_i = s[i]
    if s_i == 'a':
        if (a + b) < (A + B):
            a += 1
            print('Yes')
        else:
            print('No')
    elif s_i == 'b':
        if ((a + b) < (A + B)) & (b < B):
            b += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')
    


Fixed submission:
n, A, B = map(int, input().split())
a, b = 0, 0
s = input()
for i in range(n):
    s_i = s[i]
    if s_i == 'a':
        if (a + b) < (A + B):
            a += 1
            print('Yes')
        else:
            print('No')
    elif s_i == 'b':
        if ((a + b) < (A + B)) & (b < B):
            b += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Buggy python submission (verdict: Runtime Error):
n, A, B = map(int, input().split())
a, b = 0
s = input()
for i in range(n):
  s_i = s[i]
  if s_i == 'a':
    if (a + b) < (A + B):
      a += 1
      print('Yes')
	else:
      print('No')
  elif s_i == 'b':
    if ((a + b) < (A + B)) & (b < B):
      b += 1
      print('Yes')
    else:
      print('No')
  else:
    print('No')
    

Fixed submission:
n, A, B = map(int, input().split())
a, b = 0, 0
s = input()
for i in range(n):
    s_i = s[i]
    if s_i == 'a':
        if (a + b) < (A + B):
            a += 1
            print('Yes')
        else:
            print('No')
    elif s_i == 'b':
        if ((a + b) < (A + B)) & (b < B):
            b += 1
            print('Yes')
        else:
            print('No')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
x = input()
while (len(x.split("ST")) > 1):
    x = "".join(x.split("ST"))
print(len(x))

Fixed submission:
x = list(input())
count = 0
stock_s = 0

for i in range(len(x)):
    if x[i] == "S":
        stock_s += 1
    else:
        if stock_s > 0:
            stock_s -= 1
        else:
            count += 1
print(count * 2)
Buggy python submission (verdict: Runtime Error):
alphabet = 'abcdefghijklmnopqrstuvwxyz'
s = input()
K = int(input())
ans = ''
for i in range(len(s) - 1):
    s_i = alphabet.index(s[i])
    elif (26 - s_i < K) & (s_i != 0):
        K -= 26 - s_i
        s_i = 0
    ans += alphabet[s_i]
s_i = (alphabet.index(s[-1]) + K) % 26
ans += alphabet[s_i]
print(ans)


Fixed submission:
alphabet = 'abcdefghijklmnopqrstuvwxyz'
s = input()
K = int(input())
ans = ''
for i in range(len(s) - 1):
    s_i = alphabet.index(s[i])
    if s[i] == 'a':
        ans += 'a'
        continue
    if (26 - s_i <= K):
        K -= 26 - s_i
        ans += 'a'
    else:
        ans += s[i]
ans += alphabet[(K + alphabet.index(s[-1])) % 26]
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
d = set([str(i) for i in input().split()])
c = 0
for i in range(1, 11):
    c += n
    t = set(list(str(c)))
    if len(d & t) == 0:
        ans = c
        break
print(ans)

Fixed submission:
n, k = map(int, input().split())
d = [str(i) for i in input().split()]
for i in range(n, 10*n+1):
    if len(set(list(str(i))) & set(d)) == 0:
        print(i)
        break

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
d = set([str(i) for i in input().split()])
c = 0
for i in range(1, 10):
    c += n
    t = set(list(str(c)))
    if len(t & d) == 0:
        ans = c
        break
print(ans)

Fixed submission:
n, k = map(int, input().split())
d = [str(i) for i in input().split()]
for i in range(n, 10*n+1):
    if len(set(list(str(i))) & set(d)) == 0:
        print(i)
        break
Buggy python submission (verdict: Time Limit Exceeded):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

n = k()

for i in range(1,n):
  a = len(make_divisors(i))
  if a % 2 != 0:
    ans += 2*(a//2) + 1
  else:
    ans += 2*(a//2)

print(ans)

Fixed submission:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

"""
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)
"""

n = k()

for i in range(1,n):
  for j in range(n//i,0,-1):
    if 1<=i*j<=n-1:
      cnt += 1
      continue

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 100000
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

n = k()
a = l()

for i in range(n-1):
    for j in range(i+1, n):
        ans += (a[i]*a[j])

print(ans % mod)

Fixed submission:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 100000
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

n = k()
a = l()

ruiseki = list(itertools.accumulate(a))

for i in range(n-1):
    ans += a[i]*(ruiseki[-1]-ruiseki[i])

print(ans % mod)
Buggy python submission (verdict: Runtime Error):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

import string
s = v()

if s == 'zyxwvutsrqponmlkjihgfedcba':
    print(-1)
    exit()

lis =list(string.ascii_lowercase)
nlis = [0]*26

for i in s:
    t = lis.index(i)
    nlis[t] += 1

if sum(nlis) != 26:
    for i in range(26):
        if nlis[i] == 0:
            print(s+lis[i])
            break
else:
    for i in range(25, -1, -1):
        for j in lis:
            if s[i] < j and j not in s[:i]:
                print(s[:i] + j)
                exit()


Fixed submission:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"

n,x,t = I()

if n % x == 0:
    print(t*(n//x))
else:
    print(t*(n//x+1))