Harryxun/stf_run huggingface dataset:
n = int(input())
r = [list(map(int, input().split())).append(i+1) for i in range(n)] 
tmp = sorted(data, key=lambda x:x[1], reverse=True)
res = sorted(tmp, key=lambda x:x[0])
for arr in res:
  print(arr[2])

### FIXED CODE ###

n = int(input())
r = []
for i in range(1, n+1):
  hoge = input().split()
  hoge.append(i)
  r.append(hoge) 
tmp = sorted(r, key=lambda x:int(x[1]), reverse=True)
res = sorted(tmp, key=lambda x:x[0])
for arr in res:
  print(arr[2])
import numpy as np
from collections import deque
import bisect

X,Y,Z,K=map(int,input().split())
A=sorted([int(i) for i in input().split()],reverse=True)
B=sorted([int(i) for i in input().split()],reverse=True)
C=sorted([int(i) for i in input().split()],reverse=True)
Amax,Bmax,Cmax=(max(j) for j in [A,B,C])
Umami=Amax+Bmax+Cmax
Adif=[abs(i-Amax) for i in A]
Bdif=[abs(x-Bmax) for x in B]
Cdif=[abs(p-Cmax) for p in C]#AdifBdifCdifから1個ずつ選んだ和を小さい方から3000個
rank3000=100000000#暫定3000位のやつ
visited=np.zeros((1000,1000,1000),dtype="int")#Ai,Bj,Ckの行ったやつ
queue=deque()
queue.append([0,0,0])
ranking=[]
ranked=0#3000枠埋まったら1になる
Powerful=0
while queue and Powerful ==0:
    a,b,c = queue.popleft()
    for j, k ,l in ([1,0,0],[0,1,0],[0,0, 1]):
        new_a, new_b, new_c = a+j,b+k,c+l
        rankin=0
        if 0<=a<X and 0<=b<Y and 0<=c<Z and  visited[new_a][new_b][new_c]==0:
            visited[new_a][new_b][new_c]=1
            queue.append([new_a,new_b,new_c])
            if Adif[a]+Bdif[b]+Cdif[c]<rank3000:
                rankin+=1
                ranking.append(Adif[a]+Bdif[b]+Cdif[c])
                if ranked==0:
                    if len(ranking)==K:
                        ranked=1
                ranking.sort()
                if ranked==1:
                    ranking.pop(-1)
                    rank3000=ranking[-1]
            if rankin==0:
                Powerful=1
                break
print(ranking)

    
    

### FIXED CODE ###

from collections import deque
X,Y,Z,K=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
#AとBのわのうちでかい順にK個
ABsum=[]
for i in A:
    for j in B:
        ABsum.append(i+j)
ABsum=sorted(list(ABsum),reverse=True)
sumu=[]
for i in range(min(K,X*Y)):
    for j in C:
        sumu.append(ABsum[i]+j)
sumu=sorted(list(sumu),reverse=True)
for i in range(K):
    print(sumu[i])
from collections import Counter
n = int(input())
v_input = list(map(int,input().split()))

odd_li = []
even_li = []
for i in range(n):
    if i%2==0:
        odd_li.append(v_input[i])
    else:
        even_li.append(v_input[i])
odd_count = sorted(Counter(odd_li).items(),key=lambda x:x[1])
even_count = sorted(Counter(even_li).items(),key=lambda x:x[1])

odd_max = odd_count[0][0]
even_max = even_count[0][0]

if odd_max==even_max and len(odd_count)==1:
    ans = odd_count[0][1]

elif odd_max==even_max:
    odd_next = odd_count[1][1]
    even_next = even_count[1][1]
    ans = n//2-odd_count[0][1] + n//2 - max(odd_next)
else:
    ans = n//2-odd_count[0][1] + n//2 - even_count[0][1]

print(ans)



### FIXED CODE ###

from collections import Counter
n = int(input())
v_input = list(map(int,input().split()))

odd_li = []
even_li = []
for i in range(n):
    if i%2==0:
        odd_li.append(v_input[i])
    else:
        even_li.append(v_input[i])

