Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

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

     runrun = [1, 2, 3, 4, 5, 6, 7, 8, 9]
     index = 0
     s = 9
     while(s < k):
          runrun, s = make(runrun[index], runrun, s)
          index += 1
          # print(runrun)

     print(runrun[k-1])

def make(n, r, s):
     num = n % 10
     p = n * 10 + num
     if num == 0:          
          return r + [p, p + 1], s + 2
     elif num == 9:
          return r + [p - 1, p], s + 2
     else:
          return r + [p - 1, p, p + 1], s + 3

if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-

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

     runrun = [1, 2, 3, 4, 5, 6, 7, 8, 9]
     count = 0
     while(len(runrun) < k):
          target = runrun[count]
          num = target % 10
          if num != 0:
               runrun.append(target * 10 + num - 1)
          runrun.append(target * 10 + num)
          if num != 9:
               runrun.append(target * 10 + num + 1)

          count += 1
          # print(runrun)

     print(runrun[k-1])

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

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

     runrun = [1, 2, 3, 4, 5, 6, 7, 8, 9]
     count = 0
     while(len(runrun) < k):
          target = runrun[count]
          runrun = runrun + make(target)
          count += 1
          # print(runrun)

     print(runrun[k-1])

def make(n):
     num = n % 10
     if num == 0:
          return [n * 10 + num, n * 10 + num + 1]
     elif num == 9:
          return [n * 10 + num - 1, n * 10 + num]
     else:
          return [n * 10 + num - 1, n * 10 + num, n * 10 + num + 1]

if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-

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

     runrun = [1, 2, 3, 4, 5, 6, 7, 8, 9]
     count = 0
     while(len(runrun) < k):
          target = runrun[count]
          num = target % 10
          if num != 0:
               runrun.append(target * 10 + num - 1)
          runrun.append(target * 10 + num)
          if num != 9:
               runrun.append(target * 10 + num + 1)

          count += 1
          # print(runrun)

     print(runrun[k-1])

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def main():
     x, y, a, b, c = map(int, input().split())

     # A個の赤いりんごの美味しさ
     p = list(map(int, input().split()))
     # B個の緑のりんごの美味しさ
     q = list(map(int, input().split()))
     # C個の無色のりんごの美味しさ
     r = list(map(int, input().split()))

     p = sorted(p)
     q = sorted(q)
     r = sorted(r, reverse=True)

     p_cut = p[-x:]
     q_cut = q[-y:]

     # print(p_cut)
     # print(q_cut)

     # 無色を1つも使わない場合をベースにする
     red_del = sum(p_cut)
     gre_del = sum(q_cut)
     base_ans = red_del + gre_del

     red_eat = 0
     gre_eat = 0
     cle_eat = 0
     # 交換できる無色を計算
     for i in range(c):
          if p_cut[red_eat] < q_cut[gre_eat]:
               change = p_cut[red_eat]
               if change < r[cle_eat]:
                    cle_eat += 1
                    red_eat += 1
               else:
                    break
          else:
               change = q_cut[gre_eat]
               if change < r[cle_eat]:
                    cle_eat += 1
                    gre_eat += 1
               else:
                    break
     
     ans = sum(p_cut[red_eat:]) + sum(q_cut[gre_eat:]) + sum(r[:cle_eat])
     print(ans)

if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-

def main():
     x, y, a, b, c = map(int, input().split())

     # A個の赤いりんごの美味しさ
     p = list(map(int, input().split()))
     # B個の緑のりんごの美味しさ
     q = list(map(int, input().split()))
     # C個の無色のりんごの美味しさ
     r = list(map(int, input().split()))

     p = sorted(p)
     q = sorted(q)
     r = sorted(r, reverse=True)

     p_cut = p[-x:]
     q_cut = q[-y:]

     # print(p_cut)
     # print(q_cut)

     # 無色を1つも使わない場合をベースにする
     red_del = sum(p_cut)
     gre_del = sum(q_cut)
     base_ans = red_del + gre_del

     red_eat = 0
     gre_eat = 0
     cle_eat = 0
     # 交換できる無色を計算
     for i in range(c):
          if red_eat < x and gre_eat < y:
               if p_cut[red_eat] < q_cut[gre_eat]:
                    change = p_cut[red_eat]
                    if change < r[cle_eat]:
                         cle_eat += 1
                         red_eat += 1
                    else:
                         break
               else:
                    change = q_cut[gre_eat]
                    if change < r[cle_eat]:
                         cle_eat += 1
                         gre_eat += 1
                    else:
                         break
          elif red_eat >= x and gre_eat < y:
               change = q_cut[gre_eat]
               if change < r[cle_eat]:
                    cle_eat += 1
                    gre_eat += 1
               else:
                    break
          elif red_eat < x and gre_eat >= y:
               change = p_cut[red_eat]
               if change < r[cle_eat]:
                    cle_eat += 1
                    red_eat += 1
               else:
                    break
          else:
               break

     ans = sum(p_cut[red_eat:]) + sum(q_cut[gre_eat:]) + sum(r[:cle_eat])
     print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from scipy.misc import comb

