Problem:


Score : 100 points

Problem Statement

N of us are going on a trip, by train or taxi.

The train will cost each of us A yen (the currency of Japan).

The taxi will cost us a total of B yen.

How much is our minimum total travel expense?

Constraints

All values in input are integers.

1 \leq N \leq 20

1 \leq A \leq 50

1 \leq B \leq 50

Input

Input is given from Standard Input in the following format:

N A B

Output

Print an integer representing the minimum total travel expense.

Sample Input 1

4 2 9

Sample Output 1

8

The train will cost us 4 \times 2 = 8 yen, and the taxi will cost us 9 yen, so the minimum total travel expense is 8 yen.

Sample Input 2

4 2 7

Sample Output 2

7

Sample Input 3

4 2 8

Sample Output 3

8



Sample input:
4 2 9


Sample output:
8

Submission status: Runtime Error

Solution code:
L,R = map(int,input().split())

if L-R > 672:
    print(0)
else:
    minMod = 100000000
    for i in range(L,R):
        for j in range(i+1,R+1):
            tmp = (i*j)%2019
            if minMod > tmp:
                minMod = tmp
    print(minMod)

Submission status: Runtime Error

Solution code:
import map
n, a, b = map(int, raw_input().split())
if a < b:
  max_value = b
else:
  max_value = a

print(str(max_value*n))

Submission status: Runtime Error

Solution code:
n, a, b = map(int, raw_input().split())
if a < b:
  max = b
else:
  max = a

print(str(max*n))

Submission status: Runtime Error

Solution code:
n, a, b = map(input().split())
print(min(n*a, b))

Submission status: Runtime Error

Solution code:
mod=[]
answer = 2018
count = 0
mod = [int(i) for i in input().split()]
for i in range(mod[0],mod[1]):
    for j in range(i+1,mod[1]):
      sub=i*j%2019
        if sub<answer:
            answer = sub
    if count ==2018:
        break
    count = count + 1
print(answer)

Submission status: Runtime Error

Solution code:
mod=[]
answer = 2018
count = 0
mod = [int(i) for i in input().split()]
for i in range(mod[0],mod[1]):
    for j in range(i+1,mod[1]):
      	sub=i*j%2019
        if sub<answer:
            answer = sub
    if count ==2018:
        break
    count = count + 1
print(answer)

Submission status: Runtime Error

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 9 + 7

def P(m, n):
    num = 1
    for i in range(n):
        num = (num*(m-i)) % INF
    return num


n, k = list(map(int, sys.stdin.readline().split()))
graph = [dict() for i in range(n)]
for i in range(n):
    graph[i]["eda"]=[]
for i in range(n - 1):
    a, b = list(map(int, sys.stdin.readline().split()))
    graph[a - 1]["eda"].append(b - 1)
    graph[b - 1]["eda"].append(a - 1)
ans = 1
check = [False] * n
stack = [0]
ans = 1
while len(stack) > 0:
    x = stack.pop()
    check[x] = True
    count = 0
    for i in graph[x]["eda"]:
        if not check[i]:
            count += 1
            stack.append(i)
    if x == 0:
        temp = P(k - 1, count)
        ans = (ans * temp) % INF
    else:
        temp = P(k - 2, count)
        ans = (ans * temp) % INF

print((ans * k) % INF)

Submission status: Runtime Error

Solution code:
import sys
import math

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 9 + 7

def P(n, r):
    num = math.factorial(n) // math.factorial(n - r)
    return num



n, k = list(map(int, sys.stdin.readline().split()))
graph = [dict() for i in range(n)]
for i in range(n):
    graph[i]["eda"]=[]
for i in range(n - 1):
    a, b = list(map(int, sys.stdin.readline().split()))
    graph[a - 1]["eda"].append(b - 1)
    graph[b - 1]["eda"].append(a - 1)
ans = 1
check = [False] * n
stack = [0]
ans = 1
while len(stack) > 0:
    x = stack.pop()
    check[x] = True
    count = 0
    for i in graph[x]["eda"]:
        if not check[i]:
            count += 1
            stack.append(i)
    if x == 0:
        temp = P(k - 1, count)
        ans = (ans * temp) % INF
    else:
        temp = P(k - 2, count)
        ans = (ans * temp) % INF

