Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,m,k = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
b = sum(B)
ka = k
i = m
re = 0
for a in A:
  if ka < 0:
    break
  while ka < b and i > 0:
    b -= B[i]
    i -= 1
  ka -= a
  re += 1
  
print(re+i)

Fixed submission:
n,m,k = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
b = sum(B)
ka = k
i = m
c = 0
re = 0
A.insert(0, 0)
for a in A:
  ka -= a
  if ka < 0:
    break
  while ka < b and i > 0:
    i -= 1
    b -= B[i]
  c += 1
  re = max(re, c+i)

  
print(re-1)
Buggy python submission (verdict: Runtime Error):
import sys
def Ii():return int(sys.stdin.readline())
def Mi():return map(int,sys.stdin.readline().split())
def Li():return list(map(int,sys.stdin.readline().split()))

n = Ii()
a = Li()
sa = sum(a)
af = [0]*(10**5)
for i in a: 
  af[i]+=1
q = Ii()
for i in range(q):
  b,c = Mi()
  sa = sa + (c-b)*af[b]
  af[c] += af[b]
  af[b] = 0;
  print(sa)
  

Fixed submission:
import sys
n = int(input())
a = list(map(int,sys.stdin.readline().split()))
q = int(input())
s = sum(a)
cnt = [0]*(10**5+5)
for c in a:
  cnt[c] +=1
for i in range(q):
  b,c = map(int,sys.stdin.readline().split())
  bdif = c-b
  s += cnt[b]*bdif
  cnt[c] += cnt[b]
  cnt[b] = 0
  print(s)

Buggy python submission (verdict: Runtime Error):
import sys
def Ii():return int(sys.stdin.readline())
def Mi():return map(int,sys.stdin.readline().split())
def Li():return list(map(int,sys.stdin.readline().split()))

n = Ii()
a = Li()
sa = sum(a)
af = [0]*(10**5)
for i in a: 
  af[i]+=1
q = Ii()
for i in range(q):
  b,c = Mi()
  sa = sa + (c-b)*af[b]
  af[c] += af[b]
  af[b] = 0;
  print(sa)

Fixed submission:
import sys
n = int(input())
a = list(map(int,sys.stdin.readline().split()))
q = int(input())
s = sum(a)
cnt = [0]*(10**5+5)
for c in a:
  cnt[c] +=1
for i in range(q):
  b,c = map(int,sys.stdin.readline().split())
  bdif = c-b
  s += cnt[b]*bdif
  cnt[c] += cnt[b]
  cnt[b] = 0
  print(s)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = int(input())
a = input()
q = int(input())
for i in range(q):
  b = list(input().split())
  a = a.replace(b[0],b[1])
  print(sum(list(map(int,a.split()))))

Fixed submission:
import sys
n = int(input())
a = list(map(int,sys.stdin.readline().split()))
q = int(input())
s = sum(a)
cnt = [0]*(10**5+5)
for c in a:
  cnt[c] +=1
for i in range(q):
  b,c = map(int,sys.stdin.readline().split())
  bdif = c-b
  s += cnt[b]*bdif
  cnt[c] += cnt[b]
  cnt[b] = 0
  print(s)
Buggy python submission (verdict: Runtime Error):
X,Y = map(int,input().split())
if y%2 == 0:
  y = Y//2
else:
  print('No')
  exit(0)

if x < y <2*x:
  print('Yes')
else:
  print('No')



Fixed submission:
X,Y = map(int,input().split())
if Y%2 == 0:
  y = Y//2
else:
  print('No')
  exit(0)

if X <= y <=2*X:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
using System;
using System.Linq;
class program{
  static void Main(){
    int n = int.Parse(Console.ReadLine());
    long[] a = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long ans = 1;
    a.Sort();
    if(a[0] == 0){
      Console.Write(0);
      return;
    }
    for(int i = 0;i<n;i++){
      if(ans*a[i] > 1e18){
        Console.Write(-1);
      	return;
      }
      ans *= a[i];
    }
    Console.Write(ans);
  }
}

Fixed submission:
def Ii():return int(input())
def Mi():return map(int,input().split())
def Li():return list(map(int,input().split()))
n = Ii()
a = sorted(Li())

