Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
A = list(map(int, input().split()))
dp = [0 for i in range(N)]
dp[0] = 0
if N > K:
    for i in range(1,N):
        if i <= K:
            dp[i] = abs(A[i] - A[0])
        else:
            L = []
            for j in range(1,K+1):
                L.append(abs(A[i]-A[i-j]) + dp[i-j])
            dp[i] = min(L)
    print(dp[N-1])
else:
    print(abs(A[N-1]-A[0]))

Fixed submission:
import numpy as np

N,K = map(int, input().split())
A = list(map(int, input().split()))
A = np.array(A)
dp = np.zeros(N, dtype=int)
dp[0] = 0
if N > K:
    for i in range(1,N):
        if i <= K:
            dp[i] = abs(A[i] - A[0])
        else:
            j = max(i - K, 0)
            dp[i] = np.min(np.abs(A[i] - A[j:i]) + dp[j:i])
    print(dp[N-1])
else:
    print(abs(A[N-1]-A[0]))

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
A = list(map(int, input().split()))
dp = [0 for i in range(N)]
dp[0] = 0
if N > K:
    for i in range(1,N):
        if i <= K:
            dp[i] = abs(A[i] - A[0])
        else:
            L = []
            for j in range(1,K+1):
                L.append(abs(A[i]-A[i-j]) + dp[i-j])
            dp[i] = min(L)
    print(dp[N-1])
else:
    print(abs(A[N-1]-A[0]))

Fixed submission:
import numpy as np

N,K = map(int, input().split())
A = list(map(int, input().split()))
A = np.array(A)
dp = np.zeros(N, dtype=int)
dp[0] = 0
if N > K:
    for i in range(1,N):
        if i <= K:
            dp[i] = abs(A[i] - A[0])
        else:
            j = max(i - K, 0)
            dp[i] = np.min(np.abs(A[i] - A[j:i]) + dp[j:i])
    print(dp[N-1])
else:
    print(abs(A[N-1]-A[0]))

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
A = list(map(int, input().split()))
dp = [0 for i in range(N)]
dp[0] = 0
if N > K:
    for k in range(1,K+1):
        dp[k] = abs(A[k]-A[0])
    for i in range(K+1,N):
        L = []
        for j in range(1,K+1):
            L.append(abs(A[i]-A[i-j]) + dp[i-j])
        dp[i] = min(L)

    print(dp[N-1])
else:
    print(abs(A[N-1]-A[0]))

Fixed submission:
import numpy as np

N,K = map(int, input().split())
A = list(map(int, input().split()))
A = np.array(A)
dp = np.zeros(N, dtype=int)
dp[0] = 0
if N > K:
    for i in range(1,N):
        if i <= K:
            dp[i] = abs(A[i] - A[0])
        else:
            j = max(i - K, 0)
            dp[i] = np.min(np.abs(A[i] - A[j:i]) + dp[j:i])
    print(dp[N-1])
else:
    print(abs(A[N-1]-A[0]))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''
n=int(input())
a=list(map(int, input().split()))
ans=0
for i in range(n-1):
    for j in range(i+1,n):
        ans+=a[i]*a[j]
        if ans>10**9+7:
            ans%=10**9+7
print(ans)

Fixed submission:
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''
n=int(input())
a=list(map(int, input().split()))
ans=0
anss=[0]*(n+1)
for i in range(1,n+1):
    anss[-i-1]=anss[-i]+a[-i]
    if anss[-i-1]>10**9+7:
        anss[-i-1]%=10**9+7
#print(anss)
for i in range(n-1):
    ans+=a[i]*anss[i+1]
    if ans>10**9+7:
        ans%=10**9+7
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
n=int(input())
a= list(map(int, input().split()))
ans=1
for i in range(n):
    ans*=a[i]

if ans>10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
n=int(input())
a= list(map(int, input().split()))
ans=1
if 0 in a:
    print(0)
    sys.exit()
for i in range(n):
    ans*=a[i]
    if ans>10**18:
        print(-1)
        sys.exit()

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

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

cnt=0
now=1
cyc=0
visited=[0]*n
flg=False
for i in range(k):
    cnt+=1
    now=a[now-1]
    visited[now-1]+=1
    if visited[now-1]==1:
        cyc+=1
        #print(cyc)
    if visited[now-1]==2:
        flg=True
        cyc-=1
        break
    #print(visited)
