Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
n=int(input())
A=sorted([int(i) for i in input().split()])
B=sorted([int(i) for i in input().split()])
C=sorted([int(i) for i in input().split()])
a=[]
b=[]
for i in range(n):
    for j in range(n):
        if A[i]<B[j]:
            a.append(n-j)
            break
    else:
        a.append(0)
for i in range(n):
    for j in range(n):
        if B[i]<C[j]:
            b.append(n-j)
            break
    else:
        b.append(0)
b.sort()
b=list(accumulate(b))
ans=0
for i in range(n):
    if a[i]!=0:
        ans+=b[a[i]-1]
print(ans)

Fixed submission:
import bisect
n=int(input())
abc=[sorted(list(int(i) for i in input().split())) for i in range(3)]
print(sum([bisect.bisect_left(abc[0],b)*(n-bisect.bisect_right(abc[2],b)) for b in abc[1]]))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=sorted([int(i) for i in input().split()])
B=sorted([int(i) for i in input().split()])
C=sorted([int(i) for i in input().split()])
a=[]
b=[]
for i in range(n):
    for j in range(n):
        if A[i]<B[j]:
            a.append(n-j)
            break
    else:
        a.append(0)
for i in range(n):
    for j in range(n):
        if B[i]<C[j]:
            b.append(n-j)
            break
    else:
        b.append(0)
#print(a)
#print(b)
ans=0
for i in range(n):
    if a[i]!=0:
        for j in range(n-a[i],n):
            ans+=b[j]
#            print(ans)
print(ans)

Fixed submission:
import bisect
n=int(input())
abc=[sorted(list(int(i) for i in input().split())) for i in range(3)]
print(sum([bisect.bisect_left(abc[0],b)*(n-bisect.bisect_right(abc[2],b)) for b in abc[1]]))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=sorted([int(i) for i in input().split()])
B=sorted([int(i) for i in input().split()])
C=sorted([int(i) for i in input().split()])
a=[]
b=[]
for i in range(n):
    count=0
    for j in range(n):
        if A[i]<B[j]:
            count+=1
    a.append(count)
for i in range(n):
    count=0
    for j in range(n):
        if B[i]<C[j]:
            count+=1
    b.append(count)
ans=0
for i in range(n):
    if a[i]!=0:
        for j in range(n-a[i],n):
            ans+=b[j]
#            print(ans)
print(ans)
#print(a)
#print(b)

Fixed submission:
import bisect
n=int(input())
abc=[sorted(list(int(i) for i in input().split())) for i in range(3)]
print(sum([bisect.bisect_left(abc[0],b)*(n-bisect.bisect_right(abc[2],b)) for b in abc[1]]))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n=int(input())
d=list(map(int,input().split()))
m=int(input())
t=list(map(int,input().split()))
for i in range(m):
    if t[i] in d:
        d.remove(t[i])
    else:
        print('NO')
        sys.exit()
print('YES')

Fixed submission:
import sys
from collections import Counter
n=int(input())
d=Counter(list(map(int,input().split())))
m=int(input())
t=Counter(list(map(int,input().split())))
k=list(t.keys())
for i in range(len(k)):
    if d[k[i]]<t[k[i]]:
        print('NO')
        sys.exit()
print('YES')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(int(input()) for _ in range(n))
A=list(set(a))
cnt=0
for i in range(len(A)):
    c=a.count(A[i])
    if c%2==0:
        continue
    else:
        cnt+=1
print(cnt)

Fixed submission:
n=int(input())
a=list(int(input()) for _ in range(n))
a.sort()
cnt=1
ans=0
for i in range(n-1):
    if a[i]==a[i+1]:
        cnt+=1
    else:
        if cnt%2==0:
            cnt=1
        else:
            ans+=1
            cnt=1
if a[-2]==a[-1]:
    if cnt%2==1:
        ans+=1
else:
    ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from itertools import permutations


def input():
    return sys.stdin.readline().strip()


def main():
    N, M, R = map(int, input().split())

    def warshall_floyd(d):
        # d[i][j]: iからjへの最短距離
        for k in range(N):
            for i in range(N):
                for j in range(N):
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j])
        return d

    r = list(map(int, input().split()))
    d = [[float("inf")] * N for i in range(N)]
    for i in range(M):
        x, y, z = map(int, input().split())
        d[x - 1][y - 1] = z
        d[y - 1][x - 1] = z
    for i in range(N):
        d[i][i] = 0  # 自身のところに行くコストは０
    D = warshall_floyd(d)
    P = list(permutations(r))
    cost = float("inf")
    for p in P:
        c = 0
        for i in range(R - 1):
            c += D[p[i] - 1][p[i + 1] - 1]
        if c < cost:
            cost = c
    print(cost)


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from itertools import permutations


