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

#H = int(input())
H,N = list(map(int,input().split()))
#H = sorted(list(map(int,input().split())))
AB = [list(map(int,input().split())) for i in range(N)]
dp = [[float('inf') for i in range(H)] for j in range(N)]
for i in range(N):
    dp[i][0] = 0
for j in range(H):
    if j-AB[0][0] >= 0:
        dp[0][j] = dp[0][j-AB[0][0]]+AB[0][1]
for i in range(1,N):
    for j in range(H):
        if j-AB[i-1][0] >= 0:
            dp[i][j] = min(dp[i-1][j],dp[i][j],dp[i-1][j-AB[i-1][0]]+AB[i-1][1])
        if j-AB[i][0] >= 0:
            dp[i][j] = min(dp[i-1][j],dp[i][j],dp[i][j-AB[i][0]]+AB[i][1])
ans = float('inf')
for i in range(N):
    for j in range(max(0,H-AB[i][0]),H):
        if dp[i][j] != float('inf') and j+AB[i][0] >= H:
            ans = min(ans,dp[i][j]+AB[i][1])
print(ans)

### FIXED CODE ###

#H = int(input())
H,N = list(map(int,input().split()))
#H = sorted(list(map(int,input().split())))
AB = sorted([list(map(int,input().split())) for i in range(N)])
dp = [float('inf') for i in range(H)]
dp[0] = 0
for i in range(N):
    for j in range(H):
        if j-AB[i][0] >= 0:
            dp[j] = min(dp[j],dp[j-AB[i][0]]+AB[i][1])
ans = float('inf')
for i in range(N):
    for j in range(max(0,H-AB[i][0]),H):
        if dp[j] != float('inf') and j+AB[i][0] >= H:
            ans = min(ans,dp[j]+AB[i][1])
print(ans)
### BUGGY CODE ###

import numpy as np

n, m = map(int, input().strip().split())
dp = [float('inf')] * (1 << n)
dp[0] = 0
for i in range(m):
    a, b = map(int, input().strip().split())
    c = list(map(int, input().strip().split()))
    mask = 0b0
    for i in c:
        mask |= 0b1 << (i - 1)

    for j in range(1 << n):
        if dp[j] < float('inf'):
            dp[j | mask] = min(dp[j] + a, dp[j | mask])

print(dp[(1 << n) - 1] if dp[(1 << n) - 1] < float('inf') else -1)

### FIXED CODE ###

n,m = input().split(' ')
n = int(n)
m = int(m)
dp = [float('inf')]*2**n
dp[0] = 0
for i in range(m):
    a,b = input().split(' ')
    a = int(a)
    b = int(b)
    ngo = 0
    for j in input().split(' '):
        ngo += 2**(int(j)-1)
    for j in range(2**n):
        if dp[j|ngo] > dp[j]+a:
            dp[j|ngo] = dp[j]+a
    
if dp[2**n-1] == float('inf'):
    print(-1)
    exit(0)
print(dp[2**n-1])
### BUGGY CODE ###

a,b,n=map(int, input().split())
print(max([int(a*x/b)-a* int(x/b) for x in range(n+1)]))

### FIXED CODE ###

a,b,n = map(int, input().split())
x = min(b-1,n)
print(int(a*x/b))
### BUGGY CODE ###

l,r=map(int,input().split())
k=[]
for i in range(l,r):
    for j in range(i+1,r+1):
        k.append((i*j)%2019)
print(min(k))
        

### FIXED CODE ###

L, R = map(int, input().split())
ans = float('inf')
for i in range(L, min(L+2019, R)):
    for j in range(i+1, min(L+2019, R) + 1):
        ans = min(ans, (i*j) % 2019)
print(ans)
### BUGGY CODE ###

