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

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

for i in range(N):
  if min(list[:i+1]) >= list[i]:
    a += 1
    
print(a)

### FIXED CODE ###

N = int(input())
list = list(map(int,input().split()))
a = 0
min = list[0]

for i in range(N):
  if min >= list[i]:
    min = list[i]
    a += 1
    
print(a)
### BUGGY CODE ###

import numpy as np

mod = 10 ** 9 + 7
S = input()

l = len(S)

dp = np.zeros((l + 1, 13))

# dp = [[0 for i in range(13)] for j in range(l+1)]

dp[0][0] = 1

for i, num in enumerate(S):

    if num == "?":
        for k in range(10):
            for j in range(13):
                dp[i+1][((j * 10) + k) % 13] += dp[i][j]

    else:
        k = int(num)
        for j in range(13):
            dp[i+1][((j * 10) + k) % 13] += dp[i][j]

    for j in range(13):
        dp[i+1][j] %= mod

print(int(dp[l][5]))

### FIXED CODE ###

mod = 10 ** 9 + 7

S = input()

dp = [0] * 13

dp[0] = 1

l = len(S)

for i in S:
    nextdp = [0] * 13
    if i == "?":
        for k in range(10):
            for j in range(13):
                nextdp[((j * 10) + k) % 13] += dp[j]
                # nextdp[((j * 10) + k) % 13] %= mod

    else:
        k = int(i)
        for j in range(13):
            nextdp[((j * 10) + k) % 13] += dp[j]
            # nextdp[((j * 10) + k) % 13] %= mod

    dp = [nextdp[i] % mod for i in range(13)]

    # for i in range(13):
    #     dp[i] = nextdp[i] % mod

print(dp[5])
### BUGGY CODE ###

N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ans = 0
for i in B:
    x, y = 0, 0
    for j in A:
        if j < i:
            x += 1
        else:
            break
    for j in reversed(C):
        if i < j:
            y += 1
        else:
            break
    ans += x * y
print(ans)

### FIXED CODE ###

import bisect
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ans = 0

for i in B:
    ans += bisect.bisect_left(A,i)*(N-bisect.bisect_right(C,i))
print(ans)
### BUGGY CODE ###

def C(_mid):
    if _mid <= target_list[K - 1]:
        return True
    else:
        return False


N, K = list(map(int, input().split()))
target_list = []
for i in range(N):
    a, b = list(map(int, input().split()))
    for j in range(b):
        target_list.append(a)

target_list.sort()

lb = 1
ub = 100000
while ub - lb > 1:
    # print(str(lb) + " " + str(ub))
    mid = int((lb + ub) / 2)
    if C(mid):
        lb = mid
    else:
        ub = mid

print(lb)


### FIXED CODE ###

def C(_mid):
    tmp_sum = 0
    if len(ab) <= _mid:
        return False
    for i in range(0, _mid):
        tmp_sum += ab[i][1]
    if tmp_sum < K:
        return True
    else:
        return False


N, K = list(map(int, input().split()))
ab = []
for i in range(N):
    a, b = list(map(int, input().split()))
    ab.append([a, b])

ab.sort(key=lambda x: x[0])

lb = 0
ub = 100000
while ub - lb > 1:
    # print(str(lb) + " " + str(ub))
    mid = int((lb + ub) / 2)
    if C(mid):
        lb = mid
    else:
        ub = mid

print(ab[lb][0])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**8)

N = int(input())
graph = [[] for _ in range(N)]
numOfEdges = [0 for _ in range(N)]
visited = [0 for _ in range(N)]
color = [[-1 for _ in range(N)] for _ in range(N)]
edges = []

for i in range(1, N):
    a, b = map(int, input().split())
    a -= 1; b -= 1;
    edges.append((a, b))
    graph[a].append(b)
    graph[b].append(a)

def dfs(prev, now, col):
    if visited[now]:
        return
    visited[now] = 1
    numOfEdges[now] = len(graph[now])
    i = 1
    for adj in graph[now]:
        if adj == prev:
            continue
        color[now][adj] = col + i
        color[adj][now] = col + i
        dfs(now, adj, col+i)
        i += 1

dfs(-1, 0, 1)
maxColor = max(numOfEdges)
print(maxColor)

