Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math
count = 0  
k = int(input())
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      d = math.gcd(a,b)
      e = math.gcd(d,c)
      count += e
print(count)

Fixed submission:
import math
count = 0  
k = int(input())
for a in range(1,k+1):
  for b in range(a,k+1):
    for c in range(b,k+1):
      d = math.gcd(a,b)
      e = math.gcd(d,c)
      if a==b==c:
        count+=e
      elif a==b or b==c or c==a:
        count+=e*3
      else:
        count+=e*6
print(count)

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

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

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
count = 0  
k = int(input())
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      count+=gcd(a, b, c)
print(count)

Fixed submission:
import math
count = 0  
k = int(input())
for a in range(1,k+1):
  for b in range(a,k+1):
    for c in range(b,k+1):
      d = math.gcd(a,b)
      e = math.gcd(d,c)
      if a==b==c:
        count+=e
      elif a==b or b==c or c==a:
        count+=e*3
      else:
        count+=e*6
print(count)
Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
a = s[:(n-1)//2-1]
b = s[-(n+3)//2:]

t = s[::-1]
c = t[:(n-1)//2-1]
d = t[-(n+3)//2:]
if (a==d) and (b==c) :
  if(a==b):
  print('Yes')
else:
  print('No')


Fixed submission:
s = input()
n = len(s)
a = s[:(n-1)//2]
b = s[(n+3)//2-1:]

t = s[::-1]
c = t[:(n-1)//2]
d = t[(n+3)//2-1:]
if (a==b) and (b==c) and (c==d) and (d==a):
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
a = s[:(n-1)//2-1]
b = s[-(n+3)//2:]
e = s[
t = s[::-1]
c = t[:(n-1)//2-1]
d = t[-(n+3)//2:]
if (a==b) and (b==c) and (c==d):
  print('Yes')
else:
  print('No')


Fixed submission:
s = input()
n = len(s)
a = s[:(n-1)//2]
b = s[(n+3)//2-1:]

t = s[::-1]
c = t[:(n-1)//2]
d = t[(n+3)//2-1:]
if (a==b) and (b==c) and (c==d) and (d==a):
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
a = s[:(n-1)/2-1]
b = s[-(n+3)/2:]
lang:reverse.py
t = s[::-1]
c = t[:(n-1)/2-1]
d = t[-(n+3)/2:]
if (a==b) and (b==c) and (c==d):
  print('Yes')
else:
  print('No')

Fixed submission:
s = input()
n = len(s)
a = s[:(n-1)//2]
b = s[(n+3)//2-1:]

t = s[::-1]
c = t[:(n-1)//2]
d = t[(n+3)//2-1:]
if (a==b) and (b==c) and (c==d) and (d==a):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
k = int(input())
alist = list(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(alist[k-1])


Fixed submission:
k = int(input())
alist = [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(alist[k-1])

Buggy python submission (verdict: Runtime Error):
k = int(input())
alist =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 . split(, )
print(alist[k-1])


Fixed submission:
k = int(input())
alist = [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(alist[k-1])

Buggy python submission (verdict: Runtime Error):
k = int(input())
alist =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 . split(,)
alist[k-1]


Fixed submission:
k = int(input())
alist = [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(alist[k-1])

Buggy python submission (verdict: Runtime Error):
a = input()
alist = a. split(,)
alist[31]


Fixed submission:
k = int(input())
alist = [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(alist[k-1])

Buggy python submission (verdict: Runtime Error):
a = input()
a. split(,)
a[31]

Fixed submission:
k = int(input())
alist = [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(alist[k-1])
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input(). split())
if (h == 1) or (w == 1):
  answer = 1
  print(answer)
elif (h%2 = 1) and (w%2 = 1):
  a = (h//2)*(w//2)
  b = ((h//2)+1)*((w//2)+1)
  answer = a + b
  print(answer)
else:
  answer = h*w/2
  print(answer)

Fixed submission:
h,w = map(int,input(). split())
if (h == 1) or (w == 1):
  answer = 1
  print(answer)
elif (h%2 == 1) and (w%2 == 1):
 
  answer = ((h*w)+1)//2
  print(answer)
else:
  answer = h*w//2
  print(answer)

Buggy python submission (verdict: Runtime Error):
h, w =map(int, input(). split())
if(h%2 = 0) and (w%2 = 0):
  answer = (h/2)*(w/2)
  print(answer)
elif(h%2 = 0) and (w%2 = 1):
  answer = (h/2)*w
  print(answer)
elif(h%2 = 1) and (w%2 = 0):
  answer = (w/2)*h
  print(answer)
else:
  answer =(h//2)*(w//2)+((h//2)+1)*((w//2)+1)
  print(answer)

Fixed submission:
h,w = map(int,input(). split())
if (h == 1) or (w == 1):
  answer = 1
  print(answer)
elif (h%2 == 1) and (w%2 == 1):
 
  answer = ((h*w)+1)//2
  print(answer)
else:
  answer = h*w//2
  print(answer)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input(). split())
if (4ab < c-a-b):
  print('Yes')
else:
  print('No')

Fixed submission:
a, b, c = map(int, input(). split())
if (4*a*b<(c-a-b)*(c-a-b)) and c-a-b>0 :
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
S = input()
if (S == AAA) or (S == BBB):
  print('No')
else:
  print('Yes')
  


Fixed submission:
S = input()
if (S == 'AAA') or (S == 'BBB'):
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
S = input()
if S = AAA or S = BBB:
  print('No')
else:
  print('Yes')
  


Fixed submission:
S = input()
if (S == 'AAA') or (S == 'BBB'):
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
S = input()
if S = 'AAA' or S = 'BBB':
  print('No')
else:
  print('Yes')
  

Fixed submission:
S = input()
if (S == 'AAA') or (S == 'BBB'):
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input(). split())
answer = None
flag = False
for i in range(1009):
  
  if (A == (i*0.08)//1) and (B == (i*0.1)//1):
    answer = i
    print(answer)
    flag = True
   
    if flag:
        break
if (answer = None):
  print(-1)
    


Fixed submission:
A, B = map(int, input(). split())
answer = None
flag = False
for i in range(1, 1009):
  
  if (A == (i*0.08)//1) and (B == (i*0.1)//1):
    answer = i
    print(answer)
    flag = True
   
    if flag:
        break
if answer is None:
  answer = -1
  print(answer)

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input(). split())
answer = None
flag = False
for i in range(1009):
  
  if (A == i*0.08//1) and (B == i*0.1//1):
    Answer = i
    print(Answer)
    flag = True
   
    if flag:
        break
if (answer = None):
  print(-1)
    


Fixed submission:
A, B = map(int, input(). split())
answer = None
flag = False
for i in range(1, 1009):
  
  if (A == (i*0.08)//1) and (B == (i*0.1)//1):
    answer = i
    print(answer)
    flag = True
   
    if flag:
        break
if answer is None:
  answer = -1
  print(answer)

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input(). split())
answer = None
flag = False
for i in range(1009):
  
  if (i*0.08//1 = A) and (i*0.1//1 = B):
    print(i)
    flag = True
   
    if flag:
        break
if (answer = None):
  print(-1)
    


Fixed submission:
A, B = map(int, input(). split())
answer = None
flag = False
for i in range(1, 1009):
  
  if (A == (i*0.08)//1) and (B == (i*0.1)//1):
    answer = i
    print(answer)
    flag = True
   
    if flag:
        break
if answer is None:
  answer = -1
  print(answer)

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input(). split())
answer = None
flag = False
for i in range(1001):
  
  if (i*0.08//1 = A) and (i*0.1//1 = B):
    print(i)
    flag = True
    break
if (answer = None):
  print(-1)
    


Fixed submission:
A, B = map(int, input(). split())
answer = None
flag = False
for i in range(1, 1009):
  
  if (A == (i*0.08)//1) and (B == (i*0.1)//1):
    answer = i
    print(answer)
    flag = True
   
    if flag:
        break
if answer is None:
  answer = -1
  print(answer)

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input(). split())
for i in range(1001):
  flag = True
  if (i*0.08//1 = A) and (i*0.1//1 = B):
    print(i)
    flag = False
    break
if (flag = True):
  print(-1)
    

Fixed submission:
A, B = map(int, input(). split())
answer = None
flag = False
for i in range(1, 1009):
  
  if (A == (i*0.08)//1) and (B == (i*0.1)//1):
    answer = i
    print(answer)
    flag = True
   
    if flag:
        break
if answer is None:
  answer = -1
  print(answer)
Buggy python submission (verdict: Runtime Error):
n =int(input())
if n%2=0:
  answer = n//2
  print(answer)
else:
  answer = n//2+1
  print(answer)


Fixed submission:
n =int(input())
if n%2==0:
  answer = n//2
  print(answer)
else:
  answer = n//2+1
  print(answer)

Buggy python submission (verdict: Runtime Error):
n =int(input())
if n%2=0:
  print(n//2)
else:
  print(n//2+1)


Fixed submission:
n =int(input())
if n%2==0:
  answer = n//2
  print(answer)
else:
  answer = n//2+1
  print(answer)

Buggy python submission (verdict: Runtime Error):
n =int(input())
if n//2=0:
  print(n//2)
else:
  print(n//2+1)

Fixed submission:
n =int(input())
if n%2==0:
  answer = n//2
  print(answer)
else:
  answer = n//2+1
  print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))

## 高々 N(N-1)/2　< 2 * 10^10 のため何とかなる...?
mod = 10**9 + 7

sum = 0
for i in range(N-1):
    for j in range(i+1,N):
        sum += a[i]*a[j]

ans = sum % mod
print(ans)

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

## 高々 N(N-1)/2　< 2 * 10^10 のため何とかなる...?
mod = 10**9 + 7

'''
sum = 0
for i in range(N-1):
    for j in range(i+1,N):
        sum += a[i]*a[j]

ans = sum % mod
print(ans)
'''

### a1　は a2~an(= S)までの和を必要とする. a2 は S - a2 (=S). a3 は S - a3...

s = 0
for i in range(N):
    s += a[i]

sum = 0
for i in range(N-1):
    s -= a[i]
    sum += a[i]*s

ans = sum % mod
print(ans)
Buggy python submission (verdict: Runtime Error):
##この問題はグループの最大人数を求めれば良い

n,m = map(int,input().split())

a = [list(map(int,input().split())) for i in range(m)]

#print(a[0][1])

l = [n+1]*n
# lで何のグループに属しているか判定する
p = [1]*n
# lでどのグループがどのくらいのpowerを持っているか判定する

##最終的にlがn+1でない中で,pが一番大きいのを解答に出す
##ただ,これでは更新頻度がえぐいため工夫がいる.


for j in range(m):
    if(l[a[j][0]] == n+1 & l[a[j][1]] == n+1):
        if(a[j][0] > a[j][1]):
            l[a[j][0]] = a[j][1]
            l[a[j][1]] = a[j][1]
            p[a[j][1]] = 2
        else:
            l[a[j][0]] = a[j][0]
            l[a[j][1]] = a[j][0]
            p[a[j][0]] = 2

    elif(l[a[j][0]] != n+1 & l[a[j][1]] != n+1):
        if(l[a[j][0]] < l[a[j][1]]):

            ###give up


Fixed submission:
# union-find を使う

# unionするクエリが飛んでくる(クエリ:要求)
# find(どのグループ,集合かわかるようにする)
# findはある要素とある要素が同じグループに属するか,そのグループのサイズはどうか
# この二つを処理する

# 計算量 O(log N) か 工夫すると O(a(N)):アッカーマン計算量の逆関数... ならし計算量

##木構造を作っていく. グループのidはnodeのidにする. findするときは根の番号に辿るようにする

## 計算量を落とす.
### 木がどんどん深くなると処理が長くなる.

## 1. くっつける先を根に向かうようにする, グループとグループは根から根に繋げるようにする
## 小さい方を大きい方にくっつける
## -> 一回あたりO(log(N))
### 高さが高々 log(N)にしかならないから
#### 根から辿ると,一個辿ると頂点の個数が半分以下になっていくから
##### 証明できる: 辺が張られた後は そのグループはいじられない
##### さらに,最初につけたときに既に 残りのグループの方が大きいため

## 2. 経路縮約的な考え
# 計算結果をメモしておく
# 一回計算したところは直接つなぐ　-> メモ化で　ならしlog(N)

##3. 両方を採用すると ならし　アッカーマン関数の逆関数



##実装の工夫

# 根にマイナスのサイズを持つようにする。
# 葉には親のidを持つようにする
# メモ化するためにd[x]を親のfindと一致させるようにする

# MSTを考えてuniteでくっつけられるかどうかを考える

class UnionFind():
    def __init__(self, n):
        self.parents = [-1]*n #各親を格納する,自分が親ならマイナスサイズを持つ
    
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y) ##親を見た方が楽
        if x==y:
            return
        
        if self.parents[x] > self.parents[y]:
            x,y = y,x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def size(self,x):
        return -self.parents[self.find(x)]
    
def main():
    n,m = map(int,input().split())
    uf = UnionFind(n)
    for _ in range(m):
        a, b = map(int, input().split())
        uf.union(a-1,b-1)
    
    ans = 1
    for i in range(n):
        ans = max(ans, uf.size(i))
    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys


print("Please enter a value of N")
n = int(input())
if isinstance(n,int) == False:
    #print("Input value is not a type of int.")
    #sys.exit()
    return
elif n < 1 or 100 < n:
    #print("Input value is not in this range [0,100].")
    #sys.exit()
    return
else:
    if n%2 == 0:
        a = float(1/2)
    else:
        a = float(((n+1)/2)/n)
    
    print(a)
    return

Fixed submission:
import sys

#print("Please enter a value of N")
n = int(input())
if isinstance(n,int) == False:
    print("Input value is not a type of int.")
    sys.exit()
elif n < 1 or 100 < n:
    print("Input value is not in this range [0,100].")
    sys.exit()
else:
    if n%2 == 0:
        a = float(1/2)
    else:
        a = float(((n+1)/2)/n)
    
    print(a)
Buggy python submission (verdict: Runtime Error):
N = int(input())
h = input().rstrip().split(' ')
h.insert(0,0)
h = list(map(int,h))

#ここで保存しておく
l = [-1]*(N-1)
l.insert(0,0)
l.insert(0,0)

import sys
sys.setrecursionlimit(30000)

def cost_min(n):
    #n番目までで最小のコストを考える
    if(l[n] != -1):
        return l[n]
    else:
        l[n] = min([cost_min(n-1) + abs(h[n]-h[n-1]),cost_min(n-2) + abs(h[n]-h[n-2])])
        return l[n]

def cost_min_bottomup(n):
    if(n<2):
        return 0
    t_0 = 0
    t_1 = abs(h[2] - h[1])
    ans_0 = 0
    ans_1 = t_1
    for i in range(n-2):
        t_0 = ans_0 + abs(h[i+3]-h[i+1])
        t_1 = ans_1 + abs(h[i+3]-h[i+2])
        ans_0 = ans_1
        ans_1 = min([t_0,t_1])
    return ans_1

print(cost_min(N))
#print(cost_min_bottomup(N))

Fixed submission:
N = int(input())
h = input().rstrip().split(' ')
h.insert(0,0)
h = list(map(int,h))

#ここで保存しておく
l = [-1]*(N-1)
l.insert(0,0)
l.insert(0,0)

def cost_min(n):
    #n番目までで最小のコストを考える
    if(l[n] != -1):
        return l[n]
    else:
        l[n] = min([cost_min(n-1) + abs(h[n]-h[n-1]),cost_min(n-2) + abs(h[n]-h[n-2])])
        return l[n]

def cost_min_bottomup(n):
    if(n<2):
        return 0
    t_0 = 0
    t_1 = abs(h[2] - h[1])
    ans_0 = 0
    ans_1 = t_1
    for i in range(n-2):
        t_0 = ans_0 + abs(h[i+3]-h[i+1])
        t_1 = ans_1 + abs(h[i+3]-h[i+2])
        ans_0 = ans_1
        ans_1 = min([t_0,t_1])
    return ans_1

#print(cost_min(N))
print(cost_min_bottomup(N))

Buggy python submission (verdict: Runtime Error):
N = int(input())
h = input().rstrip().split(' ')
h.insert(0,-1)
h = list(map(int,h))

l = [-1]*(N-1)
l.insert(0,0)
l.insert(0,0)

def cost_min(n):
    #n番目までで最小のコストを考える
    if(l[n] != -1):
        return l[n]
    else:
        l[n] = min([cost_min(n-1) + abs(h[n]-h[n-1]),cost_min(n-2) + abs(h[n]-h[n-2])])
        return l[n]

print(cost_min(N))

Fixed submission:
N = int(input())
h = input().rstrip().split(' ')
h.insert(0,0)
h = list(map(int,h))

#ここで保存しておく
l = [-1]*(N-1)
l.insert(0,0)
l.insert(0,0)

def cost_min(n):
    #n番目までで最小のコストを考える
    if(l[n] != -1):
        return l[n]
    else:
        l[n] = min([cost_min(n-1) + abs(h[n]-h[n-1]),cost_min(n-2) + abs(h[n]-h[n-2])])
        return l[n]

def cost_min_bottomup(n):
    if(n<2):
        return 0
    t_0 = 0
    t_1 = abs(h[2] - h[1])
    ans_0 = 0
    ans_1 = t_1
    for i in range(n-2):
        t_0 = ans_0 + abs(h[i+3]-h[i+1])
        t_1 = ans_1 + abs(h[i+3]-h[i+2])
        ans_0 = ans_1
        ans_1 = min([t_0,t_1])
    return ans_1

#print(cost_min(N))
print(cost_min_bottomup(N))
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
l = [a*c, a*d, b*c, b*d]
print(max[l])

Fixed submission:
a,b,c,d = map(int, input().split())
l = [a*c, a*d, b*c, b*d]
print(max(l))
Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
ar = [0,N]
for m in range(M):
    l,r = map(int, input().split())
    if l>ar[0]:
        ar[0] = l
    if r<ar[1]:
        ar[1]=r
print(max([0,ar[1]-ar[0]+1])

Fixed submission:
N,M = map(int, input().split())
ar = [0,N]
for m in range(M):
    l,r = map(int, input().split())
    if l>ar[0]:
        ar[0] = l
    if r<ar[1]:
        ar[1]=r
print(max([0,ar[1]-ar[0]+1]))
Buggy python submission (verdict: Time Limit Exceeded):
"""AtCoder Beginner Contest 178.

E
"""

import sys


def input() -> str:  # noqa: A001
    """Input."""
    return sys.stdin.readline()[:-1]


def calc(p1: list, p2: list) -> int:
    """Calc Manhattan Distance."""
    return abs(p2[1] - p1[1]) + abs(p2[0] - p1[0])


def main():
    """Run."""
    n = int(input())

    points = []

    ans = 0
    for _ in range(n):
        points.append(list(map(int, input().split(' '))))

    for i, p1 in enumerate(points):
        for p2 in points[i + 1:]:
            ans = max(ans, calc(p1, p2))

    print(ans)


main()


Fixed submission:
"""AtCoder Beginner Contest 178.

E
"""

import sys


def input() -> str:  # noqa: A001
    """Input."""
    return sys.stdin.readline()[:-1]


def calc(p1: list, p2: list) -> int:
    """Calc Manhattan Distance."""
    return abs(p2[1] - p1[1]) + abs(p2[0] - p1[0])


def main():
    """Run."""
    n = int(input())

    patterns = {
        'lt': (1, 1),
        'rt': (-1, 1),
        'lb': (-1, -1),
        'rb': (1, -1),
    }

    points: dict = {k: None for k in patterns.keys()}

    for _ in range(n):
        p = list(map(int, input().split(' ')))

        for k, (x, y) in patterns.items():
            max_p = points[k]

            if max_p:
                max_p_pos = (max_p[0] * x) + (max_p[1] * y)
                p_pos = (p[0] * x) + (p[1] * y)
                if max_p_pos < p_pos:
                    points[k] = p
            else:
                points[k] = p

    ans = 0
    for i, p1 in enumerate(points.values()):
        for p2 in list(points.values())[i + 1:]:
            ans = max(ans, calc(p1, p2))

    print(ans)


main()
Buggy python submission (verdict: Time Limit Exceeded):
"""C."""

import sys

input = sys.stdin.readline  # noqa: A001

n = int(input())
a = list(map(int, input()[:-1].split(' ')))

MOD_VALUE = pow(10, 9) + 7
result = 0

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

if result < MOD_VALUE:
    print(result)
else:
    print(result % MOD_VALUE)


Fixed submission:
"""C."""

import sys

input = sys.stdin.readline  # noqa: A001

n = int(input())
a = list(map(int, input()[:-1].split(' ')))

MOD_VALUE = 10**9 + 7
result = 0

a_sum = sum(a)

for i, v in enumerate(a):
    result += v * (a_sum - v)
    a_sum -= v

if result < MOD_VALUE:
    print(result)
else:
    print(result % MOD_VALUE)

Buggy python submission (verdict: Time Limit Exceeded):
"""C."""

import sys

input = sys.stdin.readline  # noqa: A001

n = int(input())
a = list(map(int, input()[:-1].split(' ')))

MOD_VALUE = pow(10, 9) + 7
result = 0

for i in range(n - 1):
    for j in range(i + 1, n):
        result += a[i] * a[j]
print(result % MOD_VALUE)


Fixed submission:
"""C."""

import sys

input = sys.stdin.readline  # noqa: A001

n = int(input())
a = list(map(int, input()[:-1].split(' ')))

MOD_VALUE = 10**9 + 7
result = 0

a_sum = sum(a)

for i, v in enumerate(a):
    result += v * (a_sum - v)
    a_sum -= v

if result < MOD_VALUE:
    print(result)
else:
    print(result % MOD_VALUE)

Buggy python submission (verdict: Runtime Error):
"""C."""

import sys

input = sys.stdin.readline  # noqa: A001

n = int(input())
a = list(map(int, input()[:-1].split(' ')))

result = 0

for i, v1 in enumerate(a):
    for j in range(i + 1, n + 1):
        result += v1 * a[j]
print(result)


Fixed submission:
"""C."""

import sys

input = sys.stdin.readline  # noqa: A001

n = int(input())
a = list(map(int, input()[:-1].split(' ')))

MOD_VALUE = 10**9 + 7
result = 0

a_sum = sum(a)

for i, v in enumerate(a):
    result += v * (a_sum - v)
    a_sum -= v

if result < MOD_VALUE:
    print(result)
else:
    print(result % MOD_VALUE)

Buggy python submission (verdict: Runtime Error):
"""C."""

import sys

input = sys.stdin.readline  # noqa: A001

n = int(input())
a = list(map(int, input().split(' ')))

result = 0

for i, v1 in enumerate(a):
    for j in range(i + 1, n + 1):
        result += v1 * a[j]
print(result)


Fixed submission:
"""C."""

import sys

input = sys.stdin.readline  # noqa: A001

n = int(input())
a = list(map(int, input()[:-1].split(' ')))

MOD_VALUE = 10**9 + 7
result = 0

a_sum = sum(a)

for i, v in enumerate(a):
    result += v * (a_sum - v)
    a_sum -= v

if result < MOD_VALUE:
    print(result)
else:
    print(result % MOD_VALUE)
Buggy python submission (verdict: Time Limit Exceeded):
"""E."""

import math
import sys
from typing import List


def input() -> str:  # noqa: A001
    """Input."""
    return sys.stdin.readline()[:-1]


RESULT_A = 'pairwise coprime'
RESULT_B = 'setwise coprime'
RESULT_C = 'not coprime'

n = int(input())

a_list = list(map(int, input().split(' ')))


def get_all_gcd(l: List[int]) -> List[int]:
    result = []
    for i, v1 in enumerate(l[:-1]):
        for v2 in l[i + 1:]:
            result.append(math.gcd(v1, v2))
    return result


gcds = get_all_gcd(a_list)

if [1] * len(gcds) == gcds:
    print(RESULT_A)
    exit(0)

if [1] * len(gcds) == get_all_gcd(gcds):
    print(RESULT_B)
    exit(0)

print(RESULT_C)


Fixed submission:
"""E."""

import sys


def input() -> str:  # noqa: A001
    """Input."""
    return sys.stdin.readline()[:-1]


RESULT_TEXT = {
    1: 'pairwise coprime',
    2: 'setwise coprime',
    3: 'not coprime',
}

n = int(input())

a_list = list(map(int, input().split(' ')))

ans = 0

MAX = 1000000 + 1
counts = [0] * MAX
for a in a_list:
    counts[a] += 1

max_count = 0

for i in range(2, MAX):
    max_count = max(max_count, sum(counts[i::i]))

if max_count == n:
    ans = 3
elif max_count >= 2:
    ans = 2
else:
    ans = 1

print(RESULT_TEXT[ans])
Buggy python submission (verdict: Runtime Error):
N, D = map(int,input().split())
data = [map(int,input().split()) for _ in range(N)]
count = 0
for d in data:
    if d[0]*d[0] + d[1]*d[1] >= D*D:
        count += 1
print(count)

Fixed submission:
N, D = map(int,input().split())
data = [list(map(int,input().split())) for _ in range(N)]
#print(data)
count = 0
for d in data:
    if d[0]*d[0] + d[1]*d[1] <= D*D:
        count += 1
print(count)
#print(N,D)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import collections

def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
    
    return table
N = int(input())
#N=10**7
#print(prime_factor(N,prime_factor_table(N)))
ans = 0
for i,d in enumerate(num_divisors_table(N)):
    ans += i*d
print(ans)
    #num_divisors_table(N)



Fixed submission:
import itertools
import collections

def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1
        table[i] *= i
    return table

N = int(input())
#N=10**7
#print(prime_factor(N,prime_factor_table(N)))
ans = 0
print(sum(num_divisors_table(N)))

    #num_divisors_table(N)