#print(cyc,cnt,now,k-cnt+cyc)
if flg:
    for i in range((k-cnt+cyc)%cyc):
        now=a[now-1]
    print(now)
else:
    print(now)

Fixed submission:
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

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

cnt=0
now=1
cyc=0
visited=[0]*n
flg=False
for i in range(k):
    cnt+=1
    now=a[now-1]
    visited[now-1]+=1
    if visited[now-1]==2:
        cyc+=1
        #print(cyc)
    if visited[now-1]==3:
        flg=True
        #print(visited,cyc,now)
        #cyc-=1
        break
    #print(visited,now)
#print(cyc, cnt, now, (k-cnt+2*cyc) % cyc)
if flg:
    for i in range((k-cnt+2*cyc)%cyc):
        now=a[now-1]
    print(now)
else:
    print(now)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
#import copy

#import numpy as np

import collections
n=int(input())
a = list(map(int, input().split()))
alis= collections.Counter(a)
ss=[]
for i in range(1,n+1):
    ss.append(alis[i]*(alis[i]-1)//2)

for i in range(n):
    ss[a[i]-1] = (alis[a[i]]-1)*(alis[a[i]]-2)//2
    print(sum(ss))
    ss[a[i]-1] = alis[a[i]]*(alis[a[i]]-1)//2


Fixed submission:
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
import collections

n = int(input())
a = list(map(int, input().split()))
alis = collections.Counter(a)
ss = []
for i in range(1, n+1):
    ss.append(alis[i]*(alis[i]-1)//2)
#print(ss,alis)

chinpo=sum(ss)
#print(chinpo)
for i in range(n):
    #ss[a[i]-1] = (alis[a[i]]-1)*(alis[a[i]]-2)//2
    print(chinpo-ss[a[i]-1]+(alis[a[i]]-1)*(alis[a[i]]-2)//2)
Buggy python submission (verdict: Runtime Error):
n = input()
if n%2==0:
  print(n/2)
else:
  print(n//2+1)

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

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)a
    B.append(b)'''

#def sol(n,):    
    
def main():
    import sys
    input = sys.stdin.readline
    

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





if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

n,m=map(int, input().split())
s = []
c = []
for i in range(m):
    a, b = map(int, input().split())
    s.append(a)
    c.append(b)

if n==1:
    if c[0]==0:
        print(0)
        sys.exit()
def ok(num,m,s,c):
    for i in range(m):
        if str(num)[s[i]-1] != str(c[i]):
            return False
    return True
    
for num in range(10**(n-1),10**n):
    if ok(num,m,s,c):
        print(num)
        sys.exit()

print(-1)
            


Fixed submission:
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

n,m=map(int, input().split())
s = []
c = []
if m!=0:
    for i in range(m):
        a, b = map(int, input().split())
        s.append(a)
        c.append(b)

    if n==1:
        if c[0]==0:
            print(0)
            sys.exit()
    def ok(num,m,s,c):
        for i in range(m):
            if str(num)[s[i]-1] != str(c[i]):
                return False
        return True
        
    for num in range(10**(n-1),10**n):
        if ok(num,m,s,c):
            print(num)
            sys.exit()

    print(-1)
else:
    if n==1:
        print(0)
    else:
        print(10**(n-1))
Buggy python submission (verdict: Runtime Error):
#include<stdio.h>

int con(int a,int b){
    if(a>b){
       return b; 
    }else{
        return a;
    }
}

int main(void){
    int n;
    int count=0;
    int a[200000];
    int min=__INT_MAX__;

    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }

    for(int i=0;i<n;i++){
        min=con(min,a[i]);
        if(min==a[i]){
            count++;
        }
    }

    printf("%d",count);
}

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

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''


n = int(input())
p = list(map(int, input().split()))

mi = 1000000000
cnt = 0
for i in range(n):
    if p[i] <= mi:
        cnt += 1
    if mi > p[i]:
        mi = p[i]

print(cnt)
Buggy python submission (verdict: Runtime Error):
#n = int(input())
#L = list(map(int, input().split()))
#import math
#import sys
#import heapq
#import fractions
#import bisect
#import numpy




NM = list(map(int, input().split()))
ps = [list(input().split()) for i in range(NM[1])]
a=[0]*NM[0]
flg = [True]*NM[0]
for i in range(NM[1]):
    ps[i][0] = int(ps[i][0])

ans = [0]*NM[0]
ac = 0
for i in range(NM[1]):
    if ps[i][1] == "AC":
        flg[ps[i][0]-1] = False
        ans[ps[i][0]-1] = a[ps[i][0]-1]
    if ps[i][1] == "WA" and flg[ps[i][0]-1]:
        a[ps[i][0]-1] += 1

for i in range(NM[0]):
    if flg[i]== False:
        ac += 1
print(ac,sum(ans))#n = int(input())
#L = list(map(int, input().split()))
#import math
#import sys
#import heapq
#import fractions
#import bisect
#import numpy




NM = list(map(int, input().split()))
ps = [list(input().split()) for i in range(NM[1])]
a=[0]*NM[0]
flg = [True]*NM[0]
for i in range(NM[1]):
    ps[i][0] = int(ps[i][0])

ans = [0]*NM[0]
ac = 0
for i in range(NM[1]):
    if ps[i][1] == "AC":
        flg[ps[i][0]-1] = False
        ans[ps[i][0]-1] = a[ps[i][0]-1]+1
    if ps[i][1] == "WA" and flg[ps[i][0]-1]:
        a[ps[i][0]-1] += 1

for i in range(NM[0]):
    if flg[i]== False:
        ac += 1
print(ac,sum(ans)-ac)
        



        




Fixed submission:
#n = int(input())
#L = list(map(int, input().split()))
#import math
#import sys
#import heapq
#import fractions
#import bisect
#import numpy




NM = list(map(int, input().split()))
ps = [list(input().split()) for i in range(NM[1])]
a=[0]*NM[0]
flg = [True]*NM[0]
for i in range(NM[1]):
    ps[i][0] = int(ps[i][0])

ans = [0]*NM[0]
ac = 0
for i in range(NM[1]):
    if ps[i][1] == "AC" and flg[ps[i][0]-1]:
        flg[ps[i][0]-1] = False
        ans[ps[i][0]-1] = a[ps[i][0]-1]
    if ps[i][1] == "WA" and flg[ps[i][0]-1]:
        a[ps[i][0]-1] += 1

for i in range(NM[0]):
    if flg[i]== False:
        ac += 1
print(ac,sum(ans))
Buggy python submission (verdict: Runtime Error):
#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
import queue
import numpy as np

def sol(h,w,s,start):
    dx = [1, 0, -1, 0]
    dy=[0,1,0,-1]
    inf = -1000000000
    d=np.array([[inf for i in range(w)] for i in range(h)])
    q=queue.Queue()
    q.put(start)
    d[start[1]][start[0]]=0
    while not q.empty():
        p = q.get()
        for i in range(4):
            nx=p[0]+dx[i]
            ny=p[1]+dy[i]
            if 0<=nx<w and 0<=ny<h:
                S = s[ny][0]
                if d[nx][ny]==inf:
                    
                    if S[nx]=='.':
                        q.put([nx,ny])
                        d[nx][ny]=d[p[0]][p[1]]+1
    return np.max(d)


def main():
    import sys
    input = sys.stdin.readline
    h,w = map(int, input().split())
    s = []
    for i in range(h):
        SS = list(map(str, input().split()))
        s.append(SS)
    ans=[]
    for i in range(w):
        for j in range(h):
            start = [i,j]
            ans.append(sol(h,w,s,start))
    print(max(ans))
        


if __name__ == "__main__":
    main()


Fixed submission:
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''


def bfs(h, w, m, start):

    import queue
    d = [[0 for i in range(w)]for i in range(h)]
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    flg = False

    a = queue.Queue()
    a.put(start)
    #print(start)
    while not a.empty():
        hh, ww = map(int, a.get())
        for i in range(4):
            nx, ny = ww+dx[i], hh+dy[i]
            if 0 <= ny < h and 0 <= nx < w and m[ny][nx] != "#" and d[ny][nx] == 0 and [ny,nx]!=start:
                a.put([ny, nx])
                d[ny][nx] = d[hh][ww]+1
    #print(d)
    return d[hh][ww]



h, w = map(int, input().split())
m = [[]for i in range(h)]
for i in range(h):
    m[i] = list(input().rstrip())

ans=[]
for i in range(h):
    for j in range(w):
        if m[i][j]!="#":
            start=[i,j]
            ans.append(bfs(h,w,m,start))
            #print(ans)

print(max(ans))
Buggy python submission (verdict: Runtime Error):
import math
a = list(map(int, input().split()))
print(a[0]*a[1]//math.gcd(a[0],a[1]))

Fixed submission:
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
a = list(map(int, input().split()))

print(a[0]*a[1]//fractions.gcd(a[0], a[1]))

Buggy python submission (verdict: Runtime Error):
import math
a = list(map(int, input().split()))
print(int(a[0]*a[1]/math.gcd(a[0],a[1])))

Fixed submission:
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
a = list(map(int, input().split()))

print(a[0]*a[1]//fractions.gcd(a[0], a[1]))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''

n=int(input())
a=list(map(int, input().split()))
l0=[0]*60
l1=[0]*60
for i in range(n):
    b=bin(a[i])[::-1]
    #print(b)
    for j in range(60):
        if j<len(b)-2:
            if b[j]=="0":
                l0[j]+=1
            else:
                l1[j]+=1
        else:
            l0[j]+=1
#print(l0,l1)
ans=0
for i in range(60):
    ans+=l0[i]*l1[i]*(2**i)
    if ans>=10**9+7:
        ans%=(10**9+7)
print(ans)

Fixed submission:
import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''
import numpy as np
n=int(input())
a = np.array([int(i) for i in input().split()])

ans=0
for i in range(60):
    cnt=np.count_nonzero(a&1)
    ans+=(n-cnt)*cnt*(2**i)
    if ans>=10**9+7:
        ans%=(10**9+7)
    a>>=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#n = int(input())
#L = list(map(int, input().split()))
#import math
#import sys
#import heapq
#import fractions
#import bisect
#import numpy
#import queue
#import math
'''
for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
n = int(input())   
l = list(map(int, input().split()))

l.sort(reverse=True)
ans=0
for i in range(0,n-2):
    for j in range(i+1,n-1):
        for m in range(j+1,n):
            if l[i]<l[j]+l[m]:
                ans+=1
print(ans)

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

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''


def sol(n,l):
    import bisect
    l.sort()
    ans = 0
    #print(l)
    for i in range(n-1):
        for j in range(i+1,n):
            ji = l[j]+l[i]
            ind = bisect.bisect_left(l,ji)
            #print(i,j,ind,ind-j-1)
            ans += ind-j-1
    return ans


def main():
    import sys
    input = sys.stdin.readline
    n = int(input())
    l = list(map(int, input().split()))
    print(sol(n,l))

        
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):

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

ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        for m in range(j+1,N):
            if L[i]<L[j]+L[m]:
                ans+=1
print(ans)

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

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''


def sol(n,l):
    import bisect
    l.sort()
    ans = 0
    #print(l)
    for i in range(n-1):
        for j in range(i+1,n):
            ji = l[j]+l[i]
            ind = bisect.bisect_left(l,ji)
            #print(i,j,ind,ind-j-1)
            ans += ind-j-1
    return ans


def main():
    import sys
    input = sys.stdin.readline
    n = int(input())
    l = list(map(int, input().split()))
    print(sol(n,l))

        
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))