mx = 10**18
ans = 1
for i in a:
  
  ans *= i
  if ans > mx:
    ans = -1
    break
  elif ans == 0:
    break
    
print(ans)
Buggy python submission (verdict: Runtime Error):
def Ii():return int(input())
def Mi():return map(int,input().split())
def Li():return list(map(int,input().split()))

n = Ii()%10
if n == 3
  print('bon')
elif n==2 or n == 4 or n == 5 or n==7 or n == 9
  print('hon')
else
  print('pon')

 

Fixed submission:
def Ii():return int(input())
def Mi():return map(int,input().split())
def Li():return list(map(int,input().split()))
 
n = Ii()%10
if n == 3:
  print('bon')
elif n==2 or n == 4 or n == 5 or n==7 or n == 9:
  print('hon')
else:
  print('pon')
Buggy python submission (verdict: Runtime Error):
using System;
using System.Linq;

class program
{
    static void Main()
    {
        var abck = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var a = abck[0];
      	var b = abck[1];
      	var k = abck[3];
        if (a+b > k)
        {
            Console.Write(a);
            return;
        }
        else
        {
            Console.Write(2*a+b-k);
        }
    }
}

Fixed submission:
a = input()
b = input()
if a == b[:-1]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
b.pop()
if a == b[:-1]:
  print('Yes')
else:
  print('No')


Fixed submission:
a = input()
b = input()
if a == b[:-1]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
def Ii():return int(sys.stdin.buffer.read())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))
 
a,b,c,k = Mi()
if k <= a:
  ans = k
  exit(0)
ans = a
k -= a
if k > b:
  ans -= k-b
  
print(ans)

Fixed submission:
import sys
def Ii():return int(sys.stdin.buffer.read())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))
 
a,b,c,k = Mi()
if k <= a:
  print(k)
  exit(0)
ans = a
k -= a
if k > b:
  ans -= k-b
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def Ii():return int(sys.stdin.buffer.read())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))

n,k = Mi()
a = Li()
b = [1]
b.append(a[0])
flag = False
for i in range(n):
  if len(b) > k:
    print(b[k])
    exit(0)
  for j in range(len(b)):
    if b[j] == a[b[-1]-1]:
      flag = True
      break
  if flag: 
    break
    
  b.append(a[b[-1]-1])

roop = len(b)-j
roopk = (k-j)%roop
print(b[roopk+j])

Fixed submission:
import sys
def Ii():return int(sys.stdin.buffer.read())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))

n,k = Mi()
a = Li()
b = [1]
b.append(a[0])
flag = False
for i in range(n):b.append(a[b[-1]-1])
if len(b) > k:
  print(b[k])
  exit(0)
for j in range(len(b)):
  if b[j] == a[b[-1]-1]:
    break
    
roop = len(b)-j
roopk = (k-j)%roop
print(b[roopk+j])
Buggy python submission (verdict: Runtime Error):
import sys
def Ii():return int(sys.stdin.buffer.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))

n,k = Mi()
b = [1]*n
for i in range(k):
  d = Ii()
  a = Li()
  for j in a:
    b[j] = 0
    
print(sum(b)-1)

Fixed submission:
import sys
def Ii():return int(sys.stdin.buffer.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))
 
n,k = Mi()
b = [1]*(n+1)
for i in range(k):
  d = Ii()
  a = Li()
  for j in a:
    b[j] = 0
    
print(sum(b)-1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def Ii():return int(sys.stdin.buffer.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))

n = Ii()
a = Li()
ans = 0
for i in range(n-1):
  for j in range(a[i]+i+1,n):
    if a[i]+a[j] == j-i:
      ans += 1
      
print(ans)

Fixed submission:
import sys
def Ii():return int(sys.stdin.buffer.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))

n = Ii()
a = Li()
x = [0]*n
ans = 0
for i in range(n): 
  if a[i]+i < n:
    x[a[i]+i] += 1
  if i-a[i] >= 0:
    ans += x[i-a[i]]
      
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def Ii():return int(sys.stdin.buffer.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))