import sys
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    h, w = list(map(int, input().rstrip('\n').split()))
    a = [list(str(input().rstrip('\n'))) for _ in range(h)]
    ql = []
    ql = collections.deque(ql)
    fq = collections.defaultdict(list)
    for i in range(h):
        for j in range(w):
            if a[i][j] == "#":
                ql.append([0, i, j])
                fq[i, j]

    mt = 0
    while True:
        if len(ql) != 0:
            cost, x, y = ql.popleft()
            mt = max(mt, cost)
            for xv, yv in [[x + 1, y], [x - 1, y], [x, y + 1], [x, y - 1]]:
                if 0 <= xv < h and 0 <= yv < w:
                    if (xv, yv) not in fq and a[xv][yv] == ".":
                        ql.append([cost + 1, xv, yv])
                        fq[xv, yv]
        else:
            break
    print(mt)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    h, w = list(map(int, readline().split()))
    a = [[True] * w for _ in range(h)]
    ql = collections.deque()
    for i in range(h):
        s = list(str(readline().rstrip().decode('utf-8')))
        for j in range(w):
            if s[j] == "#":
                ql.append([0, i, j])
                a[i][j] = False
    while ql:
        cost, x, y = ql.popleft()
        for xv, yv in ((x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)):
            if 0 <= xv < h and 0 <= yv < w:
                if a[xv][yv]:
                    ql.append([cost + 1, xv, yv])
                    a[xv][yv] = False
    print(cost)


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

L, R = map(int, input().split())
MOD = 2019
 
if R - L >= 2019:
    print(0)
ans = (L * (L + 1)) % MOD
for i in range(L, R):
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % MOD)
 
print(ans)

### FIXED CODE ###

L, R = map(int, input().split())
MOD = 2019

if R - L >= 2019:
    print(0)
    exit()
ans = (L * (L + 1)) % MOD
for i in range(L, R):
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % MOD)

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

from collections import deque
N,K = map(int,input().split())
C = deque(map(int,input().split()))
#print(C)
ans = 1
for i in range(K):
  ans *= C[i]

for i in range(N-K):
  preans = ans
  ans *= C[K]
  ans /= C.popleft()
  if preans < ans:
    print("Yes")
  if preans >= ans:
    print("No")

### FIXED CODE ###

from collections import deque
N,K = map(int,input().split())
C = deque(map(int,input().split()))
D = C.copy()
#print(C)
ans = 1
for i in range(K):
  C.popleft()
  #ans *= C.popleft()

for i in range(N-K):
  preans = D.popleft()
  ans = C.popleft()
  #preans = ans
  #ans *= C.popleft()
  #ans /= D.popleft()
  if preans < ans:
    print("Yes")
  if preans >= ans:
    print("No")
### BUGGY CODE ###

H, W = map(int, input().split())
s_list = [input() for _ in range(H)]

yoko = [[0] * W for _ in range(H)]
tate = [[0] * H for _ in range(W)]


for i in range(H):
    S = s_list[i]
    for j in range(W):
        s = S[j]
        if s == "#":
            continue
        else:
            yoko[i][j] += 1
    for j in range(W):
        if yoko[i][j] == 1 and j > 0:
            yoko[i][j] += yoko[i][j - 1]
    for j in range(W - 1, -1, -1):
        if yoko[i][j] != 0 and j - 1 >= 0 and yoko[i][j - 1] != 0:
            yoko[i][j - 1] = yoko[i][j]
for j in range(W):
    for i in range(H):
        s = s_list[i][j]
        if s == "#":
            continue
        else:
            tate[j][i] += 1
    for i in range(H):
        if tate[j][i] == 1 and i > 0:
            tate[j][i] += tate[j][i - 1]
    for i in range(H - 1, -1, -1):
        if tate[j][i] != 0 and i - 1 >= 0 and tate[j][i - 1] != 0:
            tate[j][i - 1] = tate[j][i]

ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, tate[j][i] + yoko[i][j] - 1)
print(ans)


### FIXED CODE ###

H, W = map(int, input().split())
s_list = [input() for _ in range(H)]

yoko = [[0] * W for _ in range(H)]
tate = [[0] * H for _ in range(W)]


