Harryxun/stf_run huggingface dataset:
import heapq
n, m, s, t = map(int, input().split())
INF = 10*20-1
data = []
for _ in range(m):
    data.append(list(map(int, input().split())))

check = [False] * (n-1)
graph = [[] for i in range(n+1)]

for i in range(m):
    graph[data[i][0]].append([data[i][1], data[i][2], data[i][3]])
    graph[data[i][1]].append([data[i][0], data[i][2], data[i][3]])
city_yen_cost = [INF] * (n+1)
city_yen_cost[s] = 0
queue = []
#[cost, vertex]
heapq.heappush(queue, [0, s])
count = 0
while count != n:
    now = heapq.heappop(queue)
    if check[now[1]]:
        continue
    else:
        count += 1
        check[now[1]] = True
        for path in graph[now[1]]:
            heapq.heappush(queue, [city_yen_cost[now[1]]+path[1], path[0]])




check = [False] * (n-1)
city_snuke_cost = [INF] * (n+1)
city_snuke_cost[t] = 0
queue = []
heapq.heappush(queue, [0, t])
count = 0
while count != n
    now = heapq.heappop(queue)
    if check[now[1]]:
        continue
    else:
        count += 1
        check[now[1]] = True
        for path in graph[now[1]]:
            heapq.heappush(queue, [city_snuke_cost[now[1]]+path[2], path[0]])


for i in range(n+1):
    city_yen_cost[i] += city_snuke_cost[i]
for i in range(n):
    city_yen_cost[-i-2] = min(city_yen_cost[-i-2], city_yen_cost[-i-1])
for i in range(n):
    print(10**15-city_yen_cost[i+1])


### FIXED CODE ###

import heapq
n, m, s, t = map(int, input().split())
INF = 2**63-1
data = []
for _ in range(m):
    data.append(list(map(int, input().split())))

check = [False for i in range(n+1)]
graph = [[] for i in range(n+1)]

for i in range(m):
    graph[data[i][0]].append([data[i][1], data[i][2], data[i][3]])
    graph[data[i][1]].append([data[i][0], data[i][2], data[i][3]])
city_yen_cost = [INF for i in range(n+1)]
city_yen_cost[s] = 0
queue = []
#[cost, vertex]
heapq.heappush(queue, [0, s])
while len(queue) > 0:
    now = heapq.heappop(queue)
    if check[now[1]]:
        continue
    else:
        check[now[1]] = True
        for path in graph[now[1]]:
            if city_yen_cost[now[1]]+path[1] < city_yen_cost[path[0]]:
                city_yen_cost[path[0]] = min(city_yen_cost[now[1]]+path[1], city_yen_cost[path[0]])
                if not check[path[0]]:
                    heapq.heappush(queue, [city_yen_cost[now[1]]+path[1], path[0]])




check = [False for i in range(n+1)]
city_snuke_cost = [INF for i in range(n+1)]
city_snuke_cost[t] = 0
queue = []
heapq.heappush(queue, [0, t])
while len(queue) > 0:
    now = heapq.heappop(queue)
    if check[now[1]]:
        continue
    else:
        check[now[1]] = True
        for path in graph[now[1]]:
            if city_snuke_cost[now[1]]+path[2] < city_snuke_cost[path[0]]:
                city_snuke_cost[path[0]] = min(city_snuke_cost[now[1]]+path[2], city_snuke_cost[path[0]])
                if not check[path[0]]:
                    heapq.heappush(queue, [city_snuke_cost[now[1]]+path[2], path[0]])


totalcost = [None] * (n+1)
for i in range(n+1):
    totalcost[i] = city_yen_cost[i] + city_snuke_cost[i]
for i in range(n):
    totalcost[-i-2] = min(totalcost[-i-2], totalcost[-i-1])
for i in range(n):
    print(10**15-totalcost[i+1])
def jump(i):
    if i == 0:
        memo[0] = 0
        return memo[0]
    elif i == 1:
        memo[1] = abs(arr[1]- arr[0])               
        return memo[1]
    if memo[i] != -1:
        return memo[i]
    memo[i] = min(jump(i-1) + abs(arr[i-1]- arr[i]) ,
                  jump(i-2) + abs(arr[i-2]- arr[i]))
    return memo[i]    

n = int(input())
arr = list(map(int, input().split()))
memo = [-1] * n 
                   