for e in edges:
    a, b = e
    c = color[a][b] % maxColor
    if c == 0:
        print(maxColor)
    else:
        print(c)


### FIXED CODE ###

import sys
from collections import defaultdict
sys.setrecursionlimit(10**8)

N = int(input())
graph = [[] for _ in range(N)]
numOfEdges = [0 for _ in range(N)]
visited = [0 for _ in range(N)]
edges = defaultdict(int)

for i in range(1, N):
    a, b = map(int, input().split())
    a -= 1; b -= 1;
    numOfEdges[a] += 1
    numOfEdges[b] += 1
    edges[(a, b)] = 0
    graph[a].append(b)
    graph[b].append(a)

def dfs(prev, now, col):
    if visited[now]:
        return
    visited[now] = 1
    i = 1
    for adj in graph[now]:
        if adj == prev:
            continue
        if now < adj:
            edges[(now, adj)] = col + i
        else:
            edges[(adj, now)] = col + i
        dfs(now, adj, col+i)
        i += 1

dfs(-1, 0, 1)
maxColor = max(numOfEdges)
print(maxColor)

for k, i in edges.items():
    e = i % maxColor
    if e:
        print(e)
    else:
        print(maxColor)
### BUGGY CODE ###

N=int(input())
p=list(map(int, input().split()))
 
cnt=0
for i in range(N):
    min=p[0]
    for j in range(i):
        if min>=p[j]:
            min=p[j]
    
    if p[i]<=min:
        cnt+=1
 
print(cnt)

### FIXED CODE ###

N=int(input())
p=list(map(int, input().split()))
 
cnt=0
min=p[0]
for i in range(N):
	if p[i]<=min:
		min=p[i]
		cnt+=1
	
print(cnt)
### BUGGY CODE ###

B,W=map(int,input().split())
mod=10**9+7
kaijo=[1]
Xdiv=[1]
two=pow(2,mod-2,mod)
for i in range(1,1+B+W):
    kaijo.append((kaijo[-1])*i%mod)
    Xdiv.append((Xdiv[-1]*two)%mod)
from collections import deque
gyaku=deque()
gyaku.append(pow(kaijo[B+W],mod-2,mod))
for i in range(B+W,0,-1):
    gyaku.appendleft((gyaku[0]*i)%mod)
def conb(a,b):
    if a<b:return 0
    return (kaijo[a]*gyaku[a-b]*gyaku[b])%mod
Blost,Wlost=0,0
for k in range(1,B+W):
    print(((1+Wlost-Blost)*two)%mod)
    Blost=(Blost+conb(k-1,B-1)*Xdiv[k])%mod
    Wlost=(Wlost+conb(k-1,W-1)*Xdiv[k])%mod
print(((1+Wlost-Blost)*two)%mod)

### FIXED CODE ###

B,W=map(int,input().split())
mod=10**9+7
kaijo={0:1}
Xdiv={0:1}
two=pow(2,mod-2,mod)
for i in range(1,1+B+W):
    kaijo[i]=(kaijo[i-1]*i)%mod
    Xdiv[i]=(Xdiv[i-1]*two)%mod
gyaku={B+W:pow(kaijo[B+W],mod-2,mod)}
for i in range(B+W,0,-1):
    gyaku[i-1]=(gyaku[i]*i)%mod
def conb(a,b):
    if a<b:return 0
    return (kaijo[a]*gyaku[a-b]*gyaku[b])%mod
Blost,Wlost=0,0
for k in range(1,B+W):
    print(((1+Wlost-Blost)*two)%mod)
    Blost=(Blost+conb(k-1,B-1)*Xdiv[k])%mod
    Wlost=(Wlost+conb(k-1,W-1)*Xdiv[k])%mod
print(((1+Wlost-Blost)*two)%mod)
### BUGGY CODE ###

import re
n, q = map(int, input().split())
s = input()
count = 0

for i in range(q):
    n_, q_ = map(int, input().split())
    s_ = s[n_-1:q_]
    print(len(re.findall("AC", s_)))



### FIXED CODE ###

n, q = map(int, input().split())
s = input()
flag = False
count = 0
li = []

for i in range(n):
    if s[i] == "A":
        flag = True
    elif s[i] == "C" and flag is True:
        count += 1
        flag = False
    else:
        flag = False
    li.append(count)

