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

import sys
input = sys.stdin.readline
from collections import defaultdict, Counter
import itertools

mask = (1 << 10) - 1

symmetry = dict()
decode = dict()
counter = defaultdict(int)

def encode(a,b,c,d):
    t = 1 << 40
    for _ in range(4):
        a,b,c,d = b,c,d,a
        x = a + (b << 10) + (c << 20) + (d << 30)
        if t > x:
            t = x
    return t

N = int(input())
tiles = []
for _ in range(N):
    a,b,c,d = map(int,input().split())
    t = encode(a,b,c,d)
    tiles.append(t)
    counter[t] += 1
    if a == b == c == d:
        symmetry[t] = 4
    elif a == c and b == d:
        symmetry[t] = 2
    else:
        symmetry[t] = 1
    decode[t] = (a,b,c,d)

P = [(1,n,n*(n-1),n*(n-1)*(n-2),n*(n-1)*(n-2)*(n-3)) for n in range(N+1)]

power = [[n ** e for e in range(5)] for n in range(5)]

answer = 0
for bottom, top in itertools.combinations(tiles,2):
    counter[bottom] -= 1
    counter[top] -= 1
    a,b,c,d = decode[bottom]
    e,f,g,h = decode[top]
    for _ in range(4):
        e,f,g,h = f,g,h,e
        # a,b,c,d
        # e,h,g,f 
        tiles = [encode(p,q,r,s) for p,q,r,s in [(b,a,e,h), (c,b,h,g), (d,c,g,f), (a,d,f,e)]]
        need = Counter(tiles)
        x = 1
        for tile, cnt in need.items():
            have = counter[tile]
            if have < cnt:
                x = 0
                break
            x *= P[counter[tile]][cnt] # 残っている個数、必要枚数
            x *= power[symmetry[tile]][cnt]
        answer += x
    counter[bottom] += 1
    counter[top] += 1

# 上下を固定した分
answer //= 3
print(answer)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import Counter
import itertools

mask = (1 << 10) - 1

def encode(a,b,c,d):
    t = 1 << 40
    for x,y,z,w in [(a,b,c,d), (b,c,d,a), (c,d,a,b), (d,a,b,c)]:
        u = x + (y << 10) + (z << 20) + (w << 30)
        if t > u:
            t = u
    return t

def decode(x):
    for _ in range(4):
        yield x & mask
        x >>= 10

def P(n,k):
    x = 1
    for i in range(k):
        x *= (n-i)
    return x

def symmetry(tile):
    a,b,c,d = decode(tile)
    if a == b == c == d:
        return 4
    if a == c and b == d:
        return 2
    return 1

N = int(input())
tiles = []
for _ in range(N):
    a,b,c,d = map(int,input().split())
    tiles.append(encode(a,b,c,d))
counter = Counter(tiles)

counter

answer = 0
for bottom, top in itertools.combinations(tiles,2):
    counter[bottom] -= 1
    counter[top] -= 1
    a,b,c,d = decode(bottom)
    e,f,g,h = decode(top)
    for x,y,z,w in [(e,f,g,h), (f,g,h,e), (g,h,e,f), (h,e,f,g)]:
        # a,b,c,d
        # x,w,z,y 
        tiles = [encode(p,q,r,s) for p,q,r,s in [(b,a,x,w), (c,b,w,z), (d,c,z,y), (a,d,y,x)]]
        need = Counter(tiles)
        x = 1
        for tile, cnt in need.items():
            x *= P(counter[tile],cnt) # 残っている個数、必要枚数
            x *= pow(symmetry(tile), cnt)
        answer += x
    counter[bottom] += 1
    counter[top] += 1

# 上下を固定した分
answer //= 3
print(answer)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
# D - Line++
# モジュールのインポート
import itertools

# 標準入力の取得
N,X,Y = list(map(int, input().split()))

# 求解
# (i, j)間の最短距離はmin{|j-i|, |X-i|+1+|j-Y|, |Y-i|+1+|j-X|}であるため、
# (i, j)が決まれば、最短距離はO(1)で決まる。したがって、全(i, j)について、最短距離を求める。
k_list = [0 for i in range(1,N)]
for i,j in itertools.product(range(1,N+1), range(1,N+1)):
    # 1 <= i < j <= Nでなければ、何もしない
    if i >= j:
        continue

    min_path = min([abs(j-i), abs(X-i)+1+abs(j-Y), abs(Y-i)+1+abs(j-X)])
    k_list[min_path-1] += 1