result = jump(n-1)
print(result)


### FIXED CODE ###

def jump(i):
    memo[0] = 0
    memo[1] = abs(arr[1]- arr[0])               
    for i in range(2, n):
        memo[i] = min(memo[i-1] + abs(arr[i-1]- arr[i]) ,
                      memo[i-2] + abs(arr[i-2]- arr[i]))
    return memo[-1]    

n = int(input())
arr = list(map(int, input().split()))
memo = [-1] * n 
                   
result = jump(n)
print(result)
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
b[1] = abs(a[1]-a[0])
for i in range(2,n):
    b[i]=min(b[i-2]+abs(a[i-2]-a[i]), b[i-1]+abs(a[i-1]-a[i]))
print(b[n-1])

### FIXED CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
c = [10**9]*n
c[0]=0
c[1]=abs(a[0]-a[1])
for i in range(n-1):
    for j in range(i+1,min(n,i+k+1)):
        c[j] = min(c[j],c[i]+abs(a[i]-a[j]))
print(c[n-1])
import math
k = int(input())
ans = 0

for i in range(1,k+1):
	for j in range(1,k+1):
      	for n in range(1,k+1):
          	ans += math.gcd(i,math.gcd(j,n))
print(ans)


### FIXED CODE ###

import math
k = int(input())
ans = 0
if k < 3:
    for i in range(1,k+1):
        for j in range(1,k+1):
            for n in range(1,k+1):
                ans += math.gcd(i,math.gcd(j,n))
else: 
    #i*j
    for n in range(1,k+1):
        for i in range(1,k+1):
            ans += math.gcd(n,i)
            for j in range(i+1,k+1):            
                ans += 2*(math.gcd(math.gcd(i,j),n))

    '''
        for i in range(1,k+1):
            for j in range(i+1,k+1):
                for k in range(j+1,k+1):
                    ans += math.gcd(i,math.gcd(j,k))
    '''
print(ans)
d=int(input())

if d=25:
  print("Christmas")
elif d=24:
  print("Christmas Eve")
elif d=23:
  print("Christmas Eve Eve")  
elif d=22:
  print("Christmas Eve Eve Eve")

### FIXED CODE ###

d=int(input())

if d==25:
  print("Christmas")
elif d==24:
  print("Christmas Eve")
elif d==23:
  print("Christmas Eve Eve")  
else:
  print("Christmas Eve Eve Eve")
n = input()
array = []
for i in range(n):
	inst = raw_input().split()
	if inst[0] == "insert":
		array.insert(0,inst[1])
	if inst[0] == "delete":
		if inst[1] in array:
			array.remove(inst[1])
	if inst[0] == "deleteFirst":
		array.pop[0]
	if inst[0] == "deleteLast":
		array.pop(len(array)-1)
print " ".join(i for i in array)

### FIXED CODE ###

n = input()
array = []
base = 0
for i in xrange(n):
    inst = raw_input().split()
    if inst[0][0] == 'i':
        array.append(int(inst[1]))
    elif inst[0] == "delete":
        if int(inst[1]) in array:
            x = array[::-1].index(int(inst[1]))
            if x != -1 and int(inst[1]):
                del array[-x-1]
    elif inst[0][6] == 'F':
        array.pop()
    else:
        base += 1
print (" ".join(map(str,array[base:][::-1])))
n=int(input())
from collections import Counter as C
A=input()
for i in range(n):
  A.append(sorted(list(input())))
  
q=C(A);ans=0
for j in q.values():
  ans+= j*(j-1)//2
print(ans)

### FIXED CODE ###

n=int(input())
from collections import Counter 
A=[]
for i in range(n):
  a=sorted(input())
  a="".join(a)
  A.append(a)
ans=0
for j in Counter(A).values():
  ans+=j*(j-1)//2
print(ans)
from math import pi
r = int(input())
print('{:.5f} {:.5f}'.format(r*r*pi,r*2*pi))

### FIXED CODE ###

from math import pi
r = float(input())
print('{:.5f} {:.5f}'.format(r*r*pi,r*2*pi))
w,a,b = map(int,input().split())

if a < b:
  if b-(a+w) >0:
    print(b-(a+w))
  else:
    print(0)
    
elif a==b:
  print(0)
  
