Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
for i in range(n):
    print(max(a[:i] + a[i + 1:]))

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
m = sorted(a, reverse = True)
a_max = m[0]
b = m[1]
for i in range(n):
    if a[i] == a_max:
        print(b)
    else:
        print(a_max)
Buggy python submission (verdict: Runtime Error):
l= map(int, input().split())
print(sum(l) - max(l))

Fixed submission:
l= list(map(int, input().split()))
print(sum(l) - max(l))
Buggy python submission (verdict: Runtime Error):
l = []
for i in range(N):
    s, p = input().split()
    l.append([s, int(p), i + 1])

l.sort(key = lambda x: (x[0], -x[1]))
for i in l:
    print(i[2])

Fixed submission:
N = int(input())
l = []
for i in range(N):
    s, p = input().split()
    l.append([s, int(p), i + 1])

l.sort(key = lambda x: (x[0], -x[1]))
for i in l:
    print(i[2])
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
cnt = [0]  * n
for i in range(m):
    l, r = map(int, input().split())
    for j in range(l, r + 1):
        cnt[j - 1] += 1

print(cnt.count(m))

Fixed submission:
n, m = map(int, input().split())
l = []
r = []
for i in range(m):
    L, R = map(int, input().split())
    l.append(L)
    r.append(R)
L1 = max(l)
R1 = min(r)
if R1 >= L1:
    print(R1 - L1 + 1)
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
cnt = [0]  * n
for i in range(m):
    l, r = map(int, input().split())
    for j in range(l, r + 1):
        cnt[j - 1] += 1

print(cnt.count(m))

Fixed submission:
n, m = map(int, input().split())
l = []
r = []
for i in range(m):
    L, R = map(int, input().split())
    l.append(L)
    r.append(R)
L1 = max(l)
R1 = min(r)
if R1 >= L1:
    print(R1 - L1 + 1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
s = input()
l = []
cnt = 0
for i in s:
    if i == "A" or i =="C" or i == "G" or i == "T":
        cnt += 1
        
    else:
        l.append(cnt)
print(max(l))

Fixed submission:
s = input()
l = []
cnt = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] =="C" or s[i] == "G" or s[i] == "T":
        cnt += 1
        #print(i, cnt)
        if i == len(s) - 1:
            l.append(cnt)
            
        
        
        
    elif i != "A" or i !="C" or i != "G" or i != "T":
        l.append(cnt)
        cnt = 0
        #print("y")
print(max(l))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
l = [list(map(int, input().split())) for i in range(N)]
m = []
for i in range(1, l[0][0] + 1):
    m.append(l[0][i])
for i in range(1, N):
    for j in m:
        
        if l[i][1:i[0] + 1].count(j) == 0:
            m.remove(j)
            
print(len(m))

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

m = [0] * 30
for i in range(n):
    a = list(map(int, input().split()))
    for j in range(1, len(a)):
        m[a[j] - 1] += 1

print(m.count(n))
Buggy python submission (verdict: Runtime Error):
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;

int N; 
long long h[100010];
long long dp[100010];
int main(){
    int N; cin >> N;
    for (int i = 0; i < N; ++i) cin >> h[i] ;
    for (int i = 0; i < N; ++i) dp[i] = INF;
    dp[0] = 0;
    for (int i = 0; i < N; ++i){
        chmin(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
        chmin(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]));
    }
cout << dp[N - 1] << endl;    
    
    
    
    
}

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
dp = [0] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(1, n - 1):
    dp[i + 1] = min(dp[i - 1] + abs(h[i + 1] - h[i - 1]), dp[i] + abs(h[i + 1] - h[i]))