M = []

for i in range(len(L)):
    l = (L[i], i+1)
    M.append(l)

M = sorted(M)

for x in M:
    print(M[1])

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

M = []

for i in range(len(L)):
    l = (L[i], i+1)
    M.append(l)

M = sorted(M)

for x in M:
    print(x[1])

Buggy python submission (verdict: Time Limit Exceeded):

import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))

S = []
for i in range(N):
    S.append(A.index(max(A))+1)
    A[A.index(max(A))] -= 100000

for i in reversed(S):
    print(str(i) + " ")


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

M = []

for i in range(len(L)):
    l = (L[i], i+1)
    M.append(l)

M = sorted(M)

for x in M:
    print(x[1])

Buggy python submission (verdict: Time Limit Exceeded):

import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))

S = []
for i in range(N):
    S.append(A.index(max(A))+1)
    A[A.index(max(A))] -= 100000

for i in reversed(S):
    print(str(i) + " ")


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

M = []

for i in range(len(L)):
    l = (L[i], i+1)
    M.append(l)

M = sorted(M)

for x in M:
    print(x[1])

Buggy python submission (verdict: Time Limit Exceeded):

import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))

S = []
for i in range(N):
    S.append(A.index(max(A))+1)
    A[A.index(max(A))] -= 100000

S.reverse()
for i in range(N):
    print(str(S[i]) + " ")


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