eif a>b:
  if a-(b+w) >0:
    print(a-(b+w))
  else:
    print(0)
  

### FIXED CODE ###

w,a,b = map(int,input().split())

if a < b:
  if b-(a+w) >0:
    print(b-(a+w))
  else:
    print(0)
    
elif a==b:
  print(0)
  
elif a>b:
  if a-(b+w) >0:
    print(a-(b+w))
  else:
    print(0)
i = list(map(int, input().split())) 

int a = int(i[0])
int b = int(i[1])

int result_a = a % 2;
int result_b = b % 2;

if(result_a == 0 || result_b == 0){
    print("Even")
}else{
    print("Odd")
}

### FIXED CODE ###

i = list(map(int, input().split())) 

a = int(i[0])
b = int(i[1])

result_a = a % 2
result_b = b % 2

if (result_a == 0 or result_b == 0 ):
    print("Even")
else :
    print("Odd")
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
P = inintl()

ans = 0

if n == 2:
    if P[0] == 1:
        print(1)
        exit()
    else:
        print(0)
        exit()

for i in range(n):
    if i+1 == P[i]:
        if i+2 == P[i+1]:
            continue
        else:
            ans += 1

print(ans)

### FIXED CODE ###

import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
P = inintl()

ans = 0

for i in range(n-1):
    a = P[i]
    b = P[i+1]
    if a == i+1:
        P[i] = b
        P[i+1] = a
        ans += 1

if P[-1] == n:
    ans += 1

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

b =[0]*n

for i in a:
    b[a[i]-1] += 1

for i in b:
    print(i)

### FIXED CODE ###

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

b =[0]*n

for i in range(n-1):
    b[a[i]-1] += 1

for i in b:
    print(i)
temp = input()
if temp[-1] in {'2','4','5','7','9'}:
  return 'hon'
elif temp[-1] in {'3'}:
  return 'bon'
else:
  return 'pon'

### FIXED CODE ###

temp = input()
if temp[-1] in {'2','4','5','7','9'}:
  print('hon')
elif temp[-1] in {'3'}:
  print('bon')
else:
  print('pon')
a,b,c=map(int,input().split())
if a-b>0:
  print("delicious")
else:
  if abs(a-b) > x+1:
    print("dangerous")
  else:
    print("safe")

### FIXED CODE ###

x,a,b=map(int,input().split())
if a-b>=0:
  print("delicious")
else:
  if abs(a-b) >= x+1:
    print("dangerous")
  else:
    print("safe")
def insertionSort(a,n,g):
    for i in range(g,n):
        v = a[i]
        j = i - g
        while j >= 0 and a[j] > v:
            a[j + g] = a[j]
            j = j - g
            global cnt += 1
        a[j + g] = v

cnt = 0
n = int(input())
a = [int(input()) for i in range(n)]

i = 0
g = [1]
while 3*g[i]+1 < n:
    g.append(3*g[i]+1)
    i += 1
m = len(g)

for i in range(m):
    insertionSort(a,n,g[i])

print(m)
print(*g)
print(cnt)
print(*a, sep="\n")

### FIXED CODE ###

def insertionSort(a,n,g):
    global cnt
    for i in range(g,n):
        v = a[i]
        j = i - g
        while j >= 0 and a[j] > v:
            a[j + g] = a[j]
            j = j - g
            cnt += 1
        a[j + g] = v

cnt = 0
n = int(input())
a = [int(input()) for i in range(n)]

i = 0
g = [1]
while 3*g[i]+1 < n:
    g.append(3*g[i]+1)
    i += 1
g.reverse()
m = len(g)

for i in range(m):
    insertionSort(a,n,g[i])

print(m)
print(*g)
print(cnt)
print(*a, sep="\n")
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n, x = MI()
l = LI()
z = 0
cnt = 0
if n == 1:
    if l[0] <= x:
        print(2)
    else:
        print(1)
else:
    while z <= x and cnt < n+1:
        z = z + l[cnt]
        cnt += 1
    print(cnt)


### FIXED CODE ###

from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n, x = MI()
l = LI()
cnt = 0
ans = []
ans.append(0)
z = 0
for i in range(n):
    z += l[i]
    ans.append(z)
for num in ans:
    if num <= x:
        cnt += 1