print(dp[n - 1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n == 1:
    print("Hello World")
    break
else:
    a = int(input())
    b = int(input())
    print(a + b)

Fixed submission:

n = int(input())
if n == 1:
    print("Hello World")
    exit()
else:
    a = int(input())
    b = int(input())
    print(a + b)
Buggy python submission (verdict: Runtime Error):
N = input()
if N >= 1000:
    print("ABD")
else:
    print("ABC")

Fixed submission:
N = int(input())
if N >= 1000:
    print("ABD")
else:
    print("ABC")
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
l = []
for i in range(1, len(s) - 1):
    f = s[:i]
    b = s[i:]
    fset = list(set(s[:i]))
    bset = list(set(s[i:]))
    cnt = 0
    for j in fset:
        if bset.count(j) != 0:
            cnt += 1
    l.append(cnt)
print(max(l))

Fixed submission:
n = int(input())
s = input()
l = []

for i in range(1, len(s)):
    
    f = s[:i]
    b = s[i:]
    fset = list(set(s[:i]))
    bset = list(set(s[i:]))
    cnt = 0
   
    for j in fset:
        if bset.count(j) != 0:
            cnt += 1
    l.append(cnt)
   
print(max(l))
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())
for i in range(k):
    a, b, c = b + c, a + c, a + b 
ans = a - b
if ans >= 10 ** 18:
    print("Unfair")
else:
    print(ans)

Fixed submission:
a, b, c, k = map(int, input().split())
if k == 0:
    print(a - b)
else:
    a, b, c = b + c, a + c, a + b 
    if a - b <= 0:
        print(abs(a - b) * (-1) ** k)
    
    elif a - b > 0:
        print(abs(a - b) * (-1) ** (k - 1))
Buggy python submission (verdict: Runtime Error):
S = input()
cnt = 0
for i in s:
    if i == "o":
        cnt += 1
print(cnt * 100 + 700)


Fixed submission:
S = input()
cnt = 0
for i in S:
    if i == "o":
        cnt += 1
print(cnt * 100 + 700)

Buggy python submission (verdict: Runtime Error):
S = input()
cnt = 0
for i in s:
    if i == "o":
    cnt += 1
print(cnt * 100 + 700)


Fixed submission:
S = input()
cnt = 0
for i in S:
    if i == "o":
        cnt += 1
print(cnt * 100 + 700)

Buggy python submission (verdict: Runtime Error):
S = input()
cnt = 0
for i in s:
    if i == "o"
    cnt += 1
print(cnt * 100 + 700)

Fixed submission:
S = input()
cnt = 0
for i in S:
    if i == "o":
        cnt += 1
print(cnt * 100 + 700)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())
l = []
for i in range(A, B + 1):
    l.append(i)
if B - A + 1 < K:
    for j in l:
        print(j)

else:
    m = l[:K] + l[B - A + 1 - K:]
    
    M = list(set(m))
    M.sort()
    for k in M:
        print(k)

Fixed submission:
a, b, k = map(int, input().split())
l = []
for i in range(a, min(a + k, b)):
    l.append(i)

for i in range(max(a, b - k + 1), b + 1):
    l.append(i)

for i in sorted(set(l)):
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())
l = []
for i in range(A, B + 1):
    l.append(i)
if B - A + 1 < K:
    for j in l:
        print(j)

else:
    m = l[:K] + l[B - A + 1 - K:]
    
    
    
    for k in sorted(set(m), key = l.index):
        print(k)

Fixed submission:
a, b, k = map(int, input().split())
l = []
for i in range(a, min(a + k, b)):
    l.append(i)

for i in range(max(a, b - k + 1), b + 1):
    l.append(i)

for i in sorted(set(l)):
    print(i)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
l = []
for i in range(1, N + 1):
    for j in range(str(i)):
        wa += int(j)
    if wa >= A and wa <= B:
        l.append(i)
print(sum)
        

Fixed submission:
N, A, B = map(int, input().split())
l = []
wa = 0
for i in range(1, N + 1):
    for j in str(i):
        wa += int(j)
        #print(wa)
    if wa >= A and wa <= B:
        l.append(i)
    wa = 0
print(sum(l))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
c = 0
while all(i % 2 == 0 for i in l):
    a = [i/2 for i in l]
    c += 1
print(c)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
cnt = 0
while all(i % 2 == 0 for i in a):
    a = [i/2 for i in a]
    cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
count = 0
while all(i % 2 == 0 for i in l):
    a = [i/2 for i in l]
    count += 1
print(count)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
cnt = 0
while all(i % 2 == 0 for i in a):
    a = [i/2 for i in a]
    cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
l = list(map(int, input().split()))
count = 0
while all(i % 2 == 0 for i in l):
      a = [i / 2 for i in l]
      count += 1
print(count)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
cnt = 0
while all(i % 2 == 0 for i in a):
    a = [i/2 for i in a]
    cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
l = map(int, input().split())
count = 0
while all(i % 2 == 0 for i in l):
      a = [i / 2 for i in l]
      count += 1
print(count)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
cnt = 0
while all(i % 2 == 0 for i in a):
    a = [i/2 for i in a]
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
a = str(input())
if a[0] = a[1] = a[2] or a[1] = a[2] = a[3]:
    print("Yes")
else:
    print("No")