n = Ii()
a = Li()
ans = 0
for i in range(n-1):
  for j in range(a[i]+i,n):
    if a[i]+a[j] == j-i:
      ans += 1
      
print(ans)

Fixed submission:
import sys
def Ii():return int(sys.stdin.buffer.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))

n = Ii()
a = Li()
x = [0]*n
ans = 0
for i in range(n): 
  if a[i]+i < n:
    x[a[i]+i] += 1
  if i-a[i] >= 0:
    ans += x[i-a[i]]
      
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
import math
def Ii():return int(sys.stdin.buffer.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))

x = Ii()
ans = (math.log10(x) - 2)math.log10(1.01)
k = 100
while x > k:
  tax = k//100
  k += tax  
  ans += 1
  
print(ans)

Fixed submission:
import sys
import math
def Ii():return int(sys.stdin.buffer.readline())
def Mi():return map(int,sys.stdin.buffer.readline().split())
def Li():return list(map(int,sys.stdin.buffer.readline().split()))
 
x = Ii()
ans = 0
k = 100
while x > k:
  tax = k//100
  k += tax  
  ans += 1
  
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
Ns=list(map(int, input().split() ) ) 
ans=0
for i in range(n):
  for j in range(i,j):
    for k in range(j,n):
      a , b , c = sorted([Ns[i] , Ns[j] , Ns[k]])
      if a+b>c and a!=b and b!=c:
        ans+=1
print(ans)

Fixed submission:
n=int(input())
Ns=list(map(int, input().split() ) ) 
ans=0
for i in range(n):
  for j in range(i,n):
    for k in range(j,n):
      a , b , c = sorted([Ns[i] , Ns[j] , Ns[k]])
      if a+b>c and a!=b and b!=c:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math, sys

N=int(input())
S=input()
R_count=0
for i in range(N):
    if S[i]=="R":
        R_count+=1

ans=R_count
ind=S.index("R")
if ind>R_count:
    print(R_count)
    sys.exit()

#ans-=ind
S=S[ind:]
while S[0]=="R":
    S=S[1:]
    ans-=1
print(ans)

Fixed submission:
import math, sys

N=int(input())
S=input()
R_count=0
if "R" not in S:
    print(0)
    sys.exit()
if "W" not in S:
    print(0)
    sys.exit()
if "R" not in S[S.index("W"):]:
    print(0)
    sys.exit()
for i in range(N):
    if S[i]=="R":
        R_count+=1

S=S[:R_count]
ans=S.count("W")
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math , sys 
from collections import deque

N = int( input() )
Cs = list( map( int , input().split() ))
Cs.sort(reverse=True)

conf=0
#d=deque()
i=0
while len(Cs)>0:
    tar=Cs.pop(0)
    #print(tar,Cs)
    if i==0:
        conf+=tar
        #d.append(tar)
        i+=1
    elif i==1:
        #conf+=d[0]
        #d.append(tar)
        Ds=deque([tar,tar])
        i+=1
    else:
        #print(Ds,d)
        c=max(Ds)
        conf+=c
        ind=Ds.index(c)
        #d.insert(ind,tar)
        Ds.insert(ind,tar)
        Ds[ind+1]=tar
        #print(Ds,d)
print(conf)

Fixed submission:
import math , sys 
from collections import deque

N = int( input() )
Cs = list( map( int , input().split() ))
Cs.sort(reverse=True)

ans = Cs.pop(0)
i = 1
Q  = (N-2)//2
R = (N-2) % 2
ans += sum([Cs[i]*2 for i in range(Q)])
if R==1:
    ans+=Cs[Q]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math , sys 
from collections import deque

N = int( input() )
Cs = list( map( int , input().split() ))
Cs.sort(reverse=True)

conf=0
d=deque()
i=0
while len(Cs)>0:
    tar=Cs.pop(0)
    #print(tar,Cs)
    if i==0:
        conf+=tar
        d.append(tar)
        i+=1
    elif i==1:
        #conf+=d[0]
        #d.append(tar)
        Ds=deque([tar,tar])
        i+=1
    else:
        #print(Ds,d)
        c=max(Ds)
        conf+=c
        ind=Ds.index(c)
        #d.insert(ind,tar)
        Ds.insert(ind,tar)
        Ds[ind+1]=tar
        #print(Ds,d)