# 結果出力
for k in k_list:
    print(k)


### FIXED CODE ###

# -*- coding: utf-8 -*-
# D - Line++
# 標準入力の取得
N,X,Y = list(map(int, input().split()))

# 求解
# (i, j)間の最短距離はmin{|j-i|, |X-i|+1+|j-Y|, |Y-i|+1+|j-X|}であるため、
# (i, j)が決まれば、最短距離はO(1)で決まる。したがって、全(i, j)について、最短距離を求める。
k_list = [0 for i in range(1,N)]
for i in range(1, N):
    diff_X_i = abs(X - i)
    diff_Y_i = abs(Y - i)
    for j in range(i+1, N+1):
        diff_j_i = abs(j - i)
        diff_j_X = abs(j - X)
        diff_j_Y = abs(j - Y)
        min_path = min([diff_j_i, diff_X_i+1+diff_j_Y, diff_Y_i+1+diff_j_X])
        k_list[min_path-1] += 1

# 結果出力
for k in k_list:
    print(k)
### BUGGY CODE ###

r,g,b,n=map(int,input().split())
cnt=0
for i in range(int(n//r)+1):
    for j in range(int(n//g)+1):
        if (n-i*r-j*g) %b ==0 and 0<=(n-i*r-j*g) // b <= 3000:
            # print(i,j,(n-i*r-j*g)//3)
            cnt+=1
print(cnt)

### FIXED CODE ###

r,g,b,n=map(int,input().split())
cnt=0
for i in range(int(n//r)+1):
    for j in range(int(n//g)+1):
        if (n-i*r-j*g) %b ==0 and 0<=(n-i*r-j*g) // b <= 3000:
            # print(i,j,(n-i*r-j*g)//3)
            cnt+=1
print(cnt)
### BUGGY CODE ###

from copy import deepcopy

N=int(input())
A=[int(input()) for i in range(N)]
for i in range(N):
  a=deepcopy(A)
  del a[i]
  print(max(a))


### FIXED CODE ###

N=int(input())
A=[int(input()) for i in range(N)]
max_val1=sorted(A)[-1]
max_val2=sorted(A)[-2]
for x in A:
  print(max_val2 if x==max_val1 else max_val1)
### BUGGY CODE ###

import sys
import numpy as np
def main():
    n = int(input())
    a = np.array(list(map(int, input().split())))
    q = int(input())
    for x in sys.stdin.readlines():
        b, c = map(int, x.split())
        a = np.where(a == b, c, a)
        print(np.sum(a))

main()

### FIXED CODE ###

import sys
import collections
def main():
    n = int(input())
    a = collections.Counter(list(map(int, input().split())))
    s = [0 for i in range(10**5+1)]
    sa = 0
    for i in a:
        s[i] += a[i]
        sa += i*a[i]
    q = int(input())
    for x in sys.stdin.readlines():
        b, c = map(int, x.split())
        s[c] += s[b]
        sa = sa + c*s[b] - b*s[b]
        s[b] = 0
        print(sa)

main()
### BUGGY CODE ###

from bisect import*
def main():
    root=[[],[]]
    def search_higher(key):
        ptr=root
        ret=None
        while ptr[1]:
            i=bisect(ptr[0],key)
            if i!=len(ptr[0]):ret=ptr[0][i]
            ptr=ptr[1][i]
        i=bisect(ptr[0],key)
        if i!=len(ptr[0]):ret=ptr[0][i]
        return ret
    def search_lower(key):
        ptr=root
        ret=None
        while ptr[1]:
            i=bisect_left(ptr[0],key)
            if i!=0:ret=ptr[0][i-1]
            ptr=ptr[1][i]
        i=bisect_left(ptr[0],key)
        if i!=0:ret=ptr[0][i-1]
        return ret
    def insert_rec(ptr,key):
        b_size=550
        if not ptr[1]:
            insort(ptr[0],key)
            if len(ptr[0])==b_size*2-1:
                ret=[ptr[0][:b_size],[]]
                ptr[0]=ptr[0][b_size:]
                return ret
        else:
            i=bisect(ptr[0],key)
            tmp=insert_rec(ptr[1][i],key)
            if tmp:
                ptr[0].insert(i,tmp[0].pop())
                ptr[1].insert(i,tmp)
                if len(ptr[1])==b_size*2:
                    ret=[ptr[0][:b_size],ptr[1][:b_size]]
                    ptr[0],ptr[1]=ptr[0][b_size:],ptr[1][b_size:]
                    return ret
    def insert(key):
        tmp=insert_rec(root,key)
        if tmp:root[0],root[1]=[tmp[0].pop()],[tmp,root]
    n,*a=map(int,open(0).read().split())
    l=[0]*n
    for i,v in enumerate(a,1):l[v-1]=i
    insert(0)
    insert(n+1)
    c=0
    for i,v in enumerate(l,1):
        c+=(search_higher(v)-v)*(v-search_lower(v))*i
        insert(v)
    print(c)
main()

### FIXED CODE ###

root=lambda x:x if par[x]==x else root(par[x])
same=lambda x,y:root(x)==root(y)
def unite(*z):
  x,y=map(root,z)
  if x!=y:
    if rank[x]<rank[y]:
      par[x]=y
      size[y]+=size[x]
    else:
      par[y]=x
      size[x]+=size[y]
      if rank[x]==rank[y]:rank[x]+=1
n,*a=map(int,open(0).read().split())
*par,=range(n)
rank=[1]*n
size=[1]*n
b=[0]*n
for i,t in enumerate(a):b[t-1]=i
c=0
for k in b[::-1]:
  l=r=1
  if k>0 and a[k-1]>a[k]:
    l+=size[root(k-1)]
    unite(k-1,k)
  if k+1<n and a[k+1]>a[k]:
    r+=size[root(k+1)]
    unite(k+1,k)
  c+=l*r*a[k]
print(c)
### BUGGY CODE ###

from functools import reduce
n = int(input())
arr = list(map(int,input().split()))
def multiply(arr):
    return reduce(lambda x, y: x * y, arr)
mul = multiply(arr)
print("-1" if mul > (10**18) else mul)

### FIXED CODE ###

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

if 0 in arr:
    print(0)
else:
    r = 1
    for i in arr:
        if r*i > 10**18:
            print(-1)
            exit()
        r *= i
    print(r)
### BUGGY CODE ###

import sys 
from collections import deque
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())
def LS(): return list(sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def main():
    x,y = IL()
    bit = 2**x
    if 4*x<y:
        print('No')
        exit()
    for i in range(bit):
        tmp = 0
        for j in range(x):
            if (i>>j)&1:
                tmp += 2
            else:
                tmp += 4
            if y<tmp:
                continue
        if tmp == y:
            print('Yes')
            exit()
    print('No')
    return

if __name__=='__main__':
    main()

### FIXED CODE ###

import sys 
from collections import deque
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())
def LS(): return list(sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def main():
    x,y = IL()
    if 4*x<y or y%2!=0:
        print('No')
        exit()
    for i in range(x+1):
        if 4*i+2*(x-i)==y:
            print('Yes')
            exit()
    print('No')
    return

if __name__=='__main__':
    main()
### BUGGY CODE ###

#coding: UTF-8
import math
N = int(input())
#print(N)

ans = [0]*N

for i in range(1,N+1):
  if i <=5:
    ans[i-1] = 0
    continue
  cnt = 0
  m = int(math.sqrt(i))
  #平方根までやれば十分
  for x in range(1,m):
    if i - x**2 <= 4:
      break
    for y in range(x,m):
      if i - x**2 -y**2 <= 3:
        break
      for z in range(y,m):
        a = (x+y+z)**2 -x*y -y*z - z*x
        if a == i:
          if x==y==z:
            cnt += 1
            break
          elif x==y or y==z:
            cnt += 3
            break
          else:
            cnt += 6
            break
        elif a > i: break
  ans[i-1] = cnt
print('\n'.join(map(str, ans)))

### FIXED CODE ###

#coding: UTF-8
import math
N = int(input())
#print(N)

ans = [0]*10001

for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      a = x**2+y**2+z**2+x*y+y*z+z*x
      if a <=10000:
        ans[a] += 1
    
for i in range(1,N+1):
  print(ans[i])
### BUGGY CODE ###

T = list(input())
P = list(input())
for i in range(len(T)-len(P)+1):
        if P[0] == T[i]:
            for j in range(len(P)):
                if P[j] == T[i + j]:
                    pass
                else: break
            else: print(i)

### FIXED CODE ###

T = input()
P = input()
lenp = len(P)
for i in range(len(T)-len(P)+1):
    t = T[i : i+lenp]
    if t == P:
        print(i)
### BUGGY CODE ###

input = raw_input

M = 2019
s = input()
n = len(s)
s = list(s)

out = 0
for i in range(n): 
    cur = 0
    for j in range(i, n):
        cur = cur * 10 + int(s[j])
        cur = cur % M
        if cur % M == 0:
            out += 1

print(out)

### FIXED CODE ###

input = raw_input

M = 2019
s = input()
#n = len(s)
#s = int(s)

div = 10

counts = [0] * M
#m = 1

counts[0] += 1
cur = 0

m = 1
for c in reversed(s):
    cur = (int(c) * m + cur) % M
    counts[cur] += 1
    m = (m * 10) % M
    #m *= 10

out = 0
for c in counts:
    out += (c * (c-1) // 2)

print(out)
### BUGGY CODE ###

n, k = [int(x) for x in input().split()]
# ps = [int(x) for x in input().split()]

calc_expectedval = (lambda p: sum(range(p+1)) / p)
expected_vals = [calc_expectedval(int(x)) for x in input().split()]

prevval = sum(expected_vals[0:0+k])
maxval = prevval
for i in range(n - k):
  candidate = prevval - expected_vals[i] + expected_vals[i + k]   
  if candidate > maxval:
    maxval = candidate
  prevval = candidate
  
print(maxval)

### FIXED CODE ###

n, k = [int(x) for x in input().split()]
# ps = [int(x) for x in input().split()]

continuous_sum = (lambda n: (n + 1) * (n // 2) + (0 if n %2 == 0 else n // 2 + 1))
calc_expectedval = (lambda p: continuous_sum(p) / p)
expected_vals = [calc_expectedval(int(x)) for x in input().split()]

prevval = sum(expected_vals[0:0+k])
maxval = prevval
for i in range(n - k):
  candidate = prevval - expected_vals[i] + expected_vals[i + k]
  if candidate > maxval:
    maxval = candidate
  prevval = candidate

print(maxval)
### BUGGY CODE ###

# dp[i][j]=(区間[i,j]が残っているとき次の手番の得点-そうじゃない人の得点)
import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
INF=-10**14
dp=[[-1]*n for i in range(n)]
def memo(i,j):
    if dp[i][j]>=0:
        return dp[i][j]
    if i==j:
        dp[i][j]=a[i]
    else:
        dp[i][j]=max(a[i]-memo(i+1,j),a[j]-memo(i,j-1))
    return dp[i][j]
print(memo(0,n-1))


### FIXED CODE ###

# dp[j][i]=(区間[i,j]が残っているとき次の手番の得点-そうじゃない人の得点)
import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
INF=-10**14
dp=[[0]*(i+1) for i in range(n)]
for i in range(n):
    dp[i][i]=a[i]
for i in range(1,n):
    for j in range(i-1,-1,-1):
        dp[i][j]=max(a[i]-dp[i-1][j],a[j]-dp[i][j+1])
print(dp[-1][0])
### BUGGY CODE ###

n = int(input())
alist = [int(input())-1 for _ in range(n)]

visitedlist = [0]
from_ = 0
while True:
    to = alist[from_]
    if to in visitedlist:
        print(-1)
        break
    elif to == 1:
        print(len(visitedlist))
        break
    else:
        visitedlist.append(to)
        from_ = to

### FIXED CODE ###

n = int(input())
alist = [int(input())-1 for _ in range(n)]

now = 0
count = 0
while True:
    if now == 1:
        print(count)
        break
    elif count >= n:
        print(-1)
        break
    else:
        count += 1
        now = alist[now]
### BUGGY CODE ###

def main():
    K = int(input())

    if K % 2 == 0:
        return -1
    elif K % 5 == 0:
        return -1
    an = 7
    counter = 1

    while True:
        if an % K == 0:
            return counter

        an = an * 10 + 7
        counter = counter + 1

if __name__ == "__main__":
    answer = main()
    print(answer)

### FIXED CODE ###

def main():
    K = int(input())

    if K % 2 == 0:
        return -1
    elif K % 5 == 0:
        return -1

    an = 7
    counter = 1

    while True:
        modan = an % K

        if modan == 0:
            return counter

        an = modan * 10 + 7
        counter = counter + 1

if __name__ == "__main__":
    answer = main()
    print(answer)
### BUGGY CODE ###

def slove():
    import sys
    input = sys.stdin.readline
    l, r = list(map(int, input().rstrip('\n').split()))
    mmod = 10 ** 10
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            mmod = min(mmod, (i * j) % 2019)
            if mmod == 0:
                break
    print(mmod)


if __name__ == '__main__':
    slove()


### FIXED CODE ###

l, r = map(int, input().split())
ans = 10 ** 9
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        ans = min(ans, (i * j) % 2019)
        if ans == 0:
            print(ans)
            exit()
print(ans)
### BUGGY CODE ###

n = int(input())

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

q = int(input())

for i in range(q):
    
    b,c = map(int, input().split())
    
    for i in range(len(a)):
        if a[i] == b:
            a[i] = c

    print(sum(a))


### FIXED CODE ###

n = int(input())

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

q = int(input())

#初期化

a_dic ={}
ans = 0

for i in a:
    if i not in a_dic:
        a_dic[i] = 1
    else:
        a_dic[i] += 1
    
    ans += i

#print(ans)
#a_sorted = sorted(a)
for i in range(q):
    #ans = 0
    b,c = map(int, input().split())
    #print(a_dic)
    
    if b in a_dic:
        if c not in a_dic:
            a_dic[c] = a_dic[b]

        else:
            tmp_c = a_dic[c]
            tmp_c += a_dic[b]
            a_dic[c] = tmp_c
        tmp_a = (c-b) * a_dic[b]
        a_dic.pop(b)
        ans += tmp_a
    print(ans)
### BUGGY CODE ###

import pprint
H,W=map(int,input().split())
import copy
lastraw=["#"]*(W+2)
field=[["#"]*(W+2)]
for i in range(H):
  field.append(["#"]+list(input())+["#"])

field.append(lastraw)
maxmoves=0
#print(field)
saved_field=copy.deepcopy(field)

for i in range(H):
  for j in range(W):
    for k in range(H):
      for l in range(W):
        field=copy.deepcopy(saved_field)
        goal_point=(l+1,k+1)
        [sy,sx]=[j+1,i+1]
        [gy,gx]=[l+1,k+1]

        queue=[[sy,sx]]
        tests = ((-1,0),(0, 1),(1, 0),(0, -1))
        moves=0

        if field[sx][sy]=='#':
          queue=[]
        else:
          field[sx][sy]=0

        while True:
          if len(queue)==0:
            moves=-1
            break
          queue_next = []
          moves += 1
          #pprint.pprint(field)
          for y, x in queue:
            for ny, nx in tests:
              ty, tx = y + ny, x + nx
              if field[tx][ty] == '.' or field[tx][ty] ==moves:
                field[tx][ty] = moves
                queue_next.append((ty, tx))
          queue = queue_next
          if goal_point in queue:
            break
        #pprint.pprint(field)
        maxmoves=max(maxmoves,moves)
print(maxmoves)

### FIXED CODE ###

import pprint
H,W=map(int,input().split())
import copy
lastraw=["#"]*(W+2)
field=[["#"]*(W+2)]
for i in range(H):
  field.append(["#"]+list(input())+["#"])
 
field.append(lastraw)
maxmoves=0
#print(field)
saved_field=copy.deepcopy(field)
 
for i in range(H):
  for j in range(W):
    field=copy.deepcopy(saved_field)
    goal_point=(0,0)
    [sy,sx]=[j+1,i+1]
    [gy,gx]=[0,0]
 
    queue=[[sy,sx]]
    tests = ((-1,0),(0, 1),(1, 0),(0, -1))
    moves=0
 
    if field[sx][sy]=='#':
      queue=[]
    else:
      field[sx][sy]=0
 
    while True:
      if len(queue)==0:
        maxmoves=max(maxmoves,moves-1)
        break
      queue_next = []
      moves += 1
      #pprint.pprint(field)
      for y, x in queue:
        for ny, nx in tests:
          ty, tx = y + ny, x + nx
          if field[tx][ty] == '.':
            field[tx][ty] = moves
            queue_next.append((ty, tx))
      queue = queue_next
      if goal_point in queue:
        break
        #pprint.pprint(field)
        maxmoves=max(maxmoves,moves)
print(maxmoves)
### BUGGY CODE ###

from copy import copy, deepcopy
from collections import Counter
from math import sqrt, floor, factorial
from itertools import permutations, combinations, combinations_with_replacement
from operator import mul
from functools import reduce
import bisect

MOD = 10**9 + 7
INF = float('inf')

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

#A = [0 for i in range(N)]
B = [0 for i in range(N)]

# print(A)
for _ in range(K):
    for i in range(N):
        B[i] = 0
    for i in range(N):
        tmp = A[i]
        B[max(i-tmp, 0)] += 1
        idx = min(i+tmp+1, N)
        if idx != N:
            B[idx] -= 1
    # print(B)
    for i in range(N-1):
        B[i+1] += B[i]
    # print(B)
    for i in range(N):
        A[i] = B[i]
    if _ > 2 * int(sqrt(N)):
        break

L = " ".join([str(x) for x in A])
print(L)


### FIXED CODE ###

from copy import copy, deepcopy
from collections import Counter
from math import sqrt, floor, factorial, log
from itertools import permutations, combinations, combinations_with_replacement
from operator import mul
from functools import reduce
import bisect

MOD = 10**9 + 7
INF = float('inf')

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

#A = [0 for i in range(N)]
B = [0 for i in range(N)]

# print(A)
for _ in range(K):
    B = [0 for i in range(N)]
    for i in range(N):
        B[max(i-A[i], 0)] += 1
        idx = min(i+A[i]+1, N)
        if idx != N:
            B[idx] -= 1
    # print(B)
    for i in range(N-1):
        B[i+1] += B[i]
    # print(B)
    A = B.copy()
    if _ > 10 * int(log(N)):
        break

L = " ".join([str(x) for x in A])
print(L)
### BUGGY CODE ###

n, m = map(int, input().split())
H = list(map(int, input().split()))
road = [0 for i in range(m)]

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

ans = 0
for i in range(n):
    flag = 0
    for j in range(m):
        if road[j][0] - 1 == i:
            if H[i] <= H[road[j][1]-1]:
                flag = 1
        if road[j][1]  - 1 == i:
            if H[i] <= H[road[j][0]-1]:
                flag = 1
    if flag == 0:
        ans = ans + 1

print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
H = list(map(int, input().split()))
road = [0 for i in range(m)]
ans = [0] * n

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

for j in range(m):
    if H[road[j][0]-1] < H[road[j][1]-1]:
        ans[road[j][0]-1] = 1
    elif H[road[j][0]-1] > H[road[j][1]-1]:
        ans[road[j][1]-1] = 1
    elif H[road[j][0]-1] == H[road[j][1]-1]:
        ans[road[j][0]-1] = 1
        ans[road[j][1]-1] = 1

total = sum(ans)
print(n-total)
### BUGGY CODE ###

#
import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

def next_kenp(node, edges):
    nodes = set()
    nodes2 = set()
    for n1 in edges[node]:
        for n2 in edges[n1]:
            if n2 not in nodes2:
                nodes2.add(n2)
    for n2 in nodes2:
        for n3 in edges[n2]:
            nodes.add(n3)
    return nodes


def main():
    n, m = map(int, input().split())

    edges = defaultdict(list)

    for _ in range(m):
        u, v = map(int, input().split())
        edges[u].append(v)

    s, t = map(int, input().split())

    new_edges = defaultdict(list)
    for i in range(1, n + 1):
        nodes = next_kenp(i, edges)
        new_edges[i] = list(nodes)

    # print(new_edges)

    dones = set()
    que = [(s, 0)]
    while que:
        node, step = que.pop(0)

        next_nodes = new_edges[node]
        # print(next_nodes)
        for n in next_nodes:
            if n == t:
                print(step + 1)
                exit()

            if n not in dones:
                que.append((n, step + 1))
                dones.add(n)
    print(-1)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n, m = map(int, input().split())

    edges = defaultdict(list)

    for _ in range(m):
        u, v = map(int, input().split())
        edges[(u, 0)].append((v, 1))
        edges[(u, 1)].append((v, 2))
        edges[(u, 2)].append((v, 0))

    s, t = map(int, input().split())

    # print(new_edges)

    dones = set()
    que = deque()
    que.append(((s, 0), 0))
    while que:
        node, step = que.popleft()

        next_nodes = edges[node]
        # print(next_nodes)
        for n, l in next_nodes:
            if n == t and l == 0:
                print((step + 1) // 3)
                exit()

            if (n, l) not in dones:
                que.append(((n, l), step + 1))
                dones.add((n, l))
    print(-1)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

import numpy as np
N = int(input())
NM = 10**7+5

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]
  
if __name__ == '__main__':
  
  ans = 0
  for i in range(1, N+1):
    f = make_divisors(i)
    ans += (i*len(f))
  print(ans)

### FIXED CODE ###

N = int(input())
ans = 0
for j in range(1, N+1):
  Y = int(N / j)
  ans += (j * Y*(Y+1)/2)
print(int(ans))