print((ans * k) % INF)

Submission status: Runtime Error

Solution code:
N,A,B=map(int,input.split())
print(min(N*A,B))

Submission status: Runtime Error

Solution code:
inputs = list(map(int, input()))
smaller = inputs[1] if inputs[1] < inputs[2] else inputs[2]
print(inputs[0] * smaller)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(100000)
 
N, K = list(map(int, input().split()))
ab = []
for i in range(N-1):
    ab.append(list(map(int, input().split())))
 
ki = []
 
for i in range(N):
    ki.append(dict())
    ki[-1]["eda"] = []
 
for i in range(N-1):
    ki[ab[i][0] - 1]["eda"].append([ab[i][0] - 1, ab[i][1] - 1])
    ki[ab[i][1] - 1]["eda"].append([ab[i][1] - 1, ab[i][0] - 1])
 
def P(m ,n):
    if m <= 0 or n <= 0:
        return 0
    else:
        num = 1
        for i in range(n):
            num *= m-i
        return num
 
def saiki(i, base, ki):
    num = 1
    eda_num = len(ki[i]["eda"])-1
    if eda_num == 0:
        return num
    num *= P(K-2, eda_num)
 
    for edge in ki[i]["eda"]:
        if edge[1] != base:
            num *= saiki(edge[1], i, ki)
            num = num % 1000000007
            #print(num)
 
    return num
 
total_num = K
if len(ki[0]["eda"]) != 0:
    total_num *= P(K-1, len(ki[0]["eda"]))
    for edge in ki[0]["eda"]:
        total_num *= saiki(edge[1], 0, ki)
        total_num = total_num % 1000000007
        if total_num == 0:
            break
 
print(total_num)

Submission status: Runtime Error

Solution code:
n,a,b = map(int, input().split)
print(min(n*a,b))

Submission status: Runtime Error

Solution code:
n = input()
a = input()
b = input()

if n*a <= b:
  print(n*a)
else:
  print(b)

Submission status: Runtime Error

Solution code:
import numpy

n, d = map(int, input().split())

l = []
for v in range(n):
    l.append(list(map(int, input().split())))

ans = 0

for i in range(n - 1):
    for j in range(i + 1, n):
        if i == j:
            continue
        a = numpy.array(l[i])
        b = numpy.array(l[j])
        c = numpy.linalg.norm(b - a)
        if (c.is_integer()):
            ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())

all_mod =[]

cnt1 = 0
for i in range(l, r, 1):
    cnt = 0
    for j in range(l + 1, r + 1, 1):
        mod = (i * j) % 2019
        all_mod.append(mod)

        cnt += 1

        if cnt > 2019:
            break

    cnt1 += 1
    if cnt1 > 2019:
        break

print(min(all_mod))

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())

all_mod =[]

cnt1 = 0
for i in range(l, r, 1):
    cnt = 0
    for j in range(l + 1, r + 1, 1):
        mod = (i * j) % 2019
        all_mod.append(mod)

        cnt += 1

        if cnt > 2019:
            break

    cnt1 += 1
    if cnt1 > 2019:
        break

print(min(all_mod))

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(int,input().split()))
B1 = 0
B = []
for i in range(0,N):
    if i%2 == 0:
        B1 += A[i]
    else:
        B1 -= A[i]
B.append(B1)
XX = B1
for i in range (0,N-1) :
    X = 2*A[i]-XX
    B.append(X)
    XX = X
print(B)

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
mod = 2019

l = L // mod
r = R // mod

if l != r:
    print(0)
else:
    l_ = L % mod
    r_ = R % mod
    ans = 2019
    for i in range(l_, r_):
        for j in range(i+1, r_+1):
            a = i * j % mod
            ans = min(ans, a)
            if ans == 0:
                break
        if ans == 0:
            break
    print(ans)

Submission status: Runtime Error

Solution code:
input_data=input()
N,D=map(int,input_data.split())
X=[] 
for n in range(N) :
    X_data=input() 
    X.append(list(map(int,X_data.split())))

output=0

for i in range(N):
    for j in range(N):
        if i>j:
            dist=0
            for y, z in zip(X[i],X[j]):
                dist=dist+(y-z)**2
            if int(dist**(1/2))==dist**(1/2):
                output=output+1
            else:
                output=output+0
        else: pass