for i in range(H):
    S = s_list[i]
    for j in range(W):
        s = S[j]
        if s == "#":
            continue
        else:
            yoko[i][j] += 1
    for j in range(W):
        if yoko[i][j] == 1 and j > 0:
            yoko[i][j] += yoko[i][j - 1]
    for j in range(W - 1, -1, -1):
        if yoko[i][j] != 0 and j - 1 >= 0 and yoko[i][j - 1] != 0:
            yoko[i][j - 1] = yoko[i][j]
for j in range(W):
    for i in range(H):
        s = s_list[i][j]
        if s == "#":
            continue
        else:
            tate[j][i] += 1
    for i in range(H):
        if tate[j][i] == 1 and i > 0:
            tate[j][i] += tate[j][i - 1]
    for i in range(H - 1, -1, -1):
        if tate[j][i] != 0 and i - 1 >= 0 and tate[j][i - 1] != 0:
            tate[j][i - 1] = tate[j][i]

ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans, tate[j][i] + yoko[i][j] - 1)
print(ans)
### BUGGY CODE ###

k=int(input())

if k%2==0:
  print(-1); exit()

cnt=num=0
while 1:
  num+=7*pow(10,cnt,k)
  num%=k
  cnt+=1
  if num==0:
    break
print(cnt)

### FIXED CODE ###

K = int(input())

cnt=1
Num=7%K
while cnt<=K:
  if K%2==0:
    print('-1')
    break
  if Num%K==0:
    print(cnt)
    break
  else:
    Num = (10*Num + 7)%K
    cnt+=1
else:
  print('-1')
### BUGGY CODE ###

W, H = map(int, raw_input().split())

p_list = list()
q_list = list()

for i in range(W):
    p_list.append(int(raw_input()))
    
for j in range(H):
    q_list.append(int(raw_input()))

p_list.sort()
q_list.sort()

cp = H+1
cq = W+1

res = 0

while len(p_list) + len(q_list) > 0:
    if len(p_list) == 0:
        choice = 'q'
    elif len(q_list) == 0:
        choice = 'p'
    elif p_list[0] < q_list[0]:
        choice = 'p'
    else:
        choice = 'q'
    if choice == 'p':
        cq -= 1
        res += cp*p_list.pop(0)
    else:
        cp -= 1
        res += cq*q_list.pop(0)

print res 

### FIXED CODE ###

W, H = map(int, raw_input().split())

p_list = list()
q_list = list()

for i in range(W):
    p_list.append(int(raw_input()))
    
for j in range(H):
    q_list.append(int(raw_input()))

p_list.sort()
q_list.sort()

cp = H+1
cq = W+1

res = 0
pid = 0
qid = 0

while True:
    if pid == W:
        if qid == H:
            break
        else:
            choice = 'q'
    elif qid == H:
        choice = 'p'
    elif p_list[pid] < q_list[qid]:
        choice = 'p'
    else:
        choice = 'q'
    if choice == 'p':
        cq -= 1
        res += cp*p_list[pid]
        pid += 1
    else:
        cp -= 1
        res += cq*q_list[qid]
        qid += 1

print res
### BUGGY CODE ###

from itertools import permutations
import sys
input = sys.stdin.readline

if __name__ == "__main__":
    N, M, _ = map(int, input().split())
    R = list(map(int, input().split()))
    INF = float("inf")
    T = [[INF] * N for _ in range(N)]
    for _ in range(M):
        a, b, c = tuple(map(int, input().split()))
        T[a-1][b-1] = c
        T[b-1][a-1] = c
    for k in range(N):
        for i in range(N):
            for j in range(N):
                T[i][j] = min(T[i][j],T[i][k]+T[k][j])

    print(min(sum(T[r1-1][r2-1] for r1, r2 in zip(rs, rs[1:])) for rs in permutations(R)))

### FIXED CODE ###

from itertools import permutations
import sys
input = sys.stdin.readline