print(conf)

Fixed submission:
import math , sys 
from collections import deque

N = int( input() )
Cs = list( map( int , input().split() ))
Cs.sort(reverse=True)

ans = Cs.pop(0)
i = 1
Q  = (N-2)//2
R = (N-2) % 2
ans += sum([Cs[i]*2 for i in range(Q)])
if R==1:
    ans+=Cs[Q]
print(ans)
Buggy python submission (verdict: Runtime Error):
l=[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( l[int(input())+1])

Fixed submission:
print([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][int(input())-1])
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int, imput().split())
left=(a+b-c)**2
right=4*a*b
if a+b < c and left < right:
  print("Yes")
else:
  print("No")

Fixed submission:
a, b, c=map(int, input().split())
left=(a+b-c)**2
right=4*a*b
print("Yes") if a+b<c and left> right else print("No")
Buggy python submission (verdict: Runtime Error):
def lin(t,i):
    return As[i]*t+Bs[i]
f=input().split(" ")
n,t=int(f[0]),int(f[1])
As=[]
Bs=[]
for i in range(n):
    f=input().split(" ")
    As.append(int(f[0]))
    Bs.append(int(f[1]))
time=0
count=0
shop_list=list(range(n))
while len(shop_list)>0:
    test=min(enumerate([lin(time+1,i) for i in shop_list]), key = lambda x:x[1])
    next_time,shop=test[1],shop_list[test[0]]
    if time+1+next_time>t:
        break
    else:
        time=time+1+next_time
        shop_list.remove(shop)
        count+=1
print(count)

Fixed submission:
s=input()
while True:
  if len(s)==0:
    print("Yes")
    break
  elif len(s)==1:
    print("No")
    break
  elif s[:2]=="hi":
    s=s[2:]
  else:
    print("No")
    break
Buggy python submission (verdict: Runtime Error):
import itertools as it
dic={}
bing=[[1 for i in range(3)] for j in range(3)]
for i in range(3):
    f=list(map(int,input().split()))
    for each in f:
        dic.update({each:(i,f.index(each))})
n=int(input())
for i in range(n):
    m=int(input())
    if m in dic.keys():
      place=dic[m]
      bing[place[0]][place[1]]=0
flag=False
code="000102101112202122"
code=code+code[::-1]
code=code+"001122021120"

for i in range(8):
    code_sep=code[6*i:6*i+6]
    p=0
    for j in range(3):
        cords=code_sep[2*j:2*j+2]
        p+=bing[int(cords[0])][int(cords[1])]
    if p==0:
        flag=True
        break
    
print("yes")if flag else print("No")

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

Buggy python submission (verdict: Runtime Error):
print(int((int(input()+1))/2))

Fixed submission:
print( int( (int(input()) + 1 )/2 ) )
Buggy python submission (verdict: Runtime Error):
dic = {}
ans = []
a = 0

N = int( input() )
for i in range( N ):
  let = input()
  if let not in dic:
    dic.update( { let : 1 } )
  else:
    num=dic[ let ]
    dic[ let ] = num + 1
dic_sorted = sorted(dic.items(), key=lambda x:x[1])
for each in dic_sorted.keys():
  if dic_sorted[ each ] >= a:
    ans+=1
    a=dic_sorted[ each ]
  else:
    break
ans.sort()
for each in ans:
  print(each)

Fixed submission:
dic = {}
ans = []
a = 0

N = int( input() )
for i in range( N ):
  let = input()
  if let not in dic:
    dic.update( { let : 1 } )
  else:
    num=dic[ let ]
    dic[ let ] = num + 1
dic_sorted = sorted(dic.items(), key=lambda x:x[1],reverse=True)
for each in dic_sorted:
  if each[1] >= a:
    ans.append(each[0])
    a=each[1]
  else:
    break
ans.sort()
for each in ans:
  print(each)

Buggy python submission (verdict: Runtime Error):
N=int(inpu())
ans=[]
dic={}
for i in range(N):
  let=input()
  if let in dic.keys:
    dic.update({let:1})
  else:
    dic.update({let:dic[let]+1})