print(output)

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
ans = 202000000000000

L_quo = int((L - L % 2019) / 2019)
R_quo = int((R - R % 2019) / 2019)

if L_quo != R_quo:
    print(0)
else:
    L_rem = L % 2019
    R_rem = R % 2019
    for i in range(L_rem, R_rem):
        for j in range(i + 1, R_rem + 1):
            a = (i * j) % 2019
            ans = min(ans, a)
    print(ans)

Submission status: Runtime Error

Solution code:
min(A*N,B)

Submission status: Runtime Error

Solution code:
print(min(int(N*A),int(B))

Submission status: Runtime Error

Solution code:
N,A,B = map(int,input()split())
print(min(A*N,B))

Submission status: Runtime Error

Solution code:
a, b, c = str(input()).split()

if a * b < c:
    print(a * b)
else:
    print(c)

Submission status: Runtime Error

Solution code:
input_data=input()

a=int(input_data[0])
b=int(input_data[2])
c=int(input_data[4])

if a*b<c:
    output=a*b
    
else :
    output=c

print(output)

Submission status: Runtime Error

Solution code:
l, r = map(int,input().split())
modl= l % 2019
modr = r % 2019
if l // 2019 - r // 2019 >= 1:
    print(0)
else:
    print(modl * (modl+1) % 2019)

Submission status: Runtime Error

Solution code:
n,a,b=int(input().split())
print(min(a*n,b))

Submission status: Runtime Error

Solution code:
a,b,c=int(input().split())
print(min(a*n,b))

Submission status: Runtime Error

Solution code:
a,b,c = map(int,input.split())
print = min(a*b , c)

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split())
M=2019
import sys
for i in range(L,R):
    for j in range(i+1,R+1) :
        if (i*j)%2019 < M :
            M = (i*j)%2019
            if M == 0:
                sys,exit()
print (M)

Submission status: Runtime Error

Solution code:
print((lambda n,a,b:max(n*a, b))(*[int(x) for x in input().split()])

Submission status: Runtime Error

Solution code:


function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0].split(" ")[0]);
  var A = parseInt(input[0].split(" ")[1]);
  var B = parseInt(input[0].split(" ")[2]);
  var ans = Math.min(B,A*N);
  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Submission status: Runtime Error

Solution code:
a = [int(i) for i in input().split()]
if a[0]*a[1] > a[2]:
  return c
else:
  return a[0]*a[1]

Submission status: Runtime Error

Solution code:
a, b, c = (int(i) for i in input().split())
if a*b >= c:
  return c
else:
  return a*b

Submission status: Runtime Error

Solution code:
inf = 2019
L, R = map(int, input().split())
ans = 2018

for i in range(L, R):
    for j in range(i + 1, R + 1):
        tmp = int((i%inf * j%inf) % inf)
        ans = min(ans, tmp)
    if ans == 0:
        break

print(ans)

Submission status: Runtime Error

Solution code:
n,a,b=IL()
print(min(a*n,b))

Submission status: Runtime Error

Solution code:
L,R = [int(x) for x in input().split()]
 
min_ans = 10**18

if R-L>=2019:
  min_ans=0
else:
  for i in range(L,R):
      for j in range(i+1,R+1):
          ans = (i*j)%2019

          if ans < min_ans:
              min_ans = ans
          if min_ans == 0:
              break
print(min_ans)

Submission status: Runtime Error

Solution code:
N=int(input())
A=int(input())
B=int(input())
if (N<=20 and A<=50 and B<=50):
    a=N*A
    if a<B:
        print(a)
    else:
        print(B)

Submission status: Runtime Error

Solution code:
i=list(int,input().split())
if i[0]*i[1]>i[2]:
    print(i[0]*i[1])
elif:
    print(i[2])

Submission status: Runtime Error

Solution code:
N=int(input())
A=int(input())
B=int(input())
t1=N*A
t2=B
if t1<B:
      tmin=t1
      print(tmin)
else:
      tmin=B
      print(tmin)

Submission status: Runtime Error

Solution code:
import itertools
L, R = map(int, input().split())

if R - L + 1 > 2019:
    remainder_list = [N%2019 for N in range(L, L+2019)]
else:
    remainder_list = [N%2019 for N in range(L, R+1)]  
