Harryxun/stf_run huggingface dataset:
N = int(input())


for n in range(1,N+1):
    if n < 3:
        print(0)
    else:
        M =int((n-2)**0.5)
        count = 0
        for x in range(1,M+1):
            #P=x**2+y**2+z**2+x*y+y*z+z*x
            for y in range(1,M+1):
                #Q=x**2+y**2+z**2+x*y+y*z+z*x
                for z in range(1,M+1):
                    #R = x**2+y**2+z**2+x*y+y*z+z*x
                    if x**2+y**2+z**2+x*y+y*z+z*x == n:
                        count = count + 1
                    else:
                        pass
        print(count)



### FIXED CODE ###

li = list(map(int, input().split())) 
L = li[0]
R = li[1]
d = li[2]

#print(L)
#print(R)
#print(d)

count = 0

for X in range (L,R+1):
 if X % d == 0:
  count = count + 1
 else:
  pass

print(count)
#!/usr/bin/env python3
import sys
INF = float("inf")

MOD = 1000000007  # type: int


def solve(N: int, A: "List[int]"):
    RGB = [-1, -1, -1]
    ans = 1
    for a in A:
        mi = None
        count = 0
        for i in range(3):
            if RGB[i] == a-1:
                if mi == None:
                    mi = i
                count += 1
        ans *= count
        ans %= MOD
        RGB[mi] = a
    print(ans)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
INF = float("inf")

MOD = 1000000007  # type: int


def solve(N: int, A: "List[int]"):
    RGB = [-1, -1, -1]
    ans = 1
    for a in A:
        count = 0
        for i in range(3):
            if RGB[i] == a-1:
                if count == 0:
                    RGB[i] = a
                count += 1
        if count > 1:
            ans *= count
            ans %= MOD
        elif count == 0:
            ans = 0
            print(ans)
            return
    print(ans)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()
a,b,c = input().split()

if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
    print('YES')
else:
    print(ans)

### FIXED CODE ###

a,b,c = input().split()

if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
    print('YES')
else:
    print('NO')
print("Yes" if set(input()) == {a,b,c} else "No")

### FIXED CODE ###

print("Yes" if set(input()) == {"a","b","c"} else "No")
class Dice:
    def __init__(self, data):
        self.data = data

    def move(self, direction):
        if direction == 'E':
            self.data[0],self.data[3], self.data[5], self.data[2] = \
                self.data[3],self.data[5], self.data[2], self.data[0] 
        elif direction == 'N':
            self.data[0],self.data[1], self.data[5], self.data[4] = \
                self.data[1],self.data[5], self.data[4], self.data[0]
        elif direction == 'S':
            self.data[0],self.data[1], self.data[5], self.data[4] = \
                self.data[4],self.data[0], self.data[1], self.data[5]
        elif direction == 'W':
            self.data[0],self.data[2], self.data[5], self.data[3] = \
                self.data[2],self.data[5], self.data[3], self.data[0]

    def getTop(self):
        return self.data[0]

dice = Dice.Dice(input().split())
cmd = input()
for i in range(len(cmd)):
    dice.move(cmd[i])
print(dice.getTop())

### FIXED CODE ###

class Dice:
    def __init__(self, data):
        self.data = data

    def move(self, direction):
        if direction == 'E':
            self.data[0],self.data[3], self.data[5], self.data[2] = \
                self.data[3],self.data[5], self.data[2], self.data[0] 
        elif direction == 'N':
            self.data[0],self.data[1], self.data[5], self.data[4] = \
                self.data[1],self.data[5], self.data[4], self.data[0]
        elif direction == 'S':
            self.data[0],self.data[1], self.data[5], self.data[4] = \
                self.data[4],self.data[0], self.data[1], self.data[5]
        elif direction == 'W':
            self.data[0],self.data[2], self.data[5], self.data[3] = \
                self.data[2],self.data[5], self.data[3], self.data[0]

    def getTop(self):
        return self.data[0]

dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
    dice.move(cmd[i])
print(dice.getTop())
n, k = map(int, input().split())
n %= m
print(min(n, k - n))

### FIXED CODE ###

n, k = map(int, input().split())
n %= k
print(min(n, k - n))
import math
N, D = int(input())
cnt = 0