N = int(input())
num_list = list(map(int, input().split()))
num_set = set(num_list)

# 全数あるときの組み合わせ
ans_dict_1 = {}
# 1個抜いたときの組み合わせ
ans_dict_2 = {}

for i in num_set:
  num = num_list.count(i)
  ans_dict_1[i] = comb(num,2,exact=True)
  ans_dict_2[i] = comb(num-1,2,exact=True)

total = sum(ans_dict_1.values())

for i in num_list:
  print(total - ans_dict_1[i] + ans_dict_2[i])


Fixed submission:
# -*- coding: utf-8 -*-

def main():
     n = int(input())
     a = list(map(int, input().split()))
     num_a = dict()
     com_a = dict()

     for i in a:
          if not i in num_a.keys():
               num_a[i] = 1
          else:
               num_a[i] += 1

     for i in num_a.keys():
          value = num_a[i]
          com_a[i] = com(value)

     # print(num_a)
     # print(com_a)

     pre_ans = sum(com_a.values())
     # print('pre_ans:{}'.format(pre_ans))

     for i in range(n):
          k = a[i]
          ans = pre_ans - com_a[k] + com(num_a[k] - 1)
          print(ans)

def com(n):
     return (n * (n - 1)) // 2

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

def main():
    n = int(input())
    d = dict()

    for i in range(n):
        s = input()
        if s in d.keys():
            d[s] += 1
        else:
            d[s] = 1

    m_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())]
    m_list = sorted(m_list)
    print('\n'.join(m_list))

if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-

def main():
    n = int(input())
    d = dict()

    for i in range(n):
        s = input()
        if s in d.keys():
            d[s] += 1
        else:
            d[s] = 1

    d_m = max(d.values())
    m_list = [kv[0] for kv in d.items() if kv[1] == d_m]
    m_list = sorted(m_list)
    print('\n'.join(m_list))

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

def main():
    n = int(input())
    d = dict()

    for i in range(n):
        s = input()
        if s in d.keys():
            d[s] += 1
        else:
            d[s] = 1

    m_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())]
    m_list = sorted(m_list)
    print('\n'.join(m_list))

if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-

def main():
    n = int(input())
    d = dict()

    for i in range(n):
        s = input()
        if s in d.keys():
            d[s] += 1
        else:
            d[s] = 1

    d_m = max(d.values())
    m_list = [kv[0] for kv in d.items() if kv[1] == d_m]
    m_list = sorted(m_list)
    print('\n'.join(m_list))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
 
nlist = [i for i in range(1,N+1)]
 
for i in range(N):
  d = int(input())
  A = list(map(int, input().split()))
  nlist = [a for a in A if a not in nlist]
print(len(nlist))

Fixed submission:
N,K = map(int, input().split())
 
nlist = [i for i in range(1,N+1)]
 
for i in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    if a in nlist:
      nlist.remove(a)
print(len(nlist))

Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
 
nlist = [i for i in range(1,N+1)]
 
for i in range(N):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    if a in nlist:
      nlist.remove(a)
print(len(nlist))

Fixed submission:
N,K = map(int, input().split())
 
nlist = [i for i in range(1,N+1)]
 
for i in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    if a in nlist:
      nlist.remove(a)
print(len(nlist))

Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())

nlist = [i for i in range(N)]

for i in range(N):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    if a in nlist:
      nlist.remove(a)