for i in range(q):
    l, r = map(int, input().split())
    print(li[r-1] - li[l-1])
### BUGGY CODE ###

from queue import Queue

h, w = list(map(int, input().split()))
s = []
for i in range(h):
    s.append(input().strip())

ans = 0
for i in range(h):
    for j in range(w):
        start = s[i][j]
        if start == "#":
            continue
        else:
            visited = [[False for _ in range(w)] for _ in range(h)]
            visited[i][j] = True
            queue = Queue()
            queue.put((i, j, 0))

            while 0 < queue.qsize():
                now = queue.get()
                visited[now[0]][now[1]] = True
                ans = max(ans, now[2])

                if (now[0] <= (h - 2)) and (s[now[0] + 1][now[1]] == ".") and not visited[now[0] + 1][now[1]]:
                    queue.put(((now[0] + 1), now[1], (now[2] + 1)))
                if (now[1] <= (w - 2)) and (s[now[0]][now[1] + 1] == ".") and not visited[now[0]][now[1] + 1]:
                    queue.put((now[0], (now[1] + 1), (now[2] + 1)))
                if (1 <= now[0]) and (s[now[0] - 1][now[1]] == ".") and not visited[now[0] - 1][now[1]]:
                    queue.put(((now[0] - 1), now[1], (now[2] + 1)))
                if (1 <= now[1]) and (s[now[0]][now[1] - 1] == ".") and not visited[now[0]][now[1] - 1]:
                    queue.put((now[0], (now[1] - 1), (now[2] + 1)))

print(ans)


### FIXED CODE ###

from queue import Queue

h, w = list(map(int, input().split()))
s = []
for i in range(h):
    s.append(input().strip())

ans = 0
for i in range(h):
    for j in range(w):
        start = s[i][j]
        if start == "#":
            continue
        else:
            visited = [[False for _ in range(w)] for _ in range(h)]
            visited[i][j] = True
            queue = Queue()
            queue.put((i, j, 0))

            while 0 < queue.qsize():
                now = queue.get()
                ans = max(ans, now[2])

                if (now[0] <= (h - 2)) and (s[now[0] + 1][now[1]] == ".") and not visited[now[0] + 1][now[1]]:
                    queue.put(((now[0] + 1), now[1], (now[2] + 1)))
                    visited[now[0] + 1][now[1]] = True
                if (now[1] <= (w - 2)) and (s[now[0]][now[1] + 1] == ".") and not visited[now[0]][now[1] + 1]:
                    queue.put((now[0], (now[1] + 1), (now[2] + 1)))
                    visited[now[0]][now[1] + 1] = True
                if (1 <= now[0]) and (s[now[0] - 1][now[1]] == ".") and not visited[now[0] - 1][now[1]]:
                    queue.put(((now[0] - 1), now[1], (now[2] + 1)))
                    visited[now[0] - 1][now[1]] = True
                if (1 <= now[1]) and (s[now[0]][now[1] - 1] == ".") and not visited[now[0]][now[1] - 1]:
                    queue.put((now[0], (now[1] - 1), (now[2] + 1)))
                    visited[now[0]][now[1] - 1] = True

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

import sys
input = sys.stdin.readline
n, m = map(int, input().split())
dp = [0] * (n + 2)

li_broken = [0] * m
for i in range(m):
  li_broken[i] = int(input())

dp[n] = 1
li_i = list(reversed(range(n)))

for i in li_i:

  if i in li_broken:
    dp[i] = 0

  else:
    dp[i] = (dp[i+1] + dp[i+2]) % 1000000007

      
print(dp[0])

### FIXED CODE ###

def step(n):
  if n == 0:
      return 1
  steps = [0 for i in range(n + 2)]
  steps[1] = 1
  steps[2] = 2
  for i in range(3, n + 1):
    steps[i] = steps[i - 1] + steps[i - 2]
  return steps[n]

n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]

a.append(n)

sum = 1

for i in range(m + 1):

  if i == 0:
    sum *= step(a[i] - 1)
    continue
  
  elif i == m:
    sum *= step(a[m] - a[m-1] -1)
    
  elif a[i] - a[i-1] == 1:
    sum = 0
    break

  else:
    sum *= step(a[i] - a[i-1] -2)
    