odd_count = sorted(Counter(odd_li).items(),key=lambda x:x[1],reverse=True)
even_count = sorted(Counter(even_li).items(),key=lambda x:x[1],reverse=True)

odd_max = odd_count[0][0]
even_max = even_count[0][0]

if odd_max==even_max and len(odd_count)==1:
    ans = n//2

elif odd_max==even_max:
    odd_next = odd_count[1][1]
    even_next = even_count[1][1]
    ans = n//2-odd_count[0][1] + n//2 - max(odd_next,even_next)
else:
    ans = n//2-odd_count[0][1] + n//2 - even_count[0][1]

print(ans)
N = int(input())
A = [int(i) for i in input().split()]
B = []
for i in range(N):
  B.append(A[i]-i-1)
B.sort()
b = B[2//N]
ans = 0
for a in B:
  ans += abs(b-a)
print(ans)

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
for i in range(N):
  A[i] -= i+1
A.sort()
b = A[N//2]
ans = 0
for a in A:
  ans += abs(b-a)
print(ans)
S = str(input())
T = str(input())

if len(S) + 1 == len(T) and S = T[:-1]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S = str(input())
T = str(input())
 
if len(S) + 1 == len(T) and S == T[:-1]:
  print("Yes")
else:
  print("No")
if __name__ == "__main__":
    a = '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'
    k = list(a.split(', '))
    i = int(input())
    print(k[i+1])

### FIXED CODE ###

if __name__ == "__main__":
    a = '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'
    k = list(a.split(', '))
    i = int(input())
    print(k[i-1])
a,b,c = (str(x) for x in input().split())
if a == b == c:
    print('No')
else:
    print('Yes')

### FIXED CODE ###

S = input()
if S[0] == S[1] == S[2]:
    print('No')
else:
    print('Yes')
import math
H,A = input().strip().split()
print(math.ceil(H/A))

### FIXED CODE ###

import math
H, A = map(int, input().strip().split())
print(math.ceil(H/A))
n=int(input());k=int(input()),r=1
for _ in[0]*n:r+=min(r,k)
print(r)

### FIXED CODE ###

n=int(input());k=int(input());r=1
for _ in[0]*n:r+=min(r,k)
print(r)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())
if n==1:
  print(0)
else:
  arr = factorization(n)
  trial_list = []
  for p in arr:
    i = p[0]
    j = p[1]
    for k in range(1,j+1):
      trial_list.append(i**k)
  sorted(trial_list)
  cnt=0
  for i in trial_list:
    if n%i==0:
      cnt+=1
      n//=i
  print(cnt)

### FIXED CODE ###

a, b = map(int, input().split())
print(int(a*b))
N=int(imput())
r=N%100
d=int((N-r)/100)

if r>5*d:
  print(0)
else:
  primt(1)

### FIXED CODE ###

N=int(input())
r=N%100
d=int((N-r)/100)
 
if r>5*d:
  print(0)
else:
  print(1)
from sys import stdin
main
a,b,c = map(int,input().split())
print("{} {} {}".format(c,b,a))

### FIXED CODE ###

from sys import stdin
a,b,c = map(int,input().split())
print("{} {} {}".format(c,a,b))
input()
a = list(map(int,input().split()))
while all(i % 2 == 0 for i in a)
    a = [i/2 for i in a]
    count += 1
print(count)

### FIXED CODE ###

input()
a = list(map(int,input().split()))
count = 0
while all(i % 2 == 0 for i in a):
    a = [i/2 for i in a]
    count += 1
print(count)
import math
from math import ceil
N,K=map(int,input().split())
ans=0
for i in range(1,N+1):
    k=ceil(math.log2(K/i))
    k=max(0,k)
    ans+=(1/N)*(1/2)**k
print(ans)


### FIXED CODE ###

import math
from math import ceil
N,K=map(int,input().split())
ans=0
for i in range(1,N+1):
    k=ceil(math.log(K/i,2))
    k=max(0,k)
    ans+=(1/N)*(1/2)**k
print(ans)
k = int(input())
x = int(input())
 
if 500*k < x:
print("No")
else:
print("Yes")

### FIXED CODE ###

k,x=map(int,input().split())

if 500*k >= x:
	print("Yes")
else:
	print("No")
h,w,n=map(int,input().split())
dp=[[[0]*4 for _ in range(w+1)] for _ in range(h+1)]
v=[[0]*(w+1) for _ in range(h+1)]
for _ in range(n):
  r,c,f=map(int,input().split())
  v[r][c]=f
for i in range(h):
  for x in 1,2,3:
    for j in range(w):
      dp[i+1][j+1][x]=max(dp[i+1][j+1][x-1],max(dp[i][j+1][x],(x<2)*dp[i+1][j][3])+v[i+1][j+1],dp[i+1][j][x]
print(dp[-1][-1][-1])

### FIXED CODE ###

h,w,k=map(int,input().split())
dp=[[[0]*(w+2) for _ in range(h+2)] for _ in range(4)]
f=[[0]*(w+1) for _ in range(h+1)]
for _ in range(k):
  r,c,v=map(int,input().split())
  f[r][c]=v
for i in range(1,h+1):
  for j in range(1,w+1):
    for k in range(3,-1,-1):
      if k:dp[k][i][j]=max(dp[k][i][j],dp[k-1][i][j]+f[i][j])
      dp[0][i+1][j]=max(dp[0][i+1][j],dp[k][i][j])
      dp[k][i][j+1]=max(dp[k][i][j+1],dp[k][i][j])
print(max(dp[k][h][w] for k in range(4)))
import itertools as it
import collections as col
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)


n,x=map(int,input().split())
P=list(map(int,input().split()))
if(n==1):
    print(abs(P[0]-x))
    exit(0)
P.sort()
if(x<=P[0]):
    P.insert(0,x)
elif(x>=P[n-1]):
    P.append(x)
else:
    for i in range(1,n):
        if(P[i-1]<=x and x<=P[i]):
            P.insert(i,x)
D=[0]
for i in range(1,n):
    D.append(P[i]-P[i-1])
print(gcd_list(D))



### FIXED CODE ###

import itertools as it
import collections as col
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n,x=map(int,input().split())
P=list(map(int,input().split()))

if(n==1):
    print(abs(P[0]-x))
    exit(0)

P.sort()
D=[0]
for i in range(n):
    D.append(abs(P[i]-x))
print(gcd_list(D))
import numpy as np
X, N = map(int, input().split())
P = list(map(int, input().split()))
candidate = list(range(1, 101))
P = sorted(set(candidate).difference(set(P)))
i = np.argmin([abs(p - X) for p in P])
print(P[i])


### FIXED CODE ###

import numpy as np
X, N = map(int, input().split())
P = list(map(int, input().split()))
candidate = list([x - 500 for x in range(1, 1000)])
P = sorted(set(candidate).difference(set(P)))
i = np.argmin([abs(p - X) for p in P])
print(P[i])
from fractions import gcd


def lcm(a, b):
    return a * b / gcd(a, b)
 

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

l = 1
for a in A:
    l = lcm(l, a)

l %= MOD

ans = 0
for a in A:
    ans += l * pow(a, MOD-2, MOD)
    ans %= MOD

print(int(ans))


### FIXED CODE ###

from fractions import gcd

mod = 10 ** 9 + 7

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

lcm = 1
for s in A:
    lcm = s * lcm // gcd(lcm, s)

ans = lcm * sum([pow(s, mod - 2, mod) for s in A]) % mod

print(int(ans % mod))
"""
python3 main.py < input.txt
"""
import math
import itertools as it
import heapq

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

L=[A[0]]
for i in range(1, N):
        L.append(math.gcd(L[-1], A[i]))

### FIXED CODE ###

"""
python3 main.py < input.txt
"""
import math
import itertools as it
import heapq

def gcd(a, b):
        return a if b == 0 else gcd(b, a%b)
N=int(input())
A=list(map(int, input().split()))

L=[A[0]]
for i in range(1, N):
        L.append(gcd(L[-1], A[i]))
R=[A[-1]]
for i in reversed(range(N-1)):
        R.append(gcd(R[-1], A[i]))
R.reverse()

m=max(R[1], L[-2])
for i in range(1, N-1):
        m=max(m, gcd(L[i-1], R[i+1]))
print(m)
n=int(input())
p=a+a**2+a**3
print(p)

### FIXED CODE ###

a=int(input())
p=a+a**2+a**3
print(p)
n = str(input())
sum = 0
for i in n:
    sum += int(i)
if n%sum=0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = str(input())
sum = 0
for i in range(len(n)):
    sum += int(n[i])
if int(n)%sum==0:
    print('Yes')
else:
    print('No')
N, K = map(int, input().split())

paskal3 = [[1]]
for i in range(1, N):
    l = [1]
    for j in range(1, i):
        l.append(paskal3[i-1][j-1]+paskal3[i-1][j])
    l.append(1)
    paskal3.append(l)


def comb(n, r):
    return paskal3[n][r]


for i in range(1, K+1):
    ans = comb(N-K+1, i) * comb(K-1, i-1)
    print(ans % (10**9+7))


### FIXED CODE ###

N, B = map(int, input().split())
R = N-B
MOD = 10**9+7

paskal3 = [[1]]
for i in range(1, N+5):
    l = [1]
    for j in range(1, i):
        l.append((paskal3[i-1][j-1]+paskal3[i-1][j]) % MOD)
    l.append(1)
    paskal3.append(l)


def comb(n, r):
    try:
        return paskal3[n][r]
    except:
        return 0


for i in range(1, B+1):
    print((comb(R+1, i) * comb(B-1, i-1)) % MOD)
a=input().split("¥n")
goal=int(a[1])
keta=len(a[0])
for i in range(keta):
    if(int(a[0][i])==1):
        goal-=1
        if(goal<=0):
            print("1")
            break
    else:
        print(a[0][i])
        break

### FIXED CODE ###

S=input()
S_len=len(S)
K=int(input())
for i in range(S_len):
  if(int(S[i])==1):
    K-=1
    if(K<=0):
      print("1")
      break
  else:
    print(S[i])
    break
N, M = map(int, input().split())

group = []

MOD = 1000000007

pre_a = int(input())
group.append(pre_a)

ok = True
for i in range(M-1):
    a = int(input())
    tmp = a - pre_a - 1
    pre_a = a
    group.append(tmp)
group.append(N - pre_a)

if 0 in group:
    print(0)
else:
    fiv = [0 for i in range(max(group))]
    fiv[0] = 1
    fiv[1] = 1
    for i in range(2, len(fiv)):
        fiv[i] = (fiv[i-1] + fiv[i-2]) % MOD
    ans = 1
    for g in group:
        ans *= fiv[g-1]
    print(ans%MOD)


### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N, M =map(int, input().split())
    a = [int(input()) for i in range(M)]

    sep = []
    pre = -1
    ok = True
    for t in a:
        tmp = t - pre - 1
        if tmp == 0:
            ok = False
            break
        sep.append(tmp)
        pre = t
    sep.append(N-pre)
    # print(sep)

    if not ok:
        print(0)
        return
    max_sep = max(sep)

    MOD = 1000000007
    fib = [1] * (max_sep)
    for i in range(2, max_sep):
        fib[i] = fib[i-2] + fib[i-1]
        fib[i] %= MOD
    
    ans = 1
    for s in sep:
        ans *= fib[s-1]
        ans %= MOD
    print(ans)


if __name__ == "__main__":
    main()
n=int(input())
l=list(map(int,input().split()))
l.insert(0,0)
wa=0
for i in range(n):
  wa+=abs(l[i+1]-l[i])
for i in range(1,n+1):
  print(wa-l[i]-l[i+1])

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
l.insert(0,0)
l.append(0)
wa=0
for i in range(n+1):
  wa+=abs(l[i+1]-l[i])

  
for j in range(n):  
  if abs(l[j+2]-l[j])<abs(l[j+1]-l[j])+abs(l[j+2]-l[j+1]):
    if abs(l[j+1]-l[j])<abs(l[j+2]-l[j+1]):
      print(wa-2*abs(l[j+1]-l[j]))
    else:
      print(wa-2*abs(l[j+2]-l[j+1]))
  else:
    print(wa)
from collections import *
from itertools import *
import copy

N,M,R=map(int,input().split())
Rlst=list(map(int,input().split()))
ABC=[list(map(int,input().split())) for i in range(M)]

data=[[] for i in range(N+1)]
nagasa={}
for a,b,c in ABC:
    data[a].append(b)
    data[b].append(a)
    A,B=min(a,b),max(a,b)
    nagasa.update({str(A)+" "+str(B):c})
mokutekiti=[[0 for i in range(R)] for m in range(R)]
for r1i in range(R-1):
    for r2i in range(r1i+1,R):
        r1=Rlst[r1i]
        r2=Rlst[r2i]
        mitilst=[]
        stack=[[r1,0]]
        minpoint=[100000 for i in range(N+1)]
        while stack:
            a,m=stack.pop()
            for b in data[a]:
                A,B=min(a,b),max(a,b)
                tempm=m+nagasa[str(A)+" "+str(B)]
                if tempm<minpoint[b]:
                    minpoint[b]=tempm
                    if b==r2:
                        mitilst.append(tempm)
                    else:
                        stack.append([b,tempm])
        mitilst=min(mitilst)
        mokutekiti[r1i][r2i]=mitilst
        mokutekiti[r2i][r1i]=mitilst

value=[]
for lst in permutations([i for i in range(R)],R):
    nagasa=0
    for i in range(R-1):
        nagasa+=mokutekiti[lst[i]][lst[i+1]]
    value.append(nagasa)
print(min(value))


### FIXED CODE ###

from collections import *
from itertools import *
import copy
from heapq import *


N,M,R=map(int,input().split())
Rlst=list(map(int,input().split()))
ABC=[list(map(int,input().split())) for i in range(M)]

data=[[] for i in range(N+1)]
nagasa={}
for a,b,c in ABC:
    data[a].append(b)
    data[b].append(a)
    A,B=min(a,b),max(a,b)
    nagasa.update({str(A)+" "+str(B):c})
mokutekiti=[[100000*200+1 for i in range(R)] for m in range(R)]
for r1i in range(R-1):
    for r2i in range(r1i+1,R):
        r1=Rlst[r1i]
        r2=Rlst[r2i]
        visited=set()
        stack=[0]
        heapify(stack)
        dic={0:[r1]}
        while stack:
            m=heappop(stack)
            #if not m in visited:
            #visited.add(m)
            a=dic[m].pop()
            if not a in visited:
                visited.add(a)
                for b in data[a]:
                    if not b in visited or b==r2:
                        A,B=min(a,b),max(a,b)
                        tempm=m+nagasa[str(A)+" "+str(B)]
                        if b==r2:
                            if mokutekiti[r1i][r2i]>tempm:
                                mokutekiti[r1i][r2i]=tempm
                                mokutekiti[r2i][r1i]=tempm
                        else:
                            heappush(stack,tempm)
                            if tempm in dic:
                                dic[tempm].append(b)
                            else:
                                dic.update({tempm:[b]})



value=[]
for lst in permutations([i for i in range(R)],R):
    nagasa=0
    for i in range(R-1):
        nagasa+=mokutekiti[lst[i]][lst[i+1]]
    value.append(nagasa)
print(min(value))
n = map(int,input.split())
if '7' in n:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = input()
if '7' in n:print('Yes')
else:print('No')
import math
input()
while True:
    t=input()
    if t == "":break
    l=[float(i) for i in t.split()]
    px=sum(l[0::2])/3
    py=sum(l[1::2])/3
    r=math.sqrt((l[0]-px)**2+(l[1]-py)**2)
    print("{0} {1} {2}".format([round(i,3) for i in[px,py,r]]))


### FIXED CODE ###

import math
n=int(input())
for i in range(n):
    x1,y1,x2,y2,x3,y3=[float(i) for i in input().split()]
    A=math.hypot(x2-x3,y2-y3)**2
    B=math.hypot(x1-x3,y1-y3)**2
    C=math.hypot(x1-x2,y1-y2)**2
    t1=A*(B+C-A)
    t2=B*(A+C-B)
    t3=C*(A+B-C)
    px=(t1*x1+t2*x2+t3*x3)/(t1+t2+t3)
    py=(t1*y1+t2*y2+t3*y3)/(t1+t2+t3)
    r=math.hypot(px-x1,py-y1)
    print("%.3f %.3f %.3f"%(round(px,3),round(py,3),round(r,3)))
import itertools
n = int(input())
n2 = n

i = 2
table = []
while i * i <= n:
    while n % i == 0:
        n //= i
        table.append(i)
    i += 1
if n > 1:
    table.append(n)

temp = []
for i in range(len(table)):
    temp += list(itertools.permutations(table, i))
ans = []
for i in temp:
    s = 1
    for j in i:
        s *= j
    a, b = s, n2//s
    ans.append(max(len(str(a)), len(str(b))))
print(min(ans))


### FIXED CODE ###

import math
n = int(input())
ans = []
for i in range(1, int(math.sqrt(n))+2):
    if n % i == 0:
        ans.append(max(len(str(i)), len(str(n//i))))
print(min(ans))
N = int(input())
S = input()

sum = 0
for i in range(N):
    for j in range(i+1, N):
        if S[i] == S[j]:
            continue

        RGB = ['R','G','B']
            RGB.remove(S[j])
            RGB.remove(S[i])
            sum += S[(j+1):].count(RGB[0])

            # S[k]
            k = 2 * j - i
            if k < len(S):
                if S[k] == RGB[0]:
                    sum -= 1
print(sum)

### FIXED CODE ###

from collections import Counter

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

r = S.count('R')
g = S.count('G')
b = S.count('B')

sum = r*g*b

for i in range(N):
    for j in range(i+1, N):
        k = 2 * j - i
        if k > N - 1:
            break
        if not S[i] == S[j] and not S[j] == S[k] and not S[k] == S[i]:
            sum -= 1
print(sum)
import math
N = int(input())
ans = 0
num = {i:0 for i in range(1, N+1)}
upper = int(math.sqrt(N)) + 1
for x in range(1, upper):
    for y  in range(1, upper):
        z = 1
        v = x**2 + y**2 + z**2 + x*y + y*z + z*x
        if v > n:
            break
        for z in range(1, upper):
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v in num.keys():
                num[v] += 1
            if v > N:
                break
for n in range(1, N+1):
    print(num[n])

### FIXED CODE ###

import math
N = int(input())
ans = 0
num = {i:0 for i in range(1, N+1)}
upper = int(math.sqrt(N)) + 1
for x in range(1, upper):
    for y  in range(1, upper):
        z = 1
        v = x**2 + y**2 + z**2 + x*y + y*z + z*x
        if v > N:
            break
        for z in range(1, upper):
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v in num.keys():
                num[v] += 1
            if v > N:
                break
for n in range(1, N+1):
    print(num[n])
N,A,B = map(int,input().split())
string = ''
for i in range(N//(A+B)+A+B):
  string += 'b'*A
  string += 'r'*B
  if len(string) >= N:
    break
str2 = string[0:N]
cnt = str2.count('b')
print(cnt)

### FIXED CODE ###

N,A,B = map(int,input().split())
syou = N//(A+B)
amari = N%(A+B)
ans = A*syou + min(A,amari)
print(ans)
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from sys import stdin
import math

# 標準入力をスペースで区切って、intに変換 listに収納
int_list  = [int(x) for x in stdin.readline().rstrip().split()]

N = int_list[0]


total = int(N*(N-1)/2)
print(total)


### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from sys import stdin
import math

# 標準入力をスペースで区切って、intに変換 listに収納
S = stdin.readline()
T = stdin.readline()

cnt=0
for i in range(3):
    if S[i] == T[i]:
        cnt+=1


print(cnt)
def solve():
    n = int(input())
    s = []
    for i in range(n):
        s.append(int(input()))

    s.sort()
    score = sum(s)

    i = 0
    flag = True
    if not score % 10:
        while 1:
            if s[i] % 10:
                score -= s[i]
                break
            i += 1
            if i == n - 1:
                flag = False
                break

    if flag:
        print(score)
    else:
        print(0)


solve()

### FIXED CODE ###

def solve():
    n = int(input())
    s = []
    for i in range(n):
        s.append(int(input()))

    s.sort()
    score = sum(s)

    i = 0
    flag = True
    if not score % 10 and n != 1:
        while 1:
            if s[i] % 10:
                score -= s[i]
                break
            i += 1
            if i == n - 1:
                flag = False
                break
    elif not score % 10 and n == 1:
        flag = False

    if flag:
        print(score)
    else:
        print(0)


solve()
a = list(map(int, input().split()))
if a[0] >= a[1]:
    b = a[0]
    c = a[1]
else:
    b = a[1]
    c = a[0]

if a[2]%b == 0:
    s = int(a[2]/b)
else:
    s = int(a[2]/b)+1

print(s)

### FIXED CODE ###

h = int(input())
w = int(input())
n = int(input())
        
if h >= w:
  if n%h == 0:
    s = int(n/h)
  else:
    s = int(n/h)+1
    
else:
  if n%w == 0:
    s = int(n/w)
  else:
    s = int(n/w)+1

print(s)
l = [int(raw_input()) for _ in range(3)]
print (l[0] - l[[1]) % l[2]


### FIXED CODE ###

l = [int(raw_input()) for _ in range(3)]
print (l[0] - l[1]) % l[2]
def ab(a,b,c):
	if((a+b>c) and (a+c>b) and (b+c>a)):
		return 1
	else:
		return 0
n=input()
n=int(n)
l=get_array()
c=0
for i in range(n):
	for j in range(i+1,n):
		for k in range(j+1,n):
			if(l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]):
				if(ab(l[i],l[j],l[k])):
					#print(i,j,k)
					c+=1
print(c)	

### FIXED CODE ###

def get_array():
    l=list(map(int, input().split()))
    return l
def ab(a,b,c):
	if((a+b>c) and (a+c>b) and (b+c>a)):
		return 1
	else:
		return 0
n=input()
n=int(n)
l=get_array()
c=0
for i in range(n):
	for j in range(i+1,n):
		for k in range(j+1,n):
			if(l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]):
				if(ab(l[i],l[j],l[k])):
					#print(i,j,k)
					c+=1
print(c)
tmp = list(map(int,input().split()))
L = tmp[0] % 2019
R = tmp[1] % 2019
l = tmp[0]//2019
r = tmp[1]//2019
if l == r:
  num_list = []
  for i in range(tmp[0],tmp[1]+1,1):
    for k in range(i+1,tmp[1],1):
      num_list.append((i*k) % 2019)
  print(min(num_list))
else:
  print(0)

### FIXED CODE ###

tmp = list(map(int,input().split()))
L = tmp[0] % 2019
R = tmp[1] % 2019
l = tmp[0]//2019
r = tmp[1]//2019
if l == r:
  if tmp[1] - tmp[0] > 673:
    print(0)
  else:
    num_list = []
    for i in range(tmp[0],tmp[1]+1,1):
      for k in range(i+1,tmp[1]+1,1):
        num_list.append((i*k) % 2019)
    print(min(num_list))
else:
  print(0)
import math

a,b=[int(x) for x in input().rstrip().split()]
print(int(a * b / math.gcd(a, b)))

### FIXED CODE ###

a,b=[int(x) for x in input().rstrip().split()]

def gcd(m,n):
    x=max(m,n)
    y=min(m,n)

    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z
def lcm(m,n):
    return int(m*n/gcd(m,n))
print(lcm(a,b))