Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n = int(input())

spot = input().split()

for i in range(n):
    total = 0

    pos = 0
    
    for l in range(n):
        if i != l:
            money = pos - int(spot[l])
            pos = int(spot[l])
            
            if money < 0:
                money *= -1
            total += money

    if pos < 0:
        pos *= -1
    total += pos
    
    print(total)

### FIXED CODE ###

from collections import deque

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

A.append(0)
A.appendleft(0)

A_diff = [abs(A[i+1] - A[i]) for i in range(N+1)]
A_sum = sum(A_diff)

for i in range(N):
    print(A_sum - (A_diff[i] + A_diff[i+1]) + abs(A[i+2] - A[i]))
### BUGGY CODE ###

import heapq

X , Y , Z , K = map(int,input().split())

A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

# それぞれソート
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)


# 処理済みフラグ
confilm = []

q = [(-(A[0] + B[0] + C[0]) , 0,0,0)]
confilm.append((0,0,0))

for _ in range(K) :
    val , i , j , k = heapq.heappop(q)

    print(-val)

    if i + 1 < X and not (i+1,j,k) in confilm :
        heapq.heappush(q,(-(A[i+1] + B[j] + C[k]), i+1,j,k))
        confilm.append((i+1,j,k))
    if j + 1 < Y and not (i,j+1,k) in confilm :
        heapq.heappush(q,(-(A[i] + B[j+1] + C[k]), i,j+1,k))
        confilm.append((i,j+1,k))
    if k + 1 < Z and not (i,j,k+1) in confilm :
        heapq.heappush(q,(-(A[i] + B[j] + C[k+1]), i,j,k+1))
        confilm.append((i,j,k+1))




### FIXED CODE ###

from heapq import heappop , heappush

X , Y , Z , K = map(int,input().split())

A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

# それぞれソート
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

# 処理済みフラグ
confilm = []

q = [(-(A[0] + B[0] + C[0]) , 0,0,0)]

for _ in range(K) :
    val , i , j , k = heappop(q)

    print(-val)

    t = (i+1,j,k)
    if i + 1 < X and not t in confilm :
        heappush(q,(-(A[i+1] + B[j] + C[k]),) + t)
        confilm.append(t)

    t = (i,j+1,k)
    if j + 1 < Y and not t in confilm :
        heappush(q,(-(A[i] + B[j+1] + C[k]),) + t)
        confilm.append(t)

    t = (i,j,k+1)
    if k + 1 < Z and not t in confilm :
        heappush(q,(-(A[i] + B[j] + C[k+1]),) + t)
        confilm.append(t)
### BUGGY CODE ###

MOD = 10 ** 9 + 7


def ncr(n, r, mod=MOD):
    return (fct[n] * invf[r] * invf[n - r]) % mod


def make_tables(n, mod=MOD):
    fct = [1 for _ in range(N + 1)]
    invf = [1 for _ in range(N + 1)]

    for i in range(2, N + 1):
        fct[i] = (fct[i - 1] * i) % mod
        invf[i] = divmod(fct[i])
    return fct, invf


def divmod(a, mod=MOD):
    return pow(a, mod - 2, mod)


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

fct, invf = make_tables(N, mod=MOD)

ans = 0
test_cnt = 0
for i in range(N - K + 1):
    for j in range(i + K - 1, N):
        if K <= 2:
            ans += (A[j] - A[i]) % MOD
        else:
            test_cnt += ncr(j - i - 1, K - 2)
            ans += ((A[j] - A[i]) % MOD * ncr(j - i - 1, K - 2)) % MOD
print(ans % MOD)



### FIXED CODE ###

MOD = 10 ** 9 + 7

def ncr(n, r, mod=MOD):
    return (fct[n] * invf[r] * invf[n - r]) % mod


def make_tables(n, mod=MOD):
    fct = [1 for _ in range(n + 1)]
    invf = [1 for _ in range(n + 1)]

    for i in range(2, n + 1):
        fct[i] = (fct[i - 1] * i) % mod
        invf[i] = divmod(fct[i])
    return fct, invf