remainder_list = list(set(remainder_list))
all_list = [(i*j)%2019 for i, j in list(itertools.combinations(remainder_list, 2))]
print(min(all_list))

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())

result = 2019

for i in range(2019):
    if L+i > R-1:
        break;
    for j in range(i+1, 2019):
        if(L+j > R):
            break
        else:
            result = min(result,((L+i)*(L+j))%2019)

print(result)

Submission status: Runtime Error

Solution code:
l,r = map(int, input().split())

r = min(r, l = 4038);
ans = 2018
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        x = i * j % 2019
        ans = min(ans, x)

print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
A=int(input())
B=int(input())
if (N<=20 and A<=50 and B<=50):
    a=N*A
    b=N*B
    if a<b:
        print(a)
    else:
        print(b)

Submission status: Runtime Error

Solution code:
L,R = map(int,input().split())
 
x = 2019**2
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if x > ans:
            x = ans
            if x == 0:
        	    break
    if x == 0:
      break
print(x)

Submission status: Runtime Error

Solution code:
N=int(input())
A=int(input())
B=int(input())
t1=N*A
t2=N*B
if t1<t2:
      tmin=t1
      print(tmin)
else:
      tmin=t2
      print(tmin)

Submission status: Runtime Error

Solution code:
L,R = map(int,input()split())

x = 2019**2
for i in range(L, R):
    for r in range(i+1, R+1):
        ans = (i*r) % 2019 
        if x > ans:
            x = ans
            if x == 0:
        	    break
    if x == 0:
      break

Submission status: Runtime Error

Solution code:
L,R = map(int,input().split())
#divisor = [2019,673,3]
x = 2019
X = []
if L-R >= 2019:
    x=0
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            #x = min(x,(i%2019)*(j%2019))
            X.append((i*j)%2019)
x = min(X)
print(x)

Submission status: Runtime Error