def input():
    return sys.stdin.readline().strip()


def main():
    N, M, R = map(int, input().split())

    def warshall_floyd(d):
        # d[i][j]: iからjへの最短距離
        for k in range(N):
            for i in range(N):
                for j in range(N):
                    tmp = d[i][k] + d[k][j]
                    if d[i][j] > tmp:
                        d[i][j] = tmp
        return d

    r = list(map(int, input().split()))
    d = [[float("inf")] * N for i in range(N)]
    for i in range(M):
        x, y, z = map(int, input().split())
        d[x - 1][y - 1] = z
        d[y - 1][x - 1] = z
    for i in range(N):
        d[i][i] = 0  # 自身のところに行くコストは０
    D = warshall_floyd(d)
    P = list(permutations(r))
    cost = float("inf")
    for p in P:
        c = 0
        for i in range(R - 1):
            c += D[p[i] - 1][p[i + 1] - 1]
        if c < cost:
            cost = c
    print(cost)


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

N = int(input())
A = list(map(int, input().split()))

if N >= 3:
    counter = Counter(A)
    m = min(A)
    M = max(A)
    cnt = []
    for i in range(m, M - 1):
        ans = counter[i] + counter[i + 1] + counter[i + 2]
        if ans:
            cnt.append(ans)
        print(cnt)
    print(max(cnt))

elif N == 2:
    if abs(A[0] - A[1]) <= 2:
        print(2)
    else:
        print(1)

elif N == 1:
    print(1)


Fixed submission:
import numpy as np

N = int(input())
A = np.bincount(np.array(list(map(int, input().split()))))

B = A.copy()
B[1:] += A[:-1]
B[:-1] += A[1:]

answer = B.max()
print(answer)

Buggy python submission (verdict: Runtime Error):
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

if N >= 3:
    counter = Counter(A)
    m = min(A)
    M = max(A)
    cnt = []
    for i in range(m, M - 2):
        cnt.append(counter[i] + counter[i + 1] + counter[i + 2])
    print(max(cnt))

elif N == 2:
    if abs(A[0] - A[1]) <= 2:
        print(2)
    else:
        print(1)

elif N == 1:
    print(1)


Fixed submission:
import numpy as np

N = int(input())
A = np.bincount(np.array(list(map(int, input().split()))))

B = A.copy()
B[1:] += A[:-1]
B[:-1] += A[1:]

answer = B.max()
print(answer)
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=sorted(list(map(int,input().split())))
L={}
if n==1:
        print(1)
elif n==2:
    if abs(A[0]-A[1])==1:
        print(2)
    else:
        print(1)
else:
    for i in A:
        if i not in L:
            L[i]=1
        else:
            L[i]+=1
    print(L)
    ans=[]
    for j in range(A[0],A[-1]+1):
        if (j in L) and (j-1 in L) and (j+1 in L):
            ans.append(L[j]+L[j+1]+L[j-1])
        elif (j in L) and (j-1 in L):
            ans.append(L[j-1]+L[j])
        elif (j in L) and (j+1 in L):
            ans.append(L[j+1]+L[j])
        elif (j-1 in L) and (j+1 in L):
            ans.append(L[j+1]+L[j-1])
        elif (j in L):
            ans.append(L[j])
print(max(ans))

Fixed submission:
n=int(input())
A=sorted(list(map(int,input().split())))
L={}
if n==1:
        print(1)
elif n==2:
    if abs(A[0]-A[1])==1:
        print(2)
    else:
        print(1)
else:
    for i in A:
        if i not in L:
            L[i]=1
        else:
            L[i]+=1
    ans=[]
    for j in range(A[0],A[-1]+1):
        if (j in L) and (j-1 in L) and (j+1 in L):
            ans.append(L[j]+L[j+1]+L[j-1])
        elif (j in L) and (j-1 in L):
            ans.append(L[j-1]+L[j])
        elif (j in L) and (j+1 in L):
            ans.append(L[j+1]+L[j])
        elif (j-1 in L) and (j+1 in L):
            ans.append(L[j+1]+L[j-1])
        elif (j in L):
            ans.append(L[j])
    print(max(ans))

Buggy python submission (verdict: Runtime Error):
n=int(input())
A=sorted(list(map(int,input().split())))
L={}
for i in A:
    if i not in L:
        L[i]=1
    else:
        L[i]+=1
ans=[]
for j in range(A[0],A[-1]+1):
    if j in L:
        if j-1 in L:
            if j+1 in L:
                ans.append(L[j]+L[j+1]+L[j-1])