if m == 0:
  sum = step(n)

print(sum % 1000000007)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)
import math
mod = 10**9 + 7
def I(): return int(input())
def II(): return map(int, input().split())
def L(): return list(map(int, input().split()))
def TWO(M):
  L=[0]*M
  R=[0]*M
  for i in range(M):
    L[i],R[i] = II()
  return L, R

N = I()
A = [0]*N
for i in range(N):
  A[i] = I()

check = [0]*N
counter = 0
all_counter = 0
while 1:
  temp = -1
  for i in range(N):
    if check[i]==0 and temp<A[i]:
      check[i]=1
      temp = A[i]
      all_counter += 1
  counter += 1
  if all_counter==N:
    break
  
print(counter)


### FIXED CODE ###

#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

from bisect import bisect_left

N = I()
A = [0]*N
for i in range(N):
    A[i] = I()

val = [-1]*N
for i in range(N):
    temp = bisect_left(val,A[i])
    val[temp-1] = A[i]

ans = 0
for i in range(N):
    if val[i]!=-1:
        ans += 1

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

import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)

R, C, K = rl()
I = [[0]*(C+2) for _ in range(R+2)]
for i in range(K):
	r, c, v = rl()
	I[r][c] = v

dp = [[[0]*4 for _ in range(C+2)] for _ in range(R+2)]

for i in range(R+1):
	for j in range(C+1):
		d = dp[i][j]
		for ni, nj in [[i+1, j], [i, j+1]]:
			nd = dp[ni][nj]
			v = I[ni][nj]
			for m in range(4):
				if i == ni:
					nd[m] = max(nd[m], d[m])
					if m < 3:
						nd[m+1] = max(nd[m+1], d[m]+v)
				else:
					nd[0] = max(nd[0], d[m])
					nd[1] = max(nd[1], d[m] + v)
ans = 0
for m in range(4):
	ans = max(ans, dp[R][C][m])
print(ans)


### FIXED CODE ###

import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 1000000007
sys.setrecursionlimit(1000000)
 
R, C, K = rl()
I = [[0]*(C+2) for _ in range(R+2)]
for i in range(K):
	r, c, v = rl()
	I[r][c] = v
 
dp = [[0]*4 for _ in range(C+2)]
dp2 = [[0]*4 for _ in range(C+2)]
 
for i in range(R+1):
	for j in range(C+1):
		for m in range(4):
			ni, nj = i, j+1
			dp[nj][m] = max(dp[nj][m], dp[j][m])
			if m < 3:
				dp[nj][m+1] = max(dp[nj][m+1], dp[j][m]+I[ni][nj])
			ni, nj = i+1, j
			dp2[nj][0] = max(dp2[nj][0], dp[j][m])
			dp2[nj][1] = max(dp2[nj][1], dp[j][m]+I[ni][nj])
	dp = dp2
	dp2 = [[0]*4 for _ in range(C+2)]
ans = 0
for m in range(4):
	ans = max(ans, dp[C][m])
print(ans)
### BUGGY CODE ###

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

while(A or C != 0):
    C = C - B
    if(C == 0):
        print("Yes")
        break
    A = A - D
    if(A == 0):
        print("No")
        break

### FIXED CODE ###

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

while(A or C <= 0):
    C = C - B
    if(C <= 0):
        print("Yes")
        break
    A = A - D
    if(A <= 0):
        print("No")
        break
### BUGGY CODE ###

t = list(input())
cnt = t.count('?')
score = 0
ans = str()

for i in range(2 ** cnt):
    PorD = [''] * cnt
    for j in range(cnt):
        if i >> j & 1:
            PorD[cnt-1-j] = 'P'
        else:
            PorD[cnt-1-j] = 'D'
    
    l = 0
    new_list = [''] * len(t)
    for k in range(len(t)):
        if t[k] == '?':
            new_list[k] = PorD[l]
            l += 1
        else:
            new_list[k] = t[k]
    
    pd = 0
    for m in range(len(new_list)-1):
        if new_list[m] == 'P' and new_list[m+1] == 'D':
            pd += 1
            
    if  score < (new_list.count('D') + pd):
        score = (new_list.count('D') + pd)
        ans = ''.join(new_list)
        
print(ans)

### FIXED CODE ###