def main():
    N, M, RR = map(int, input().split())
    R = list(map(int, input().split()))
    INF = float("inf")
    T = [[INF] * N for _ in range(N)]
    for _ in range(M):
        a, b, c = tuple(map(int, input().split()))
        T[a-1][b-1] = c
        T[b-1][a-1] = c
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if T[i][j] > T[i][k]+T[k][j]:
                    T[i][j] = T[i][k]+T[k][j]
    ans = INF
    for rs in permutations(R):
        cost = 0
        for i in range(RR-1):
            cost += T[rs[i]-1][rs[i+1]-1]
        ans = min(ans, cost)
    print(ans)

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

n, m, k = map(int, input().split())

graph = [[] for _ in range(n + 1)]
friends = [set() for _ in range(n + 1)]
for _ in range(m):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)
    friends[a].add(b)
    friends[b].add(a)

block = [set() for _ in range(n + 1)]

for _ in range(k):
    c, d = map(int, input().split())
    block[c].add(d)
    block[d].add(c)

def dfs(graph, start):
    visited = set([start])
    stack = []
    for f in graph[start]:
        stack.append(f)
    can_reach = set()
    while stack:
        friend = stack.pop()
        visited.add(friend)
        candidates = graph[friend]
        for c in candidates:
            if c not in visited:
                if c not in block[start] and c not in friends[start]:
                    can_reach.add(c)
                stack.append(c)
    return can_reach

ans = []
for i in range(1, n + 1):
    c = dfs(graph, i)
    ans.append(len(c))
print(*ans)

### FIXED CODE ###

n, m, k = map(int, input().split())

graph = [[] for _ in range(n + 1)]
for _ in range(m):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

block = [[] for _ in range(n + 1)]

for _ in range(k):
    c, d = map(int, input().split())
    block[c].append(d)
    block[d].append(c)

def dfs(graph, start):
    visited = set([start])
    stack = []
    can_reach = set([start])
    for f in graph[start]:
        stack.append(f)
        can_reach.add(f)
    while stack:
        friend = stack.pop()
        visited.add(friend)
        candidates = graph[friend]
        for c in candidates:
            if c not in visited:
                can_reach.add(c)
                stack.append(c)
    return can_reach

labels = [None] * (n + 1)
for i in range(1, n + 1):
    if labels[i] is None:
        c = dfs(graph, i)
        for j in c:
            labels[j] = [i, len(c)]

ans = []
for i in range(1, n + 1):
    num = labels[i][1] - 1
    for j in graph[i]:
        if labels[i][0] == labels[j][0]:
            num -= 1
    for k in block[i]:
        if labels[i][0] == labels[k][0]:
            num -= 1
    ans.append(num)
print(*ans)
### BUGGY CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
BC0 = [0]*M
for m in range(M):
    BC0[m] = list(map(int, input().split()))
A.sort()
BC0.sort(key=lambda x:x[1])
BC = []
for bc0 in BC0:
    BC = BC + [bc0[1]]*bc0[0]

S = [0] * (N+1)
S[0] = sum(A)
for n in range(min(N,len(BC))):
    S[n+1] = S[n] - A[n] + BC[-n-1]
print(max(S))

### FIXED CODE ###

N, M = map(int, input().split())
A0 = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]

A = [[1,a] for a in A0] 
ABC = A + BC
ABC.sort(key=lambda x:x[1], reverse=True)

summation = 0
p = 0
n = 0

while n<N:
    summation += ABC[p][1] * (min(ABC[p][0], N-n))
    n += min(ABC[p][0], N-n)
    p += 1

print(summation)
### BUGGY CODE ###

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

dic = {}
dic[1] = 2
dic[2] = 5
dic[3] = 5
dic[4] = 4
dic[5] = 5
dic[6] = 6
dic[7] = 3
dic[8] = 7
dic[9] = 6

ls = [-1]*8
dp = [-1]*(N+1)
dp[0] = ''
for i in a:
  j = dic[i]
  if ls[j]<i:
    ls[j] = i

tag = []
for i in range(len(ls)):
  if ls[i]!=-1:
    tag += [i]
for i in range(N+1):
  for j in tag:
    if i-j>-1 and dp[i-j]!=-1:
      s = str(ls[j])+str(dp[i-j])
      s = int(s)
      if i-j==0 and dp[i]<s:
        dp[i] = s
      elif dp[i]<s:
        dp[i] = s