if len(A)>=3:
    print(max(ans))
else:
    if len(A)==1:
        print(1)
    else:
        if abs(A[0]-A[1])==1:
            print(2)
        else:
            print(1)


Fixed submission:
n=int(input())
A=sorted(list(map(int,input().split())))
L={}
if n==1:
        print(1)
elif n==2:
    if abs(A[0]-A[1])==1:
        print(2)
    else:
        print(1)
else:
    for i in A:
        if i not in L:
            L[i]=1
        else:
            L[i]+=1
    ans=[]
    for j in range(A[0],A[-1]+1):
        if (j in L) and (j-1 in L) and (j+1 in L):
            ans.append(L[j]+L[j+1]+L[j-1])
        elif (j in L) and (j-1 in L):
            ans.append(L[j-1]+L[j])
        elif (j in L) and (j+1 in L):
            ans.append(L[j+1]+L[j])
        elif (j-1 in L) and (j+1 in L):
            ans.append(L[j+1]+L[j-1])
        elif (j in L):
            ans.append(L[j])
    print(max(ans))
Buggy python submission (verdict: Time Limit Exceeded):
def test(L):
    T = abs(sum(A[:L]) - sum(A[L:]))
    return T < answer


N = int(input())
A = list(map(int, input().split()))

left = 0
right = N
answer = float("inf")

for i in range(1, N):
    if test(i):
        answer = abs(sum(A[:i]) - sum(A[i:]))

print(answer)


Fixed submission:
from itertools import accumulate

N = int(input())
A = list(map(int, input().split()))
A = list(accumulate(A))
answer = abs((A[-1] - A[0]) - A[0])
for i in range(N - 1):
    L = A[-1] - A[i]
    K = abs(L - A[i])
    if K < answer:
        answer = K


print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(str, input().split()))

b = []
for i in range(N):
    if i % 2 == 1:
        b = b + [A[i]]
    else:
        b = [A[i]] + b
if N % 2 == 0:
    b = b[::-1]

print(" ".join(b))

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

b = A[::2][::-1] + A[1::2]
if N % 2 == 0:
    b = b[::-1]
print(" ".join(b))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(str, input().split()))

b = []
for i in range(N):
    b.append(A[i])
    b = b[::-1]
print(" ".join(b))


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

b = A[::2][::-1] + A[1::2]
if N % 2 == 0:
    b = b[::-1]
print(" ".join(b))
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
N=[2,3,4,5,6,7,8,9,10,11,12,13,1]
if N.index(A)<N.index(B):
    print('Bob')
elif N.index(A)>N.index(B):
    print('Alice')
else N.index(A)==N.index(B):
    print('Draw')

Fixed submission:
A,B=map(int,input().split())
N=[2,3,4,5,6,7,8,9,10,11,12,13,1]
a=N.index(A)
b=N.index(B)
if a<b:
    print('Bob')
elif a>b:
    print('Alice')
else:
    print('Draw')
Buggy python submission (verdict: Runtime Error):
import sys
from collections import Counter
import heapq


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)


def main():
    N = int(input())
    A = list(map(int, input().split()))
    Cnt = Counter(A)
    V = list(Cnt.values())
    heap = []
    for v in V:
        heapq.heappush(heap, -1 * v)
    while heap:
        a = heapq.heappop(heap)
        if a == -1:
            print(-1 * sum(heap) + 1)
            return
        b = heapq.heappop(heap)
        heapq.heappush(heap, a + 1)
        heapq.heappush(heap, b + 1)


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from collections import Counter
import heapq


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)


def main():
    N = int(input())
    A = list(map(int, input().split()))
    Cnt = Counter(A)
    V = list(Cnt.values())
    heap = []
    for v in V:
        heapq.heappush(heap, -1 * v)
    if len(heap) == 1:
        print(1)
        return
    while heap:
        a = heapq.heappop(heap)
        if a == -1:
            print(-1 * sum(heap) + 1)
            return
        b = heapq.heappop(heap)
        heapq.heappush(heap, a + 1)
        heapq.heappush(heap, b + 1)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    N = int(input())
    A = []
    B = []
    for i in range(N):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)
    A = np.array(list(reversed(A)))
    B = np.array(list(reversed(B)))
    ans = 0
    for i in range(N):
        a = A[i]
        b = B[i]
        if a % b > 0:
            btn = b - (a % b)
        else:
            btn = a % b
        ans += btn
        A[i:] += btn
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
import sys
import numpy as np


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    N = int(input())
    A = []
    B = []
    for i in range(N):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)
    A = np.array(list(reversed(A)))
    B = np.array(list(reversed(B)))
    ans = 0
    for i in range(N):
        a = A[i] + ans
        b = B[i]
        if a % b > 0:
            btn = b - (a % b)
        else:
            btn = a % b
        ans += btn
    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