Solution code:
N=int(input("enter number of people")
A=int(input("enter the cost of train")
B=int(input("enter the cost of taxi")
t1=N*A
if t1<B:
      tmin=t1
      print("minimum total travel expense",tmin)
else:
      tmin=B
      print("minimum total travel expense",tmin)

Submission status: Runtime Error

Solution code:
a,b,c = map(int, input().split())
if a*b <= c:
    print(a*b)
    else:
        print(c)

Submission status: Runtime Error

Solution code:
l,r=map(int,input().split())
s=list()
if l+1==r:
    print(l*r)
else:
    for i in range(l,r):
        s.append([i*(i+1)%2019])
    #print(s[0][0])
    s=(sorted(s))
    print(s[0][0])

Submission status: Runtime Error

Solution code:
l,r = map(int,input().split())
ans = 2019
mod = 2019
 
for i in range(l,r):
  for j in range(i+1,r):
    ans = min(ans,(i*j)%mod)
    if ans == 0:
      print(0)
      exit()
print(ans)

Submission status: Runtime Error

Solution code:
N,D = map(int,input().split())
A=[]
C=0
D=0
E=0
for i in range (1,N+1):
    A.append(i)
for i in range (0,N):
    A[i]=list(map(int,input().split()))
for i in range (0,N-1):
    for j in range(i,N-1):
        for k in range(0,D):
            B=(A[j][k]-A[j+1][k])**2
            C+=B
        D=C
        C=0
        if ((D)**(1/2))%1 ==  (D)**(1/2):
            E+=1
print(E)

Submission status: Runtime Error

Solution code:
import numpy as np

def mod_2019(L, R):
  year = 2019
  if (R - L) >= year:
    return 0
 
  import numpy as np
  array = np.array([[i for i in range(L, R)]])
  if (array % year).min() == 0:
    return 0
  
  
  array_2d = np.dot(array.T, array)
  for i in range(len(array_2d[0])):
     array_2d[i][i] = year -1
  return (array_2d % year).min()
  

L, R = (int(i) for i in input().split())

print(mod_2019(L, R))

Submission status: Runtime Error

Solution code:
L,R = map(int, input().split())
MIN = 2019
for i in range(L,R):
    for j in range(i+1, R+1):
        mod = ij % 2019

        if MIN > mod:
            MIN = mod
 
print(MIN)

Submission status: Runtime Error

Solution code:
import time

def mod_2019(L, R):
  year = 2019
  if (R - L) >= year:
    return 0
 
  import numpy as np
  array = np.array([[i for i in range(L, R)]])
  if (array % year).min() == 0:
    return 0
  
  
  array_2d = np.dot(array.T, array)
  for i in range(len(array_2d[0])):
     array_2d[i][i] = year -1
  return (array_2d % year).min()
  

L, R = (int(i) for i in input().split())

print(mod_2019(L, R))

Submission status: Runtime Error

Solution code:
L,R = map(int, input().split())
MIN = R*2
for i in range(L,R):
    for j in range(i+1, R+1):
        mod = ij % 2019

        if MIN > mod:
            MIN = mod
 
print(MIN)

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())

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

Submission status: Runtime Error

Solution code:
def input_from_console():
    l, r = map(int, input().split())
    return l, r


def solve(l, r):
    minimum = 2020
    if r - l >= 2019:
        return 0
    a, b = l % 2019, r % 2019
    if r // 2019 > l // 2019:
        return 0
    for i in range(a, b):
        for j in range(a + 1, b + 1):
            minimum = min(minimum, (i * j) % 2019)
    result = minimum
    return result


def main():
    l, r = input_from_console()
    print(solve(l, r))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()

Submission status: Runtime Error

Solution code:
"""
#include <stdio.h>
int main(){
  int l, r, ans=99999;
  int lst[99999];
  scanf("%d",&l);
  scanf("%d",&r);
  l %= 2019;
  r %= 2019;
  for(int i=l;i<r;i++){
    for(int j=i+1;j<r+1;j++){
      if(ans>(i*j)%2019){
        ans = (i*j)%2019;
        //printf("%d\n",ans);
      }
    }
  }
  printf("%d\n",ans);

}
/*"""
l, r = map(int, input().split())
l3 = l
l2 = 2019*(l//2019)
r -= l2
l %= 2019

if r>= 2019:
  print(0)
else:
  print(l*(l+1)%2019)

#for i in range()

#lst = []
sum = 9999999999
#lm = 99999999999
#rm = 99999999999
#for 
#print(l%2019)
"""
for i in range(l,r):
  for j in range(i+1,r+1):
    #lst.append(i*j%2019)
    if sum > i*j%2019:
      sum = i*j%2019
print(sum)
"""
#*/

Submission status: Runtime Error

Solution code:
def yo():
    l,r = map(int,input().split())

    a = l*r%2019
    for i in range(l,r) :
        for j in range(i+1,r+1):
            ij = i*j%2019
 
            if(ij==0) :
                return a

            if (a > ij) :
                a = ij


    return a



print(yo())

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
from itertools import combinations

mod = 2019
l, r = L % mod, R % mod
if l > r:
    l, r = r, l

mini = l*r % mod
for i, j in combinations(range(l, r+1), 2):
    mini = min(mini, i*j % mod)
    if mini == 0:
        break
print(mini)

Submission status: Runtime Error

Solution code:
n, r = map(int, input().split())
if r-n >= 2019:
  print(0)
  sys.exit(0)
mini = 2019
#nM = n % 2019
#rM = r % 2019
for i in range(n, r+1):
  for j in range(i+1, r+1):
    mini = min((i*j)%2019, mini)
print(mini)

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())

listX = []
sw = 0
i = 1
for i in range(1, 990590):
  listX.append(i*2019)

for n in range(len(listX)):
  if L < listX[n] and R > listX[n]:
    sw += 1

if sw > 0:
  print(0)

elif sw == 0:      
  L_1 = L % 2019
  R_1 = R % 2019
  
  idx1 = 0
  listA = []
  for idx1 in range(L_1, R_1):
    for idx2 in range(idx1 + 1, R_1 + 1):
      listA.append(idx1 * idx2)
 
  print(min(listA))

Submission status: Runtime Error

Solution code:
x,y,z = map(int, input().split())
D = x * y
T=z
 if  D < T :
     print(D)
 else : print(T)

Submission status: Runtime Error

Solution code:
def solve():
  L, R = map(int, input().split())
  ans = 2019
  for i in range(L, R):
    for j in range(i + 1, R + 1):
      v = i * j % 2019
      if v < ans: ans = v
      if ans == 0: return
  return ans

print(solve())

Submission status: Runtime Error

Solution code:
S=input().split()
L=int(S[0])
R=int(S[1])
list=2018
L1=L
L2=L
while list <> 1:  
  while L2 <= R:
    while L1 < L2:
      if (L1*L2)%2019 <= list:
        list = (L1*L2)%2019
      L1 += 1
    L1 =int(L)
    L2 += 1
print(list)

Submission status: Runtime Error

Solution code:
x,y,z = map(int, input().split())
D = x * y
T=z
 if  D < T :
      print(D)
 else : print(T)

Submission status: Runtime Error

Solution code:
x,y,z = map(int, input().split())
D=x*y
T=z
 if D<T:
  print(D)
 else:  print(T)

Submission status: Runtime Error

Solution code:
N,A,B=map(int,iput(),split())
if A*N<B :
  print(A*N)
else:
    print(B)

Submission status: Runtime Error

Solution code:
n,d=map(int,input().split())
x=[]
for i in range(n):
    a=list(map(int,input().split()))
    x.append(a)
import math
c=0
d=0
e=0
for j in range (n-1):
    for k in range(j+1,n):
        for m in range(d):
            d+=float((x[j][m]-x[k][m])*(x[j][m]-x[k][m]))
        c=float(math.sqrt(d))
        if(c.is_integer()=1):
            e+=1
        d=0
print('{0}'.format(e))

Submission status: Runtime Error

Solution code:
A,B,N=map(int,iput(),split())
if A*N<B :
  print(A*N)
else:
    print(B)

Submission status: Runtime Error

Solution code:
x,y,z = map(int, input().split())
D=x*y
T=z
 if( D<T,print(D))
 else(D>T,print(T)

Submission status: Runtime Error

Solution code:
A,B,N=map(int,iput(),split())
if A*N<B :
  print("A*N")
else:
  print("B")

Submission status: Runtime Error

Solution code:
N = int(input())
A = list(map(lambda x: int(x),input().split()))
X = [(-1)**(i) for i in range(N)]
for i in range(N):
    c = 0
    for j in range(N):
        c += A[j]*X[(N+j-i)%N]
    print(c,end=" ")

Submission status: Runtime Error

Solution code:
A,B=map(int,iput(),split())
if A*N<B :
  print(A*N)
else:
    print(B)

Submission status: Runtime Error

Solution code:
A,B=map(int,iput(),split())
if A*N<B :
  print("A*N")
else:
    print("B")

Submission status: Runtime Error

Solution code:
(n,a,b)=map(int,inpput().split())
print(mini(n*a,b))

Submission status: Runtime Error

Solution code:
import numpy as np

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

X = []
for i in range(N):
    x = [0 for _ in range(N)]
    for j in range(i, i+2):
        if j >= N:
            continue
        x[j] = 1
    if i == N - 1:
        x[0] = 1
    X.append(x)

Y = A
X = np.matrix(X)
Y = np.matrix(Y).reshape(-1, 1)
ans = np.linalg.solve(X,Y) * 2
ans = list(map(lambda x: str(int(x)), ans))
print(' '.join(ans).strip())

Submission status: Runtime Error

Solution code:
N=int(input())
A=[int(i) for i in input().split()]
B=[None for i in range(N)]
res=0
for n in range(N):
	if n%2!=0:res-=A[n]
	else:res+=A[n]
B[0]=res
ans=str(res)+" "
for i in range(1,N):
	B[i]=int((A[i-1]-(int(B[i-1])/2))*2)
	ans=str(ans)+str(B[i])+" "

print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
 
N = int(input())
X = [int(i) for i in input().split()]
a = np.eye(N)
b = np.roll(a, 1, axis=1)
A = a + b
 
Y = np.linalg.solve(A, X)
 
Y = list(map(lambda x: str(int(x*2)), Y))
print(' '.join(Y))

Submission status: Runtime Error

Solution code:
import itertools
import numpy as np

def mod(n):
    return n % 2019


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

a = list(range(L,R+1))
p = list(itertools.combinations(a, 2))
a1, a2 = map(list, zip(*p))
ans = np.array(a1)*np.array(a2)
ans = map(mod,ans)
print(min(ans))

Submission status: Runtime Error

Solution code:
def mod(n):
    return n % 2019

import itertools
import numpy as np
import operator as op
L, R = map(int, input().split())

a = list(range(L,R+1))
p = list(itertools.combinations(a, 2))
a1, a2 = map(list, zip(*p))
ans = np.array(a1)*np.array(a2)
ans = map(mod,ans)
print(min(ans))

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
 
v = []

if l == 0:
    print(0)
if l*r < 2019:
    print(l*r)
else:
    for a, i in enumerate(range(l, r+1)):
        for j in range(i+1, r+1):
            if i*j%2019 in v:
                break
            else:
                v.append(i*j%2019)
        else:
            continue
        break

    print(min(v))

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
m = 673
if R // m - (L - 1) // m != 0:
    print(0)
else:
    minnum = 1000
    Lmod = L % m
    Rmod = R % m
    for i in range(Lmod, Rmod+1):
        for j in range(i + 1, Rmod+1):
            #print(i, j, (i * j) % 2019)
            minnum = min(minnum, (i * j) % 2019)
    print(minnum)

Submission status: Runtime Error

Solution code:
import numpy as np 

L, R = list(map(int, input().split()))
data = np.array([x for x in range(L, R+1)]) % 2019

if np.where(data == 0):
    print(0)

else: 
    data = np.sort(data)
    min_mod = (data[0] * data[1]) % 2019
    print(min_mod)

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())

a = R % 2019
b = L % 2019

if a > 2019 // 2:
    a = 2019 - a
if b > 2019 // 2:
    b = 2019 - b

print(a * (a+1) % 2019)

Submission status: Runtime Error

Solution code:
import itertools
import numpy as np
H, W = map(int, input().split())
arr = []
for _ in range(H):
    S = input().split()
    S = [int(s) for s in S]
    arr.append(S)
x = list(itertools.combinations(arr,2))
count = 0
for i in range(len(x)):
    vec_a = np.array(x[i][0])
    vec_b = np.array(x[i][1])
    d = np.linalg.norm(vec_a - vec_b)
    d2 = int(d)
    if d == d2:
        count+=1
print(count)
print()

Submission status: Runtime Error

Solution code:
import sys

A = int(sys.argv[1]) * int(sys.argv[2])
B = int(sys.argv[3])
print(min(A, B))

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input().split())
s = a*b
if s <= c:
    print("{}".format(s))
   else:
       print("{}".format(c))

Submission status: Runtime Error

Solution code:
l,r=map(int,raw_input().split())
if l<2019 and r<2019:
  print(((l%2019)*(r%2019))%2019)
else:
  if (r-l)>=2019:
    print('0')
  else:
  	print(((l%2019)*((l+1)%2019))%2019)

Submission status: Runtime Error

Solution code:
import math, sys
sys.setrecursionlimit(100000000)
mod = 10**9+7
N, K = map(int, input().split())
edge = [[] for _ in range(N)]
flag = [False]*N
flag[0] = True
for i in range(N-1):
    a, b = map(int, input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
P = [1]*(K+10)
T = [1]*(K+10)
for i in range(1, K+10):
    P[i] = (P[i-1]*(K-i))%mod
    T[i] = T[i-1]*(K-i-1)%mod
def count(x):
    flag[x]=True
    res = 1
    l = len(edge[x])-1
        
    for e in edge[x]:
        if flag[e]:
            continue
        res*=count(e)
    if x==0:
        return res*K*P[l+1]%mod
    return res*T[l]%mod
print(count(0))

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
 
v = []
 
if l*r < 2019:
    print(l*r)
else:
    flag = True
    for a, i in enumerate(range(l, r+1)):
        for j in range(l+a+1, r+1):
            if i*j%2019 in v:
                break
            else:
                v.append(i*j%2019)
        else:
            continue
        break

    print(min(v))

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
ans = 10 ** 12
if l > r:
    ans = 0
else:
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            ans = min(ans, i * j % 2019)
print(ans)

Submission status: Runtime Error

Solution code:
L,R =(int(x) for x in input().split())
if(L<2019<R):
    print(1)
elif(L<=3 and R>=673):
    print(0)
else:
    if((L%2019)^2 < (R%2019)^2):
        if(((L+1)%2019)^2 < (R%2019)^2):
            print((L*(L+1))%2019)
        else:
            print((L*R)%2019)
    else:
        if((L%2019)^2 < ((R-1)%2019)^2):
            print((R*L%2019))
        else:
            print(((R+1)*R)%2019)

Submission status: Runtime Error

Solution code:
L, R = map(int, input().split())
diff = R-L
for n in range(1):
    if diff > 2019:
        ret = 0
        break
        
    results = []
    for i in range(L, R):
        for j in range(i+1,R+1):
            results.append((i*j)%2019)
        ret = min(results)
print(ret)

Submission status: Runtime Error

Solution code:
l,r = map(int,input().split())

if r-l >= 2019:
  ans = 0
else:
  mod_l = l % 2019  
  mod_r = r % 2019
  if mod_r < mod_l:
    ans = 0
  elif mod_l * mod_r == 0:
    ans = 0
    
  else:
    l_list=[]
    a = list(range(mod_l, mod_r+1))
    for i in range(mod_l, mod_r+1):
      ai = a[i]
      for j in range(i+1,mod_r+1):
        aj = a[j]
    l = (ai*aj) % 2019
    l_list.append(l)
    ans = min(l_list)
    
print(ans)

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split())
l=L//2019
ll=L%2019
r=R//2019
lll=L//673
rrr=R//673
if l<r or ll==0:
  print(0)
elif lll>=1 and R-L>=3:
  print(0)
else:
  print(ll*(ll+1))

Submission status: Runtime Error

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

X1by2 = 0
for i in range(N):
  if i%2 ==0:
    X1by2 += A[i]
  else:
    X1by2 -= A[i]

X = []

X.append(X1by2)
for i in range(len(A)-1):
  X.append((A[i]-X[i]/2)*2)

print(" ".join(repr(int(e)) for e in X))

Submission status: Runtime Error

Solution code:
l, r = map(int, input().split())
 
v = []
 
if l*r < 2019:
    print(l*r)
else:
    for a, i in enumerate(range(l, r+1)):
        for j in range(l+a+1, r+1):
            if i*j%2019 in v:
                print(min(v))
                exit()
            else:
                v.append(i*j%2019)
                
    print(min(v))

Submission status: Runtime Error

Solution code:
L,R=map(int,input().split())

keep=L*R
for i in range(L,R+1):
  for j in range(i+1,R+1):
    mod=(i*j) % 2019
    if mod<keep:
      keep=mod
      j=j+2019
print(keep)

Submission status: Runtime Error

Solution code:
import sys


if __name__ == '__main__':
    args = sys.argv

    N = int(args[1])
    A = int(args[2])
    B = int(args[3])

    y1 = A * N
    y2 = B
    print(min(y1, y2))

Submission status: Runtime Error

Solution code:
l,r = map(int, input().split())
gap = r-l

vlist = []
mini = 2019
xlist = []

for x in range(gap+1):
    v = (l+x) % 2019
    vlist.append(v)

mini = min(vlist)
for x in vlist:
    if v <= mini+1:
        xlist.append(x)
        

xlist.sort()
#print(vlist)

#res = i*j % 2019
print((vlist[0]*vlist[1])%2019)

Submission status: Runtime Error

Solution code:
import sys


args = sys.argv

N = int(args[1])
A = int(args[2])
B = int(args[3])


if __name__ == '__main__':
    y1 = A * N
    y2 = B
    print(min(y1, y2))

Submission status: Runtime Error

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

X1by2 = 0
for i in range(N):
  if i%2 ==0:
    X1by2 += A[i]
  else:
    X1by2 -= A[i]

X = []

X.append(X1by2)
for i in range(1,len(A)):
  X.append((A[i]-X1by2/2)*2)

print(" ".join(repr(int(e)) for e in X))

Submission status: Runtime Error

Solution code:
# coding: utf-8
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
a = a*2
#a = a.reshape((a.shape[0],1))
#print(n,a)

N = np.zeros((n,n), dtype=int)
for i in range(n):
    N[i,i] = 1
    if i+1 == n:
        N[i,0] = 1
    else:
        N[i,i+1] = 1
#print(N)

ans = np.linalg.solve(N,a)
#ans = ans.reshape((ans.shape[0],))
ans = ans.astype(np.int)
print(*ans)