Fixed submission:
a = str(input())
if a[0] == a[1] == a[2] or a[1] == a[2] == a[3]:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a, b, c, d = str(input())
if a = b = c or b = c = d:
    print("Yes")
else:
    print("No")

Fixed submission:
a = str(input())
if a[0] == a[1] == a[2] or a[1] == a[2] == a[3]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
l = input().split()
m = input().split()
if l[0] == m[2] and l[2] == m[2] and l[1] == l[0]:
    print("Yes")
else:
    print("No")

Fixed submission:
l = input()
m = input()
if l[0] == m[2] and l[1] == m[1] and l[2] == m[0]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
import math
n = int(input())
l = []
for i in range(1, n + 1):
    if math.sqrt(i) % 1 == 0:
        l.append(i)
print(max(l))

Fixed submission:
n = int(input())
for i in range(1, n + 1):
    c = i ** 2
    if c > n:
        print((i - 1) * (i - 1))
        break
    elif c == n:
        print(c)
        break
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
    num = int(input())
    if num in a:
        a.remove(num)
    else:
        a.append(num)
print(len(a))


Fixed submission:
n = int(input())
a = set()
for i in range(n):
    num = int(input())
    if num in a:
        a.remove(num)
    else:
        a.add(num)
print(len(a))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
    num = int(input())
    if num in a:
        a.remove(num)
    else:
        a.append(num)
print(len(a))

Fixed submission:
n = int(input())
a = set()
for i in range(n):
    num = int(input())
    if num in a:
        a.remove(num)
    else:
        a.add(num)
print(len(a))
Buggy python submission (verdict: Runtime Error):
s = set(input())
alp = "abcdefghijklmnopqrstuvwxyz"
alpl = [i for i in alp]
for i in s:
    if i in alp:
        alpl.remove(i)
        
print(sorted(alpl)[0])

Fixed submission:
s = set(input())
alp = "abcdefghijklmnopqrstuvwxyz"
alpl = [i for i in alp]
for i in s:
    if i in alp:
        alpl.remove(i)
if len(alpl) != 0:        
    print(sorted(alpl)[0])

else:
    print("None")
Buggy python submission (verdict: Runtime Error):
l = int(input())
if l[0] == l[2]:
    print("Yes")
else:
    print("No")

Fixed submission:
l = str(input())
if l[0] == l[2]:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
l = int(input())
if l[0] = l[2]:
    print("Yes")
else:
    print("No")
    
    

Fixed submission:
l = str(input())
if l[0] == l[2]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
l =[]
for i in range(1,n + 1):
    cnt = 0
    while i % 2 == 0 and i > 1:
        cnt += 1
        i = i / 2
        
            
    if cnt >= 1:
        l.append(int(i * 2 ** cnt))
print(max(l))
  

Fixed submission:
n = int(input())
if n == 1:
    print(1)
elif n >= 2 and n < 4:
    print(2)
elif n >= 4 and n < 8:
    print(4)
elif n >= 8 and n < 16:
    print(8)
elif n >= 16 and n < 32:
    print(16)
elif n >= 32 and n < 64:
    print(32)
elif n >= 64:
    print(64)
Buggy python submission (verdict: Runtime Error):
l= map(int, input().split())
ans = sum(l) - max(l)
print(ans)

Fixed submission:
l= list(map(int, input().split()))
ans = sum(l) - max(l)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
now = a[0]
cnt = 0
for i in range(n):
    cnt += 1
    now = a[now - 1]
    
    if a[now] == 2:
        
        print(cnt + 1)
        
        exit()
print("-1")

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
now = 0
cnt = 0
for i in range(n):
    #print(now)
    now = a[now] - 1
    cnt += 1
    if now == 1:
        
        print(cnt)
        
        exit()
print("-1")
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [int(input()) for i in range(n)]
wa = sum(l)
cnt = 0
for i in l:
    if i % 10:
        cnt += 10
if cnt == n:
    print(0)
    exit()
    
if wa % 10 != 0:
    print(wa)
else:
    l.sort()
    for i in l:
        if i % 10 != 0:
            ex = i
            break
    
    print(wa - ex)

Fixed submission:
n = int(input())
l = [int(input()) for i in range(n)]
wa = sum(l)
cnt = 0
for i in l:
    if i % 10 == 0:
        cnt += 1
        
if cnt == n:
    print(0)
    exit()
    
if wa % 10 != 0:
    print(wa)
else:
    l.sort()
    for i in l:
        if i % 10 != 0:
            print(wa - i)
            break

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [int(input()) for i in range(n)]
wa = sum(l)
cnt = 0
for i in l:
    if i % 10:
        cnt += 10