M = []

for i in range(len(L)):
    l = (L[i], i+1)
    M.append(l)

M = sorted(M)

for x in M:
    print(x[1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N = int(input())
A = input().split()
for i in range(N):
    A[i] = int(A[i])

S = []
for i in range(N):
    B = A.index(max(A))
    A[A.index(max(A))] -= 100000
    S.append(B+1)


for i in reversed(range(0,N)):
    print(str(S[i]) + " ")


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

M = []

for i in range(len(L)):
    l = (L[i], i+1)
    M.append(l)

M = sorted(M)

for x in M:
    print(x[1])

Buggy python submission (verdict: Time Limit Exceeded):

N = int(input())
A = input().split()
for i in range(N):
    A[i] = int(A[i])

S = []
for i in range(N):
    B = A.index(max(A))
    A[A.index(max(A))] -= 100000
    S.append(B+1)


for i in reversed(range(0,N)):
    print(str(S[i]) + " ")

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

M = []

for i in range(len(L)):
    l = (L[i], i+1)
    M.append(l)

M = sorted(M)

for x in M:
    print(x[1])
Buggy python submission (verdict: Runtime Error):
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(input())
if N >1:
    sum = N*(N-1)/2
elif N = 1:
    sum = 1
else:
    sum = 0
sum = int(sum)
print(sum)


Fixed submission:
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(input())
print(N*(N-1)//2)

Buggy python submission (verdict: Time Limit Exceeded):
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(sys.stdin.readline()[:-1])
sum = 0
for i in range(N):
    sum += i
print(sum)


Fixed submission:
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(input())
print(N*(N-1)//2)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
sum = 0
for i in range(N):
    sum += i
print(sum)

Fixed submission:
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(input())
print(N*(N-1)//2)

Buggy python submission (verdict: Time Limit Exceeded):
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
sum = 0
for i in range(5*10**8):
    sum += i
N = int(input())
if N >=5*10*8:
    for i in range((5*10**8),N):
        sum += i
else:
    for i in range(0,N,-1):
        sum -= i

print(sum)


Fixed submission:
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(input())
print(N*(N-1)//2)

Buggy python submission (verdict: Time Limit Exceeded):
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(input())
sum = 0
for i in range(N):
    sum += i
print(sum)

Fixed submission:
#n = int(input())
#L = list(map(int, input().split()))
import math
import sys
import fractions
N = int(input())
print(N*(N-1)//2)
Buggy python submission (verdict: Runtime Error):

N = int(input())
#s = input()
#S = []
#for i in range(N):
S = input().split(" ")
SUM = 0
for i in range(N):
    temp = S[i]
    temtem = 1 / temp
    SUM += temtem
Ans = 1 / SUM
print(Ans)



Fixed submission:

N = int(input())
#s = input()
#S = []
#for i in range(N):
S = input().split(" ")
SUM = 0
for i in range(N):
    temp = int(S[i])
    temtem = 1 / temp
    SUM += temtem
Ans = 1 / SUM
print(Ans)
Buggy python submission (verdict: Runtime Error):

N = int(input())
#s = input()
#S = []
#for i in range(N):
S = input().split(" ")
for i in range(N):
    S[i] = int(S[i])
for i in range(N):
    S[i+1] = (int(S[i])+int(S[i+1])) / 2
print(S[N-1])




Fixed submission:

N = int(input())
#s = input()
#S = []
#for i in range(N):
S = input().split(" ")
for i in range(N):
    S[i] = float(S[i])
S.sort()
for i in range(N-1):
    S[i+1] = (float(S[i])+float(S[i+1])) / 2.000000
print(S[N-1])