problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p03103
u686036872
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N, M = map(int, input().split())\n\nA = []\nfor i in range(N):\n a, b = map(int, input().split())\n A.append([a, b])\n\nA.sort(key=lambda x:x[0])\n\nmoney = 0\ncnt = 0\nfor i in range(N):\n for j in range(A[i][1]):\n money += A[i][0]\n if cnt == N:\n print(money)\n break', 'N, M = map(int, input().split())\n\nA = []\nfor i in range(N):\n a, b = map(int, input().split())\n A.append([a, b])\n\nA.sort(key=lambda x:x[0])\n\nmoney = 0\ncnt = 0\nfor i in range(N):\n if cnt + A[i][1] < M: \n money += A[i][0]*A[i][1]\n cnt += A[i][1]\n else: \n money += A[i][0]*(M-cnt)\n print(money)\n break']
['Wrong Answer', 'Accepted']
['s129916145', 's487895633']
[21204.0, 21224.0]
[2105.0, 427.0]
[300, 344]
p03103
u687343821
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M=list(map(int,input().split()))\nA=[]\nfor i in range(N):\n A.append(list(map(int,input().split())))\n# print(A)\nA.sort()\n#print(A)\nres,count=0,0\nfor i in range(N):\n res+=A[i][0]*A[i][1]\n count+=A[i][1]\n if(count==M):\n break \n if(count>M):\n res-=A[i][0]*A[i][1]\n count-=A[i][1]\n for j in range(1,A[i][1]+1):\n res+=A[i][0]\n count+=1\n if(count==M):\n print(res)\n exit()\n\nprint(res)\nexit()a\n \n', 'N,M=list(map(int,input().split()))\nA=[]\nfor i in range(N):\n A.append(list(map(int,input().split())))\n# print(A)\nA.sort()\n#print(A)\nres,count=0,0\nfor i in range(N):\n res+=A[i][0]*A[i][1]\n count+=A[i][1]\n if(count==M):\n break \n if(count>M):\n res-=A[i][0]*A[i][1]\n count-=A[i][1]\n for j in range(1,A[i][1]+1):\n res+=A[i][0]\n count+=1\n if(count==M):\n print(res)\n exit()\n\nprint(res)\nexit()\n \n']
['Runtime Error', 'Accepted']
['s140085923', 's551950558']
[3064.0, 27884.0]
[17.0, 514.0]
[509, 508]
p03103
u691018832
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n, m = map(int, input().split())\na = [0] * n\nb = [0] * n\nfor i in range(n):\n a[i], b[i] = map(int, input().split())\nmatch = 0\nans = 0\nmini = min(a)\n\nfor j in range(n):\n for k in range(b[a.index(mini)]):\n if m <= match:\n break\n ans += mini\n match += 1\n \n b.pop(a.index(mini))\n a.remove(mini)\n mini = min(a)\nprint(ans)', 'n, m = map(int, input().split())\na = [0] * n\nb = [0] * n\nfor i in range(n):\n a[i], b[i] = map(int, input().split())\nmatch = 0\nans = 0\n\nfor j in min(a):\n for k in range(b[a.index(j)]):\n if m <= match:\n break\n ans += j\n match += 1\n \n b.pop(a.index(j))\n a.remove(j)\nprint(ans)', 'n, m = map(int, input().split())\na = [0] * n\nb = [0] * n\nfor i in range(n):\n a[i], b[i] = map(int, input().split())\nmatch = 0\nans = 0\nmini = 0\n\nwhile 1:\n mini = min(a)\n \n for j in range(b[a.index(mini)]):\n ans += mini\n match += 1\n if m == match:\n break\n \n a.remove(mini)\nprint(ans)', '# sys.stdin.readline()\nimport sys\ninput = sys.stdin.readline\n\nn, m = map(int, input().split())\nab = []\nans = 0\nfor i in range(n):\n a, b = map(int, input().split())\n ab.append((a,b))\nab = sorted(ab)\nfor c, d in ab:\n if m >= d:\n ans += c*d\n m -= d\n else:\n ans += c*m\n break\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s242581385', 's481796129', 's492716397', 's139090171']
[10868.0, 10868.0, 10868.0, 17740.0]
[2104.0, 288.0, 2104.0, 252.0]
[366, 320, 331, 322]
p03103
u693716675
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N, M = [int(i) for i in input().split()]\ncost = 0\namount =0\ndic ={}\nfor _ in range(N):\n a,b = [int(i) for i in input().split()]\n if a in dic:\n dic[a] += b\n else:\n dic[a] = b\n\nfor a,b in dic.items():\n if amount+b<=M:\n amount += b\n cost += a*b\n else:\n rest = M - amount\n cost += a*rest\n break\n\nprint(cost)\n', 'N, M = [int(i) for i in input().split()]\ncost = 0\namount =0\ndic ={}\nfor _ in range(N):\n a,b = [int(i) for i in input().split()]\n dic[a] = b\n\nfor a,b in dic.items():\n if amount+b<=M:\n amount += b\n cost += a*b\n else:\n rest = M - amount\n cost += a*rest\n break\n\nprint(cost)\n', 'N, M = [int(i) for i in input().split()]\ncost = 0\namount =0\ndic ={}\nfor _ in range(N):\n a,b = [int(i) for i in input().split()]\n if a in dic:\n dic[a] += b\n else:\n dic[a] = b\n\ndic = sorted(dic.items())\n\nfor a,b in dic:\n if amount+b<=M:\n amount += b\n cost += a*b\n else:\n rest = M - amount\n cost += a*rest\n break\n\nprint(cost)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s513180970', 's565890576', 's680239194']
[17808.0, 17808.0, 23008.0]
[351.0, 354.0, 475.0]
[368, 317, 387]
p03103
u693933222
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['lx = list(map(int,input().split(" ")))\n#la = [li[0]][li[1]]\nla = []\ncnt = 0\n\nfor i in range(0, lx[0]):\n la.append(list(map(int,input().split(" "))))\n\nprint("setok")\ncoin = 0\nbottle = 0\nfor i in range(1, 10 ** 9):\n for j in range(0, lx[0]):\n if (la[j][0] == i):\n while (bottle <= lx[1] and la[j][1] > 0):\n coin += la[j][0]\n bottle += 1\n la[j][1] - 1\n if (bottle == lx[1]):\n break\n', 'lx = list(map(int,input().split(" ")))\nla = []\ncnt = 0\n\nfor i in range(0, lx[0]):\n la.append(list(map(int,input().split(" "))))\n\nla = sorted(la)\n\ncoin = 0\nbottle = lx[1]\ni = -1\nwhile (bottle > 0 and i < lx[0]-1):\n i += 1\n while (bottle > 0 and la[i][1] > 0):\n coin += la[i][0]\n bottle -= 1\n la[i][1] -= 1\n\nprint(coin)']
['Time Limit Exceeded', 'Accepted']
['s982184275', 's338058616']
[27380.0, 28656.0]
[2105.0, 535.0]
[458, 347]
p03103
u698771758
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['a,b=map(int,input().split())\ne=[]\nfor i in range(a):\n c,d=map(int, input().split())\n e+=[[c,d]]\ne.sort()\nprint(e)\na=i=j=0\nwhile i < b:\n a+=(e[j][0]*e[j][1])\n i+=e[j][1]\n j+=1\nprint(a-((i-b)*e[j-1][0]))', 'a,b=map(int,input().split())\ne=[]\nfor i in range(a):\n c,d=map(int, input().split())\n e+=[[c,d]]\ne.sort()\na=i=j=0\nwhile i < b:\n a+=(e[j][0]*e[j][1])\n i+=e[j][1]\n j+=1\nprint(a-((i-b)*e[j-1][0]))']
['Wrong Answer', 'Accepted']
['s360286480', 's540360483']
[26056.0, 19996.0]
[539.0, 482.0]
[216, 207]
p03103
u701743518
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['# coding: utf-8\nfrom sys import stdin.readline as input\n \nN, M = [int(i) for i in input().split()]\n \nplices = [[int(i) for i in input().split()] for _ in range(N)]\n \nplices.sort(key = lambda x:x[0])\n \nm = 0\ncost = 0\n \nfor i in range(N):\n if m >= M:\n break\n buy = min(M - m, plices[i][1])\n cost += plices[i][0] * buy\n m += buy\n \nprint(cost)', '# coding: utf-8\nimport sys\ninput = sys.stdin.readline\n \nN, M = [int(i) for i in input().split()]\n \nplices = [[int(i) for i in input().split()] for _ in range(N)]\n \nplices.sort(key = lambda x:x[0])\n \nm = 0\ncost = 0\n \nfor i in range(N):\n if m >= M:\n break\n buy = min(M - m, plices[i][1])\n cost += plices[i][0] * buy\n m += buy\n \nprint(cost)']
['Runtime Error', 'Accepted']
['s191159760', 's530935427']
[2940.0, 22800.0]
[19.0, 320.0]
[358, 356]
p03103
u703130195
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n, m = map(int, input().split())\nsum = 0\nmoney = 0\nlist_ab = list()\nfor i in range(n):\n list_ab.append(list(map(int, input().split())))\nlist_ab = sorted(list_ab)\nfor i in range(n):\n print(i)\n if(list_ab[i][1] >= m - sum):\n money += list_ab[i][0] * (m - sum)\n break\n else:\n sum += list_ab[i][1]\n money += list_ab[i][0]*list_ab[i][1]\nprint(money)\n', 'n, m = map(int, input().split())\nsum = 0\nmoney = 0\nlist_ab = list()\nfor i in range(n):\n list_ab.append(list(map(int, input().split())))\nlist_ab = sorted(list_ab)\nfor i in range(n):\n if(list_ab[i][1] >= m - sum):\n money += list_ab[i][0] * (m - sum)\n break\n else:\n sum += list_ab[i][1]\n money += list_ab[i][0]*list_ab[i][1]\nprint(money)\n']
['Wrong Answer', 'Accepted']
['s105918090', 's078780362']
[28656.0, 28656.0]
[577.0, 521.0]
[385, 372]
p03103
u711539583
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n, m = map(int, input().split())\na = []\nfor _ in range(n):\n a.append(list(map(int, input().split())))\na.sort()\npm = s = 0\nm_minus_1 = m - 1\nfor item in a:\n pm += item[1]\n if tmp > m_minus_1:\n print(s + item[0] * (m - pm + item[1]))\n break\n else:\n s += item[0] * item[1]\n', 'n, m = map(int, input().split())\na = [list(map(int, input().split())) for _ in range(n)].sort()\npm = s = 0\nm_minus_1 = m - 1\nfor item in a:\n pm += item[1]\n if pm > m_minus_1:\n print(s + item[0] * (m - pm + item[1]))\n break\n else:\n s += item[0] * item[1]\n', 'n, m = map(int, input().split())\na = []\nfor _ in range(n):\n a.append(list(map(int, input().split())))\na.sort()\npm = s = 0\nm_minus_1 = m - 1\nfor item in a:\n pm += item[1]\n if tmp > m_minus_1:\n print(s + item[0] * (m - pm + item[1]))\n break\n else:\n s += item[0] * item[1]\n', 'n, m = map(int, input().split())\na = [list(map(int, input().split())) for _ in range(n)]\na.sort()\npm = s = 0\nm_minus_1 = m - 1\nfor item in a:\n pm += item[1]\n if pm > m_minus_1:\n print(s + item[0] * (m - pm + item[1]))\n break\n else:\n s += item[0] * item[1]\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s266337924', 's281800849', 's809692544', 's368603434']
[27756.0, 27880.0, 27884.0, 27880.0]
[487.0, 440.0, 465.0, 483.0]
[303, 284, 303, 286]
p03103
u712082626
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n, m = map(int, input().split())\nt = {}\nfor i in range(n):\n a,b = map(int, input().split())\n t[a] = b\nt = sorted(t.items())\nprint(t)\nr = 0\nfor i in t:\n if i[1] < m:\n r += i[0]*i[1]\n m -= i[1]\n else:\n r += i[0]*(m)\n break\nprint(r)\n', 'n, m = map(int, input().split())\nl = []\nfor i in range(n):\n a, b = map(int, input().split())\n l.append((a, b))\n\nl = sorted(l)\n\n\nr = 0\nfor i in l:\n if i[1] < m:\n r += i[0]*i[1]\n m -= i[1]\n else:\n r += i[0]*(m)\n break\nprint(r)\n']
['Wrong Answer', 'Accepted']
['s226645524', 's808421243']
[22996.0, 17788.0]
[460.0, 407.0]
[270, 265]
p03103
u712975113
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M=map(int,input().split())\nA=[[]]\nfor i in range(N):\n A.append(list(map(int,input().split())))\nA.sort(key=lambda x:(x[0],x[1]))\nC=[A[0][0]*A[0][1]]\nD=A[0][1]\nfor i in range(N-1):\n C.append(C[i]+A[i+1][0]*A[i+1][1])\n D.append(D[i]+A[i+1][1])\nfor i in range(N):\n if M<D[i]:\n print(C[i]-(D[i]-M)*A[i][0])', 'N,M=map(int,input().split())\nA=[]\nfor i in range(N):\n A.append(list(map(int,input().split())))\nA.sort(key=lambda x:(x[0],x[1]))\nC=[A[0][0]*A[0][1]]\nD=[A[0][1]]\nfor i in range(N-1):\n C.append(C[i]+A[i+1][0]*A[i+1][1])\n D.append(D[i]+A[i+1][1])\nfor i in range(N):\n if M<D[i]:\n print(C[i]-(D[i]-M)*A[i][0])\n break\nif M==D[N-1]:\n print(C[N-1])']
['Runtime Error', 'Accepted']
['s252460688', 's144681664']
[27380.0, 41672.0]
[349.0, 607.0]
[322, 368]
p03103
u720636500
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N, M = map(int, input().split())\nlis = []\nfor _ in range(N):\n a, b = map(int, input().split)\n for l in range(b):\n lis.append(a)\nlis.sort()\ntotal = 0\nfor i in range(M):\n total = total + lis[i]\nprint(total) ', 'N, M = map(int, input().split())\nlis = []\nfor _ in range(N):\n a, b = map(int, input().split())\n lis.append((a, b))\ndef eval(data):\n return data[0]\nlis.sort(key=eval)\ntotal = 0\nnum = 0\nmark = 0\nfor i in range(N):\n num = num + lis[i][1]\n total = total + lis[i][0]*lis[i][1]\n if num > M:\n mark = i\n total = total - lis[i][0]*lis[i][1]\n num = num - lis[i][1]\n break\ntotal = total + (M - num)*lis[mark][0]\nprint(total) ']
['Runtime Error', 'Accepted']
['s000865271', 's932041393']
[3060.0, 18168.0]
[18.0, 392.0]
[212, 433]
p03103
u732870425
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n, m = map(int, input().split())\nab = [tuple(map(int, input().split())) for _ in range(n)]\n\nab.sort(key=lambda x:x[0])\n\ncnt = 0\nprice = 0\ni = 0\nwhile cnt < m:\n price += ab[i][0] * ab[i][1]\n cnt += ab[i][1]\n if cnt > m:\n price -= ab[i][0] * (m - cnt)\n break\n i += 1\n\nprint(price)', 'n, m = map(int, input().split())\nab = [tuple(map(int, input().split())) for _ in range(n)]\n\nab.sort(key=lambda x:x[0])\n\ncnt = 0\nprice = 0\ni = 0\nwhile cnt < m:\n price += ab[i][0] * ab[i][1]\n cnt += ab[i][1]\n if cnt > m:\n price -= ab[i][0] * (cnt - m)\n break\n i += 1\n\nprint(price)']
['Wrong Answer', 'Accepted']
['s866810655', 's044841451']
[18116.0, 18116.0]
[385.0, 397.0]
[304, 304]
p03103
u742385708
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N = list(map(int,input().split()))\ndrinks = [list(map(int,input().split())) for i in range(N[0])]\ndrinks.sort()\nprint(drinks)\ncounter=0\namount=0\nflag=0\n\nfor i in range(N[0]):\n if flag==1:\n break\n while(drinks[i][1]!=0):\n drinks[i][1] -=1\n counter +=1\n amount += drinks[i][0]\n if counter==N[1]:\n flag=1\n break\nprint(amount) \n \n\n', 'N = list(map(int,input().split()))\ndrinks = [list(map(int,input().split())) for i in range(N[0])]\ndrinks.sort()\n\ncounter=0\namount=0\nflag=0\n\nfor i in range(N[0]):\n if flag==1:\n break\n while(drinks[i][1]!=0):\n drinks[i][1] -=1\n counter +=1\n amount += drinks[i][0]\n if counter==N[1]:\n flag=1\n break\nprint(amount) \n \n\n']
['Wrong Answer', 'Accepted']
['s382708431', 's523435266']
[33776.0, 27880.0]
[553.0, 480.0]
[393, 380]
p03103
u749770850
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n, m = map(int, input().split())\n\nab = []\n\nfor i in range(n):\n a, b = map(int, input().split())\n ab.append([a,b])\n\nab.sort()\nans = 0\nif len(ab) == 1:\n if m >= ab[0][1]:\n print(ab[0][0] * ab[0][1])\n exit()\n else:\n print(ab[0][0] * m)\n exit()\n\n\nfor i, j in ab:\n for k in range(j):\n if m != 0:\n print(m)\n m -= 1\n ans += i\n else:\n print(ans)\n exit()\n\n ', 'n, m = map(int, input().split())\n\nab = []\n\nfor i in range(n):\n a, b = map(int, input().split())\n ab.append([a,b])\n\nab.sort()\n\nans = 0\n\nfor a, b in ab:\n if m - b > 0:\n m -= b\n ans += a * b\n \n else:\n ans += a * m\n print(ans)\n exit()\n\n']
['Wrong Answer', 'Accepted']
['s327297945', 's831214130']
[20540.0, 20048.0]
[551.0, 447.0]
[397, 254]
p03103
u754022296
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n, m = map(int, input().split())\nab = sorted([ list(map(int, input().split())) for _ in range(n) ])\nc = 0\nfor a, b in ab:\n if n <= b:\n c += a*n\n print(c)\n break\n else:\n c += a*b\n n -= b', 'n, m = map(int, input().split())\nab = sorted([ list(map(int, input().split())) for _ in range(n) ])\nc = 0\nfor a, b in ab:\n if m <= b:\n c += a*m\n print(c)\n break\n else:\n c += a*b\n m -= b']
['Wrong Answer', 'Accepted']
['s605287555', 's211324927']
[28652.0, 28652.0]
[520.0, 489.0]
[202, 202]
p03103
u755027226
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N, M = map(int, input().split())\n\nAB = []\nfor i in range(N):\n AB.append(list(map(int, input().split())))\nAB.sort(key=lambda x: x[0])\ncount = 0\nans = 0\nfor ab in AB:\n if M > count+ab[1]:\n count += ab[1]\n ans += ab[0]*ab[1]\n print(count, ans)\n else:\n ans += ab[0] * (M-count)\n print(count, ans)\n break\nprint(ans)', 'N, M = map(int, input().split())\n\nAB = []\nfor i in range(N):\n AB.append(list(map(int, input().split())))\nAB.sort(key=lambda x: x[0])\ncount = 0\nans = 0\nfor ab in AB:\n if M > count+ab[1]:\n count += ab[1]\n ans += ab[0]*ab[1]\n else:\n ans += ab[0] * (M-count)\n break\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s936182879', 's098542877']
[29024.0, 29024.0]
[565.0, 446.0]
[361, 310]
p03103
u756429062
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n, m = (int(i) for i in input().split())\na = [list(map(int,input().split())) for i in range(n)]\nb = sorted(a)\ncnt = 0\nmoney = 0\nprint(b)\n\nwhile True:\n\tfor x,y in b:\n\t\tcnt += y\n\t\tmoney += x * y\n\t\tprint(money)\n\t\tif m < cnt:\n\t\t\tmoney -= (cnt - m)*x\n\t\t\tprint(money)\n\t\t\texit()', 'n, m = (int(i) for i in input().split())\na = [list(map(int,input().split())) for i in range(n)]\nb = sorted(a)\ncnt = 0\nmoney = 0\nwhile True:\n\tfor x,y in b:\n\t\tcnt += y\n\t\tmoney += x * y\n\t\tif m < cnt:\n\t\t\tmoney -= (cnt - m)*x\n\t\t\tprint(money)\n\t\t\texit()\n']
['Wrong Answer', 'Accepted']
['s262386030', 's405332946']
[34544.0, 28648.0]
[596.0, 450.0]
[271, 247]
p03103
u756988562
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n,m=map(int,input().split())\na = []\nb = []\nans = 0\nfor i in range(n):\n tempa,tempb = map(int,input().split())\n a.append(tempa)\n b.append(tempb)\ntest = dict(zip(a,b))\ntest = sorted(test.items())\nprint(test)\n# test_item = test.values()\n# test_key = test.keys()\n# print(test_item)\n# print(test_key)\n\n# if m-test[i][1] >=0:\n\ni=0\nwhile m>0:\n if m-test[i][1] >=0:\n ans += test[i][0]*test[i][1]\n m -=test[i][1]\n i += 1\n else:\n ans += test[i][0]*m\n m=0\n print(ans)\n exit()\nprint(ans)', 'n,m=map(int,input().split())\na = []\nb = []\nans = 0\nfor i in range(n):\n tempa,tempb = map(int,input().split())\n a.append(tempa)\n b.append(tempb)\ntest = list(zip(a,b))\ntest = sorted(test)\ni=0\nwhile m>0:\n if m-test[i][1] >=0:\n ans += test[i][0]*test[i][1]\n m -=test[i][1]\n else:\n ans += test[i][0]*m\n m=0\n print(ans)\n exit()\n i+=1\nprint(ans)']
['Runtime Error', 'Accepted']
['s589341970', 's670989804']
[24568.0, 19412.0]
[505.0, 447.0]
[563, 398]
p03103
u757446793
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['# coding: utf-8\n# Your code here!\n\nN,M = map(int,input().split())\nA = []\n\nans = 0\nfor _ in range(N):\n A.append(list(map(int,input().split())))\n\nA = sorted(A, key=lambda x: x[0])\nprint(A)\nfor a in A:\n if a[1] >= M:\n ans += a[0]*M\n break\n else:\n ans += a[0]*a[1]\n M -= a[1]\n \nprint(ans)', '# coding: utf-8\n# Your code here!\n\nN,M = map(int,input().split())\nA = []\n\nans = 0\nfor _ in range(N):\n A.append(list(map(int,input().split())))\n\nA = sorted(A, key=lambda x: x[0])\n# print(A)\nfor a in A:\n if a[1] >= M:\n ans += a[0]*M\n break\n else:\n ans += a[0]*a[1]\n M -= a[1]\n \nprint(ans)']
['Wrong Answer', 'Accepted']
['s852001812', 's532439674']
[34640.0, 29792.0]
[525.0, 458.0]
[328, 330]
p03103
u760391419
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M = map(int,input().split())\n\nA = [ list(map(int,input().split())) for _ in range(N) ]\nA.sort()\nans = 0\nfor M == 0:\n if M >= A[0][1]:\n ans += A[0][0] * A[0][1]\n M -= A[0][1]\n del A[0]\n else:\n ans += A[0][0] * M\n M = 0\nprint(ans)', 'N,M = map(int,input().split())\n \nA = [ list(map(int,input().split())) for _ in range(N) ]\nA.sort()\nans = 0\nwhile M > 0:\n if M >= A[0][1]:\n ans += A[0][0] * A[0][1]\n M -= A[0][1]\n del A[0]\n else:\n ans += A[0][0] * M\n M = 0\nprint(ans)']
['Runtime Error', 'Accepted']
['s706634595', 's470075480']
[3064.0, 27760.0]
[17.0, 1950.0]
[247, 249]
p03103
u764956288
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N, M = map(int,input().split())\nPNs = [list(map(int,input().split())) for _ in range(N)]\n#price_and_number_of_drinks\n\nPNs.sort(key=lambda x: x[0])\n\nans = 0\nsum_drinks = 0 #sum of drinks which Takahashi has bought\nfor i in range(N):\n nos = PNs[i][1] #number of drinks at i_th shop\n nob = min(M-sum_drinks, nos) #number of drinks which he can buy at the shop\n ans += nob*PNs[i][0] #add money he spent at the shop\n sum_drinks += nob\n if s>=M: break\n\nprint(ans)\n', 'N, M = map(int,input().split())\nPNs = [list(map(int,input().split())) for _ in range(N)]\n#price_and_number_of_drinks\n\nPNs.sort(key=lambda x: x[0])\n\nans = 0\nsum_drinks = 0 #sum of drinks which Takahashi has bought\nfor i in range(N):\n drinks_at_shop = PNs[i][1] #number of drinks at i_th shop\n ans += drinks_at_shop*PNs[i][0]\n sum_drinks += drinks_at_shop\n \n over = sum_drinks-M\n if over>=0:\n ans -= (over)*PNs[i][0]\n break\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s816646796', 's718409911']
[29032.0, 29028.0]
[397.0, 458.0]
[473, 465]
p03103
u772588522
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n, m = map(int, input().split())\n\nab = [[int(l[0]), int(l[1])] for l in (input().split() for i in range(n))]\nab.sort()\ntemp = sum(ab, []) \na, b = temp[0::2], temp[1::2]\nprint(a, b)\n\ncount, index, remainder = 0, 0, 0\n\nfor i in range(n):\n if count + b[i] < m: \n count += b[i]\n else:\n index = i\n remainder = m - count\n \ntotal = a[index] * remainder\n# print(a[index])\n# print(remainder)\n# print(total)\n\nfor i in range(index):\n total += a[i] * b[i]\n\nprint(total)', 'import sys\ninput = sys.stdin.readline\nn, m = map(int, input().split())\n\nab = [[int(x) for x in input().split()] for _ in range(n)]\n\nab.sort(key=lambda x: x[0])\n\ntemp = sum(ab, []) \na, b = temp[0::2], temp[1::2]\n\ncount, index, remainder = 0, 0, 0\n\nfor bottle in b:\n index += 1\n if count + bottle < m: \n count += bottle\n else:\n remainder = m - count\n break\n \ntotal = a[index] * remainder\ntotal += sum([a[i] * b[i] for i in range(index)])\n\n\nprint(total)', 'import sys\ninput = sys.stdin.readline\nn, m = map(int, input().split())\n \nab = [[int(x) for x in input().split()] for _ in range(n)]\n \nab.sort(key=lambda x: x[0])\n \ncount, cost, index = 0, 0, 0\n\nfor x in ab:\n bottle = x[1]\n if count + bottle < m: \n count += bottle\n cost += ab[index][0] * bottle\n index += 1\n else:\n cost += ab[index][0] * (m - count)\n break\n\nprint(cost)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s362954114', 's516226072', 's780031380']
[22184.0, 23652.0, 22812.0]
[2105.0, 2105.0, 253.0]
[489, 482, 388]
p03103
u780475861
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nn,m=map(int,readline().split())\nd = map(int,read().split())\ndata = list(zip(d,d))\ndata.sort(key=lambda x:x[0])\nc=0\nfor x,y in data:\n if m-c<=y:\n c+=m-c\n break\n else:\n c+=y\nprint(c)', 'import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nn,m=map(int,readline().split())\nd = map(int,read().split())\ndata = list(zip(d,d))\ndata.sort(key=lambda x:x[0])\nc=0\ncost=0\nfor x,y in data:\n if m-c<=y:\n cost+=(m-c)*x\n break\n else:\n c+=y\n cost+=y*x\nprint(cost)\n\n']
['Wrong Answer', 'Accepted']
['s953878473', 's828623535']
[27496.0, 27496.0]
[144.0, 159.0]
[308, 341]
p03103
u785578220
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['from operator import itemgetter\nk, b = map(int, input().split())\na=[]\nfrom heapq import heappush, heappop\nfor i in range(k):\n ta,tb = map(int, input().split())\n a.append([ta,tb])\na = sorted(a, key=itemgetter(0), reverse=False)\nprint(a)\ns=0\nt = 0\nans = 0\ni = 0\nwhile s<b:\n s+=1\n if t<a[i][1]:\n ans+=a[i][0]\n t+=1\n else:\n i+=1\n ans+=a[i][0]\n t=1 \n\nprint(ans)\n', 'from operator import itemgetter\nk, b = map(int, input().split())\na=[]\nfrom heapq import heappush, heappop\nfor i in range(k):\n ta,tb = map(int, input().split())\n a.append([ta,tb])\na = sorted(a, key=itemgetter(0), reverse=False)\ns=0\nt = 0\nans = 0\ni = 0\nwhile s<b:\n s+=1\n if t<a[i][1]:\n ans+=a[i][0]\n t+=1\n else:\n i+=1\n ans+=a[i][0]\n t=1 \n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s725332659', 's241629256']
[27016.0, 22076.0]
[497.0, 460.0]
[410, 401]
p03103
u787332781
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['from collections import OrderedDict\nif __name__ == "__main__":\n NM = list(map(int, input().split()))\n n = NM[0]\n m = NM[1]\n mydict = {}\n for i in range(n):\n money_can = list(map(int, input().split()))\n money = money_can[0]\n can = money_can[1]\n if(money not in mydict.keys()):\n mydict[money] = []\n mydict[money].append(can)\n buynow = 0\n moneynow = 0\n\n mydict = OrderedDict(sorted(mydict.items()))\n for i in mydict.keys():\n if(buynow >= m):\n break\n for canNO in mydcit[i]:\n if(buynow >= m):\n break\n if(can + buynow <= m):\n moneynow += can*i\n buynow += can\n else:\n need = m - buynow\n moneynow += need*i\n buynow += need\n else:\n continue\n print(moneynow)\n\n ', 'from collections import OrderedDict\nif __name__ == "__main__":\n NM = list(map(int, input().split()))\n n = NM[0]\n m = NM[1]\n mydict = {}\n for i in range(n):\n money_can = list(map(int, input().split()))\n money = money_can[0]\n can = money_can[1]\n if(money not in mydict.keys()):\n mydict[money] = []\n mydict[money].append(can)\n buynow = 0\n moneynow = 0\n\n mydict = OrderedDict(sorted(mydict.items()))\n for i in mydict.keys():\n if(buynow >= m):\n break\n for canNO in mydict[i]:\n if(buynow >= m):\n break\n if(canNO + buynow < m):\n moneynow += canNO*i\n buynow += canNO\n else:\n need = m - buynow\n moneynow += need*i\n buynow += need\n else:\n continue\n print(moneynow)\n\n ']
['Runtime Error', 'Accepted']
['s431051550', 's782870363']
[75844.0, 75844.0]
[953.0, 1022.0]
[897, 902]
p03103
u790865625
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['#!/usr/bin/env python3\nN, M = map(int, input().split())\nAB = [list(map(int, input().split())), for i in range(N)]\n\nAB.sort()\n\nans = 0\nfor i, j in AB\n\tans += i * min(M, j)\n\tM -= min(M, j)\n\nprint(ans)\n', '#!/usr/bin/env python3\nN, M = map(int, input().split())\nAB = [list(map(int, input().split())) for i in range(N)]\n\nAB.sort()\n\nans = 0\nfor i, j in AB:\n\tans += i * min(M, j)\n\tM -= min(M, j)\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s295247019', 's220267300']
[2940.0, 27760.0]
[18.0, 506.0]
[199, 199]
p03103
u796789068
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M=map(int,input().split()) \nA=[list(map(int,input().split())) for i in range(N)]\nA=sorted(A) #A...en B..hon\nprint(A)\nprice=0\nnum=0\nfor i in range(N):\n if num+A[i][1]<M:\n price+=A[i][0]*A[i][1]\n num+=A[i][1]\n elif num<M and num+A[i][1]>=M:\n price+=A[i][0]*(M-num)\n break\n else:\n break\nprint(price)\n', 'N,M=map(int,input().split()) \nA=[list(map(int,input().split())) for i in range(N)]\nA=sorted(A) #A...en B..hon\n#print(A)\nprice=0\nnum=0\nfor i in range(N):\n if num+A[i][1]<M:\n price+=A[i][0]*A[i][1]\n num+=A[i][1]\n elif num<M and num+A[i][1]>=M:\n price+=A[i][0]*(M-num)\n break\n else:\n break\nprint(price)\n']
['Wrong Answer', 'Accepted']
['s927759518', 's878259354']
[34656.0, 28656.0]
[600.0, 503.0]
[358, 359]
p03103
u798818115
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['# coding: utf-8\n# Your code here!\nN,M=map(int,input().split())\nl=[10**5]*M\n\nfor i in range(N):\n a,b=map(int,input().split())\n \n count=0\n for j in range(M):\n if l[j]>a:\n l[j]=a\n count+=1\n l.reverse()\n if count==b:\n break\n\nprint(l)\nprint(sum(l))\n', '# coding: utf-8\n# Your code here!\nN,M=map(int,input().split())\nl=[10**5]*M\n\nfor i in range(N):\n a,b=map(int,input().split())\n \n count=0\n for j in range(M):\n if l[j]>a:\n del l[0]\n l.append(a)\n count+=1\n l.sort(reverse=True)\n if count==b:\n break\n\nprint(l)\nprint(sum(l))\n', '# coding: utf-8\n# Your code here!\nN,M=map(int,input().split())\nl=[[-1]*2 for i in range(N)]\n\nfor i in range(N):\n a,b=map(int,input().split())\n l[i]=[a,b]\n\nl.sort()\nsum=0\ni=0\nwhile M>0:\n num=min(M,l[i][1])\n sum+=num*l[i][0]\n M-=num\n i+=1\nprint(sum)\n\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s481907484', 's648040991', 's549313181']
[3828.0, 3828.0, 20012.0]
[2104.0, 2104.0, 488.0]
[310, 345, 267]
p03103
u800704240
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n,m = map(int,input().split())\nplist = []\nfor _ in range(n):\n plist.append([int(x) for x in input().split()])\n\nplist.sort()\nprint(plist)\n\ncost=0\ni = 0\n\nwhile i < len(plist):\n tmp = plist[i]\n if tmp[1] < m:\n m -= tmp[1]\n cost += tmp[0] * tmp[1]\n i += 1\n continue\n else:\n cost += tmp[0] * m\n break\nprint(cost)\n', 'n,m = map(int,input().split())\nplist = []\nfor _ in range(n):\n plist.append([int(x) for x in input().split()])\n\nplist.sort()\n\ncost=0\ni = 0\n\nwhile i < len(plist):\n tmp = plist[i]\n if tmp[1] < m:\n m -= tmp[1]\n cost += tmp[0] * tmp[1]\n i += 1\n continue\n else:\n cost += tmp[0] * m\n break\nprint(cost)']
['Wrong Answer', 'Accepted']
['s246833176', 's402117875']
[27632.0, 21612.0]
[513.0, 473.0]
[362, 348]
p03103
u802772880
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M=list(map(int,input().split(" ")))\nl=[]\nl=[list(map(int,input().split(" "))) for i in range(n)]\ndrink=0\nprice=0\ni=0\nl.sort(key=lambda x: x[0])\nwhile drink<M:\n pri=l[i][0]\n num=l[i][1]\n i+=1\n drink+=num\n price+=pri*num\nif drink>M:\n price-=(drink-m)*pri\nprint(price)\n', 'n,m=map(int,input().split())\na=[[int(i) for i in input().split()] for i in range(n)]\na.sort()\nprice=0\ncnt=0\nfor i in range(n):\n if cnt+a[i][1]==m:\n cnt+=a[i][1]\n price+=a[i][0]*a[i][1]\n break\n elif cnt+a[i][1]<m:\n cnt+=a[i][1]\n price+=a[i][0]*a[i][1]\n else:\n price+=a[i][0]*(m-cnt)\n break\nprint(price)']
['Runtime Error', 'Accepted']
['s544912503', 's135843629']
[3064.0, 21604.0]
[17.0, 469.0]
[286, 359]
p03103
u802977614
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n,m=map(int,input().split())\ndataset=sorted([tuple(map(int,input().split())) for i in range(n)])\nans=0\nfor data in dataset:\n if m==0:\n print(ans)\n exit()\n tmp=min(data[1],m)\n ans+=tmp*data[0]\n m-=tmp', 'n,m=map(int,input().split())\ndataset=sorted([tuple(map(int,input().split())) for i in range(n)])\nans=0\nfor data in dataset:\n if m==0:\n print(ans)\n exit()\n tmp=min(data[1],m)\n ans+=tmp*data[0]\n m-=tmp\nprint(ans)']
['Wrong Answer', 'Accepted']
['s378251771', 's348450014']
[17764.0, 17752.0]
[425.0, 429.0]
[209, 220]
p03103
u811132356
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['#!/usr/bin/env python\n# coding: utf-8\n\n# In[86]:\n\n\nN,M=map(int,input().split())\nab=[list(map(int,input().split())) for l in range(N)]\nct=0\nmoney=0\nl=[]\nfor i in range(N):\n l.append(ab[i][0])\nl.sort()\nfor i in range(N):\n # min_id=l.index(min(l))\n if ct+ab[i][1]<M:\n money+=ab[i][0]*ab[i][1]\n ct+=ab[i][1]\n #l[i]=10000000000\n else:\n for i in range(ab[i][1]):\n money+=l[i]\n ct+=1\n if ct==M:\n break\nprint(money)\n\n\n# ## \n', '\n\nN,M=map(int,input().split())\nab=[list(map(int,input().split())) for l in range(N)]\nct=0\nmoney=0\nl=[]\nfor i in range(N):\n l.append(ab[i][0])\nl.sort()\nfor i in range(N):\n # min_id=l.index(min(l))\n if ct+ab[i][1]<M:\n money+=ab[i][0]*ab[i][1]\n ct+=ab[i][1]\n #l[i]=10000000000\n else:\n for i in range(ab[i][1]):\n money+=l[i]\n ct+=1\n if ct==M:\n break\n # l[min_id]=100000000000\n if ct==M:\n break\nprint(money)\n\n\n# ## \n', 'N,M=map(int,input().split())\nab=[list(map(int,input().split())) for l in range(N)]\nct=0\nct1=0\nct2=0\nmoney=0\nl=[]\nid=[]\nfor i in range(N):\n l.append(ab[i][0])\nid=sorted(range(len(l)),key=lambda k: l[k])\nl.sort()\nwhile ct<M:\n while ct2<ab[id[ct1]][1]:##\n money+=l[ct1] #l[ct1]\n #print(money,l[ct1])\n ct+=1\n ct2+=1\n if ct==M:\n break\n ct1+=1\n ct2=0\nprint(money)\n\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s643406830', 's747438396', 's580550870']
[28684.0, 28684.0, 33800.0]
[2105.0, 409.0, 558.0]
[503, 522, 417]
p03103
u821251381
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N, M = map(int,input().split())\n\nAB = {}\nfor i in range(N):\n A, B = map(int,input().split())\n AB[A]=B\nAB = sorted(AB.items(),key = lambda x:x[0])\n\nacost = 0\n\nfor a,b in AB:\n cost += (min(max(M,0),b))*a\n M-=b\n if M<=0:\n break\nprint(cost)\n ', 'N, M = map(int,input().split())\n\nAB = []\nfor i in range(N):\n A, B = map(int,input().split())\n AB.append([A,B])\nAB = sorted(AB,key = lambda x:x[0])\ncost = 0\n\nfor a,b in AB:\n cost += (min(max(M,0),b))*a\n M-=b\n if M<=0:\n break\nprint(cost)\n ']
['Runtime Error', 'Accepted']
['s742618790', 's074633707']
[29076.0, 26240.0]
[239.0, 312.0]
[247, 246]
p03103
u821262411
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M=map(int,input().split())\nL=[]\n\nans=0\n\nfor i in range(N):\n a,b=map(int,input().split())\n\n L.append([a,b])\n\nL= sorted(L)\n\n\n\nfor i in range(N):\n\n if M < L[i][1]\n ans=L[i][0]*M\n\n print(ans)\n exit()\n \n else:\n\n\n ans = L[i][0]*L[i][1]\n M -= L[i][1]\n\n\n if M==0:\n\n print(ans)\n exit()\n\n\n if M <= L[i+1][1]:\n\n ans += M * L[i+1][0]\n\n print(ans)\n\n exit()\n\n \n\n\n', 'N,M=map(int,input().split())\nL=[]\nans=0\n\nfor i in range(N):\n a,b=map(int,input().split())\n\n L.append([a,b])\n\nL= sorted(L)\n\nfor i in range(N):\n\n if M < L[i][1]:\n ans=L[i][0]*M\n\n print(ans)\n exit()\n \n else:\n ans += L[i][0]*L[i][1]\n M -= L[i][1]\n\n if M==0:\n\n print(ans)\n exit()\n\n elif M <= L[i+1][1]:\n\n ans += M * L[i+1][0]\n print(ans)\n exit()\n\n \n\n\n']
['Runtime Error', 'Accepted']
['s658214657', 's819226986']
[2940.0, 20816.0]
[17.0, 507.0]
[509, 476]
p03103
u826929627
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M = map(int,input().split())\n\ndct_a_tmp = {}\ndct_b = {}\nfor n in range(N):\n a,b = map(int, input().split())\n dct_a_tmp[n] = a\n dct_b[n] = b\n\n\nlist_a = sorted(dct_a_tmp.items(), key=lambda x: x[1])\n\n\n\n\ncnt_buied = 0\ncost = 0\ninf = 10 ** 18\n\n\nfor i in range(inf):\n want_buy = M - cnt_buied \n \n if dct_b[list_a[i][0]] <= want_buy:\n cost += list_a[i][1] * dct_b[list_a[i][0]]\n cnt_buied += dct_b[list_a[i][0]] \n else:\n cost += list_a[i][1] * want_buy\n \n if cnt_buied >= M:\n break\n\nprint(cost)', "import sys\n \nstdin = sys.stdin\n\nN,Q = map(int,input().split())\nS = input()\n\ncheck_point = []\ninf = 10 ** 18\n\n\nfor i in range(inf):\n out = S.find('AC')\n if out < 0:\n break\n else:\n S = S[out+2:]\n check_point.extend([(out + len(check_point) * 2)])\n \n\n\nfor i in range(Q):\n start, end = map(int, stdin.readline().split())\n print(len([i for i in check_point if (start - 1 <= i) and (i + 1 < end)]))\n", 'N,M = map(int,input().split())\n\ndct_a_tmp = {}\ndct_b = {}\nfor n in range(N):\n a,b = map(int, input().split())\n dct_a_tmp[n] = a\n dct_b[n] = b\n\n\nlist_a = sorted(dct_a_tmp.items(), key=lambda x: x[1])\n\n\n\n\ncnt_buied = 0\ncost = 0\ninf = 10 ** 18\n\n\nfor i in range(inf):\n want_buy = M - cnt_buied \n \n if dct_b[list_a[i][0]] <= want_buy:\n cost += list_a[i][1] * dct_b[list_a[i][0]]\n cnt_buied += dct_b[list_a[i][0]] \n else:\n cost += list_a[i][1] * want_buy\n cnt_buied += want_buy\n \n if cnt_buied >= M:\n break\n\nprint(cost)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s312624248', 's360716165', 's128069886']
[33480.0, 3952.0, 33476.0]
[433.0, 233.0, 453.0]
[761, 515, 787]
p03103
u827885761
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N, M = map(int, input().split())\nd = dict([list(map(int, input().split()))[::-1] for i in range(N)])\nd = sorted(d.items(), key=lambda x: x[1])\nc = p = i = 0\n\nwhile c < M:\n if c + d[i][0] <= M:\n c += d[i][0]\n p += d[i][1] * d[i][0]\n i += 1\n else:\n p += d[i][1] * (M - c)\n print(c)\n break\n\nprint(p)\n', 'N, M = map(int, input().split())\nd = [list(map(int, input().split())) for i in range(N)]\nd.sort(key=lambda x:(x[0],x[1]))\n\nc = p = i = 0\n\nwhile c < M:\n if c + d[i][1] <= M:\n c += d[i][1]\n p += d[i][0] * d[i][1]\n i += 1\n else:\n p += d[i][0] * (M - c)\n break\n\nprint(p)\n']
['Runtime Error', 'Accepted']
['s561292819', 's046031666']
[24748.0, 35292.0]
[401.0, 505.0]
[345, 308]
p03103
u829416877
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M = map(int,input().split())\nlist = []\nfor _ in range(n):\n a,b = map(int,input().split())\n list.append([a,b])\nlist.sort()\nans = 0\nfor a,b in l:\n ans += min(b,M)*a\n M = max(0,M-b)\nprint(ans)', 'N,M = map(int,input().split())\nlist = []\nfor _ in range(N):\n a,b = map(int,input().split())\n list.append([a,b])\nlist.sort()\nans = 0\nfor a,b in list:\n ans += min(b,M)*a\n M = max(0,M-b)\nprint(ans)']
['Runtime Error', 'Accepted']
['s376724606', 's048466494']
[9108.0, 24236.0]
[25.0, 369.0]
[195, 198]
p03103
u829895669
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M = map(int, input().split())\nAB = [list(map(int, input().split())) for _ in range(N)]\n\nsortAB = sorted(AB)\n\nans = 0\nnum = M\nfor i in sortAB:\n a,b = i\n if num >= b:\n num -= b\n ans += a* b\n else:\n ans += i * num\n break\n\nprint(ans)', 'N,M = map(int, input().split())\nAB = [list(map(int, input().split())) for _ in range(N)]\n\nA = []\nB = []\nfor i in AB:\n a,b = i\n A.append(a)\n B.append(b)\n\nsortA = sorted(A)\n\nans = 0\nnum = M\nfor i in sortA:\n ind = A.index(i)\n k = B[ind]\n if num > k:\n num -= k\n ans += i* k\n else:\n while True:\n if K == 0:\n break\n ans += i\n k -=1\nprint(ans)', 'N,M = map(int, input().split())\nAB = [list(map(int, input().split())) for _ in range(N)]\n\nsortAB = sorted(AB)\n\nans = 0\nnum = M\nfor i in sortAB:\n a,b = i\n if num >= b:\n num -= b\n ans += a* b\n else:\n ans += a * num\n break\n\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s681519750', 's757489815', 's511555903']
[28768.0, 30248.0, 28648.0]
[451.0, 2105.0, 463.0]
[268, 426, 268]
p03103
u835283937
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['def main():\n N, M = map(int, input().split())\n store = list()\n for i in range(N):\n A, B = map(int, input().split())\n store.append([A, B])\n store.sort(key = lambda x : x[0])\n cost = 0\n drink = 0\n print(store)\n for i in range(N):\n if drink < M:\n if drink + store[i][1] < M:\n drink += store[i][1]\n cost += store[i][0] * store[i][1]\n else:\n cost += store[i][0] * (M - drink)\n drink += M - drink\n else:\n break\n print(cost)\nif __name__ == "__main__":\n main()', 'def main():\n N, M = map(int, input().split())\n store = list()\n for i in range(N):\n A, B = map(int, input().split())\n store.append([A, B])\n store.sort(key = lambda x : x[0])\n cost = 0\n drink = 0\n for i in range(N):\n if drink < M:\n if drink + store[i][1] < M:\n drink += store[i][1]\n cost += store[i][0] * store[i][1]\n else:\n cost += store[i][0] * (M - drink)\n drink += M - drink\n else:\n break\n print(cost)\nif __name__ == "__main__":\n main()']
['Wrong Answer', 'Accepted']
['s076297569', 's540065160']
[26928.0, 21204.0]
[435.0, 377.0]
[603, 586]
p03103
u836737505
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n,m = map(int, input().split())\na = [list(map(int, input().split())) for _ in range(n)]\na.sort(key=lambda x:(x[0],x[1]))\nc = 0\nans = 0\nfor i in range(n):\n if c >= m:\n break\n for j in range(a[i][1]):\n if c < m:\n c += 1\n ans += a[i][0]', 'n,m = map(int, input().split())\na = [list(map(int, input().split())) for _ in range(n)]\na.sort(key=lambda x:(x[0]))\nc = 0\nans = 0\nfor i in a:\n if c + i[1] < m:\n c += i[1]\n ans += i[0]*i[1]\n else:\n for j in range(i[1]):\n c += 1\n ans += i[0]\n if c >=m:\n break\n break\nprint(ans)']
['Wrong Answer', 'Accepted']
['s038215768', 's726802410']
[35292.0, 29028.0]
[510.0, 437.0]
[275, 373]
p03103
u840958781
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n,m=map(int,input().split())\nL=0\nR=n\nfor i in range(m):\n l,r=map(int,input().split())\n if l>L:\n L=l\n if r<R:\n R=r\nif R-L<0:\n print(0)\nelse:\n print(R-L)', 'n,m=map(int,input().split())\ns=[]\nfor i in range(n):\n a,b=map(int,input().split())\n \n s.append([a,b])\ns.sort()\nans=0\ni=0\nwhile m-s[i][1]>0:\n m-=s[i][1]\n ans+=s[i][0]*s[i][1] \n i+=1\nprint(ans+s[i][0]*m)']
['Runtime Error', 'Accepted']
['s808866955', 's598044172']
[3060.0, 20056.0]
[284.0, 501.0]
[180, 254]
p03103
u845620905
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['\n#include <algorithm>\n\n#include <string>\n#include <map>\n#include <set>\nusing namespace std;\nint main() {\n int n, m;\n long long ans = 0;\n cin >> n >> m;\n vector<int> a(n), b(n);\n vector<pair<int, int> > ab(n);\n for(int i = 0; i < n; i++) {\n cin >> a[i] >> b[i];\n }\n for(int i = 0; i < n; i++) {\n ab[i] = make_pair(a[i], b[i]);\n }\n sort(ab.begin(), ab.end()); \n for(int i = 0; i < n; i++) {\n int buy = min(m, ab[i].second);\n ans += buy * ab[i].first;\n m -= buy;\n }\n \n cout << ans << endl;\n}', 'import numpy as np\nn, m = map(int, input().split())\na = []\nb = []\nbot = m\nans = 0\nfor i in range(n):\n l,m = map(int, input().split())\n a.append(l)\n b.append(m)\n \na = np.array(a)\nb = np.array(b)\ns = np.argsort(a)\nfor i in s:\n if(bot >= b[i]):\n bot -= b[i]\n ans += a[i] * b[i]\n else: \n ans += a[i] * (bot)\n bot = 0\n break\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s954692761', 's391432249']
[2940.0, 20848.0]
[20.0, 612.0]
[554, 353]
p03103
u856234158
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['tmp = input()\nN = int(tmp.split()[0])\nM = int(tmp.split()[1])\nA = []\nB = []\nfor i in range(N):\n\ttmp = input()\n\tA[i] = int(tmp.split()[0])\n\tB[i] = int(tmp.split()[1])\n\ncnt=0\ntotal=0\nwhile cnt < M:\n\tmini = N\n\tminv = 999999999999999\n\tfor i in range(N):\n\t\tif minv > A[i]:\n\t\t\tminv = A[i]\n\t\t\tmini = i\n\tcnt += B[mini]\n\ttotal += A[mini]*B[mini]\n\tA[mini] = 999999999999999\ntotal -= minv*(cnt-M)\nprint(total)', 'tmp = input()\nN = int(tmp.split()[0])\nM = int(tmp.split()[1])\nA = []\nB = []\nfor i in range(N):\n\ttmp = input()\n\tA[i] = int(tmp.split()[0])\n\tB[i] = int(tmp.split()[1])\n\nminv = 100000000000\ncnt=0\ntotal=0\nwhile cnt < M:\n\tmini = N\n\tfor i in range(N):\n\t\tif minv > A[i]:\n\t\t\tminv = A[i]\n\t\t\tmini = i\n\tcnt += B[mini]\n\ttotal = A[mini]*B[mini]\n\tA[mini] = 1000000000000\ntotal -= minv*(cnt-M)\nprint(total)', 'tmp = input()\nN = int(tmp.split()[0])\nM = int(tmp.split()[1])\nAB = []\nfor i in range(N):\n\ttmp = input()\n\tAB.append([int(tmp.split()[0]),int(tmp.split()[1])])\n\nAB.sort()\n\ncnt=0\ntotal=0\ni = 0\nwhile cnt < M:\n\tcnt += AB[i][1]\n\ttotal += AB[i][0]*AB[i][1]\n\ti+=1\ntotal -= AB[i-1][0]*(cnt-M)\nprint(total)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s824171548', 's910813450', 's221396262']
[3064.0, 3064.0, 20012.0]
[17.0, 18.0, 452.0]
[398, 391, 297]
p03103
u858670323
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['# coding: utf-8\nimport os\nfrom sys import stdin\nfrom functools import total_ordering\n\n__dirname = os.path.dirname(__file__)\n__basename = os.path.splitext(os.path.basename(__file__))[0]\n__targetname = \'./input/\' + __basename + \'.txt\'\ntarget_path = os.path.join(__dirname, __targetname)\nstdin = open(target_path)\n\n@total_ordering\nclass struct(object):\n def __init__(self,a,b):\n self.a=a\n self.b=b\n def __lt__\t(self,other):\n return self.a < other.a\n def __eq__\t(self,other):\n return self.a == other.a\n\ndef main():\n # st = struct(10,1)\n # print(st.a)\n input_line = stdin.readline().rstrip().split(\' \')\n N, M = map(int, input_line)\n A = list()\n for _ in range(N):\n input_line = stdin.readline().rstrip().split(\' \')\n a,b=map(int, input_line)\n st=struct(a,b)\n A.append(st)\n A.sort()\n ans=0\n time=0\n for x in A:\n # print(x.a,x.b)\n if(time>M):\n continue\n if((time+x.b)<=M):\n ans += x.a*x.b\n time += x.b\n else:\n ans += x.a*(M-time)\n time = M\n print(ans)\n\n\n\nif __name__ == "__main__":\n main()\n ', '# coding: utf-8\nimport os\nfrom sys import stdin\nfrom functools import total_ordering\n\n# __dirname = os.path.dirname(__file__)\n\n\n# target_path = os.path.join(__dirname, __targetname)\n\n\n@total_ordering\nclass struct(object):\n def __init__(self,a,b):\n self.a=a\n self.b=b\n def __lt__\t(self,other):\n return self.a < other.a\n def __eq__\t(self,other):\n return self.a == other.a\n\ndef main():\n # st = struct(10,1)\n # print(st.a)\n input_line = stdin.readline().rstrip().split(\' \')\n N, M = map(int, input_line)\n A = list()\n for _ in range(N):\n input_line = stdin.readline().rstrip().split(\' \')\n a,b=map(int, input_line)\n st=struct(a,b)\n A.append(st)\n A.sort()\n ans=0\n time=0\n for x in A:\n # print(x.a,x.b)\n if(time>M):\n continue\n if((time+x.b)<=M):\n ans += x.a*x.b\n time += x.b\n else:\n ans += x.a*(M-time)\n time = M\n print(ans)\n\n\n\nif __name__ == "__main__":\n main()\n ']
['Runtime Error', 'Accepted']
['s192397064', 's817014393']
[3700.0, 27692.0]
[24.0, 682.0]
[1170, 1180]
p03103
u862479046
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M = [int(s) for s in input().split()]\npre_lst=[]\nfor i in range(N):\n a,b = [int(s) for s in input().split()]\n pre_lst=lst+[[a,b,a*b]]\nlst = sorted(pre_lst, key=lambda x: x[0])\nm=0\ni=0\ncost=0\nwhile(m<M):\n m+=lst[i][1]\n cost+=lst[i][2]\n i+=1\nif(m>M):\n cost-=lst[i-1][0]*(m-M)\nprint(cost)\n', 'N,M = [int(s) for s in input().split()]\npre_lst=[]\nfor i in range(N):\n a,b = [int(s) for s in input().split()]\n pre_lst=lst+[[a,b,a*b]]\nlst = sorted(pre_lst, lambda=x: x[0])\nm=0\ni=0\ncost=0\nwhile(m<M):\n m+=lst[i][1]\n cost+=lst[i][2]\n i+=1\nif(m>M):\n cost-=lst[i-1][0]*(m-M)\nprint(cost)', 'N,M = [int(s) for s in input().split()]\nlst=[]\nfor i in range(N):\n lst.append([int(s) for s in input().split()])\n\nlst.sort()\ncount=0\ncost=0\nfor e in lst:\n count+=e[1]\n cost+=e[0]*e[1]\n if(count>=M):\n cost-=e[0]*(count-M)\n break\nprint(cost)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s065487866', 's697591653', 's499092053']
[3064.0, 2940.0, 21616.0]
[17.0, 17.0, 449.0]
[294, 289, 293]
p03103
u874333466
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N, M = map(int,input().split())\nA = []\nB = []\nfor i in range(N):\n a, b = map(int,input().split())\n A.append(a)\n B.append(b)\n\nvdic = {}\n\nfor i in range(N):\n if A[i] not in vdic.keys():\n vdic[A[i]] = B[i]\n else:\n vdic[A[i]] += B[i]\n \ncount = 0\ncost = 0\n \nfor i in vdic.keys():\n if vdic[i] + count >= M:\n cost += (M - count) * i\n break\n else:\n cost += vdic[i] * i\n count += vdic[i]\n \nprint(cost)', 'N, M = map(int,input().split())\nA = []\nB = []\nfor i in range(N):\n a, b = map(int,input().split())\n A.append(a)\n B.append(b)\n\nvdic = {}\n\nfor i in range(N):\n if A[i] not in vdic.keys():\n vdic[A[i]] = B[i]\n else:\n vdic[A[i]] += B[i]\n \nVdic = sorted(vdic.items())\n \ncount = 0\ncost = 0\n \nfor i in range(len(Vdic)):\n if Vdic[i][1] + count >= M:\n cost += (M - count) * Vdic[i][0]\n break\n else:\n cost += Vdic[i][1] * Vdic[i][0]\n count += Vdic[i][1]\n \nprint(cost)']
['Wrong Answer', 'Accepted']
['s994984627', 's715707561']
[20172.0, 24524.0]
[379.0, 491.0]
[426, 491]
p03103
u883203948
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n,m = list(map(int,input().split()))\na = []\nb = []\nfor i in range(n):\n x,y = list(map(int,input().split()))\n a.append(x)\n b.append(y)\ncount = 0\n\nwhile True:\n mi = min(a)\n print(mi,"mi")\n if m - b[a.index(min(a))] > 0 : \n m = m-b[a.index(min(a))]\n count += b[a.index(min(a))] * min(a)\n \n elif m - b[a.index(min(a))] == 0:\n count += m * min(a)\n \n break\n else:\n count += m * min(a)\n break\n d = a.index(min(a))\n del a[d]\n del b[d]\n\nprint(count)\n\n\n', 'n,m = list(map(int,input().split()))\na = []\nb = []\ndic = {}\ncount = 0\ndata = [0] * n\nfor i in range(n):\n x,y = list(map(int,input().split()))\n data[i] = [x,y]\ndata = sorted(data,key = lambda x : x[0])\nfor i in range(n):\n if m > data[i][1]:\n count += data[i][0] * data[i][1]\n m -= data[i][1]\n else:\n count += data[i][0] * m\n break\nprint(count)\n\n\n \n\n\n']
['Wrong Answer', 'Accepted']
['s396667901', 's353074159']
[11012.0, 22496.0]
[2108.0, 472.0]
[545, 1000]
p03103
u891482208
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n, m = map(int, input().split())\nshop = []\nfor i in range(n):\n shop.append(list(map(int, input().split())))\nshop.sort()\nbought = 0\ncost = 0\nfor i in range(n):\n bought += min(m, b[i])\n cost += min(m, b[i]) * a[i]\n m -= min(m, b[i])\nprint(cost)', 'n, m = map(int, input().split())\nshop = []\nfor i in range(n):\n shop.append(list(map(int, input().split())))\nshop.sort()\nbought = 0\ncost = 0\nfor i in range(n):\n bought += min(m, shop[i][1])\n cost += min(m, shop[i][1]) * shop[i][0]\n m -= min(m, shop[i][1])\nprint(cost)']
['Runtime Error', 'Accepted']
['s672385892', 's766278360']
[27760.0, 27760.0]
[504.0, 602.0]
[246, 270]
p03103
u892340697
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n,m = map(int,input().split())\nd = []\nfor i in range(n):\n a,b = map(int,input().split())\n d.append([a,b])\n \nd.sort(key=lambda x:x[0])\n\nsum_ = 0\ncnt = 0\nfor ab in d:\n if cnt + ab[1] > M:\n sum_ += ab[0] * (M-cnt)\n break\n else:\n cnt += ab[1]\n sum_ += ab[0]*ab[1]\nprint(sum_)\n', 'n,M = map(int,input().split())\nd = []\nfor i in range(n):\n a,b = map(int,input().split())\n d.append([a,b])\n \nd.sort(key=lambda x:x[0])\n\nsum_ = 0\ncnt = 0\nfor ab in d:\n if cnt + ab[1] > M:\n sum_ += ab[0] * (M-cnt)\n break\n else:\n cnt += ab[1]\n sum_ += ab[0]*ab[1]\nprint(sum_)\n']
['Runtime Error', 'Accepted']
['s073703199', 's519089810']
[25172.0, 25292.0]
[254.0, 276.0]
[312, 312]
p03103
u899975427
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M = (int(i) for i in input().split())\ndic = {}\ndrink = M\nmoney = 0\nfor i in range(N):\n a,b = (int(i) for i in input().split())\n dic[a] += b\nc = sorted(dic.keys())\nprint(c)\nfor j in c:\n if drink > dic[j]:\n money += j * dic[j]\n drink -= dic[j]\n else:\n money += j * drink\n break\nprint(money)', 'N,M = (int(i) for i in input().split())\ndic = {}\ndrink = M\nmoney = 0\nfor i in range(N):\n a,b = (int(i) for i in input().split())\n if a not in dic:\n dic[a] = b\n else:\n dic[a] += b\nc = sorted(dic.keys())\nprint(c)\nfor j in c:\n if drink > dic[j]:\n money += j * dic[j]\n drink -= dic[j]\n else:\n money += j * drink\n break\nprint(money)', 'N,M = (int(i) for i in input().split())\ndic = {}\ndrink = M\nmoney = 0\nfor i in range(N):\n a,b = (int(i) for i in input().split())\n if a not in dic:\n dic[a] = b\n else:\n dic[a] += b\nc = sorted(dic.keys())\nfor j in c:\n if drink > dic[j]:\n money += j * dic[j]\n drink -= dic[j]\n else:\n money += j * drink\n break\nprint(money)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s519300199', 's957254484', 's053320376']
[3064.0, 19424.0, 17892.0]
[17.0, 445.0, 429.0]
[306, 350, 341]
p03103
u900688325
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N, M = map(int, input().split())\nAB = list(map(int, input().split()) for _ in range(N))\n\nsorted_ab = sorted(AB)\ncost = 0\nwhile M > 0:\n for i in range(N):\n for j in range(sorted_ab[i][1]):\n M -= 1\n cost += sorted_ab[i][0]\nprint(cost)', 'N, M = map(int, input().split())\nAB = [list(map(int, input().split())) for _ in range(N)]\n \nAB.sort()\ncost = 0\nfor i in range(N):\n M -= AB[i][1]\n cost += AB[i][1]*AB[i][0]\n if M<=0:\n store_num = i\n break\nif M<0:\n m = abs(M)\n cost -= m*AB[store_num][0]\nprint(cost)']
['Runtime Error', 'Accepted']
['s939044298', 's078091653']
[50420.0, 27752.0]
[377.0, 470.0]
[264, 292]
p03103
u903596281
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M=map(int,input().split())\nl=[]\nfor i in range(N):\n A,B=map(int,input().split())\n l.append([A,B])\nl.sort(key=lambda x:x[0])\ni=0\nans=0\nwhile M>l[i][1]:\n M-=l[i][1]\n i+=1\n ans+=l[i][0]*l[i][1]\nans+=l[i][0]*M\nprint(ans)', 'N,M=map(int,input().split())\nl=[]\nfor i in range(N):\n A,B=map(int,input().split())\n l.append([A,B])\nl.sort(key=lambda x:x[1])\ni=0\nans=0\nwhile M>l[i][1]:\n M-=l[i][1]\n i+=1\n ans+=l[i][0]+l[i][1]\nans+=l[i][0]*M\nprint(ans)', 'N,M=map(int,input().split())\nl=[]\nfor i in range(N):\n A,B=map(int,input().split())\n l.append([A,B])\nl.sort(key=lambda x:x[0])\ni=0\nans=0\nwhile M>l[i][1]:\n M-=l[i][1]\n i+=1\n ans+=l[i][0]+l[i][1]\nans+=l[i][0]*M\nprint(ans)', 'N,M=map(int,input().split())\nl=[]\nfor i in range(N):\n A,B=map(int,input().split())\n l.append([A,B])\nl.sort(key=lambda x:x[0])\ni=0\nans=0\nwhile M>l[i][1]:\n M-=l[i][1]\n ans+=l[i][0]*l[i][1]\n i+=1\nans+=l[i][0]*M\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s947362661', 's975532105', 's977378811', 's330014766']
[21208.0, 21268.0, 21208.0, 21208.0]
[432.0, 384.0, 424.0, 464.0]
[223, 223, 223, 223]
p03103
u904844073
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N, M = [int(i) for i in input().split()]\nshops = []\n\nfor i in range(0, N):\n A, B = [int(i) for i in input().split()]\n shops.append((A, B))\n\nshops.sort()\n\nprint(shops)\nresult = 0\nrest_count = M\nfor shop in shops:\n if rest_count > shop[1]:\n result += shop[0] * shop[1]\n rest_count -= shop[1]\n else:\n result += shop[0] * rest_count\n break\n\nprint(result)', 'N, M = [int(i) for i in input().split()]\nshops = []\n\nfor i in range(0, N):\n A, B = [int(i) for i in input().split()]\n shops.append((A, B))\n\nshops.sort()\n\nresult = 0\nrest_count = M\nfor shop in shops:\n if rest_count > shop[1]:\n result += shop[0] * shop[1]\n rest_count -= shop[1]\n else:\n result += shop[0] * rest_count\n break\n\nprint(result)']
['Wrong Answer', 'Accepted']
['s225295770', 's546060490']
[23028.0, 16956.0]
[468.0, 425.0]
[390, 377]
p03103
u905582793
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n,m=map(int,input().split())\na=[list(map(int,input().split())) for i in range(n)]\na.sort()\ndr=0\ni=0\npr=0\nwhile(dr<m):\n if dr+a[i][1]>=m:\n dr+=m-dr\n pr+=(m-dr)*a[i][0]\n else:\n dr+=a[i][1]\n pr+=a[i][0]*a[i][1]\n i+=1\nprint(pr)', 'n,m=map(int,input().split())\na=[list(map(int,input().split())) for i in range(n)]\na.sort()\ndr=0\ni=0\npr=0\nwhile(dr<m):\n if dr+a[i][1]>=m:\n pr+=(m-dr)*a[i][0]\n dr+=m-dr\n else:\n dr+=a[i][1]\n pr+=a[i][0]*a[i][1]\n i+=1\nprint(pr)\n']
['Wrong Answer', 'Accepted']
['s420169521', 's019730005']
[27760.0, 27760.0]
[496.0, 509.0]
[238, 239]
p03103
u912158215
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N, M = map(int, input().split())\nshops = sorted([list(map(int, input().split())) for i in range(n)])\ndrink = 0\ncost = 0\n\nfor i in range(N):\n cost += shops[i][0]*shops[i][1]\n drink += shops[i][1]\n if drink >= M:\n cost -= (drink -\u3000M) * shops[i][0]\n break\n \nprint(cost)', 'N, M = map(int, input().split())\nshops = sorted([list(map(int, input().split())) for i in range(n)])\ndrink = 0\ncost = 0\n\nfor i in range(N):\n cost += shops[i][0]*shops[i][1]\n drink += shops[i][1]\n if drink >= m:\n cost -= (drink -m) * shops[i][0]\n break\n \nprint(cost)\n', 'N, M = map(int, input().split())\nshops = sorted([list(map(int, input().split())) for i in range(N)])\ndrink = 0\ncost = 0\n\nfor i in range(N):\n cost += shops[i][0]*shops[i][1]\n drink += shops[i][1]\n if drink >= M:\n cost -= (drink -M) * shops[i][0]\n break\n \nprint(cost)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s708826035', 's922477545', 's059098859']
[3188.0, 3060.0, 28656.0]
[18.0, 18.0, 485.0]
[298, 296, 295]
p03103
u920204936
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['data = line.split(" ")\nshoplist = [] \nfor i in range(int(data[0])):\n shop = input()\n shopdata = shop.split(" ")\n shop_int = []\n for j in range(len(shopdata)):\n shop_int.append(int(shopdata[j]))\n shoplist.append(shop_int)\n\npayment = 0 \nwantdrink = int(data[1]) \npricelist = [] \nfor i in range(len(shoplist)):\n pricelist.append(shoplist[i][0])\nwhile wantdrink > 0 :\n pricemin = min(pricelist[i] for i in range(len(pricelist)))\n min_index = pricelist.index(pricemin)\n restdrink = shoplist[min_index][1]\n if restdrink >= wantdrink:\n while restdrink > 0:\n payment += pricemin\n restdrink -= 1\n wantdrink -= 1\n if wantdrink == 0:\n break\n else:\n payment += restdrink * pricemin\n wantdrink -= restdrink\n del shoplist[min_index]\n del pricelist[min_index]\nprint(payment)', 'data = line.split(" ")\nshoplist = [] \nfor i in range(int(data[0])):\n shop = input()\n shopdata = shop.split(" ")\n shop_int = []\n for j in range(len(shopdata)):\n shop_int.append(int(shopdata[j]))\n shoplist.append(shop_int)\n\npayment = 0 \nwantdrink = int(data[1]) \npricelist = [] \nfor i in range(len(shoplist)):\n pricelist.append(shoplist[i][0])\nwhile wantdrink > 0 :\n pricemin = min(pricelist[i] for i in range(len(pricelist)))\n min_index = pricelist.index(pricemin)\n restdrink = shoplist[min_index][1]\n if restdrink >= wantdrink:\n while restdrink > 0:\n payment += pricemin\n restdrink -= 1\n wantdrink -= 1\n if wantdrink == 0:\n break\n else:\n payment += restdrink * pricemin\n wantdrink -= restdrink\n del shoplist[min_index]\n del pricelist[min_index]\nprint(payment)', '# coding: utf-8\n\ndata = input().split()\nshoplist = []\nfor i in range(int(data[0])):\n shopdata = list(map(int, input().split()))\n shoplist.append(shopdata)\nshoplist.sort()\n\npayment = 0\nwantdrink = int(data[1])\nwhile wantdrink > 0 :\n restdrink = shoplist[0][1]\n if restdrink >= wantdrink:\n payment += wantdrink * shoplist[0][0]\n break\n else:\n payment += restdrink * shoplist[0][0]\n wantdrink -= restdrink\n del shoplist[0]\nprint(payment)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s043833623', 's207869137', 's969469896']
[3064.0, 3064.0, 27760.0]
[18.0, 18.0, 2000.0]
[966, 966, 484]
p03103
u921773161
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N, M = map(int, input().split())\nA = [0] * N \nB = [0] * N\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\n\nA.sort()', 'N, M = map(int, input().split())\nA = [0] * N \nB = [0] * N\nfor i in range(N):\n A[i], B[i] = map(int, input().split())\n\nA.sort()\n\nprint(1)', 'N, M = map(int, input().split())\nAB = [0] * N\nfor i in range(N):\n AB[i] =list(map(int, input().split()))\n\nAB.sort()\n\ncount = 0\nmoney = 0\ni = 0\n\nwhile count < M:\n money += AB[i][0] * AB[i][1]\n count += AB[i][1]\n i += 1\n\nif count > M:\n tmp = count - M\n money -= AB[i-1][0]*tmp\n\nans = money\nprint(ans)\n\n\n\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s308404773', 's684405509', 's261425577']
[11300.0, 11300.0, 27760.0]
[319.0, 314.0, 513.0]
[129, 139, 320]
p03103
u923105140
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N, M = map(int, input().split())\nAB = [list(map(int, input().split())) for i in range(N)]\nAB.sort(key = lambda x: x[0])\n\ntotal = 0\ni = 0\n\nwhile True:\n total += AB[i][1]\n if total < m:\n i += 1\n else:\n break\n\nans = 0\nfor j in range(i):\n ans += AB[j][0]*AB[j][1]\nans += (m - sum(AB[p][1] for p in range(0,i))) * AB[i][0]', 'N, M = map(int, input().split())\nAB = [list(map(int, input().split())) for i in range(N)]\nAB.sort(key = lambda x: x[0])\n\ntotal = 0\ni = 0\n\nwhile True:\n total += AB[i][1]\n if total < M:\n i += 1\n else:\n break\n\nans = 0\nfor j in range(i):\n ans += AB[j][0]*AB[j][1]\nans += (M - sum(AB[p][1] for p in range(0,i))) * AB[i][0]\nprint(ans)']
['Runtime Error', 'Accepted']
['s750508777', 's740648192']
[29020.0, 29024.0]
[407.0, 485.0]
[343, 354]
p03103
u923279197
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n,m = map(int,input().split())\nAB = [list(map(int,input().split())) for i in range(n)]\nAB.sort(reverse = True)\nc = 0\nans = 0\ni = 0\nwhile c < m:\n if c + AB[i][1] <= m:\n c += AB[i][1]\n ans += AB[i][0]*AB[i][1]\n i += 1\n else:\n ans += AB[i][0]*(m-c)\n break\n\nprint(ans)\n', 'n,m = map(int,input().split())\nAB = [list(map(int,input().split())) for i in range(n)]\nAB.sort(reverse = True)\nc = 0\nans = 0\ni = 0\nwhile c < m:\n if c + AB[i][1] <= m:\n c += AB[i][1]\n ans += AB[i][0]*AB[i][1]\n i += 1\n else:\n ans += Ab[i][0]*(m-c)\n break\n\nprint(ans)', 'n,m = map(int,input().split())\nAB = [list(map(int,input().split())) for i in range(n)]\nAB.sort()\nc = 0\nans = 0\ni = 0\nwhile c < m:\n if c + AB[i][1] <= m:\n c += AB[i][1]\n ans += AB[i][0]*AB[i][1]\n i += 1\n else:\n ans += AB[i][0]*(m-c)\n break\n\nprint(ans)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s284077021', 's591227469', 's652864917']
[27880.0, 27752.0, 27760.0]
[511.0, 557.0, 494.0]
[283, 282, 269]
p03103
u923341003
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['m = 0\ncnt = 0\nfor i in range(N):\n \n cnt += c[i][1]\n m += c[i][0] * c[i][1]\n \n if cnt == M:\n print(m)\n break\n elif cnt > M:\n print(m - c[i][0] * (cnt - M))\n break\n else:\n continue', 'N, M = map(int, input().split())\na, b = [0 for _ in range(N)], [0 for _ in range(N)]\nfor i in range(N):\n a[i], b[i] = (list(map(int, input().split())))\nc = []\nfor i in range(N):\n c.append([a[i],b[i],i])\nc = sorted(c, key=lambda x: x[0])\nm = 0\ncnt = 0\nfor i in range(N):\n \n cnt += c[i][1]\n m += c[i][0] * c[i][1]\n \n if cnt == M:\n print(m)\n break\n elif cnt > M:\n print(m - c[i][0] * (cnt - M))\n break\n else:\n continue']
['Runtime Error', 'Accepted']
['s897742825', 's722489950']
[3060.0, 26720.0]
[18.0, 494.0]
[235, 478]
p03103
u934868410
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n,m = map(int,input().split())\nl = [map(int, input().split()) for i in range(n)]\nans = 0\nfor a,b in l:\n if b >= m:\n ans += a * (b-m)\n break\n else:\n ans += a*b\n m -= b\nprint(ans)', 'n,m = map(int,input().split())\nl = [map(int, input().split()) for i in range(n)]\nans = 0\nl.sort()\nfor a,b in l:\n if b >= m:\n ans += a * m\n break\n else:\n ans += a*b\n m -= b\nprint(ans)', 'n,m = map(int,input().split())\nl = []\nfor i in range(n):\n a,b = map(int, input().split())\n l.append((a,b))\nans = 0\nl.sort()\nfor a,b in l:\n if b >= m:\n ans += a * m\n break\n else:\n ans += a*b\n m -= b\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s120894945', 's273307915', 's580303718']
[49652.0, 49652.0, 16892.0]
[378.0, 367.0, 412.0]
[191, 196, 228]
p03103
u939585142
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M = map(int,input().split())\na = []\n\nfor i in range(N):\n a.append(list(map(int,input().split())))\n\na.sort()\n\nnum = 0\nans = 0\nfor i in range(N):\n ans = 0\n num = 0\n while i <= N - 1:\n ans += a[i][0] * a[i][1]\n num += a[i][1]\n if num > M:\n ans -= a[i][0] * (num - M)\n break\nprint(ans) \n', 'N,M = map(int,input().split())\na = []\n\nfor i in range(N):\n a.append(list(map(int,input().split())))\n\na = sorted(a)\n\ni = 0\nnum = 0\nans = 0\nwhile i <= N - 1:\n ans += a[i][0] * a[i][1]\n num += a[i][1]\n if num > M:\n ans -= a[i][0] * (num - M)\n break\n i += 1\nprint(ans) \n']
['Wrong Answer', 'Accepted']
['s849959073', 's759482625']
[27760.0, 28656.0]
[2105.0, 592.0]
[313, 278]
p03103
u941439555
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N, M = list(map(int, input().split()))\n\n# Insert all the data into dictionary\nstores = []\nwhile 1:\n\ttry:\n\t\ta, b = list(map(int, input().split()))\n\t\tstores.append([a,b])\n\texcept:\n\t\tbreak\n\nstores = sorted(stores, key=lambda x:x[0])\n\nm = 0\nmoney = 0\n\nfor store in stores:\n\tmoney += min(store[1], M - m) * store[0]\n\tif m == M:\n\t\tbreak\nprint(money)\n \nprint(stores)', 'N, M = list(map(int, input().split()))\n\n# Insert all the data into dictionary\nstores = []\nfor _ in range(N):\n a, b = list(map(int, input().split()))\n stores.append([a,b])\n\nstores = sorted(stores, key=lambda x:x[0])\nprint(stores)\n\nm = 0\nmoney = 0\n\nfor store in stores:\n money += min(store[1], M - m) * store[0]\n m += min(store[1], M - m)\n if m == M:\n break\nprint(money)', 'N, M = list(map(int, input().split()))\n\n# Insert all the data into dictionary\nstores = []\nfor _ in range(N):\n a, b = list(map(int, input().split()))\n stores.append([a,b])\n\nstores = sorted(stores, key=lambda x:x[0])\n\nm = 0\nmoney = 0\n\nfor store in stores:\n money += min(store[1], M - m) * store[0]\n m += min(store[1], M - m)\n if m == M:\n break\nprint(money)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s497246683', 's959326217', 's775133363']
[27368.0, 27344.0, 22492.0]
[556.0, 548.0, 519.0]
[366, 376, 362]
p03103
u947883560
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['print(AB)\n\nN, M = [int(x) for x in input().split()]\nAB = [[int(x) for x in input().split()] for _ in range(N)]\nAB.sort(key=lambda x: x[0])\n\ns = 0\nfor ab in AB:\n if ab[1] > M:\n s += M*ab[0]\n break\n else:\n s += ab[0]*ab[1]\n M -= ab[1]\n\nprint(s)\n', 'import numpy as np\nN, M, C = [int(x) for x in input().split()]\nB = np.array([int(x) for x in input().split()])\nA = np.array([[int(x) for x in input().split()] for _ in range(N)])\n \nprint(np.sum(A.dot(B) > -C))', 'import numpy as np\nN, M, C = [int(x) for x in input().split()]\nB = np.array([int(x) for x in input().split()])\nA = np.array([[int(x) for x in input().split()] for _ in range(N)])\n \nprint(np.sum(A@B > -C))', '#!/usr/bin/env python3\nimport sys\n\n\ndef solve(N: int, M: int, A: "List[int]", B: "List[int]"):\n AB = sorted(range(N), key=lambda x: A[x])\n\n s = 0\n for i in AB:\n if B[i] > M:\n s += M*A[i]\n break\n else:\n s += A[i]*B[i]\n M -= B[i]\n\n print(s)\n return\n\n\n# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)\ndef main():\n def iterate_tokens():\n for line in sys.stdin:\n for word in line.split():\n yield word\n tokens = iterate_tokens()\n N = int(next(tokens)) # type: int\n M = int(next(tokens)) # type: int\n A = [int()] * (N) # type: "List[int]"\n B = [int()] * (N) # type: "List[int]"\n for i in range(N):\n A[i] = int(next(tokens))\n B[i] = int(next(tokens))\n solve(N, M, A, B)\n\n\nif __name__ == \'__main__\':\n main()\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s187237293', 's301528476', 's558112043', 's577773431']
[3060.0, 12448.0, 2940.0, 16436.0]
[18.0, 147.0, 19.0, 193.0]
[277, 209, 204, 967]
p03103
u948911484
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n,m = map(int,input().split())\nab = [list(map(int,input().split())) for _ in range(n)]\nab = sorted(ab, key=lambda x:x[0])\nprint(ab)\nans = 0\nd = 0\ni = 0\nwhile d < m:\n ans += ab[i][0]*min(m-d,ab[i][1])\n d += ab[i][1]\n i += 1\nprint(ans)', 'n,m = map(int,input().split())\nab = [list(map(int,input().split())) for _ in range(n)]\nab = sorted(ab, key=lambda x:x[0])\nans = 0\nd = 0\ni = 0\nwhile d < m:\n ans += ab[i][0]*min(m-d,ab[i][1])\n d += ab[i][1]\n i += 1\nprint(ans)']
['Wrong Answer', 'Accepted']
['s066303099', 's147000267']
[34640.0, 29796.0]
[562.0, 460.0]
[236, 226]
p03103
u960171798
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M = map(int, input().split())\nA = []\nquantity = 0\nprice = 0\n\nfor i in range(N):\n a = list(map(int, input().split()))\n A.append(a)\nprint(A)\nA = sorted(A)\nfor i in range(M):\n quantity += A[i][1]\n if quantity <= M:\n price += A[i][0]*A[i][1]\n else:\n price += A[i][0]*(M-(quantity-A[i][1]))\n break\nprint(price)', 'N,M = map(int, input().split())\nA = []\nquantity = 0\nprice = 0\n\nfor i in range(N):\n a = list(map(int, input().split()))\n A.append(a)\nA = sorted(A)\nfor i in range(M):\n quantity += A[i][1]\n if quantity < M:\n price += A[i][0]*A[i][1]\n else:\n price += A[i][0]*(M-(quantity-A[i][1]))\n break\nprint(price)']
['Runtime Error', 'Accepted']
['s495762119', 's100365790']
[33776.0, 28656.0]
[546.0, 592.0]
[341, 331]
p03103
u965075144
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n, m = [int(i) for i in input().split()]\ndat = [[int(i) for i in input().split()] for i in range(n)]\nsort(dat)\nsum = 0\n_m = 0\nfor i in dat:\n _m += dat[1]\n if _m > m:\n print(sum + dat[0]*(m - _m))\n break\n sum += dat[0] * dat[1]\n', 'n, m = [int(i) for i in input().split()]\ndat = [[int(i) for i in input().split()] for i in range(n)]\ndat.sort()\nsum = 0\n_m = 0\nfor i in dat:\n if _m + i[1] >= m:\n print(sum + i[0]*(m - _m))\n break\n _m += i[1]\n sum += i[0] * i[1]']
['Runtime Error', 'Accepted']
['s943537199', 's470633847']
[21164.0, 21604.0]
[312.0, 466.0]
[250, 250]
p03103
u970899068
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['n,m=map(int,input().split())\ns=[list(map(int, input().split())) for i in range(n)] \ns.sort()\ns.append([0,0])\na=0\nb=0\nfor i in range(n):\n if a<m:\n a+=s[i][1]\n b+=s[i][0]*s[i][1]\n else:\n print(a,b,s[i-1][1])\n b-=(a-m)*s[i-1][0]\n break\n \nprint(b)', 'n,m=map(int,input().split())\ns=[list(map(int, input().split())) for i in range(n)] \ns.sort()\ns.append([0,0])\na=0\nb=0\nfor i in range(n+1):\n if a<m:\n a+=s[i][1]\n b+=s[i][0]*s[i][1]\n else:\n b-=(a-m)*s[i-1][0]\n break\n \nprint(b)']
['Wrong Answer', 'Accepted']
['s505039593', 's083702625']
[27756.0, 27756.0]
[458.0, 503.0]
[291, 264]
p03103
u973840923
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['N,M = map(int,input().split())\nlist = [list(map(int,input().split())) for _ in range(N)]\nlist.sort()\n\ncnt = 0\nsum = 0\n\nfor i in range(N):\n if cnt + list[i][1] <= M:\n cnt += list[i][1]\n sum += list[i][1]*list[i][0]\n else:\n sum += (M-cnt)*list[i][0]\n break\n\nprint(cnt,sum)', 'import sys\nsys.setrecursionlimit(10**6)\n\nN,M = map(int,input().split())\nlist = [list(map(int,input().split())) for i in range(N)]\nlist.sort(key=lambda x:x[0])\n\ndef dfs(m,cnt):\n if m <= 0 or cnt == len(list):\n return 0\n b = list[cnt][1] if list[cnt][1] < m else m\n a = b*list[cnt][0]\n\n return a + dfs(m-b,cnt+1)\n\nprint(dfs(M,0))']
['Wrong Answer', 'Accepted']
['s369508852', 's731343934']
[27760.0, 116468.0]
[499.0, 538.0]
[304, 346]
p03103
u977885542
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['from sys import stdin\nimport heapq\nhq = [] \n\nNM = input()\nNM = NM.split()\nN = int(NM[0])\nM = int(NM[1])\n\nhq = []\nAB = {}\nfor i in range(N):\n temp = input()\n temp = temp.split()\n AB[int(temp[0])] = int(temp[1])\n heapq.heappush(hq, (int(temp[0]), int(temp[1])))\n\nprint(hq)\ncost = 0\namount = 0\nfor i in range(N):\n if amount + hq[i][1] < M:\n amount += hq[i][1]\n cost += hq[i][0]*hq[i][1]\n else:\n temp = M - amount\n cost += hq[i][0]*temp\n break\n \nprint(cost)\n', 'NM = NM.split()\nN = int(NM[0])\nM = int(NM[1])\n\nAB = {}\nfor i in range(N):\n temp = input()\n temp = temp.split()\n AB[int(temp[0])] = int(temp[1])\n\nA_list = list(AB.keys())\nA_list.sort()\n\ncost = 0\namount = 0\nfor i in range(N):\n if amount + AB[A_list[i]] <= M:\n amount += AB[A_list[i]]\n cost += A_list[i]*AB[A_list[i]]\n else:\n print(amount)\n temp = M - amount\n cost += A_list[i]*temp\n break\n \nprint(cost)', 'from sys import stdin\nimport heapq\nhq = [] \n\nNM = input()\nNM = NM.split()\nN = int(NM[0])\nM = int(NM[1])\n\nhq = []\nAB = {}\nfor i in range(N):\n temp = input()\n temp = temp.split()\n AB[int(temp[0])] = int(temp[1])\n heapq.heappush(hq, (int(temp[0]), int(temp[1])))\n\ncost = 0\namount = 0\nfor i in range(N):\n temp = heapq.heappop(hq)\n if amount + temp[1] < M:\n amount += temp[1]\n cost += temp[0]*temp[1]\n else:\n temp1 = M - amount\n cost += temp[0]*temp1\n break\n \nprint(cost)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s272584634', 's466369097', 's555334235']
[35476.0, 3064.0, 29616.0]
[456.0, 17.0, 534.0]
[479, 426, 493]
p03103
u990670021
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['s = input().split()\nN = int(s[0])\nM = int(s[1])\n\nAB = {}\nfor i in range(N):\n data = input().split()\n AB[int(data[0])] = int(data[1])\n\nmoney = 0\nnum = 0\nfor A,B in sorted(AB.items()):\n if num+B < M:\n money += A*B\n \tnum += B\n else:\n money += A*(M-num)\n break\n \nprint(money)', 's = input().split()\nN = int(s[0])\nM = int(s[1])\n \nAB = {}\nfor i in range(N):\n data = input().split()\n if int(data[0]) in AB.keys():\n AB[int(data[0])] += int(data[1])\n else:\n AB[int(data[0])] = int(data[1])\nAB = sorted(AB.items())\nmoney = 0\nnum = 0\nfor A,B in AB:\n if num+B < M:\n money += A*B\n num += B\n elif num+B == M:\n money += A*B\n break\n elif num+B > M:\n money += A*(M-num)\n break\nprint(int(money))']
['Runtime Error', 'Accepted']
['s365742612', 's024232494']
[2940.0, 23008.0]
[17.0, 438.0]
[286, 432]
p03103
u995062424
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['def main():\n N, M = map(int, input().split())\n A = [[0, 0] for _ in range(N)]\n for i in range(N):\n A[i][0], A[i][1] = map(int, input().split())\n \n cnt = 0\n money = 0\n A.sort(key=lambda x:x[0])\n for i in range(N):\n if(cnt < M):\n money += A[i][0]*A[i][1]\n cnt += A[i][1]\n else:\n break\n if(cnt == M):\n print(money)\n else:\n print(money-(cnt-M)*A[i-1][0])\n \nmain()', 'def main():\n N, M = map(int, input().split())\n A = [[0, 0] for _ in range(N)]\n for i in range(N):\n A[i][0], A[i][1] = map(int, input().split())\n \n cnt = 0\n money = 0\n\n A.sort(key=lambda x:(x[0], x[1]))\n for i in range(N):\n money += A[i][0]*A[i][1]\n cnt += A[i][1]\n if(cnt >= M):\n break\n if(cnt == M):\n print(money)\n else:\n print(money-(cnt-M)*A[i][0])\n \nmain()']
['Wrong Answer', 'Accepted']
['s689465359', 's561753508']
[21156.0, 27556.0]
[382.0, 425.0]
[460, 446]
p03103
u998978987
2,000
1,048,576
Hearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks. There are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each. What is the minimum amount of money with which he can buy M cans of energy drinks? It is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.
['text = input()\nvals = text.split(" ")\nlines = []\nfor i in range(int(len(vals) / 2)):\n lines.append([vals[i * 2], vals[i * 2 + 1]])\n\nn_and_m = lines[0]\nn = n_and_m[0]\nm = n_and_m[1]\n\na_and_b = lines[1:]\na = list(map(lambda x: x[0], a_and_b))\nb = list(map(lambda x:x[1], a_and_b))\n\ntmp = []\n\na_and_b = sorted(a_and_b, key=lambda x:int(x[0]))\n\n\nremain = int(m)\n\nprice = 0\nfor i in range(len(a_and_b)):\n for j in range(int(a_and_b[i][1])):\n remain = remain - 1\n price = price + int(a_and_b[i][0])\n if (remain == 0):\n break\n else:\n continue\n break\nprint(price)\n', 'text = input()\nlines = text.split("\\n")\n\nlines = list(map(lambda x: x.split(" "), lines))\nn_and_m = lines[0]\nn = n_and_m[0]\nm = n_and_m[1]\na_and_b = []\nfor i in range(int(n)):\n a_and_b.append(input().split(" "))\n\n\ntmp = []\n\na_and_b = sorted(a_and_b, key=lambda x:int(x[0]))\n\n\nremain = int(m)\n\nprice = 0\nfor i in range(len(a_and_b)):\n for j in range(int(a_and_b[i][1])):\n remain = remain - 1\n price = price + int(a_and_b[i][0])\n if (remain == 0):\n break\n else:\n continue\n break\nprint(price)\n']
['Wrong Answer', 'Accepted']
['s947038241', 's641322334']
[3064.0, 38564.0]
[17.0, 420.0]
[607, 541]
p03105
u006576567
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['# -*- coding: utf-8 -*-\n\n\n\ndef calc(a, b, c):\n rest = b\n count = 0\n while True:\n if count >= c:\n break\n if rest < a:\n break\n count += 1\n rest -= a\n return count\n', '# -*- coding: utf-8 -*-\n\n\n\ndef calc(a, b, c):\n rest = b\n count = 0\n while True:\n if count >= c:\n break\n if rest < a:\n break\n count += 1\n rest -= a\n return count\n\n\na, b, c = map(int, input().split())\nprint(calc(a, b, c))\n']
['Wrong Answer', 'Accepted']
['s693905883', 's054396111']
[2940.0, 2940.0]
[17.0, 17.0]
[274, 333]
p03105
u006721330
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['a, b, c = map(int, input().split())\n\nnum1 = 11 // 2\n\nif num <= c:\n print(num)\nelse:\n print(c)', 'a, b, c = map(int, input().split())\n\nnum = a // b\n\nif num <= c:\n print(num)\nelse:\n print(c)', 'a, b, k = map(int, input().split())\nlist = []\n\nfor i in range(1, 101):\n if a%i == 0 and b %i == 0:\n list.append(i)\n list.sort(reverse=True)\n \nprint(list[k-1])', 'a, b, c = map(int, input().split())\n\nnum = b // a\n\nif num <= c:\n print(num)\nelse:\n print(c)']
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s370819183', 's536796650', 's913396703', 's261626206']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 18.0]
[95, 93, 168, 93]
p03105
u014333473
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['A, B, C = map(int, input().split())\nmoney_time = A * C\nif money_time <= B:\n print(A)\nelse:\n print(B // A)', 'a,b,c=map(int,input().split());print(min(b//a,c))']
['Wrong Answer', 'Accepted']
['s661576195', 's339239949']
[2940.0, 9140.0]
[17.0, 26.0]
[107, 49]
p03105
u016182925
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['a,b,c = map(int,input().split())\ncount = 0\nif a//b > c :\n an = (c)\nelse :\n an = (b//a)\nprint(an)\n ', 'a,b,c = map(int,input().split())\nif b//a > c :\n an = (c)\nelse :\n an = (b//a)\nprint(an)\n ']
['Wrong Answer', 'Accepted']
['s303400474', 's215039770']
[2940.0, 2940.0]
[18.0, 17.0]
[101, 91]
p03105
u017245095
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['# -*- coding: utf-8 -*-\n\n\nstring = input()\n\n\nmax = min(len(string), 100000)\n\n\ndel_count = 0\n\n\ndel_flg = True\n\n\nwhile del_flg:\n del_flg = False\n\n # \n for idx in range(max):\n if idx == max or idx > max:\n break\n \n \n target = string[idx : idx + 2]\n \n if target == "01" or target == "10":\n \n \n string = string[:idx] + string[idx + 2:]\n del_count += 2\n max -= 2\n del_flg = True\n\nprint(del_count)', '# -*- coding: utf-8 -*-\n\na, b, c = map(int, input().split())\nretVal = 0\n\nif a > b:\n retVal = 0\nelif b // a < c :\n retVal = b // a\nelse :\n retVal = c\n\nprint(retVal)']
['Wrong Answer', 'Accepted']
['s582609490', 's101494435']
[3064.0, 2940.0]
[18.0, 18.0]
[871, 172]
p03105
u019566983
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['\ndef make_divisors(n):\n divisors = []\n for i in range(1, int(n**0.5)+1):\n if n % i == 0:\n divisors.append(i)\n if i != n // i:\n divisors.append(n//i)\n \n divisors.sort()\n return divisors\n\n\na, b, c = map(int, input().split())\n\nc_set = list(set(make_divisors(a))&set(make_divisors(b)))\n\nc_set.sort()\nprint(c_set[-c])\n', 'a, b, c = map(int, input().split())\n\nif b//a >= c:\n print(c)\nelse:\n print(b//a)\n']
['Runtime Error', 'Accepted']
['s688654750', 's916414122']
[3060.0, 2940.0]
[17.0, 17.0]
[384, 86]
p03105
u020332228
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['A, B, K = (int(i) for i in input().split())\nlist = []\nfor i in range(1, 100):\n if A % == 0 and B % i == 0:\n list.append(i)\nprint(list[len(list)-K])', 'A, B, C = (int(i) for i in input().split())\nif B > (A*C):\n print(C)\nelse:\n print(B//A)']
['Runtime Error', 'Accepted']
['s965341260', 's870329246']
[2940.0, 2940.0]
[17.0, 17.0]
[151, 88]
p03105
u020604402
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['if B / A >= C:\n print(C)\nelse:\n print(int(B/A))', 'A, B, C = map(int ,input().split())\nprint(min(B//A,C))']
['Runtime Error', 'Accepted']
['s005263418', 's050256712']
[2940.0, 2940.0]
[17.0, 17.0]
[49, 54]
p03105
u022658079
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['A,B,C=(int(x) for x in input().split())\ncount=0\nfor i in range(1,C):\n if A*i>B:\n break\n else:\n count+=1\nprint(count)', 'A,B,C=(int(x) for x in input().split())\ncount=0\nfor i in range(C):\n if B*i>A:\n break\n else:\n count+=1\nprint(count) \n', 'A,B,K=(int(x) for x in input().split())\ncount=0\nresult=0\nfor i in reversed(range(1,min([A,B])+1)):\n if A%i==0 and B%i==0:\n count+=1\n if count==K:\n result=i\nprint(result)', 'A,B,C=(int(x) for x in input().split())\ncount=0\nfor i in range(1,C+1):\n if A*i>B:\n break\n else:\n count+=1\nprint(count)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s240598340', 's281533886', 's679818443', 's958770670']
[2940.0, 2940.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[124, 127, 177, 126]
p03105
u023958502
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
[',b,c = map(int,input().split())\nprint(min(c,b // a))', 'a,b,c = map(int,input().split())\nprint(min(c,b // a))']
['Runtime Error', 'Accepted']
['s847366614', 's398019564']
[2940.0, 2940.0]
[17.0, 17.0]
[52, 53]
p03105
u027403702
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['A,B,C = map(int,input())\nmin(B//A,C)', 'A,B,C = map(int,input())\nprint(min(B//A,C))', 'A,B,C = map(int,input().split())\nprint(min(B//A,C))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s337512309', 's436644972', 's546074604']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[36, 43, 51]
p03105
u027675217
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['A,B,C = map(int, input().split())\ns = B//A\nif C<=s:\n\tprint(C)\nelse\n\tprint(s)', 'A,B,C = map(int, input().split())\ns = B//A\nif C<=s:\n\tprint(C)\nelse:\n\tprint(s)']
['Runtime Error', 'Accepted']
['s802361092', 's313807101']
[2940.0, 2940.0]
[17.0, 17.0]
[76, 77]
p03105
u032955959
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['a,b,c=map(int,input().split())\n\nd=a//b\n\nif d>=c:\n print(c)\nelse:\n print(d)', 'a,b,c=map(int,input().split())\n\nd=b//a\n\nif d>=c:\n print(c)\nelse:\n print(d)\n']
['Wrong Answer', 'Accepted']
['s773135948', 's914101742']
[2940.0, 2940.0]
[18.0, 17.0]
[76, 77]
p03105
u035605655
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
["import sys\n\n\ndef main():\n one_try = int(sys.argv[1])\n money = int(sys.argv[2])\n count = int(sys.argv[3])\n n = 0\n while(True):\n if money >= one_try:\n money = money - one_try\n n = n + 1\n else:\n break\n if n == count:\n break\n print(n)\n\n\nif __name__ == '__main__':\n main()\n ", "import sys\n\n\ndef main():\n lines = sys.stdin.readlines().split(' ')\n one_try = int(lines[0])\n money = int(lines[1])\n count = int(lines[2])\n n = 0\n while(True):\n if money >= one_try:\n money = money - one_try\n n = n + 1\n else:\n break\n if n == count:\n break\n print(n)\n\n\nif __name__ == '__main__':\n main()\n ", "import sys\n\n\ndef main():\n lines = sys.stdin.readlines()[0].split(' ')\n one_try = int(lines[0])\n money = int(lines[1])\n count = int(lines[2])\n n = 0\n while(True):\n if money >= one_try:\n money = money - one_try\n n = n + 1\n else:\n break\n if n == count:\n break\n print(n)\n\n\nif __name__ == '__main__':\n main()\n "]
['Runtime Error', 'Runtime Error', 'Accepted']
['s523472412', 's964593262', 's652554639']
[3056.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[358, 394, 397]
p03105
u036340997
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['a, b, c = map(int, input().split())\nprint(max(b//a, c))\n', 'a, b, c = map(int, input().split())\nprint(min(b//a, c))\n']
['Wrong Answer', 'Accepted']
['s103047871', 's514159233']
[2940.0, 2940.0]
[17.0, 17.0]
[56, 56]
p03105
u037074041
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
["from sys import stdin\n\n\ndef a(input_string):\n print(input_string)\n favorite_sound_fee ,my_money, count = [int(x) for x in input_string.split()]\n hear_count = 0\n while(hear_count < count and my_money >= favorite_sound_fee):\n my_money -= favorite_sound_fee\n hear_count += 1\n return hear_count\n\n\ndef main():\n input_line = stdin.readline().rstrip()\n answer = a(input_line)\n print(answer)\n\n\nif __name__ == '__main__':\n main()\n", "from sys import stdin\n\n\ndef a(input_string):\n favorite_sound_fee ,my_money, count = [int(x) for x in input_string.split()]\n hear_count = 0\n while(hear_count < count and my_money >= favorite_sound_fee):\n my_money -= favorite_sound_fee\n hear_count += 1\n return hear_count\n\n\ndef main():\n input_line = stdin.readline().rstrip()\n answer = a(input_line)\n print(answer)\n\n\nif __name__ == '__main__':\n main()\n"]
['Wrong Answer', 'Accepted']
['s592959016', 's304208671']
[2940.0, 3060.0]
[17.0, 17.0]
[462, 438]
p03105
u037221289
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
["A, B, C = map(int,input().split(' '))\n\n\ndef calc1(A,B,C):\n if A*C <= B:\n return C\n else:\n \n N = 0\n while A*N <=B:\n N += 1\n return N-1\nprint(calc1(A,", "A, B, C = map(int,input().split(' '))\n\n\ndef calc1(A,B,C):\n if A*C <= B:\n return C\n else:\n \n N = 0\n while A*N <=B:\n N += 1\n return N-1\nprint(calc1(A,B,C))"]
['Runtime Error', 'Accepted']
['s549064755', 's072179188']
[2940.0, 3060.0]
[17.0, 18.0]
[177, 182]
p03105
u038676814
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['S = input()\nS = list(S)\ncount = 0\n\n\npreviousCount = 0\nwhile(1) :\n if len(S) < 2:\n break\n \n if S[0] != S[1] :\n S.pop(0)\n S.pop(0)\n count+=2\n \n for i in range(1,len(S)-2) :\n if S[i] != S[i+1] :\n if S[i-1] != S[i+2] :\n S.pop(i)\n S.pop(i)\n count +=2\n break\n if previousCount == count :\n break\n previousCount = count\n \nprint(count)\n \n', 'import math\nA,B,C = map(int, input().split(" "))\n\ntem = B/A\nif tem < C :\n print(int(tem))\nelse :\n print(C)\n ']
['Wrong Answer', 'Accepted']
['s502218054', 's547372866']
[3064.0, 2940.0]
[17.0, 17.0]
[481, 118]
p03105
u039360403
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['a,b,c=map(int,input().split())\nprint(max(c,b//a))\n', 'a,b,c=map(int,input().split())\nprint(min(c,b//a))\n']
['Wrong Answer', 'Accepted']
['s125965216', 's618843071']
[2940.0, 2940.0]
[18.0, 18.0]
[50, 50]
p03105
u045953894
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
["a,b,c = map(int,input().split())\nif b >= a:\n print(round(b/a))\nelif round(b/a) > c:\n print(c)\nelse:\n print('0')", 'a,b,c = map(int,input().split())\n\nif b//a > c:\n print(c)\nelse:\n print(b//a)']
['Wrong Answer', 'Accepted']
['s019435573', 's539654661']
[2940.0, 2940.0]
[17.0, 17.0]
[120, 81]
p03105
u046158516
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['a,b,c=map(int,input().split())\nd=a//b\nif (d+1)*b<=a:\n d+=1\nprint(min(d,c))', 'a,b,c=map(int,input().split())\nd=b//a\nif (d+1)*a<=b:\n d+=1\nprint(min(d,c))']
['Wrong Answer', 'Accepted']
['s973643908', 's467142676']
[2940.0, 2940.0]
[18.0, 17.0]
[75, 75]
p03105
u052606232
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['a = int(input())\nb = int(input())\nc = int(input())\nif b//a > c:\n print(c)\nelse:\n print(b//c)\n\n', 'a,b,c = map(int,input().split())\na_set = {1}\nb_set = {1}\nfor i in range(1,a):\n if a % i == 0:\n a_set.add(i)\n\nfor i in range(1,b):\n if b % i == 0:\n b_set.add(i)\n\nc_list = list(a_set & b_set)\nc_list.sort()\nprint(c_list[c - 1])\n', 'A, B, C = map(int, input().split())\nprint(min(int(B / A), C))\n\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s256456896', 's441205592', 's698916518']
[2940.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0]
[169, 245, 209]
p03105
u054008010
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['class Solution:\n def solve(self, A, B, C):\n count = 0\n spent = 0\n while B >= 0:\n B -= A\n count += 1\n if count == C:\n return C\n return count\n\ndef main():\n A = int(input())\n B = int(input())\n C = int(input())\n print(Solution().solve(A, B, C))\n \nif __name__ == "__main__":\n main()', 'class Solution:\n def solve(self, A, B, C):\n count = 0\n while True:\n B -= A\n if B < 0: break\n count += 1\n if count == C: return C\n return count\n\ndef main():\n inputs = list(map(int, input().split()))\n A, B, C = inputs\n print(Solution().solve(A, B, C))\n \nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s579502361', 's290081163']
[3060.0, 3060.0]
[18.0, 18.0]
[325, 328]
p03105
u055793529
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
['usr_input = input()\nlst = usr_input.split()\n\na = int(lst[0])\nb = int(lst[1])\nc = int(lst[2])\n\nprint(b//a)\n', 'usr_input = input()\nlst = usr_input.split()\n\na = int(lst[0])\nb = int(lst[1])\nc = int(lst[2])\n\ndevider_a=[]\ndevider_b=[]\nfor i in range(1,a,1):\n if a%i == 0:\n devider_a.append(i)\n\nfor i in range(1,b,1):\n if b % i == 0:\n devider_b.append(i)\n\ncommon_devider = []\nfor element in devider_a:\n for value in devider_b:\n if element==value:\n common_devider.append(value)\n\nprint(common_devider[c-1])\n', 'usr_input = input()\nlst = usr_input.split()\n\na = int(lst[0])\nb = int(lst[1])\nc = int(lst[2])\n\nif b//a < c:\n print(b//a)\nelse:\n print(c)\n\n \n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s259447602', 's976858074', 's840295264']
[2940.0, 3064.0, 2940.0]
[19.0, 18.0, 18.0]
[106, 430, 150]
p03105
u057993957
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
["A, B, C = list(map(int, input().split()))\n\nsum = 1\ncount = 0\n\nif B > A:\n for i in range(1, C):\n sum *= A\n if sum > B:\n count = i\n break\n print(count)\n\nelse:\n print('0')", 'from collections import Counter\nprint(2*min(Counter(list(input()).values()))', 'A, B, C = list(map(int, input().split()))\nprint(min(B//A, C))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s266609372', 's626951004', 's363774258']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[187, 76, 61]
p03105
u058729328
2,000
1,048,576
Takahashi likes the sound when he buys a drink from a vending machine. That sound can be heard by spending A yen (the currency of Japan) each time. Takahashi has B yen. He will hear the sound as many times as he can with that money, but at most C times, as he would be satisfied at that time. How many times will he hear the sound?
["string = input()\none = 0\nzero = 0\nfor s in string:\n if s == '1':\n ones += 1\n else:\n zeros += 1\n\nprint(2*min(one, zero))\n", 'import math\n\na, b, c = map(int, input().split())\n\nrequired = a * c\nlimit = b\n\nif required <= limit:\n print(c)\nelse:\n print(math.floor(b / a))\n']
['Runtime Error', 'Accepted']
['s848893448', 's532083930']
[2940.0, 2940.0]
[17.0, 17.0]
[140, 148]