def divmod(a, mod=MOD):
    return pow(a, mod - 2, mod)


N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
for i in range(N):
    A[i] %= MOD

fct, invf = make_tables(N, mod=MOD)

ans = 0
for i in range(N - K + 1):
    ans += ((A[-1-i] - A[i]) % MOD * ncr(N - i - 1, K - 1)) % MOD
print(ans % MOD)
### BUGGY CODE ###

N,K,L = map(int, input().split())


class UFT:
    def __init__(self, N):
        self.UFdata = [-1] * (N+1)
        self.rank   = [0]  * (N+1)
        self.connected_num = [1] * (N+1)

    def find(self,x):
        UFdata = self.UFdata
        while UFdata[x] != -1:
            x = UFdata[x]
        return x

    def unite(self,x,y):
        UFdata = self.UFdata
        rank = self.rank
        connected_num = self.connected_num
        find = self.find

        x = find(x)
        y = find(y)
        if x != y:
            if rank[x] < rank[y]:
                UFdata[x] = UFdata[y]
                x,y = y,x
            if rank[x] == rank[y]:
                rank[x] += 1
            UFdata[y] = x       
            connected_num[x] += connected_num[y]
            

UF1 = UFT(N)
UF2 = UFT(N)
ans = [1] * (N+1)
MAP= [ [0] * (N+1) for _ in range(N+1)]
import sys
input = sys.stdin.readline
PQ = [ [int(j) for j in input().split()] for _ in range(K)]
RS = [ [int(j) for j in input().split()] for _ in range(L)]

for i in range(K):
    p,q = PQ[i]
    if UF1.find(p) != -1 and UF1.find(p) != UF1.find(q)  or UF1.find(p) == UF1.find(q) == -1:
        UF1.unite(p,q)

    

for i in range(L):
    p,q = RS[i]

    if UF1.find(p) != -1 and UF1.find(p) == UF1.find(q) :
        UF2.unite(p, q)

ans = [0]*(N+1)
par_idx = [0]*(N+1)
for i in range(1,N+1):
    par_idx[i] = UF2.find(i)
for i in range(1,N+1):
    ans[i] = UF2.connected_num[par_idx[i]]

del ans[0]
# print(" ".join( map(lambda x: str(x), connected_num[1:])))
print(" ".join( map(lambda x: str(x), ans)))


### FIXED CODE ###

N,K,L = map(int, input().split())


class UFT:
    def __init__(self, N):
        self.UFdata = [-1] * (N+1)
        self.rank   = [0]  * (N+1)

    def find(self,x):
        UFdata = self.UFdata
        while UFdata[x] != -1:
            x = UFdata[x]
        return x

    def unite(self,x,y):
        UFdata = self.UFdata
        rank = self.rank 
        find = self.find

        x = find(x)
        y = find(y)
        if x != y:
            if rank[x] < rank[y]:
                x,y = y,x
            if rank[x] == rank[y]:
                rank[x] += 1
            UFdata[y] = x       
            

UF1 = UFT(N)
UF2 = UFT(N)
ans = [1] * (N+1)
# MAP= [ [0] * (N+1) for _ in range(N+1)]
import sys
input = sys.stdin.readline
#PQ = [ [int(j) for j in input().split()] for _ in range(K)]
#RS = [ [int(j) for j in input().split()] for _ in range(L)]

for i in range(K):
    p,q = map(int,input().split())
    UF1.unite(p,q)
for i in range(L):
    p,q = map(int,input().split())#RS[i]
    UF2.unite(p, q)
counter=[]
from collections import defaultdict
cntdic =defaultdict(int)
for i in range(1,N+1):
  counter.append(UF1.find(i)+UF2.find(i)*10**6)
  cntdic[counter[-1]]+=1 