if cnt == n:
    print(0)
    exit()
    
if wa % 10:
    print(wa)
else:
    l.sort()
    for i in l:
        if i % 10 != 0:
            ex = i
            break
    
    print(wa - ex)

Fixed submission:
n = int(input())
l = [int(input()) for i in range(n)]
wa = sum(l)
cnt = 0
for i in l:
    if i % 10 == 0:
        cnt += 1
        
if cnt == n:
    print(0)
    exit()
    
if wa % 10 != 0:
    print(wa)
else:
    l.sort()
    for i in l:
        if i % 10 != 0:
            print(wa - i)
            break
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
l = [1, 3, 5, 7, 8, 10, ,12]
m = [4, 6, 9, 11]
n = [2]
if l.count(x) == l.count(y) != 0 or m.count(x) == m.count(y) != 0 or x == y == 2:
    print("Yes")
else:
    print("No")

Fixed submission:
x, y = map(int, input().split())
l = [1, 3, 5, 7, 8, 10, 12]
m = [4, 6, 9, 11]
n = [2]
if l.count(x) == l.count(y) != 0 or m.count(x) == m.count(y) != 0 or x == y == 2:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N, Y = map(int, input().split())
for i in range(N + 1):
    for j in range(N + 1 - i):
        k = int((Y - 10000 * i - 5000 * j) / 1000)
        if N - i - j >= k >= 0 and i + j + k == N:
            print(i, j, k)
            exit()
print(-1, -1, -1)

Fixed submission:
N = int(input())
l = []
for A in range(1, int(N ** 0.5) + 1):
    B = N // A
    if N == A * B:
        
        l.append(max(len(str(A)), len(str(B))))
        #print(A, B)
print(min(l))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
p = 1
for i in range(1, N + 1):
    p *= i
    amari = p % (10 ** 9 + 7)
print(amari)
    


Fixed submission:
N = int(input())
pw = 1 
for i in range(1, N + 1):
    pw = (pw * i) % (10 ** 9 + 7)
print(pw)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
p = 1
for i in range(1, N + 1):
    p *= i
print(p % (10 ** 9 + 7))
    

Fixed submission:
N = int(input())
pw = 1 
for i in range(1, N + 1):
    pw = (pw * i) % (10 ** 9 + 7)
print(pw)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
cnt = 0
for x in range(K + 1):
    pass
    for y in range(K + 1):
        pass
        for z in range(K + 1):
            if x + y + z == S:
                cnt += 1
print(cnt)


Fixed submission:
K, S = map(int, input().split())
cnt = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if z >= 0 and z <= K:
            cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
cnt = 0
for x in range(K + 1):
    for y in range(K + 1):
        for z in range(K + 1):
            if x + y + z == S:
                cnt += 1
print(cnt)

Fixed submission:
K, S = map(int, input().split())
cnt = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if z >= 0 and z <= K:
            cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
a, op, b = input().split()
if op = "+":
  print(int(a) + int(b))
else:
  print(int(a) - int(b))

Fixed submission:
a, op, b = input().split()
if op == "+":
  print(int(a) + int(b))
else:
  print(int(a) - int(b))
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(a[0] + b[0] + c[0])


Fixed submission:
a, b, c = map(str, input().split())
print(a[0] + b[0] + c[0])
Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int, input().split())
cnt = 0
for i in range(a, b + 1):
    if i % x == 0:
        cnt += 1
print(cnt)