t = input()
print(t.replace('?', 'D'))
### BUGGY CODE ###

a, b, k = map(int, input().split())
for i in range(k):
    if a > 0:
        a -= 1
        continue
    if b > 0:
        b -= 1
        continue
print('%d %d'%(a, b))

### FIXED CODE ###

a, b, k = map(int, input().split())
num = min(a, k)
a -= num
b = max(0, b - (k - num))
print(a, b)
### BUGGY CODE ###

from sys import stdin
S = (stdin.readline().rstrip())
Q = int(stdin.readline().rstrip())
cnt = 0
ccnt = 0
s = "@"
for i in range(Q):
    data = [(x) for x in stdin.readline().rstrip().split()]
    if data[0] == "2":
        ccnt = 0
        if data[1] == "1":
            if cnt % 2 == 0:
                s = "".join([data[2],s])
            else:
                s = "".join([s,data[2]])  
        else:
            if cnt % 2 == 0:
                s = "".join([s,data[2]])
            else:
                s = "".join([data[2],s])
    else:
        cnt += 1
if cnt % 2 != 0:
    s = s[::-1]
if cnt % 2 != 0:
    S = S[::-1]
ans = s.replace("@",S)
print(ans)

### FIXED CODE ###

from sys import stdin
from collections import deque
S = (stdin.readline().rstrip())
Q = int(stdin.readline().rstrip())
cnt = 0
ccnt = 0
s = deque(["@"])
for i in range(Q):
    data = [(x) for x in stdin.readline().rstrip().split()]
    if data[0] == "2":
        if data[1] == "1":
            if cnt % 2 == 0:
                s.appendleft(data[2])
            else:
                s.append(data[2])
        else:
            if cnt % 2 == 0:
                s.append(data[2])
            else:
                s.appendleft(data[2])
    else:
        cnt += 1
s = "".join(s)
if cnt % 2 != 0:
    s = s[::-1]
if cnt % 2 != 0:
    S = S[::-1]
ans = s.replace("@",S)
print(ans)
### BUGGY CODE ###

import collections

N, Q = map(int, input().split())
S = input()

new_S = S.replace("AC", "12")

count_one_list = [new_S[:i].count('1') for i in range(len(S))]

for i in range(Q):
    left, right = map(int, input().split())
    count_one = count_one_list[right-1] - count_one_list[left-1]
    print(count_one)

### FIXED CODE ###

import collections

N, Q = map(int, input().split())
S = input()

new_S = S.replace("AC", "12")


count_one_list = [0] * len(S)
for i in range(len(S)-1):
    if new_S[i] == '1' and i == 0:
        count_one_list[i+1] += 1
    elif new_S[i] == '1':
        count_one_list[i+1] = count_one_list[i] + 1
    else:
        count_one_list[i+1] = count_one_list[i]
# count_one_list = [new_S[:i].count('1') for i in range(len(S))]
# print(count_one_list)

for i in range(Q):
    left, right = map(int, input().split())
    count_one = count_one_list[right-1] - count_one_list[left-1]
    print(count_one)
### BUGGY CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]
result = []
for a in A:
    if a in result:
        result.remove(a)
    else:
        result.append(a)
print(len(result))


### FIXED CODE ###

from collections import Counter
N = int(input())
A = Counter([int(input()) for _ in range(N)])
num = 0
for a, n in A.items():
    if n % 2 == 1:
        num += 1
print(num)
### BUGGY CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]
a_max = max(a)
a_second = sorted(a)[-2]

if a.count(max(a)) >= 2:
    for _ in range(n):
        print(a_max)
else:
    for _ in range(n):
        if a[_] == max(a):
            print(a_second)
        else:
            print(a_max)


### FIXED CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]
a_ = sorted(a)
a_max = a_[-1]
a_second = a_[-2]
 
if a.count(a_max) >= 2:
    for _ in range(n):
        print(a_max)
else:
    for _ in range(n):
        if a[_] == a_max:
            print(a_second)
        else:
            print(a_max)
### BUGGY CODE ###

import math as mt 
import collections
N = int(raw_input())
MAX_SIZE = N+1
  
# stores smallest prime factor for 
# every number 
# Python3 program to generate all 
# prime numbers less than N in O(N) 