ans = [0]*(N+1)
for i in range(1,N+1):
    ans[i] = cntdic[counter[i-1]]

del ans[0]
# print(" ".join( map(lambda x: str(x), connected_num[1:])))
print(" ".join( map(lambda x: str(x), ans)))
### BUGGY CODE ###


#aまでいけそうなら動かす。駄目そうならその項は終わり
import sys


def move(s, k):
    if len(s) == 1:
        return chr(97+(ord(s) + k - 97)%26)
    if s[0] == 'a' or 123-ord(s[0]) > k:
        return s[0] + move(s[1:], k)
    else:
        return 'a' + move(s[1:], k-(123-ord(s[0])))


s = input()
K = int(input())
sys.setrecursionlimit(20000)
print(move(s,K))



### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Sep 24 21:28:20 2016

@author: dotha
"""

#aまでいけそうなら動かす。駄目そうならその項は終わり

def move(s, k):
    if len(s) == 1:
        return chr(97+(ord(s) + k - 97)%26)
    if s[0] == 'a' or 123-ord(s[0]) > k:
        return s[0] + move(s[1:], k)
    else:
        return 'a' + move(s[1:], k-(123-ord(s[0])))

def move_(l,k):
    if l =='a' or 123-ord(l) > k:
        return (l,k)
    else:
        return ('a', k-(123-ord(l)))

s = input()
K = int(input())
answer=[]
#print(move(s,K))

for l in s:
    (x,K) = move_(l,K)
    answer.append(x)

answer[-1] = chr(97++(ord(answer[-1]) + K - 97)%26)
    
print(''.join(answer))
### BUGGY CODE ###

import copy
import sys
input=sys.stdin.readline

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

new_a = [0 for i in range(n)]
for i in range(k):
    for j in range(n):
        new_a[max(j-a[j], 0)] += 1
        if j+a[j]+1 < n:
            new_a[j+a[j]+1] += -1
    for j in range(n):
        if j > 0:
            new_a[j] += new_a[j-1]
    if new_a == [n for i in range(n)]:
        break
    a = copy.copy(new_a)
    new_a = [0 for i in range(n)]

print(" ".join(list(map(str, a))))

### FIXED CODE ###

import copy
import sys
input = sys.stdin.readline

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

new_a = [0 for i in range(n)]
for i in range(k):
    for j in range(n):
        new_a[max(j-a[j], 0)] += 1
        if j+a[j]+1 < n:
            new_a[j+a[j]+1] += -1
    for j in range(n):
        if j > 0:
            new_a[j] += new_a[j-1]
    if new_a == [n for i in range(n)]:
        a = copy.copy(new_a)
        break
    a = copy.copy(new_a)
    new_a = [0 for i in range(n)]

print(" ".join(list(map(str, a))))
### BUGGY CODE ###

#!/usr/bin/env python3
import itertools

n, m, q = map(int, input().split())
abcd = [input() for _ in range(q)]
a, b, c, d = [0] * q, [0] * q, [0] * q, [0] * q
for i in range(q):
    a[i], b[i], c[i], d[i] = map(int, abcd[i].split())

comb = [1] * n + [0] * (m - 1)
combination_all = set(itertools.permutations(comb))  # 5!通り出力する
all_array = []
#print(combination_all)
for i in combination_all:
    tmp = 1
    lis = []
    for j in range(len(i)):
        if i[j]:
            lis.append(tmp)
        else:
            tmp += 1
    all_array.append(lis)
#print(all_array)
ans = 0  # maxをとる
for arr in all_array:
    val = 0
    for j in range(q):
        if arr[b[j] - 1] - arr[a[j] - 1] == c[j]:
            val += d[j]
    ans = max(ans, val)
print(ans)
# bit 全探索で i が成り立つと仮定する
# 連結する奴の中で最大と最小の差がN-1以下なら成立
"""ans = 0