Fixed submission:
a, b, x = map(int, input().split())
if a % x == 0:
    print(b // x - a // x + 1)
else:
    print(b // x - a // x)
Buggy python submission (verdict: Runtime Error):
l = map(int, input().split())
m = max(l)
n = l.pop(m)
wa = 0
for i in n:
    wa += i
if wa == m:
    print("Yes")
else:
    print("No")

Fixed submission:
l = list(map(int, input().split()))
p = max(l)
s = min(l)
wa =sum(l)
m = wa - p - s
if m + s == p:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if k < n :
  print(k * x + (n - k) * y)
else:
  primt(n * x)

Fixed submission:
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if k < n :
  print(k * x + (n - k) * y)
else:
  print(n * x)
Buggy python submission (verdict: Runtime Error):
s = input()
l =[]
for i in range(len(s)):
    if s[i] == "0":
        l.append("0")
    elif s[i] == "1":
        l.append("1")
    elif s[i] =="B":
        if len(l) == 0:
           pass
        else:
           del l[i - 1]
print("".join(l))

Fixed submission:
s = input()
l =[]
for i in range(len(s)):
    if s[i] == "0":
        l.append("0")
    elif s[i] == "1":
        l.append("1")
    elif s[i] =="B":
        if len(l) == 0:
           pass
        else:
           del l[-1]
print("".join(l))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
array = list(map(int,input().split()))
num_sum = 0
tmp_sum = 0

for i in range(N):
    for j in range(N-i-1):
        tmp_sum += array[i+1+j]
    num_sum += tmp_sum*array[i]
    tmp_sum = 0
print(num_sum%1000000007)

Fixed submission:
N = int(input())
array = list(map(int,input().split()))
num_sum = 0
tmp_sum = 0

tmp_sum = sum(array)

for a in array:
    tmp_sum -= a
    num_sum += tmp_sum*a

print(num_sum%1000000007)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

a = []

for i in range(len(s)-len(t)):
    count = 0
    for j in range(len(t)):
        if t[j] == s[i + j]:
            count += 1
    a.append(count)
print(len(t)-max(a))

Fixed submission:
s = input()
t = input()

a = []

for i in range(len(s)-len(t)+1):
    count = 0
    for j in range(len(t)):
        if t[j] == s[i + j]:
            count += 1
    a.append(count)
print(len(t)-max(a))

Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

a = []

for i in range(len(s)-len(t)):
    count = 0
    for j in range(len(t)):
        if t[j] == s[i + j]:
            count += 1
    a.append(count)
print(len(t)-max(a))

        


Fixed submission:
s = input()
t = input()

a = []

for i in range(len(s)-len(t)+1):
    count = 0
    for j in range(len(t)):
        if t[j] == s[i + j]:
            count += 1
    a.append(count)
print(len(t)-max(a))
Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
b = sum(a)
sum = 0

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

print(sum%(10**9+7))

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

for i in range(len(a)):
    b -= a[i]
    sum += a[i]*b   

print(sum%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = list(map(int, input().split()))
b= []
for i in range(len(a)):
    b.append(a[i]%(10**9+7))
sum = 0

for i in range(len(b)):
    for j in range(i,len(b)):
        if i<j:
            sum += (b[i]) * (b[j])
    sum %= (10**9+7)
       
    
print(sum)


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

for i in range(len(a)):
    b -= a[i]
    sum += a[i]*b   

print(sum%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = list(map(int, input().split()))
b= []
for i in range(len(a)):
    b.append(a[i]%(10**9+7))
sum = 0

for i in range(len(b)):
    for j in range(i,len(b)):
        if i<j:
            sum += (b[i]) * (b[j])
    
print(sum % (10**9+7))

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

for i in range(len(a)):
    b -= a[i]
    sum += a[i]*b   

print(sum%(10**9+7))

Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map((int%10**9+7), input().split()))
sum = 0

for i in range(len(a)):
    for j in range(len(a)):
        if i<j:
            sum += (a[i]) * (a[j])
    
print(sum % 10**9+7)

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

for i in range(len(a)):
    b -= a[i]
    sum += a[i]*b   

print(sum%(10**9+7))

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

for i in range(len(a)):
    for j in range(len(a)):
        if i<j:
            sum += (a[i]%(10**9+7)) * (a[j]%(10**9+7))
    
print(sum % 1000000007)

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

for i in range(len(a)):
    b -= a[i]
    sum += a[i]*b   

print(sum%(10**9+7))

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

for i in range(len(a)):
    for j in range(len(a)):
        if i<j:
            sum += a[i] * a[j] %1000000007
    
print(sum % 1000000007)

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

for i in range(len(a)):
    b -= a[i]
    sum += a[i]*b   

print(sum%(10**9+7))

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

for i in range(len(a)):
    for j in range(len(a)):
        if i<j:
            sum += a[i] * a[j]
    
print(sum%1000000007)

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

for i in range(len(a)):
    b -= a[i]
    sum += a[i]*b   

print(sum%(10**9+7))
Buggy python submission (verdict: Runtime Error):
import math

n, d = int(input().split())
count = 0

for i in range(n):
    xn, yn = int(input().split())
    if d >= math.sqrt(xn ** 2 + yn ** 2):
        count += 1

print(count)

Fixed submission:
import math

n, d = input().split()
count = 0
dn = int(d)

for i in range(int(n)):
    x = list(map(int,input().split()))
    if dn >= math.sqrt(x[0] ** 2 + x[1] ** 2):
        count += 1

print(count)