m = 0

print(dp[N])

### FIXED CODE ###

n,m=map(int,input().split())
A=list(map(int,input().split()))
L=[0,2,5,5,4,5,6,3,7,6]
dp=[0]+[-1]*n
for i in range(n+1):
  for a in A:
    if i+L[a]<=n:
      dp[i+L[a]]=max(dp[i+L[a]],dp[i]*10+a)
print(dp[n])
### BUGGY CODE ###

import numpy as np

S = input()
N = len(S)
ans = np.zeros(N, dtype=np.int)

for i in range(0,N-1):
  j = 0
  while S[i+j] == 'R':
    j += 1
  if j != 0:
    if j % 2 == 0:
      ans[i+j] += 1
    else:
      ans[i+j-1] += 1

for i in range(N-1, 0, -1):
  j = 0
  while S[i-j] == 'L':
    j += 1
  if j != 0:
    if j % 2 == 0:
      ans[i-j] += 1
    else:
      ans[i-j+1] += 1
print(*ans)

### FIXED CODE ###

import numpy as np

S = input()
N = len(S)
ans = np.zeros(N, dtype=np.int)

j = 0
for i in range(0,N-1):
  if j != 0:
    j -= 1
  if j == 0:
    while S[i+j] == 'R':
      j += 1
  if j != 0:
    if j % 2 == 0:
      ans[i+j] += 1
    else:
      ans[i+j-1] += 1

j = 0
for i in range(N-1, 0, -1):
  if j != 0:
    j -= 1
  if j == 0:
    while S[i-j] == 'L':
      j += 1
  if j != 0:
    if j % 2 == 0:
      ans[i-j] += 1
    else:
      ans[i-j+1] += 1
print(*ans)
### BUGGY CODE ###

from collections import Counter, defaultdict
from math import sqrt

MOD = 10**9+7
p_list = defaultdict(int)

def prime_decomposition(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)
    return table


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

    for i in a:
        l = Counter(prime_decomposition(i))
        for k, v in l.items():
            p_list[k] = max(p_list[k], v)
    
    lcm = 1
    for k, v in p_list.items():
        lcm *= int(k)**v

    ans = 0
    for i in a:
        ans += lcm // i

    print(int(ans) % MOD)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from functools import reduce
from fractions import gcd

MOD = 10**9+7

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

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

    lcm = reduce(lcm_base, a, 1)
    
    ans = 0
    for i in a:
        ans += lcm // i

    print(ans % MOD)


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

s=' '+input()
t=' '+input()
dp=[]
dp_l=[]
for i in range(len(s)):
    sub_list=[]
    l_list=[]
    for j in range(len(t)):
        sub_list.append('')
        l_list.append(0)
    dp.append(sub_list)
    dp_l.append(l_list)
for i in range(1,len(s)):
    for j in range(1,len(t)):
        if s[i]==t[j]:
            dp[i][j]=dp[i-1][j-1]+s[i]
            dp_l[i][j]=dp_l[i-1][j-1]+1
        else:
            if dp_l[i-1][j]>dp_l[i][j-1]:
                dp[i][j]=dp[i-1][j]
                dp_l[i][j]=dp_l[i-1][j]
            else:
                dp[i][j]=dp[i][j-1]
                dp_l[i][j]=dp_l[i][j-1]
print(dp[len(s)-1][len(t)-1])


### FIXED CODE ###

import sys
input=sys.stdin.readline
s=' '+input().rstrip()
t=' '+input().rstrip()
m=len(s)-1
n=len(t)-1
dp=[[0]*(n+1) for i in range(m+1)]
for i in range(1,m+1):
    for j in range(1,n+1):
        if s[i]==t[j]:
            dp[i][j]=dp[i-1][j-1]+1
        else:
            dp[i][j]=max(dp[i-1][j],dp[i][j-1])