# isPrime[] : isPrime[i] is true if 
#			 number is prime 
# prime[] : stores all prime number 
#		 less than N 
# SPF[] that store smallest prime 
# factor of number [for ex : smallest 
# prime factor of '8' and '16' 
# is '2' so we put SPF[8] = 2 , 
# SPF[16] = 2 ] 
isprime = [True] * MAX_SIZE 
prime = [] 
SPF = [None] * (MAX_SIZE) 

# function generate all prime number 
# less then N in O(n) 
def manipulated_seive(N): 

	# 0 and 1 are not prime 
	isprime[0] = isprime[1] = False

	# Fill rest of the entries 
	for i in range(2, N): 
	
		# If isPrime[i] == True then i is 
		# prime number 
		if isprime[i] == True: 
		
			# put i into prime[] vector 
			prime.append(i) 

			# A prime number is its own smallest 
			# prime factor 
			SPF[i] = i 
		
		# Remove all multiples of i*prime[j] 
		# which are not prime by making is 
		# Prime[i * prime[j]] = false and put 
		# smallest prime factor of i*Prime[j] 
		# as prime[j] [ for exp :let i = 5 , j = 0 , 
		# prime[j] = 2 [ i*prime[j] = 10 ] 
		# so smallest prime factor of '10' is '2' 
		# that is prime[j] ] this loop run only one 
		# time for number which are not prime 
		j = 0
		while (j < len(prime) and
			i * prime[j] < N and
				prime[j] <= SPF[i]): 
		
			isprime[i * prime[j]] = False

			# put smallest prime factor of i*prime[j] 
			SPF[i * prime[j]] = prime[j] 
			
			j += 1
		

# A O(log n) function returning prime  
# factorization by dividing by smallest  
# prime factor at every step 
def getFac(x): 
    count=0
    ret = collections.Counter()
    while (x != 1): 
        ret[SPF[x]]+=1
        count+=1
        x //= SPF[x]
    return ret , count


manipulated_seive(MAX_SIZE)
ans = 0
for i in range(1,N+1):
    fac, count = getFac(i)
    tmp = 1
    for v in fac.values():
        tmp *= (v+1)
    ans += tmp*i
print(ans)

### FIXED CODE ###

FAST_IO = 1
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())
N = rri()
ans= 0
for i in range(1, N+1):
    first = i
    last = i*(N//i)
    ans += (last+first)*(N//i)/2
print(ans)


#26879
### BUGGY CODE ###

import numpy as np
N,M=map(int,input().split())
A=[]

for i in range(N):
    A+=[[i for i in map(int,input().split())]]
A=np.array(A)
A=A[A[:,0].argsort(),:]


count=0
price=0
for i in range(N):
    if A[0,1]>=M-count:
        price+=A[0,0]*(M-count)
        break
    else:
        price+=A[0,0]*A[0,1]
        count+=A[0,1]
    A=np.delete(A,0,0)
    
print(price)

### FIXED CODE ###

import numpy as np
N,M=map(int,input().split())
A=[]
 
for i in range(N):
    A+=[[i for i in map(int,input().split())]]
A=np.array(A)
A=A[A[:,0].argsort(),:]

count=0
price=0
for i in range(N):
    if A[i,1]>=M-count:
        price+=A[i,0]*(M-count)
        break
    else:
        price+=A[i,0]*A[i,1]
        count+=A[i,1]

print(price)
### BUGGY CODE ###

q = int(input())
a = []

for i in range(q):
    ops= list(map(int,input().split()))
    if ops[0] == 0:
        if ops[1] == 0:
            a.insert(0,ops[2])
        else:
            a.append(ops[2])
    elif ops[0] == 1:
        print(a[ops[1]])
    elif ops[0] == 2:
        if ops[1] == 0:
            a.pop(0)
        else:
            a.pop(-1)


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Jun 24 14:53:50 2018
ITP21B
@author: maezawa
"""

from collections import deque

d = deque()

n = int(input())

for i in range(n):
    c = list(map(int, input().split()))
    if c[0] == 0:
        if c[1] == 0:
            d.appendleft(c[2])
        else:
            d.append(c[2])
    elif c[0] == 1:
        print(d[c[1]])
    else:
        if c[1] == 0:
            d.popleft()
        else:
            d.pop()