for n in range(0, N):
  x, y = int(input())
  if math.sqrt(x^2 + y^2) > D:
    cnt += 1

print(cnt)

### FIXED CODE ###

import numpy as np

N, D = list(map(int, input().split())) 
cnt = 0
for n in range(0, N):
  x, y = list(map(int, input().split())) 
  if  (x*x + y*y) <= D*D:
    cnt += 1

print(cnt)
import itertools

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

AB = []
for p in itertools.product(A, B):
    AB.append(sum(p))
AB.sort(reverse=True)
AB = AB[:K]

l = []
for p in itertools.product(AB, C):
    l.append(sum(p))
l.sort(reverse=True)
for i in range(K):
    print(l[i])

### FIXED CODE ###

l = [int(input()) for _ in range(5)]
k = int(input())
if max(l) - min(l) > k:
    print(':(')
else:
    print('Yay!')
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


const int N_MAX = 100001;
VI prime;
void generate_prime() {
    prime.push_back(2); 
    FOR(i, 3, N_MAX) {
        for(auto p : prime) {
            if(i % p == 0) break;
            if(p > sqrt(i)) {
                prime.push_back(i);
                break;
            }
        }
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    generate_prime();
    set<int> prime1(ALL(prime));
    set<int> prime2;
    for(auto& p : prime1) {
        if(p == 2) continue;
        if(prime1.count((p + 1) / 2) == 1) prime2.insert(p);
    }
    VI ans(N_MAX);
    ans[0] = 0;
    FOR(i, 1, N_MAX - 1) {
        if(prime2.count(i) == 1) ans[i] = ans[i - 1] + 1;
        else ans[i] = ans[i - 1];
    }
    
    int q;
    cin >> q;
    REP(i, q) {
        int l, r;
        cin >> l >> r;
        cout << ans[r] - ans[l - 1] << '\n';
    }
    return 0;
}


### FIXED CODE ###

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


def generate_prime(p_max):
    prime = [2]
    for i in range(3, p_max + 1):
        for p in prime:
            if i % p == 0:
                break
            if p > math.sqrt(i):
                prime.append(i)
                break
    return prime


def main():
    prime = generate_prime(10**5)
    prime = set(prime)
    prime2 = set()
    for p in prime:
        if p == 2:
            continue
        if (p + 1) / 2 in prime:
            prime2.add(p)
    ans = [0] * (10**5 + 1)
    for i in range(1, 10**5 + 1):
        if i in prime2:
            ans[i] = ans[i - 1] + 1
        else:
            ans[i] = ans[i - 1]

    q = int(input())
    queries = [[int(i) for i in input().split()] for _ in range(q)]
    for query in queries:
        print(ans[query[1]] - ans[query[0] - 1])


if __name__ == '__main__':
    main()
ans=0
def solve(n,left,right):
    if n==10:
        ans=1
    else:
        if a[n]>left:
            ans=solve(n+1,a[n],right)
        if a[n]>right:
            ans=solve(n+1,left,a[n])
    return ans

n=int(input())
for _ in range(n):
    a=[int(i) for i in input().split()]
    print("YES" if solve(0,0,0) else "NO")
    

### FIXED CODE ###

ans=0
def solve(n,left,right):
    global ans
    if n==10:
        ans=1
    else:
        if a[n]>left:
            ans=solve(n+1,a[n],right)
        if a[n]>right:
            ans=solve(n+1,left,a[n])
    return ans

n=int(input())
for _ in range(n):
    a=[int(i) for i in input().split()]
    print("YES" if solve(0,0,0) else "NO")
    ans=0
n = int(input())
a = [*map(int, input().split())]
a.sort()
ans = 0
for i in range(n - 1):
    ans += a[i + 1] - a[i]
print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(n - 1):
    ans += a[i + 1] - a[i]
print(ans)
n,a,b=map(int,input().split())
if n>1 and b>=a or n==1 and a==b: 
    print ((n-2)*(b-a)+1);
else:
    print ("0");

### FIXED CODE ###

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

min_sum = a * (n - 1) + b
max_sum = b * (n - 1) + a

print(max(max_sum - min_sum + 1, 0))
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

    N = II()
    A = LMIIS()
    A.sort()
    ans = 0
    exists = [False] * (2*10**5+1)
    for a in A:
        exists[a] = True
    for i,a in enumerate(A):
        j = 0
        while A[j] ** 2 <= a:
            if a % A[j] == 0:
                break
            j += 1
        else:
            # if i == 0:
            #     dbg(i,a)
            #     ans += 1
            #     continue
            j = i-1
            while j >= 0 and a**0.5 <= A[j]:
                if a % A[j] == 0:
                    break
                j -=1
            else:
                if A.count(a) == 1:
                    ans += 1
    print(ans)


    
main()

### FIXED CODE ###

def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

    N = II()
    A = LMIIS()
    ans = 0
    count = defaultdict(int)
    for a in A:
        count[a] += 1
    A = list(set(A))
    A.sort()

    if count[1] == 1:
        print(1)
        return
    if count[1] > 1:
        print(0)
        return

    sup = max(A)+1
    Not_Divisible = [True] * sup
    Not_Divisible[0] = False


    for a in A:
        if Not_Divisible[a]:
            for i in range(a*2,sup,a):
                Not_Divisible[i] = False

    ans = 0
    for a in A:
        if Not_Divisible[a] and count[a] == 1:
            ans += 1

    print(ans)
            


    
main()
s=input()
l=[]
i=0
while len(l)!=3:
  if s[i] not in l:
    l.append(s[i])
  else:
    l.clear()
    l.append(s[i])
  i+=1
print(''.join(l))


### FIXED CODE ###

s=input()
print(s[0:3])
import sys

def S(): return sys.stdin.readline().rstrip()

N,M = map(int,S().split())
mod = 10**9+7

a = M  # (M_P_N)**2
for i in range(1,N):
    a *= M-i
    a %= mod

# 包除原理
# 2つめの条件は常に成り立った状況で考える
# {1,…,N}の部分集合Sの元iに対してA_i=B_iが成り立つようなA_1,…,B_1,…の組の個数を考える
ans = a**2 % mod
r = ans
for i in range(1,N+1):
    r *= (N-i+1)*pow(i,-1,mod)*pow(M-i+1,-1,mod)*(-1)
    r %= mod
    ans += r
    ans %= mod

print(ans)

### FIXED CODE ###

import sys

def S(): return sys.stdin.readline().rstrip()

N,M = map(int,S().split())
mod = 10**9+7

a = M  # (M_P_N)**2
for i in range(1,N):
    a *= M-i
    a %= mod

# 包除原理
# 2つめの条件は常に成り立った状況で考える
# {1,…,N}の部分集合Sの元iに対してA_i=B_iが成り立つようなA_1,…,B_1,…の組の個数を考える
ans = a**2 % mod
r = ans
for i in range(1,N+1):
    r *= (N-i+1)*pow(i,-1,mod)*pow(M-i+1,-1,mod)*(-1)
    r %= mod
    ans += r
    ans %= mod

print(ans)
import numpy as np
from itertools import combinations
if n==1:
    print(int(input()))
else:
    n,k = map(int,input().split())
    lis = input().split()
    total =np.inf

    for i in combinations(lis,k):
        ml =0

        for a in i:

            ml += int(a)

        total = min(total,ml)


    print(total)

### FIXED CODE ###

n,k = map(int,input().split())
if n==1:
    print(int(input()))
else:
    total = 0
    lis = list(map(int,input().split()))
    lis.sort()
    for i in range(k):
        total += lis[i]
    print(total)
n = int(input())
l = ["".join(sorted(input())) for _ in range(n)]
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

d = {}
for i in range(n):
  if l[i] not in d:
    d[l[i]] = 1
  else:
    d[l[i]] += 1

ans = 0
for a in d.values():
  if a > 1:
    ans += cmb(a,2)
print(ans)

### FIXED CODE ###

n = int(input())
l = ["".join(sorted(input())) for _ in range(n)]
ans = 0
d = {}
for i in range(n):
  if l[i] not in d:
    d[l[i]] = 1
  else:
    ans += d[l[i]]
    d[l[i]] += 1
print(ans)
N=list(int(input()))
if N[1]==N[2]:
    if N[1]==N[0]:
        print('Yes')
    elif N[2]==N[3]:
        print('Yes')
    else:
        print('No')
else:
    print('No')

### FIXED CODE ###

N=list(input())
if N[1]==N[2]:
    if N[1]==N[0]:
        print('Yes')
    elif N[2]==N[3]:
        print('Yes')
    else:
        print('No')
else:
    print('No')
import math
n,d=input().split()
n=int(n)
d=int(d)
def combinations(n, r):
    return math.factorial(n)/(math.factorial(n-r)*math.factorial(r))
x=[]
if d==1:
  count=combinations(n,2)
  count = int(count)
else:
  for i in range(n):
    xa=[int(s) for s in input().split()]
    x.append(xa)
  a=[]
  for i in range(n-1):
    for j in range(i+1,n):
      t=[]
      for k in range(d):
        c=(x[i][k]-x[j][k])*(x[i][k]-x[j][k])
        t.append(c)
        if k==d-1:
          a.append(sum(t))
  answer=list(map(lambda x:pow(x,1/2),a))
  count=0
  for l in range(n):
    if answer[l].is_integer()==True:
      count=count+1
      print(count)
print(count)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys

N, D = map(int, input().split())
s_lines = sys.stdin.readlines()

ans = 0
X_list_list = []
for s in s_lines:
    new_list = list(map(int, s.split()))
    for i in range(len(X_list_list)):
        sum_num = float(0)
        for idx, ite in enumerate(X_list_list[i]):
            sum_num += (new_list[idx] - ite) ** 2
        if pow(sum_num, 0.5).is_integer():
            ans += 1
    X_list_list.append(new_list)

print(ans)
K, N = map(int, input().split())
A = [int(e) for e in input().split()]

ans = 0
for i in range(N - 2):
    S = [A[i + 1] - A[i]]
    S.append((K - A[N - 1]) + A[0])
    S.sort
    for n in range(N - 1):
        ans += S[i]
print(ans)

### FIXED CODE ###

K, N = map(int, input().split())
A = [int(e) for e in input().split()]

ans = 0
S = [(A[i + 1] - A[i]) for i in range(N - 1)]
S.append((K - A[N - 1]) + A[0])
S.sort
m = sorted(S)
for n in range(N - 1):
    ans += m[n]
print(ans)
def gcd(a,b):
    c=max(a,b)
    d=min(a,b)
    while True:
        if c%d==0:
            return d
        c,d=d,c%d

def gcd_list(A):
    if len(A)==2:
        return gcd(A[0],A[1])
    elif len(A)==1:
        return A[0]
    else:
        return gcd(gcd_list(A[len(A)//2:]),gcd_list(A[:len(A)//2]))
max_gcd=1
for i in range(N):
    max_gcd=max(gcd_list(A[:i]+A[i+1:]),max_gcd)
    
print(max_gcd)

### FIXED CODE ###

def gcd(a,b):
	a,b = max(a,b),min(a,b)
	while a%b!=0:
   		a,b = b,a%b
	return b

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

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

S2 = [A[N-1]]
s = A[N-1]
for i in range(1,N-1):
    s=gcd(s,A[N-i-1])
    S2.append(s)

max_gcd = 1
for i in range(N):
    if i==0:
        max_gcd=max(max_gcd,S2[N-2])
    elif i==N-1:
        max_gcd=max(max_gcd,S1[N-2])
    else:
        max_gcd=max(max_gcd,gcd(S1[i-1],S2[N-2-i]))

print(max_gcd)
A,B=map(int,input().split())
A={1,3,5,7,8,10,12}
B={4,6,9,11}
print("Yes" if {x,y} <= A or {x,y} <= B else "No")

### FIXED CODE ###

x,y = map(int, input().split())
A = {1, 3, 5, 7, 8, 10, 12}
B = {4, 6, 9, 11}
print("Yes" if {x, y} <= A or {x, y} <= B else "No")
X = int(input())
	if X in [7, 5, 3]:
    	print('YES')
	else:
		print('NO')


### FIXED CODE ###

X = int(input())
if X == 7:
  print('YES')
elif X == 5:
  print('YES')
elif X == 3:
  print('YES')
else:
  print('NO')
print("Yes" if input()==input()[:-1])

### FIXED CODE ###

a=input()
b=input()
print("Yes" if a==b[:-1] and len(a)+1==len(b) else "No")
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n,m,r=na()
rs = na()
for i in range(r):
    rs[i] -= 1

g = [[99999999999]*n for _ in range(n)]
for i in range(n):
    g[i][i] = 0
for i in range(m):
    a, b, c = na()
    a -= 1
    b -= 1
    g[a][b] = g[b][a] = c

from heapq import *
def dijkstra(g, start):
    n = len(g)
    ds = [1e18] * n
    ds[start] = 0
    h = []
    heappush(h, (0, start))
    while len(h) > 0:
        d, cur = heappop(h)
        if d != ds[cur]: continue
        for e, ew in g[cur]:
            if d + ew < ds[e]:
                ds[e] = d + ew
                heappush(h, (ds[e], e))
    return ds

def dijkstra_dense(g, start):
    n = len(g)
    ds = [1e18] * n
    ds[start] = 0

    done = [0] * n
    while True:
        lmin = 1e19
        arg = -1
        for i in range(n):
            if not done[i] and ds[i] < lmin:
                lmin = ds[i]
                arg = i
        if arg == -1: break
        done[arg] = 1
        for i in range(n):
            ds[i] = min(ds[i], lmin + g[arg][i])
    return ds


dss = [None] * n
for r in rs:
    dss[r] = dijkstra_dense(g, r)

from itertools import *

ans = 9999999999999999999
for ord in permutations(rs):
    w = 0
    for i in range(1, r):
        w += dss[ord[i-1]][ord[i]]
    ans = min(ans, w)
print(ans)


### FIXED CODE ###

import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n,m,r=na()
rs = na()
for i in range(r):
    rs[i] -= 1

g = [[99999999999]*n for _ in range(n)]
for i in range(n):
    g[i][i] = 0
for i in range(m):
    a, b, c = na()
    a -= 1
    b -= 1
    g[a][b] = g[b][a] = c

for k in range(n):
    for i in range(n):
        for j in range(n):
            g[i][j] = min(g[i][j], g[i][k] + g[k][j])

from itertools import *

ans = 9999999999999999999
for ord in permutations(rs):
    w = 0
    for i in range(1, r):
        w += g[ord[i-1]][ord[i]]
    ans = min(ans, w)
print(ans)
s = input().strip()
K = int(input())


def min_substring(s, l, num):
    substrings = list(set([s[i:i+l] for i in range(len(s)-l+1)]))
    substrings.sort()

    return substrings[num]




rank = 0
top = min_substring(s, 1, rank)
res = top
k = 1
l = 2

while k < K:
    substrings = list(set([s[i:i+l] for i in range(len(s)-l+1) if s[i:i+l-1] == res]))
    substrings.sort()

    if len(substrings) == 0:
        rank += 1
        top = min_substring(s, 1, rank)
        res = top
        k += 1
        continue
    else:
        for string in substrings:
            k += 1
            res = string
            break

        l += 1

print(res)



### FIXED CODE ###

s = input().strip()
K = int(input())

indices = [0]*5
substrings = [sorted(list(set([s[i:i+l] for i in range(len(s)-l+1)])))[:5]+['zzzzz'] for l in range(1,6)]
for k in range(K):
    s = min(substrings[l][i] for l, i in enumerate(indices))
    # print([substrings[l][i] for l, i in enumerate(indices)])
    indices[len(s)-1] += 1
    if k == K-1:
        print(s)
def inpl(): return map(int,input().split())

N, W = inpl()
dp = [[0]*W for _ in range(N)]
for n in range(1,N+1):
  w, v = inpl()
  for x in range(W):
    if x < w:
      dp[n][x] = dp[n-1][x]
    else:
      dp[n][x] = max(dp[n-1][x], dp[n-1][x-w] + v)
print(dp[-1][-1])


### FIXED CODE ###

def inpl(): return list(map(int,input().split()))
 
N, W = inpl()
dp = [[0]*(W+1) for _ in range(N+1)]
for n in range(1,N+1):
  w, v = inpl()
  for x in range(W+1):
    if x < w:
      dp[n][x] = dp[n-1][x]
    else:
      dp[n][x] = max(dp[n-1][x], dp[n-1][x-w] + v)
print(dp[-1][-1])
import math

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

print(int(math.floor(A*B)))


### FIXED CODE ###

import sys
S, T = map(str, input().split())
 
S1 = int(S)
T1 = T.replace(".", "")


print(S1*int(T1)//100)
L,R = map(int,input().split())
amr =[]
if R-L > 2019:
  amari = sorted([i%2019 for i in range(L,L+2019)])
  if 0 in amari:
    print(0)
  else:
    for i,j in enumerate(amari):
      for k in amari[i+1::]:
        amr.append(j*k%2019)
else:
  amari = sorted([i%2019 for i in range(L,R+1)])
  if 0 in amari:
    print(0)
  else:
    for i,j in enumerate(amari):
      for k in amari[i+1::]:
        amr.append(j*k%2019)
        
print(min(amr))

### FIXED CODE ###

L,R = map(int,input().split())
amr =[]
if R-L > 2019:
  amari = sorted([i%2019 for i in range(L,L+2019)])
  if 0 in amari:
    print(0)
  else:
    for i,j in enumerate(amari):
      for k in amari[i+1::]:
        amr.append(j*k%2019)
    print(min(amr))
else:
  amari = sorted([i%2019 for i in range(L,R+1)])
  if 0 in amari:
    print(0)
  else:
    for i,j in enumerate(amari):
      for k in amari[i+1::]:
        amr.append(j*k%2019)
    print(min(amr))
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    v = A[i]
    j = i - 1
    while((j <= 0) and A(j) > v):
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print(A)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    v = A[i]
    j = i - 1
    while((j >= 0) and A[j] > v):
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print(*A)
n=int(input())
d={'M':0,'A':0,'R':0,'C':0,'H':0}
for i in range(n):
  s=input()
  if s[0]=='M':
    d['M']+=1
  if s[0]=='A':
    d['A']+=1
  if s[0]=='R':
    d['R']+=1
  if s[0]=='C':
    d['C']+=1
  if s[0]=='H':
    d['H']+=1

ans=0
for i,j,k in combinations('MARCH',3):
  ans+=d[i]*d[j]*d[k]

print(ans)

### FIXED CODE ###

n=int(input())
s=[input() for i in range(n)]
cnt1,cnt2,cnt3,cnt4,cnt5=0,0,0,0,0
for i in s:
    if i[0]=='M':
        cnt1+=1
    elif i[0]=='A':
        cnt2+=1
    elif i[0]=='R':
        cnt3+=1
    elif i[0]=='C':
        cnt4+=1
    elif i[0]=='H':
        cnt5+=1
print(cnt1*cnt2*cnt3+cnt1*cnt2*cnt4+cnt1*cnt2*cnt5+cnt1*cnt3*cnt4+cnt1*cnt3*cnt5+cnt1*cnt4*cnt5+cnt2*cnt3*cnt4+cnt2*cnt3*cnt5+cnt2*cnt4*cnt5+cnt3*cnt4*cnt5)
n,k=map(int,input().split())
candle=list(map(int,input().split()))
ans=2000000000
for i in range(n-k+1):
  if candle[i]<0 and candle[i+k-1]>0:
    temp=min(abs(candle[i]), candle[i+k-1])*2+max(abs(candle[i]), candle[i+k-1])
  elif n==1 and k==1 and candle[k]==0:
    ans=0
  elif candle[i+k-1]<=0:
    temp=abs(candle[i])
  elif candle[i]>=0:
    temp=candle[i+k-1]
  ans=min(temp, ans)
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
candle=list(map(int,input().split()))
ans=2000000000
for i in range(n-k+1):
  if candle[i]<0 and candle[i+k-1]>0:
    temp=min(abs(candle[i]), candle[i+k-1])*2+max(abs(candle[i]), candle[i+k-1])
  elif candle[i+k-1]<=0:
    temp=abs(candle[i])
  elif candle[i]>=0:
    temp=candle[i+k-1]
  ans=min(temp, ans)
print(ans)