for i in range(2**n):
    score = 0
    emerge = []
    lis = []
    for j in range(n):
        if i>>j & j:
            if a[i] in emerge:"""


### FIXED CODE ###

#!/usr/bin/env python3
from itertools import combinations_with_replacement

n, m, q = map(int, input().split())
abcd = [0] * q
for i in range(q):
    abcd[i] = list(map(int, input().split()))
# print(0)
# comb = [1] * n + [0] * (m - 1)
# combination_all = set(itertools.permutations(comb))  # 5!通り出力する
cmb = combinations_with_replacement([i for i in range(1, m + 1)], n)
all_array = list(cmb)
"""for i in combination_all:
    tmp = 1
    lis = []
    for j in range(len(i)):
        if i[j]:
            lis.append(tmp)
        else:
            tmp += 1
    all_array.append(lis)"""
# print(all_array)
ans = 0  # maxをとる
for arr in all_array:
    val = 0
    for j in range(q):
        if arr[abcd[j][1] - 1] - arr[abcd[j][0] - 1] == abcd[j][2]:
            val += abcd[j][3]
    ans = max(ans, val)
print(ans)
# bit 全探索で i が成り立つと仮定する
# 連結する奴の中で最大と最小の差がN-1以下なら成立
"""ans = 0

for i in range(2**n):
    score = 0
    emerge = []
    lis = []
    for j in range(n):
        if i>>j & j:
            if a[i] in emerge:"""
### BUGGY CODE ###

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

import itertools
import math
def main():
    a,b=map(int,input().split())
    x=[y for y in make_divisors(a) if b%y==0]
    ans = 0
    for e in itertools.product([0,1], repeat=len(x)):
        t = [x[i] for i,v in enumerate(e) if v==1]
        for i, j in itertools.combinations(t, 2):
            if math.gcd(i, j) != 1:
                break
        else:
            ans = max(ans, e.count(1))
    print(ans)
                
if __name__ == "__main__":
    main()

### FIXED CODE ###

from functools import lru_cache

def main():
    a,b=map(lambda x: set(prime_factorize(int(x))),input().split())
    print(len(a&b)+1)

@lru_cache(maxsize=None)
def primes(n:int) -> list:
    '''n以下の全素数をlistで返す'''
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

# 素数判定（単純な素数判定なら十分早い。大量にやる場合はX in primesがよさそう）
@lru_cache(maxsize=None)
def is_prime(n: int) -> bool:
    '''引数nが素数であればTrue、そうでなければFalseを返す'''
    if n == 1:
        return False
    elif n == 2:
        return True
    elif n % 2 == 0:
        return False
    
    for i in range(3, int(n**0.5)+1, 2):
        if n % i == 0:
            return False
    return True

# 素因数分解
@lru_cache(maxsize=None)
def prime_factorize(n: int) -> list:
    '''引数nの素因数分解結果のlistを返す。'''
    arr = []
    # 2で割り続け奇数まで還元する
    while n % 2 == 0:
        arr.append(2)
        n //= 2
    # sqrt(n)までの素数で試し割
    for f in primes(int(n**0.5)):
        while n % f == 0:
            arr.append(f)
            n //= f
    if n != 1:
        arr.append(n)
    return arr

#約数リスト
def make_divisors(n: int) -> list:
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
        
if __name__ == "__main__":
    main()
### BUGGY CODE ###

a, b, k = map(int, input().split())
for x in range(a, b+1):
    if x < a+k or x > b-k:
        print(x)

### FIXED CODE ###

a, b, k = map(int, input().split())
if b - a - 2*k + 1 > 0:
    for x in (list(range(a, a+k)) + list(range(b-k+1, b+1))):
        print(x)
else:
    for x in (range(a, b+1)):
        print(x)
### BUGGY CODE ###

n,k,q=map(int,input().split())
A=[]
for _ in range(q):
  A.append(input())
i=1
while i<n+1:
  i=str(i)
  x=A.count(i)
  if k>q-x:
    print("Yes")
  else:
    print("No")
  i=int(i)
  i=i+1

### FIXED CODE ###

n,k,q=map(int,input().split())
A=[]
for _ in range(q):
  A.append(int(input())-1)
B=[0]*n
for i in range(q):
  B[A[i]]+=1
for i in range(n):
  if B[i]<=q-k:
    print("No")
  else:
    print("Yes")
### BUGGY CODE ###

# import math
# import numpy as np

# S = input()
# N = int(input())
N, W = map(int, input().split())
# A = list(map(int, input().split()))
# B = [int(input()) for _ in range(n)]
A = []
B = []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
# As = np.array(As)
# Bs = np.array(Bs)

# 二次元配列の初期化
# [[inf, inf, inf], [inf, inf, inf]]
dp = [[0] * (W + 1) for i in range(N + 1)]

def solve():
    for i in range(N):
        for w in range(W + 1):
            if w - A[i] >= 0:
                dp[i+1][w] = max(dp[i+1][w], dp[i][w - A[i]] + B[i])

            dp[i+1][w] = max(dp[i+1][w], dp[i][w])

    return dp[N][W]

# 0 [0, 0, 0, 0, 0, 0, 0, 0, 0]
# 1 [0, 0, 0, 30, 30, 30, 30, 30, 30]
# 2 [0, 0, 0, 30, 50, 50, 50, 80, 80]
# 3 [0, 0, 0, 30, 50, 60, 60, 80, 90]

print(solve())


### FIXED CODE ###

def solve():
    N, M = map(int, input().split())
    A = [list(map(int, input().split())) for i in range(N)]
    dp = [[0] * (M+1) for i in range(N+1)]
    
    for i in range(N):
        for s in range(M+1):
            a, b = A[i]
            if s-a >= 0:
                dp[i+1][s] = max(dp[i+1][s], dp[i][s-a] + b)
            dp[i+1][s] = max(dp[i+1][s], dp[i][s])
    return dp[N][M]

print(solve())
### BUGGY CODE ###

a,b=map(int,input().split())
Cdiv=[]
ans=[]
for i in range(1,min(a,b)+1):
    if a%i==0 and b%i==0:
        Cdiv.append(i)
for i in reversed(Cdiv):
    flag=0
    for j in range(2,i):
        if i%j==0:
            flag+=1
            break
    if flag==0:
        ans.append(i)

print(len(ans))

### FIXED CODE ###

import fractions

A,B = map(int, input().strip().split(' '))

# 素因数分解
def trial_division(n):
  result = []
  while n % 2 == 0:
    result.append(2)
    n //= 2
  f = 3
  while f*f <= n:
    if n % f == 0:
      result.append(f)
      n //= f
    else:
      f += 2
  if n != 1:
    result.append(n)
  return result

gcd_ = fractions.gcd(A,B)
if gcd_ == 1:
  print(1)
else:
  print(len(set(trial_division(gcd_)))+1)
### BUGGY CODE ###

from functools import reduce
from itertools import combinations
from operator import or_

n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
d = [1 << i for i in range(n)]
same_groups = [0] * (1 << n)
dp = [0] * (1 << n)

for i in range(1, 1 << n):
    k = i
    rb = k & -k
    ri = rb.bit_length() - 1
    ar = a[ri]
    k ^= rb
    val = same_groups[k]
    while k:
        pb = k & -k
        val += ar[pb.bit_length() - 1]
        k ^= pb
    same_groups[i] = val
# print(same_groups)

for k in range(3, n + 1):
    for grp in combinations(d, k):
        grp_i = reduce(or_, grp)
        val = float('-inf')
        for j in range(1, k + 1):
            for subgrp in combinations(grp, j):
                subgrp_i = reduce(or_, subgrp)
                comple_i = grp_i ^ subgrp_i
                val = max(val, same_groups[subgrp_i] + dp[comple_i])
        dp[grp_i] = val
        # print(k, dp, grp_i)
    # print(k)

print(dp[-1])


### FIXED CODE ###

n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
d = [1 << i for i in range(n)]

same_groups = [0] * (1 << n)
for i in range(1, 1 << n):
    k = i
    rb = k & -k
    ri = rb.bit_length() - 1
    ar = a[ri]
    k ^= rb
    val = same_groups[k]
    while k:
        pb = k & -k
        val += ar[pb.bit_length() - 1]
        k ^= pb
    same_groups[i] = val

dp = [0] * (1 << n)
for grp in range(1 << n):
    g = grp
    while g:
        dp[grp] = max(dp[grp], same_groups[g] + dp[grp ^ g])
        g = (g - 1) & grp

print(dp[-1])
### BUGGY CODE ###


a = int(input())
b = input()

def func(c):
    x = c.count("1")
    if x == 0:
        return 0
    n = 1
    nsum = 0
    for i in reversed(range(len(c))):
        if c[i] == "1":
            nsum += n
            if n > x:
                n = n % x
        n *= 2
    nsum %= x
    cans = bin(nsum).count("1")
    if cans == 0:
        return 1
    else:
        return 1 + func(bin(nsum))

for i in range(a):
    s = list(b)
    s[i] = "0" if s[i] == "1" else "1"
    c = "".join(s)
    print(str(func(c)))

### FIXED CODE ###

from functools import lru_cache


a = int(input())
b = input()
X = b.count("1")
ans1 = []
ans2 = []

@lru_cache(maxsize=None)
def func1(c):
    x = X + 1
    n = 1
    nsum = 0
    for i in reversed(range(len(c))):
        ans1.append(n)
        nsum += n * int(c[i])
        n = n % x if n > x else n
        n *= 2
    return nsum
    
@lru_cache(maxsize=None)
def func2(c):
    x = X - 1
    if x == 0:
        return 0
    n = 1
    nsum = 0
    for i in reversed(range(len(c))):
        ans2.append(n)
        nsum += n * int(c[i])
        n = n % x if n > x else n
        n *= 2
    return nsum    

def func(c):
    x = c.count("1")
    if x == 0:
        return 0
    n = 1
    nsum = 0
    for i in reversed(range(len(c))):
        nsum += n * int(c[i])
        n = n % x if n > x else n
        if n == 0:
            break
        n *= 2
    nsum %= x
    cans = bin(nsum).count("1")
    if cans == 0:
        return 1
    else:
        return 1 + func(bin(nsum)[2:])
    
allans1 = func1(b)
allans2 = func2(b)
ans1 = ans1[::-1]
if allans2 == 0:
    ans2 = [0] * a
else:
    ans2 = ans2[::-1]

c = list(b)
for i in range(a):
    if c[i] == "0":
        ans = (allans1 + ans1[i]) % (X + 1)
        ans = func(bin(ans)[2:]) + 1
        print(str(ans))
    else:
        if allans2 - ans2[i] == 0 and X - 1 == 0:
            print("0")
        else:
            ans = (allans2 - ans2[i]) % (X - 1)
            ans = func(bin(ans)[2:]) + 1
            print(str(ans))
### BUGGY CODE ###

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


def prime_factorize(n):
    r = set()
    if n % 2 == 0:
        r.add(2)
    f = 3
    while f * f <= n:
        if n % f == 0:
            r.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        r.add(n)
    return collections.Counter(r)


a1 = collections.Counter([])
a2 = prime_factorize(A[0])
for a in A:
    tmp = prime_factorize(a)
    a1 += tmp
    a2 &= tmp
if a2:
    print('not coprime')
elif a1.most_common()[0][1] >= 2:
    print('setwise coprime')
else:
    print('pairwise coprime')

### FIXED CODE ###

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


def prime_factorize(n):
    r = set()
    while n % 2 == 0:
        r.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            r.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        r.add(n)
    return r


j = 0
a1 = set()
a2 = prime_factorize(A[0])
for a in A[1:]:
    tmp = prime_factorize(a)
    if a1 & tmp:
        j = 1
    a1 |= tmp
    a2 &= tmp
if a2:
    print('not coprime')
elif j:
    print('setwise coprime')
else:
    print('pairwise coprime')
### BUGGY CODE ###

N = int(input())
S = input()

# len 取り得る最大の長さは N / 2

for i in range(N//2, 0, -1):
  for j in range(0, N-2*i+1):
    left = S[j:j+i]
    if left in S[j+i:]:
        print(len(left))
        exit()
        
print(0)

### FIXED CODE ###

N = int(input())
S = input()


r = 0
ans = 0
for l in range(N):

    while True:
        # print(S.rfind(S[l:r+1]), S[l:r+1], l, r)
        
        if S.rfind(S[l:r+1]) >= r+1:
            r += 1
            ans = max(ans, r-l)
        else:
            break

print(ans)
### BUGGY CODE ###

from collections import deque
N,Q=map(int,input().split())
nondirtree=[[] for _ in range(N)]
dirtree=[[] for _ in range(N)]
rootflag=[0]*N
rootflag[0]=1
for i in range(N-1):
    a,b=map(int,input().split())
    nondirtree[a-1].append(b-1)
    nondirtree[b - 1].append(a - 1)
#points=[tuple(map(int,input().split())) for _ in range(Q)]
score=[0]*N
for i in range(Q):
    point,sc=map(int,input().split())
    score[point-1]=score[point-1]+sc
#print(points)
v=0
d=deque()
d.append(v)
seen=[0]*N
seen[0]=1
ans=[0]*N
while len(d)!=0:
    v=d.popleft()
    for j in nondirtree[v]:
        if seen[j]==0:
            dirtree[v].append(j)
            seen[j]=1
            d.append(j)
    #print(d,seen,dirtree)
    #input(
v=0
d=deque()
d.append(v)
for i in range(N):
    dirtree[i]=tuple(dirtree[i])
dirtree=tuple(dirtree)
score=tuple(score)
#print(dirtree)
ans[0]=score[0]
while len(d)!=0:
    v=d.popleft()
    for j in dirtree[v]:
        ans[j]=ans[v]+score[j]
        d.append(j)
    #input()
    #print(ans)
print(*ans,sep=" ")


### FIXED CODE ###

from collections import deque
N,Q=map(int,input().split())
nondirtree=[[] for _ in range(N)]
dirtree=[[] for _ in range(N)]
rootflag=[0]*N
rootflag[0]=1
for i in range(N-1):
    a,b=map(int,input().split())
    nondirtree[a-1].append(b-1)
    nondirtree[b - 1].append(a - 1)
points=[list(map(int,input().split())) for _ in range(Q)]
#print(points)
v=0
d=deque()
d.append(v)
seen=[0]*N
seen[0]=1
score=[0]*N
ans=[0]*N
while len(d)!=0:
    v=d.popleft()
    for j in nondirtree[v]:
        if seen[j]==0:
            dirtree[v].append(j)
            seen[j]=1
            d.append(j)
    #print(d,seen,dirtree)
    #input(
#print(dirtree)
for i in range(Q):
    score[points[i][0]-1]=score[points[i][0]-1]+points[i][1]
#print(score)
v=0
d=deque()
d.append(v)
ans[0]=score[0]
while len(d)!=0:
    v=d.popleft()
    for j in dirtree[v]:
        ans[j]=ans[v]+score[j]
        d.append(j)
    #input()
    #print(ans)
print(*ans,sep=" ")
### BUGGY CODE ###

import sys
input = sys.stdin.readline
#-------------------------------------
n = int(input())
v = n
ammount = 0
for i in range(v):
    ammount += v
    v -= 1

print(ammount-n)

### FIXED CODE ###

import sys
input = sys.stdin.readline
#-------------------------------------
n = int(input())
print((n+1) * (n//2) + (n%2)*(n//2+1) - n)