score_sorted = sorted(score.items(), key=lambda x:x[1])
a=0
for each in score_sorted.keys():
  if score_sorted[each]>=a:
    ans+=each
    a=score_sorted[each]
  else:
    break
ans.sort()
for each in ans:
  print(each)

Fixed submission:
dic = {}
ans = []
a = 0

N = int( input() )
for i in range( N ):
  let = input()
  if let not in dic:
    dic.update( { let : 1 } )
  else:
    num=dic[ let ]
    dic[ let ] = num + 1
dic_sorted = sorted(dic.items(), key=lambda x:x[1],reverse=True)
for each in dic_sorted:
  if each[1] >= a:
    ans.append(each[0])
    a=each[1]
  else:
    break
ans.sort()
for each in ans:
  print(each)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map( int, input().split() )
ps = list( map( int, input().split() ) ) 
s=0
for i in range( N-K+1 ) :
  l=sum(ps[i:i+K])
  if l > s:
         s=l
print( (s+K)/2 )

Fixed submission:
N, K = map( int, input().split() )
ps = list( map( int, input().split() ) ) 
s=sum(ps[0:K])
ans=s
for i in range( 1, N-K+1 ) :
  s = s + ps[i-1+K] - ps[i-1]
  if s > ans:
    ans=s
print( (ans+K)/2 )
Buggy python submission (verdict: Time Limit Exceeded):
import math , sys
N = int( input() )

X = []
for i in range(N):
    A , B = list(map(int, input().split()))
    X.append([i , A-B , A , A+B])


X.sort(key=lambda x: x[3])

Y = X.pop(0)
Ri = Y[-1]
ans = 1

j=0

while len(X)>0:
    Y = X.pop(0)
    if Y[1]>=Ri:
        ans+=1
        Ri = Y[-1]
print(ans)


Fixed submission:
import math , sys
N = int( input() )

X = []
for i in range(N):
    A , B = list(map(int, input().split()))
    X.append([i , A-B , A , A+B])


X.sort(key=lambda x: x[3])

Y = X[0]
Ri = Y[-1]
ans = 1

j=0