ans=''
while m>0 and n>0:
    if dp[m][n]==dp[m][n-1]:
        n-=1
    elif dp[m][n]==dp[m-1][n]:
        m-=1
    elif dp[m][n]==dp[m-1][n-1]+1:
        ans=s[m]+ans
        m-=1
        n-=1
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
mx = 0
for i in a:
  count = a.count(i) + a.count(i+1) +a.count(i+2)
  if count > mx:
    mx = count
print(mx)

### FIXED CODE ###

n = int(input())
x = [0]*100001
a = list(map(int,input().split()))
m = 0
ma = 0
for i in range(n):
    x[a[i]]+=1
for i in range(100001-2):
    m=x[i]+x[i+1]+x[i+2]
    if m>ma:
        ma=m
print(ma)
### BUGGY CODE ###

n=int(input())
s=input()
q=int(input())
No=2
while n>No:
    No*=2
tree=[set()]*(2*No)
def add(k,x):
    k+=No-1
    tree[k]=set([x])
    while k>0:
        k=(k-1)//2
        tree[k]=tree[2*k+1]|tree[2*k+2]
def query(l,r):
    L=l+No-1
    R=r+No-1
    s=set()
    while L<=R:
        if R&1:
            s|=tree[R]
            R-=2
        else:
            R-=1
        if L&1:
            L-=1
        else:
            s|=tree[L]
        L>>=1;R>>=1
    return len(s)
for i,j in enumerate(s):
    add(i,j)
for i in range(q):
    a,b,c=input().split()
    a,b=int(a),int(b)
    if a==1:
        add(b-1,c)
    if a==2:
        c=int(c)
        print(query(b-1,c-1))

### FIXED CODE ###

n=int(input())
s=input()
q=int(input())
dic=dict()
for i,j in enumerate("qwertyuioplkjhgfdsazxcvbnm"):
    dic[j]=i
No=2
while n>No:
    No*=2
tree=[set()]*(2*No)
def add(k,x):
    k+=No-1
    tree[k]=set([dic[x]])
    while k>0:
        k=(k-1)//2
        tree[k]=tree[2*k+1]|tree[2*k+2]
def query(l,r):
    L=l+No-1
    R=r+No-1
    s=set()
    while L<=R:
        if R&1:
            s|=tree[R]
            R-=2
        else:
            R-=1
        if L&1:
            L-=1
        else:
            s|=tree[L]
        L>>=1;R>>=1
    return len(s)
for i,j in enumerate(s):
    tree[i+No-1]=set([dic[j]])
for i in range(No-2,-1,-1):
    tree[i]=tree[2*i+1]|tree[2*i+2]
for i in range(q):
    a,b,c=input().split()
    a,b=int(a),int(b)
    if a==1:
        add(b-1,c)
    if a==2:
        c=int(c)
        print(query(b-1,c-1))
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
result = []
for i in range(1, N+1):
  print(A.count(i))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
result = {}
for i in range(N):
  result[i+1] = 0
for i in range(N-1):
  if A[i] in result:
    result[A[i]] += 1
for i in result.values():
  print(i)
### BUGGY CODE ###

N,K = map(int,input().split())
for i in range(1,10**9):
    if K**i <= N < K**(i+1):
        print(i+1)
    

### FIXED CODE ###

N,K = map(int,input().split())
if N == 0 or N == 1:
    print(1)
for i in range(1,100):
    if K**i <= N < K**(i+1):
        print(i+1)
        break
### BUGGY CODE ###

import numpy as np
k = int(input())
n = 0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
      n += np.gcd.reduce([j, i, l])
print(n)


### FIXED CODE ###

from math import gcd
k = int(input())+1
n = 0
for i in range(1,k):
  for j in range(i,k):
    for l in range(j, k):
      if i == j == l:
        n += gcd(i,gcd(j,l))
      elif i == j or j == l or l == i:
        n += gcd(i,gcd(j,l))*3
      else:
        n += gcd(i,gcd(j,l))*6
print(n)
### BUGGY CODE ###

#create date: 2020-04-26 21:06

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    s = ns()
    n = len(s)
    now = 0
    m = [0] * 2019
    for i in range(n):
        now = (now + int(s[n-i-1]) * (10**i)) % 2019
        #print(now)
        m[now] += 1
    ans = m[0]
    for mi in m[1:]:
        ans += (mi-1) * mi //2
    print(ans)

    