print(cnt)
n=int(input())
d=list(map(int,input().split()))
m=int(input())
t=list(map(int,input().split()))
d.sort()
t.sort()
di=0
f=0
for ti in range(m):
    if di<n:
    	while d[di]!=t[ti]:
        	di+=1
        	if d[di]>t[ti]:
            	f=1
            	break
    if f==1:
        break
if f==1:
    print('NO')
else:
    print('YES')

### FIXED CODE ###

n=int(input())
d=list(map(int,input().split()))
m=int(input())
t=list(map(int,input().split()))
d.sort()
t.sort()
di=0
f=0
for ti in range(m):
    if di<n:
        while d[di]!=t[ti]:
            if d[di]>t[ti]:
                f=1
                break
            di+=1
        di+=1
    if f==1:
        break
if f==1:
    print('NO')
else:
    print('YES')
n, y = map(int, input().split())
y //= 1000

for a in range(n + 1):
    for b in range(n + 1):
        c = n - a - b
        if 10*a + 5*b + c == y:
            print(a, b, c)
            exit()

print(-1, -1, -1)

### FIXED CODE ###

s = input()
print(s.replace('2017/', '2018/'))
n = int(input())
a = [int(input().split(sep=" ")[1])]
for i in range(n - 1):
    command = input()
    if(command == "deleteFirst"):
        a.pop(0)
    elif(command == "deleteLast"):
        a.pop()
    else:
        command,num = command.split(sep = " ")
        num = int(num)
        if(command == "delete"):
            a.remove(num)
        else:
            a.append(num)
print(a[0],end = "")
for num in a[1:]:
    print(" ",num,sep = "",end="")
print()



### FIXED CODE ###

class Node(object):
    def __init__(self, num, prv = None, nxt = None):
        self.num = num
        self.prv = prv
        self.nxt = nxt
  
  
class DoublyLinkedList(object):
    def __init__(self):
        self.start = self.last = None
  
    def insert(self, num):
        new_elem = Node(num)
  
        if self.start is None:
            self.start = self.last = new_elem
        else:
            new_elem.nxt = self.start
            self.start.prv = new_elem
            self.start = new_elem
  
    def delete_num(self, target):
        it = self.start
        while it is not None:
            if it.num == target:
                if it.prv is None and it.nxt is None:
                    self.start = self.last = None
                else:
                    if it.prv is not None:
                        it.prv.nxt = it.nxt
                    else:
                        self.start = self.start.nxt
  
                    if it.nxt is not None:
                        it.nxt.prv = it.prv
                    else:
                        self.last = self.last.prv
                break
            it = it.nxt
  
    def delete_start(self):
        if self.start is self.last:
            self.start = self.last = None
        else:
            self.start.nxt.prv = None
            self.start = self.start.nxt
  
    def delete_last(self):
        if self.start is self.last:
            self.start = self.last = None
        else:
            self.last.prv.nxt = None
            self.last = self.last.prv
  
    def get_content(self):
        ret = []
        it = self.start
  
        while it is not None:
            ret.append(it.num)
            it = it.nxt
  
        return ' '.join(ret)
  
  
def _main():
    from sys import stdin
  
    n = int(input())
  
    lst = DoublyLinkedList()
      
    for _ in range(n):
        cmd = stdin.readline().strip().split()
        if cmd[0] == 'insert':
            lst.insert(cmd[1])
        elif cmd[0] == 'delete':
            lst.delete_num(cmd[1])
        elif cmd[0] == 'deleteFirst':
            lst.delete_start()
        elif cmd[0] == 'deleteLast':
            lst.delete_last()
  
    print(lst.get_content())
  
  
if __name__ == '__main__':
    _main()
a,b,n=map(int,input().split())
l=[]

if n>b:
    for x in range(b-1,n):
        y=a*x//b-a*(x//b)
        l.append(y)

else:
    for x in range(1,n):
        y=a*x//b-a*(x//b)
        l.append(y)


print(max(l))


### FIXED CODE ###

a,b,n=map(int,input().split())
l=[]
m=a//b
if b==1:
    print(0)
    exit()
if n>=b:
    for x in range(b-1,n+1,b):
        y=a*x//b-a*(x//b)
        #l.append(y)
        m=max(m,y)
    x=n
    y=a*x//b-a*(x//b)
    m=max(m,y)