for i in range(1,N):
    Y = X[i]
    if Y[1] >= Ri:
        ans+=1
        Ri = Y[-1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math , sys

H,W = list(map( int, input().split() ))
maze = []
for i in range(H):
    maze.append(input())
if H==1:
    print(W-1)
    sys.exit()
if W ==1:
    print(H-1)
    sys.exit()
    
di = [(-1,0),(1,0),(0,1),(0,-1)]
def sol(s,g):
    h = s[0] ; w = s[1]
    gh,gw = g
    d = [[math.inf for _ in range(W)] for _ in range(H)]
    cand = []
    dis = 0
    while True:
        for each in di:
            dh , dw = each
            if h + dh>=0 and h + dh<H and w + dw>=0 and w + dw<W and maze[h+dh][w+dw]=="." and d[h+dh][w+dw]>dis+1:
                if h+dh ==gh and w+dw ==gw:
                    return dis+1
                cand.append((h+dh, w+dw))
                d[h+dh][w+dw] = dis +1
        if len(cand)==0:
            break
        h , w =cand.pop(0)
        dis = d[h][w]
    return d[g[0]][g[1]]

ans = 0

for sh in range(H):
    for sw in range(W):
        for gh in range(H):
            for gw in range(W):
                if maze[sh][sw]=="#" or maze[gh][gw]=="#":
                    continue
                ans = max(ans, sol((sh,sw),(gh,gw)))
print(ans)

Fixed submission:
import math , sys

H,W = list(map( int, input().split() ))
maze = []
for i in range(H):
    maze.append(input())
if H==1:
    print(W-1)
    sys.exit()
if W ==1:
    print(H-1)
    sys.exit()

di = [(-1,0),(1,0),(0,1),(0,-1)]
"""
def sol(s,g):
    h = s[0] ; w = s[1]
    gh, gw = g
    d = [[math.inf for _ in range(W)] for _ in range(H)]
    cand = []
    dis = 0
    while True:
        for each in di:
            dh , dw = each
            if h + dh>=0 and h + dh<H and w + dw>=0 and w + dw<W and maze[h+dh][w+dw]=="." and d[h+dh][w+dw]>dis+1:
                cand.append((h+dh, w+dw))
                d[h+dh][w+dw] = dis +1
        if len(cand)==0:
            break
        h , w =cand.pop(0)
        dis = d[h][w]
    return d[g[0]][g[1]]
"""
ans = 0
for h in range(H):
    for w in range(W):
        if maze[h][w]=="#":
            continue
        d = [[math.inf for _ in range(W)] for _ in range(H)]
        cand = []
        dis = 0
        while True:
            for each in di:
                dh , dw = each
                if h + dh>=0 and h + dh<H and w + dw>=0 and w + dw<W and maze[h+dh][w+dw]=="." and d[h+dh][w+dw]>dis+1:
                    cand.append((h+dh, w+dw))
                    d[h+dh][w+dw] = dis +1
                    ans = max(ans, dis+1)
            #print(h,w,cand, d,dis,ans)
            if len(cand)==0:
                break
            h , w =cand.pop(0)
            dis = d[h][w]

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

Fixed submission:
n=int(input())
c = list(map(int, input().rstrip().split()))
ans=0
b=10**9+7
sum1=0
for i in range(n):
    ans=(ans+c[i]*sum1)%b
    sum1=(sum1+c[i])%b

    
    
    
        
print(ans)

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

Fixed submission:
n=int(input())
c = list(map(int, input().rstrip().split()))
ans=0
b=10**9+7
sum1=0
for i in range(n):
    ans=(ans+c[i]*sum1)%b
    sum1=(sum1+c[i])%b

    
    
    
        
print(ans)

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

Fixed submission:
n=int(input())
c = list(map(int, input().rstrip().split()))
ans=0
b=10**9+7
sum1=0
for i in range(n):
    ans=(ans+c[i]*sum1)%b
    sum1=(sum1+c[i])%b

    
    
    
        
print(ans)

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

Fixed submission:
n=int(input())
c = list(map(int, input().rstrip().split()))
ans=0
b=10**9+7
sum1=0
for i in range(n):
    ans=(ans+c[i]*sum1)%b
    sum1=(sum1+c[i])%b

    
    
    
        
print(ans)

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

Fixed submission:
n=int(input())
c = list(map(int, input().rstrip().split()))
ans=0
b=10**9+7
sum1=0
for i in range(n):
    ans=(ans+c[i]*sum1)%b
    sum1=(sum1+c[i])%b

    
    
    
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
c = list(map(int, input().rstrip().split()))
a=0
for i in range(n):
    for j in range(i+1,n):
        a=a+c[i]*c[j]
print(a%(10**9+7))

Fixed submission:
n=int(input())
c = list(map(int, input().rstrip().split()))
ans=0
b=10**9+7
sum1=0
for i in range(n):
    ans=(ans+c[i]*sum1)%b
    sum1=(sum1+c[i])%b

    
    
    
        
print(ans)
Buggy python submission (verdict: Runtime Error):
days = {"SUN:0", "MON:1"," TUE:2", "WED:3", "THU:4","FRI:5","SAT:6"}
week = raw_input()
t = 7 - days[week] 
print(t)

Fixed submission:
days = {"SUN":0, "MON":1,"TUE":2, "WED":3, "THU":4,"FRI":5,"SAT":6}
week = raw_input()
t = 7 - days[week] 
print(t)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[]
ans=0
for i in range(n):
  s=str(input())
  if s not in l:
    l.append(s)
    ans+=1
print(ans)


Fixed submission:
n=int(input())
l=[]
for i in range(n):
  s=str(input())
  l.append(s)
print(len(set(l)))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[]
ans=0
for i in range(n):
  s=str(input())
  if s not in l:
    l.append(s)
    ans+=1
print(ans)

Fixed submission:
n=int(input())
l=[]
for i in range(n):
  s=str(input())
  l.append(s)
print(len(set(l)))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[]
for i in range(n):
  s=str(input())
  if s not in l:
    l.append(s)
print(len(l))

Fixed submission:
n=int(input())
l=[]
for i in range(n):
  s=str(input())
  l.append(s)
print(len(set(l)))