ans=0
for i in range(k+1):
    for j in range(k+1):
        for l in range(k+1):
            if i+j+l==s:
                ans+=1
print(ans)


Fixed submission:
K,S=map(int,input().split())
if S<=K:
    print((S+2)*(S+1)//2)
elif S<=2*K:
    m=0
    for i in range(K+1):
        s=S-i
        if s<=K:
            m+=s+1
            
        else:
            c=s-K
            a=s-2*c
            m+=a+1         
    print(m)

else:
    s=3*K-S
    print((s+2)*(s+1)//2)

Buggy python submission (verdict: Runtime Error):
K,S=map(int,input().split())
if S<=K:
    print((S+2)*(S+1)//2)
elif S<=2*K:
    s=S-math.ceil(K/3)*3
    print((s+2)*(s+1)//2)
else:
    s=3*K-S
    print((s+2)*(s+1)//2)

Fixed submission:
K,S=map(int,input().split())
if S<=K:
    print((S+2)*(S+1)//2)
elif S<=2*K:
    m=0
    for i in range(K+1):
        s=S-i
        if s<=K:
            m+=s+1
            
        else:
            c=s-K
            a=s-2*c
            m+=a+1         
    print(m)

else:
    s=3*K-S
    print((s+2)*(s+1)//2)
Buggy python submission (verdict: Runtime Error):
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)


def main():
    N, M = map(int, input().split())
    S = []

    d = [[float("inf")] * N for _ in range(N)]
    L = []
    for i in range(M):
        a, b, c = map(int, input().split())
        d[a - 1][b - 1] = c
        d[b - 1][a - 1] = c
        if a < b:
            L.append((a - 1, b - 1))
        else:
            L.append(b - 1, a - 1)
    for i in range(N):
        d[i][i] = 0
    L = set(L)

    def warshall_floyd(d):
        # d[i][j]: iからjへの最短距離
        for k in range(N):
            for i in range(N):
                for j in range(N):
                    if d[i][j] > d[i][k] + d[k][j]:
                        d[i][j] = d[i][k] + d[k][j]
                        if i < j:
                            if (i, j) in L:
                                S.append((i, j))
                        else:
                            if (j, i) in L:
                                S.append((j, i))
        return d

    warshall_floyd(d)
    print(len(set(S)))


if __name__ == "__main__":
    main()


Fixed submission:
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)


def main():
    N, M = map(int, input().split())
    S = []

    d = [[float("inf")] * N for _ in range(N)]
    L = []
    for i in range(M):
        a, b, c = map(int, input().split())
        d[a - 1][b - 1] = c
        d[b - 1][a - 1] = c
        if a < b:
            L.append((a - 1, b - 1))
        else:
            L.append((b - 1, a - 1))
    for i in range(N):
        d[i][i] = 0
    L = set(L)

    def warshall_floyd(d):
        # d[i][j]: iからjへの最短距離
        for k in range(N):
            for i in range(N):
                for j in range(N):
                    if d[i][j] > d[i][k] + d[k][j]:
                        d[i][j] = d[i][k] + d[k][j]
                        if i < j:
                            if (i, j) in L:
                                S.append((i, j))
                        else:
                            if (j, i) in L:
                                S.append((j, i))
        return d

    warshall_floyd(d)
    print(len(set(S)))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
N=int(input())
T=[int(i) for i in raw_input().split()]
M=int(input())

for i in range(M):
    p,x=map(int,raw_input().split())
    time=sum(T)-T[p-1]+x
    print(time)


Fixed submission:
N=int(input())
T=list(map(int,input().split()))
M=int(input())
P=[]
X=[]
for k in range(M):
    p,x=map(int,input().split())
    P.append(p)
    X.append(x)

for h in range(M):
    time=sum(T)-T[P[h]-1]+X[h]
    print(time)

Buggy python submission (verdict: Runtime Error):
N=int(input())
T=[int(i) for i in raw_input().split()]
M=int(input())
PX=[]
for i in range(M):
    p,x=map(int,raw_input().split())
    time=sum(T)-T[p-1]+x
    print(time)


Fixed submission:
N=int(input())
T=list(map(int,input().split()))
M=int(input())
P=[]
X=[]
for k in range(M):
    p,x=map(int,input().split())
    P.append(p)
    X.append(x)

for h in range(M):
    time=sum(T)-T[P[h]-1]+X[h]
    print(time)

Buggy python submission (verdict: Runtime Error):
N=int(input())
T=[int(i) for i in raw_input().split()]
M=int(input())
PX=[]
for i in range(M):
    PX.append([int(k) for k in raw_input().split()])
if N>=M:
    for h in range(M):
        time=sum(T)-(T[PX[h][0]-1]-PX[h][1])
        print(time)
else:
    for h in range(N):
        time=sum(T)-(T[PX[h][0]-1]-PX[h][1])
        print(time)

Fixed submission:
N=int(input())
T=list(map(int,input().split()))
M=int(input())
P=[]
X=[]
for k in range(M):
    p,x=map(int,input().split())
    P.append(p)
    X.append(x)

for h in range(M):
    time=sum(T)-T[P[h]-1]+X[h]
    print(time)

Buggy python submission (verdict: Runtime Error):
N=int(input())
T=[int(i) for i in raw_input().split()]
M=int(input())
PX=[]
for i in range(M):
    PX.append([int(k) for k in raw_input().split()])

for h in range(M):
    time=sum(T)-(T[PX[h][0]-1]-PX[h][1])
    print(time)

Fixed submission:
N=int(input())
T=list(map(int,input().split()))
M=int(input())
P=[]
X=[]
for k in range(M):
    p,x=map(int,input().split())
    P.append(p)
    X.append(x)

for h in range(M):
    time=sum(T)-T[P[h]-1]+X[h]
    print(time)
Buggy python submission (verdict: Runtime Error):
import sys
h,w=map(int,input().split())
A=['A','B','C','D','E','F','G','H','I','J']
s=[]
for i in range(h):
    s.append(list(map(str,input().split())))
for i in range(h):
    for j in range(w):
        if s[i][j]=='snuke':
            a=A[j]
            b=str(i+1)
            print(a+b)
            sys.exit()

Fixed submission:
import sys
h,w=map(int,input().split())
A=[chr(i) for i in range(ord('A'), ord('Z')+1)]
s=[]
for i in range(h):
    s.append(list(map(str,input().split())))
for i in range(h):
    for j in range(w):
        if s[i][j]=='snuke':
            a=A[j]
            b=str(i+1)
            print(a+b)
            sys.exit()
Buggy python submission (verdict: Runtime Error):
S=input()
n=len(S)
ans=0
for i in range(1<<(n-1)):
    for j in range(n):
        if 1&(i>>j):
            ans+=int(S[k:j+1])
            k=j+1
    ans+=int(S[k:])
        
print(ans)



Fixed submission:
S=input()
n=len(S)
ans=0
for i in range(1<<(n-1)):
    k=0
    for j in range(n):
        if 1&(i>>j):
            ans+=int(S[k:j+1])
            k=j+1
    ans+=int(S[k:])
        
print(ans)
Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
X=[int(i)-a for i in input().split()]

memo={0:1}
for x in X:
    for k,v in list(memo.items()):
        memo[x+k]=memo.get(x+k,0)+v
        print(memo)
print(memo[0]-1)


Fixed submission:
n,a=map(int,input().split())
X=[int(i)-a for i in input().split()]

memo={0:1}
for x in X:
    for k,v in list(memo.items()):
        memo[x+k]=memo.get(x+k,0)+v
print(memo[0]-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,a=map(int,input().split())
x=sorted(list(map(int,input().split())))
for i in range(n):
    x[i]-=a
cnt=0
for i in range(2**n):
    ans=0
    for j in range(n):
        if ((i>>j)&1):
            ans+=x[j]
    if ans==0:
        cnt+=1
print(cnt-1)

Fixed submission:
n,a=map(int,input().split())
X=[int(i)-a for i in input().split()]

memo={0:1}
for x in X:
    for k,v in list(memo.items()):
        memo[x+k]=memo.get(x+k,0)+v
print(memo[0]-1)
Buggy python submission (verdict: Runtime Error):
s=input()
S=list(s)
L=len(S)
A=[]
for i in range(L):
    if S[i]=='0' or S[i]=='1':
        A.append(S[i])
    elif S[i]=='B' and len(A)==0:
        A.append('')
    else:
        A.remove(A[-1])
a=''.join(A)
print(a)

Fixed submission:
N=int(input())

print(int((N+1)*N/2))

Buggy python submission (verdict: Runtime Error):
s=input()
S=list(s)
L=len(S)
A=[]
for i in range(L):
    if S[i]=='0' or S[i]=='1':
        A.append(S[i])
    elif S[i]=='B' and len(A)==0:
        A.append('')
    else:
        A.remove(A[-1])
a=''.join(A)
print(a)

Fixed submission:
N=int(input())

print(int((N+1)*N/2))