print(len(nlist))

Fixed submission:
N,K = map(int, input().split())
 
nlist = [i for i in range(1,N+1)]
 
for i in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    if a in nlist:
      nlist.remove(a)
print(len(nlist))
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
H = list(map(int,input().split()))

rlist = {n:[] for n in range(1,N+1)}
cnt = 0
for m in range(1.M+1):
  A,B = map(int,input().split())
  rlist[A].append(B)
  rlist[B].append(A)

for k,v in rlist.items():
  if len(v) == 0:
    cnt += 1
  else:
    for i in v:
      if H[k-1] <= H[i-1]:
        break
    else:
      cnt += 1
      
print(cnt)

Fixed submission:
N,M = map(int,input().split())
H = list(map(int,input().split()))
 
rlist = {n:[] for n in range(1,N+1)}
cnt = 0
for m in range(1,M+1):
  A,B = map(int,input().split())
  rlist[A].append(B)
  rlist[B].append(A)
  
for k,v in rlist.items():
  if len(v) == 0:
    cnt += 1
  else:
    for i in v:
      if H[k-1] <= H[i-1]:
        break
    else:
      cnt += 1
      
print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())

total = sum([i for i in range(1,N+1) if i%3!=0 and i%5!=0]
print(total)

Fixed submission:
N = int(input())
 
total = sum([i for i in range(1,N+1) if i%3!=0 and i%5!=0])
print(total)
Buggy python submission (verdict: Runtime Error):
import sys
S = sys.argv
if S[2]==S[3] and S[4]==S[5]:
  print('Yes')
else:
  print('No')

Fixed submission:
S = input()
if S[2]==S[3] and S[4]==S[5]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
X = int(input())

div = int(X/500)
mod = int(X%500)
hap = 0

if div != 0:
  hap = i
q = int(p/5)
hap += q

print(hap)

Fixed submission:
X = int(input())
 
div = int(X/500)
mod = int(X%500)
hap = 0
 
if div != 0:
  hap = div*1000
q = int(mod/5)
hap += q*5
 
print(hap)
Buggy python submission (verdict: Runtime Error):
N, R = map(int, input().solit())
if N>= 10:
  print(R)
else:
  print(R+1000-100*N)

Fixed submission:
N, R = map(int, input().split())
if N>= 10:
  print(R)
else:
  print(R+1000-100*N)
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = list(map(int, input().split()))

cost = 0

for i in range(1, 101):
  cand = 0
  for x in X:
    cand += (x[i]-i)**2
  cost = min(cost, cand)

print(cost)

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
 
cost = 10**10
 
for i in range(1, 101):
  cand = sum([(x-i)**2 for x in X])
  cost = min(cost, cand)

print(cost)
Buggy python submission (verdict: Time Limit Exceeded):
#ABC158 D - String Formation

S = str(input())
Q = int(input())

for i in range(Q):
    q = input().split(' ')
    if(q[0] == '1'):
        S = S[::-1]

    else:
        if(q[1] == '1'):
            #temp = [q[2]]
            S = q[2] + S
        else:
            S = S + q[2]

print(S)


Fixed submission:
#ABC158 D - String Formation

start = str(input())
Q = int(input())
S = "X"
cnt = 0
q = []
for i in range(Q):
    q.append(input().split(' '))
    if(q[i][0] == '1'):
        #S = S[::-1]
        cnt += 1

cntq = 0
for i in range(Q):
    #q = input().split(' ')
    if(q[i][0] == '1'):
        #S = S[::-1]
        cntq += 1
 
    else:
        if((q[i][1] == '1' and (cnt-cntq)%2 == 0) or(q[i][1] == '2' and (cnt-cntq)%2 == 1)):
            S = q[i][2] + S
        else:
            S = S + q[i][2]

if(cnt%2 == 1):
    start = start[::-1]


#print(S)
print(S.replace("X",start))
Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter
import datetime

n = int(input())
sn = []
cntlist = []

for i in range(n):
    s = input()
    for j in sn:
        if(j[0] == s):
            j[1] += 1
            break
    else:
        sn.append([s,1])
        continue

sn.sort(key=itemgetter(1))
#sn.sort(key=cntlist)
sn.reverse()
#print(sn)

cnt = sn[0][1]
for i in sn:
    if(int(i[1]) == cnt):
        print(i[0])
        continue
    else:
        break


Fixed submission:
from operator import itemgetter
import datetime

n = int(input())
sn = dict()

for i in range(n):
    s = input()
    if(s in sn):
        sn[s] += 1
    else:
        sn[s] = 1

sn = sorted(sn.items(), key=lambda x:(-x[1],x[0]))
#print(sn)

max_val = max(dict(sn).values())

for si in sn:
    if(int(si[1]) == max_val):
        print(si[0])
    else:
        break

Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter

n = int(input())
sn = []

for i in range(n):
    s = input()
    flg = 0
    for j in sn:
        if(j[0] == s):
            j[1] += 1
            flg = 1
            break
    if(flg == 0):
        sn.append([s,1])
    else:
        continue
        
sn.sort(key=itemgetter(1))
sn.reverse()
#print(sn)

cnt = sn[0][1]
for i in sn:
    if(int(i[1]) == cnt):
        print(i[0])
        continue
    else:
        break



Fixed submission:
from operator import itemgetter
import datetime

n = int(input())
sn = dict()

for i in range(n):
    s = input()
    if(s in sn):
        sn[s] += 1
    else:
        sn[s] = 1

sn = sorted(sn.items(), key=lambda x:(-x[1],x[0]))
#print(sn)

max_val = max(dict(sn).values())

for si in sn:
    if(int(si[1]) == max_val):
        print(si[0])
    else:
        break

Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter

n = int(input())
sn = []

for i in range(n):
    s = input()
    flg = 0
    for j in range(len(sn)):
        if(sn[j][0] == s):
            sn[j][1] += 1
            flg += 1
    if(flg == 0):
        sn.append([s,1])
        
sn.sort(key=itemgetter(1))
sn.reverse()
#print(sn)

cnt = sn[0][1]
for i in sn:
    if(int(i[1]) == cnt):
        print(i[0])
        continue
    else:
        break



Fixed submission:
from operator import itemgetter
import datetime

n = int(input())
sn = dict()

for i in range(n):
    s = input()
    if(s in sn):
        sn[s] += 1
    else:
        sn[s] = 1

sn = sorted(sn.items(), key=lambda x:(-x[1],x[0]))
#print(sn)

max_val = max(dict(sn).values())

for si in sn:
    if(int(si[1]) == max_val):
        print(si[0])
    else:
        break
Buggy python submission (verdict: Runtime Error):
K=input()
A,B = map(int,input().split())

sa = B - A 
flag = 0

for i in range(sa+1):
	if (A+i)%K==0:
		flag = 1
		break

if flag==1:
	print('OK')
else:
	print('NG')

Fixed submission:
K=int(input())
A,B = map(int,input().split())

sa = B - A 
flag = 0

for i in range(sa+1):
	if (A+i)%K==0:
		flag = 1
		break

if flag==1:
	print('OK')
else:
	print('NG')
Buggy python submission (verdict: Time Limit Exceeded):
import math

def siki(A, B, X):
	return math.floor((A*X)/B) - A*math.floor(X/B)

A,B,N = map(int,input().split())
x = N
max_value = 0

if B > A * N:
	print(0)
else:
	if N < B:
		k = N
	else:
		k = B
	for i in range(1, k+1):
		if max_value < siki(A,B,i):
			max_value = siki(A,B,i)

	print(max_value)


Fixed submission:
import math

def f(A, B, X):
	return math.floor((A*X)/B) - A*math.floor(X/B)

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

if N < B:
	print(f(A,B,N))
else:
	print(f(A,B,B-1))

Buggy python submission (verdict: Time Limit Exceeded):
import math

def siki(A, B, X):
	return math.floor((A*X)/B) - A*math.floor(X/B)

A,B,N = map(int,input().split())
x = N
max_value = 0

if N < B:
	k = N
else:
	k = B
for i in range(1, k+1):
	if max_value < siki(A,B,i):
		max_value = siki(A,B,i)

print(max_value)


Fixed submission:
import math

def f(A, B, X):
	return math.floor((A*X)/B) - A*math.floor(X/B)

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

if N < B:
	print(f(A,B,N))
else:
	print(f(A,B,B-1))
Buggy python submission (verdict: Runtime Error):
s=list(input())

if s[0] == s[1] and s[1] == [2] and s[2] == s[0]: 
	print("No")
else if s[0] != s[1] and s[1] != [2] and s[2] != s[0]:
	print("No")
else:
	print("Yes")

Fixed submission:
s=list(map(int,input().split()))

if s[0] == s[1] == s[2]: 
	print("No")
elif s[0] != s[1] != s[2] != s[0]:
	print("No")
else:
	print("Yes")
Buggy python submission (verdict: Runtime Error):
import collections

N=int(input())
S=[input() for i in range(N)]
S = sorted(collections.Counter(S))

print_list = []
count = []
S_max = 0

S_common = S.most_common()
#print(S_common)

values, counts = zip(*S_common)
#print(counts[0])

for i in range(len(values)):
	if counts[0] == counts[i]:
		print(values[i])


Fixed submission:
import collections
S_print = []
N=int(input())
S=[input() for i in range(N)]
S = collections.Counter(S)

S_common = S.most_common()

for i in range(len(S_common)):
	if S_common[0][1] == S_common[i][1]:
		S_print.append(S_common[i][0])

S_print_new = sorted(S_print)
#print(S_print_new)
for i in range(len(S_print_new)):
	print(S_print_new[i])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = input().split()
flag = 1

for j in range(N):
	for i in range(N):
		if i+j+1<N:
			if A[j] == A[i+j+1]:
				flag = 0
				break
if flag==0:
	print('NO')
elif flag==1:
	print('YES')



Fixed submission:
s,t = input().split()
a,b = map(int,input().split())
#print(s,t)
#print(a,b)
u = input()
#print(u)

if s == u :
	a = a - 1
elif t == u:
	b = b - 1

print(a, b)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = input().split()
flag = 1

for j in range(N):
	for i in range(N):
		if i+j+1<N:
			if A[j] == A[i+j+1]:
				flag = 0
				break
if flag==0:
	print('NO')
elif flag==1:
	print('YES')



Fixed submission:
s,t = input().split()
a,b = map(int,input().split())
#print(s,t)
#print(a,b)
u = input()
#print(u)

if s == u :
	a = a - 1
elif t == u:
	b = b - 1

print(a, b)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = input().split()
flag = 1
A.sort()

for i in range(N):
	if A[i] == A[i+1]:
		flag = 0
		break
if flag==0:
	print('NO')
elif flag==1:
	print('YES')



Fixed submission:
N = int(input())
A = input().split()
flag = 1
A.sort()

for i in range(N-1):
	if A[i] == A[i+1]:
		flag = 0
		break
if flag==0:
	print('NO')
elif flag==1:
	print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = input().split()
flag = 1

for j in range(N):
	for i in range(N):
		if i+j+1<N:
			if A[j] == A[i+j+1]:
				flag = 0
				break
if flag==0:
	print('NO')
elif flag==1:
	print('YES')



Fixed submission:
N = int(input())
A = input().split()
flag = 1
A.sort()

for i in range(N-1):
	if A[i] == A[i+1]:
		flag = 0
		break
if flag==0:
	print('NO')
elif flag==1:
	print('YES')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = input().split()
flag = 1

for j in range(N):
	for i in range(N):
		if i+j+1<N:
			if A[j] == A[i+j+1]:
				flag = 0
				break
if flag==0:
	print('NO')
elif flag==1:
	print('YES')



Fixed submission:
N = int(input())
A = input().split()
flag = 1
A.sort()

for i in range(N-1):
	if A[i] == A[i+1]:
		flag = 0
		break
if flag==0:
	print('NO')
elif flag==1:
	print('YES')
Buggy python submission (verdict: Runtime Error):
A,B,X = map(int,input().split())
#print(A,B,X)
out=0
for i in range(X):
	num = i
	price = A*num+B*len(str(num)) #Nの金額
	if price < X:
		out = num
	else:
		break

print(out)

Fixed submission:
s=input()
if s=='SUN':
	print(7)
if s=='MON':
	print(6)
if s=='TUE':
	print(5)
if s=='WED':
	print(4)
if s=='THU':
	print(3)
if s=='FRI':
	print(2)
if s=='SAT':
	print(1)
Buggy python submission (verdict: Runtime Error):
import math
N, D = map(int,input().split())
print(N, D)
cnt = math.floor(N/(2*D+1))
if N%(2*D+1) != 0:
  cnt += 1
print(cnt)

Fixed submission:
r = int(input())
print(3*r*r)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[int(input()) for i in range(N)]
B = A.copy()
B.sort()
print(B)

for i in range(N):
	k = A.pop(0)
	if k == B[N]:
		print(B[N])
	else:
		print(B[N-1])


Fixed submission:
N=int(input())
A=[int(input()) for i in range(N)]
#print(A)
B = A.copy()
#print(B)
B.sort()


for i in range(N):
	k = A[i]
	#print(k)
	if k != B[N-1]:
		print(B[N-1])
	else:
		print(B[N-2])

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[int(input()) for i in range(N)]
amax = max(A)
B = A.copy()
B.sort()
print(B)

for i in range(N):
	k = A.pop(0)
	if k == B[N]:
		print(B[N])
	else:
		print(amax)


Fixed submission:
N=int(input())
A=[int(input()) for i in range(N)]
#print(A)
B = A.copy()
#print(B)
B.sort()


for i in range(N):
	k = A[i]
	#print(k)
	if k != B[N-1]:
		print(B[N-1])
	else:
		print(B[N-2])

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[int(input()) for i in range(N)]
amax = max(A)
B = A.copy()
B.sort()
print(B)

for i in range(N):
	k = A.pop(0)
    if k == B[N]:
      print(B[N])
	else:
	  print(amax)


Fixed submission:
N=int(input())
A=[int(input()) for i in range(N)]
#print(A)
B = A.copy()
#print(B)
B.sort()


for i in range(N):
	k = A[i]
	#print(k)
	if k != B[N-1]:
		print(B[N-1])
	else:
		print(B[N-2])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[int(input()) for i in range(N)]
amax = max(A)

for i in range(N):
	if amax!=A[i]:
		print(amax)
	else:
		B = A.copy()
		B.pop(i)
		print(max(B))

Fixed submission:
N=int(input())
A=[int(input()) for i in range(N)]
#print(A)
B = A.copy()
#print(B)
B.sort()


for i in range(N):
	k = A[i]
	#print(k)
	if k != B[N-1]:
		print(B[N-1])
	else:
		print(B[N-2])

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=[int(input()) for i in range(N)]
amax = max(A)
for i in range(N):
	if amax==A[i]:
		print(amax)
	else:
		print(max(B))

Fixed submission:
N=int(input())
A=[int(input()) for i in range(N)]
#print(A)
B = A.copy()
#print(B)
B.sort()


for i in range(N):
	k = A[i]
	#print(k)
	if k != B[N-1]:
		print(B[N-1])
	else:
		print(B[N-2])

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[int(input()) for i in range(N)]
for i in range(N):
	B = A.copy()
	B.pop(i)
	print(max(B))

Fixed submission:
N=int(input())
A=[int(input()) for i in range(N)]
#print(A)
B = A.copy()
#print(B)
B.sort()


for i in range(N):
	k = A[i]
	#print(k)
	if k != B[N-1]:
		print(B[N-1])
	else:
		print(B[N-2])
Buggy python submission (verdict: Runtime Error):
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)

Fixed submission:
N, A, B = map(int,input().split())

if N*A>B:
	print(B)
else:
	print (A*N)

Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())



#print(L%2019, R%2019)

#print((L + 2019 - L%2019))

tmp = 0
"""
if L * R < 2019:
	i = L
	j = R

elif (L + 2019 - L%2019) + 1 <= R:
	if L < L + 2019 - L % 2019 and L + 2019 - L % 2019 + 1 < R:
		i =  L + 2019 - L % 2019
		j = i+1

elif L % 2019 < R % 2019:
	i = L
	j = i+1

elif R % 2019 > L % 2019:
	j = R
	i = j-1

else:
	i = L
	j = R
"""

i = 2019 - np.abs(L-R)
j = i+1

ans = i * j % 2019

print(ans)

Fixed submission:
N, A, B = map(int,input().split())

if N*A>B:
	print(B)
else:
	print (A*N)