else:
    x=n
    y=a*x//b-a*(x//b)
    #l.append(y)
    xx=n-1
    yy=a*xx//b-a*(xx//b)
    m=max(y,yy)


print(m)
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<numeric>
#include<string>
#include<vector>
using namespace std;
int main(){
    int N;
    cin>>N;
    for(int i=100;i<=999;i+111){
        if(N<=i){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}


### FIXED CODE ###

n=list(input())
temp=""
temp=temp.join(map(str,n))
temp=int(temp)
if n[0]==n[1]==n[2]:
    temp=""
    temp=temp.join(map(str,n))
    temp=int(temp)
    print(temp)
else:
    a=n[0]*3
    a=int(a)
    b=(str(int(n[0])+1))*3
    b=int(b)
    if a<temp:
        print(b)
    else:
        print(a)
import math
a, b = map(int, input().split())
def lcm(x, y):
    return (x*y) // math.gcd(x, y)
print(lcm(a,b))

### FIXED CODE ###

import fractions
a, b = map(int, input().split())
def lcm(x, y):
    return (x*y) // fractions.gcd(x, y)
print(lcm(a,b))
def kmpTable(w):
    lw = len(w)
    nx = [-1] * (lw + 1)
    j = -1
    for i in xrange(lw):
        while j >= 0 and w[i] != w[j]:
            j = nx[j]
        j += 1
        nx[i + 1] = j
    return nx
 
def kmpSearch(s, w):
    ls = len(s)
    start = 0
    w_idx = 0
    ret = []
    nx = kmpTable(w)
    while start + w_idx < ls:
        if s[start + w_idx] == w[w_idx]:
            w_idx += 1
            if w_idx == len(w):
                ret.append(start)
                start = start + w_idx - nx[w_idx]
                w_idx = nx[w_idx]
        else:
            if w_idx == 0:
                 start += 1
            else:
                start = start + w_idx - nx[w_idx]
                w_idx = nx[w_idx]
    return ret
     
T = input()
P = input()
ans = kmpSearch(T, P)
for i in ans:
    print(i)


### FIXED CODE ###

def kmpTable(w):
    lw = len(w)
    nx = [-1] * (lw + 1)
    j = -1
    for i in range(lw):
        while j >= 0 and w[i] != w[j]:
            j = nx[j]
        j += 1
        nx[i + 1] = j
    return tuple(nx)
def kmpSearch(s, w):
    ls = len(s)
    start = 0
    w_idx = 0
    ret = []
    nx = kmpTable(w)
    while start + w_idx < ls:
        if s[start + w_idx] == w[w_idx]:
            w_idx += 1
            if w_idx == len(w):
                ret.append(start)
                start = start + w_idx - nx[w_idx]
                w_idx = nx[w_idx]
        else:
            if w_idx == 0:
                start += 1
            else:
                start = start + w_idx - nx[w_idx]
                w_idx = nx[w_idx]
    return ret
T = input()
P = input()
ans = kmpSearch(T, P)

if ans:
    print(*ans, sep="\n")
#    print("\n".join(map(str, ans)))
N, X = map(int, input().split())
L = [int(x) for x in range(N)]
print(N + ((X - sum(L))) // min(L))

### FIXED CODE ###

N, X = map(int, input().split())
L = [int(input()) for x in range(N)]
print(N + ((X - sum(L))) // min(L))
n=int(input())
m=int(input())
if (str(n) in str(m)) is True:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())
a = list(int(x) for x in input().split())
x = 0
 
a.sort()
for i in range(n-1):
    if a[-1] - a[-2] == 0:
        print("NO")
        x = 1
        break
    a.pop()
 
if x == 0:
    print("YES")
dp = [[0 for _ in range(10**2+10)] for _ in range(10**5+10)]

N, W = map(int,input().split())
w = []
v = []

for i in range(N):
    wi,vi = map(int,input().split())

    w.append(wi)
    v.append(vi)

for i in range(N):
    for capacity in range(W):
        if w[i] > capacity:
            dp[i+1][capacity] = dp[i][capacity]
        else:
            dp[i+1][capacity] = max(dp[i][capacity], dp[i][capacity-w[i]] + w[i])

print(dp[N-1][W-1])

### FIXED CODE ###

dp = [[0 for _ in range(10**5+10)] for _ in range(10**2+10)]

N, W = map(int,input().split())
w = []
v = []

for i in range(N):
    wi,vi = map(int,input().split())

    w.append(wi)
    v.append(vi)

for i in range(N):
    for capacity in range(W+1):
        if w[i] > capacity:
            dp[i+1][capacity] = dp[i][capacity]
        else:
            dp[i+1][capacity] = max(dp[i][capacity], dp[i][capacity-w[i]] + v[i])

print(dp[N][W])
import collections,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,Q = LI()
ab = [LI() for _ in range(N-1)]
px = [LI() for _ in range(Q)]
ans = [0]*(N+1) #1_index
graph = [collections.deque() for _ in range(N+1)] #1_index
for a,b in ab:
        graph[a].append(b)
        graph[b].append(a)
for p,x in px:
    ans[p] += x
seen = [0]*(N+1) #1_index
stack = []
def dfs():
    seen[1] = 1
    stack.append(1)
    while stack:
        s = stack.pop()
        if not graph[s]:
            continue
        for j in range(len(graph[s])):
            g_NO = graph[s].popleft()
            if seen[g_NO]:
                continue
            seen[g_NO] = 1
            stack.append(g_NO)
            ans[g_NO] += ans[s]
dfs()
print(*ans[1:])


### FIXED CODE ###

a = int(input())
s = input()
if a >=3200:
    print(s)
else:
    print('red')
s=input()
t=input()
print(t+s)

### FIXED CODE ###

s,t=input().split();print(t+s)
N=int(input())
import numpy as np
x = np.arange(N+1)
print(np.sum(x)-N)

### FIXED CODE ###

N=int(input())
print(N*(N+1)//2-N)
A,B,C = map(int,input().split())

if A == B and A != C :
	answer　= "Yes"
    
elif A == C and A != B :
	answer　= "Yes"
    
elif B == C and B != A :
	answer　= "Yes"
else:
	answer = "No"

print(answer)
    

### FIXED CODE ###

A,B,C = map(int,input().split())
 
if A == B and A != C :
	answer = "Yes"
elif A == C and A != B :
	answer = "Yes"
    
elif B == C and B != A :
	answer = "Yes"
else:
	answer = "No"
 
print(answer)
n,m=map(int,input().split()) 
lst_b=[] 
lst_c=[] 
while(True): 
    b=n//m 
    c=n%m 
    lst_b.append(b) 
    lst_c.append(c) 
    n=b 
    	if b==0: 
    		print("".join(map(str,lst_c[::-1]))) 
    		break                       

### FIXED CODE ###

n,m=map(int,input().split()) 
lst_b=[] 
lst_c=[] 
while(True): 
    b=n//m 
    c=n%m 
    lst_b.append(b) 
    lst_c.append(c) 
    n=b 
    if b==0: 
    	print(len("".join(map(str,lst_c[::-1])))) 
    	break
N = int(input())

A = [int(x) for x in input().split()]
A = sorted(A)


if A[0] == A[1]:
    cnt = 0
else:
    cnt = 1
    
for i in range(1,N):
    flag = True
    for j in range(i):
        if A[i]%A[j] == 0:
            flag = False
            break
        break
    
    if i != N-1:
        if A[i] == A[i+1]:
            flag = False
    
    if flag == True:
        cnt += 1
print(cnt)

### FIXED CODE ###

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

l=[0]*(10**6+1)
ans=0
#print(l)
for i in a:
    if l[i]==0:
        for j in range(i,10**6+1,i):
            l[j] += 1
    else:
        l[i] += 1
#print(l)
for i in a:
    if l[i]==1:
        ans+=1

print(ans)
a,b,k = map(int, input().split())
for i in range (min(a,b),0,-1):
	if a % i == 0 and b % i == 0:
		count += 1
		d = i;
	if count == k:
		print(d)
		break


### FIXED CODE ###

a,b,k = map(int, input().split())
count = 0
for i in range (min(a,b),0,-1):
	if a % i == 0 and b % i == 0:
		count += 1
		d = i;
	if count == k:
		print(d)
		break
n=int(input())
a=list(map(int,input().splilt()))
a.sort()
if a[n/2-1]!=a[n/2]:
  print(a[n/2]-a[n/2-1])
else:
  print(0)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a.sort()
if a[n//2-1]!=a[n//2]:
  print(a[n//2]-a[(n//2)-1])
else:
  print(0)