if __name__ == "__main__":
    main()

### FIXED CODE ###

#create date: 2020-04-26 21:06

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    s = ns()
    n = len(s)
    now = 0
    m = [0] * 2019
    for i in range(n):
        now = (now + int(s[n-i-1]) * pow(10, i, 2019)) % 2019
        #print(now)
        m[now] += 1
    m[0] += 1
    ans = 0
    for mi in m:
        ans += (mi-1) * mi //2
    print(ans)

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

s=input()

n=len(s)

x=[1]*n
z=[]
itr=0

for i in range(10**100):
	y=[0]*n
	for j in range(n):
		if s[j]=='R':
			y[j+1]+=x[j]       
		else:
			y[j-1]+=x[j]
	x=y
	z.append(y)
	if i>=2 and y==z[i-2]:
		itr=i
		break

if (10*100-itr)%2==0:
	res=z[itr-1]
else:
	res=z[itr-2]

print(*res)

### FIXED CODE ###

s=input()

n=len(s)
x=[1]*n
x[n-1]=0
y=[1]*n
y[0]=0
z=[0]*n

for i in range(0,n-1):
	if s[i]=='R' and s[i+1]=='R':
		x[i+1]+=x[i]
		x[i]=0
	if s[i]=='L':
		x[i]=0   

for i in range(n-1,0,-1):
	if s[i]=='L' and s[i-1]=='L':
		y[i-1]+=y[i]
		y[i]=0
	if s[i]=='R':
		y[i]=0

i=1
while i<=n-2:
	if x[i]>1:
		if x[i]%2==0:
			x[i]=x[i]//2
			x[i+1]=x[i]
		else:
			x[i]=x[i]//2+1
			x[i+1]=x[i]-1
		i+=1
	i+=1
        
i=n-2
while i>=1:
	if y[i]>1:
		if y[i]%2==0:
			y[i]=y[i]//2
			y[i-1]=y[i]
		else:
			y[i]=y[i]//2+1
			y[i-1]=y[i]-1
		i-=1
	i-=1

for i in range(n):
	z[i]=x[i]+y[i]

print(*z)
### BUGGY CODE ###

# -*- coding: utf-8 -*-


def check(a_list :list, X :int) -> int:
    count=0
    for num in a_list:
        diff = num - X
        if abs(diff) <=1:
            count += 1
    
    return count
   
#----------
N = int(input().strip())
a_list = list(map(int, input().rstrip().split()))
#----------
a_set=set(a_list)

count = 0
for X in a_set:
    tmp_count=check(a_list,X)
    
    if tmp_count > count:
        count = tmp_count
        result_X = X
    
print(count)


### FIXED CODE ###

# -*- coding: utf-8 -*-


N = int(input().strip())
a_list = list(map(int, input().rstrip().split()))
#----------
a_set=set(a_list)
count_dic={}
for X in a_set:
    count_dic[str(X)] = 0
    count_dic[str(X+1)] = 0
    count_dic[str(X-1)] = 0

count = 0
for X in a_list:
    count_dic[str(X)] += 1
    count_dic[str(X+1)] += 1
    count_dic[str(X-1)] += 1
    
print(max(count_dic.values()))
### BUGGY CODE ###

import itertools
n = int(input())
a = list(map(int,input().split()))
arr = [0]
ans = 0
for i, j in enumerate(a):
    arr.append(arr[i] + j)

_set = set(arr)
for i in _set:
    c = arr.count(i)
    if c == 2:
        ans += 1
    elif c > 2:
        ans += (c * (c - 1)) // 2

print(ans)

### FIXED CODE ###

import itertools
from collections import Counter

n = int(input())
a = list(map(int,input().split()))
arr = [0]
arr += list(itertools.accumulate(a))
ans = 0

c = Counter(arr)
for v in c.values():
    if v > 1:
        ans += v * (v - 1) // 2

print(ans)