message stringlengths 2 30.5k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 237 109k | cluster float64 10 10 | __index_level_0__ int64 474 217k |
|---|---|---|---|---|---|
Provide a correct Python 3 solution for this coding contest problem.
To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.
He is famous across the country for his ability to for... | instruction | 0 | 28,020 | 10 | 56,040 |
"Correct Solution:
```
n,*l=map(int,open(0).read().split())
a=1000
for s,t in zip(l,l[1:]): a+=a//s*max(t-s,0)
print(a)
``` | output | 1 | 28,020 | 10 | 56,041 |
Provide a correct Python 3 solution for this coding contest problem.
To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.
He is famous across the country for his ability to for... | instruction | 0 | 28,021 | 10 | 56,042 |
"Correct Solution:
```
n = int(input())
a = list(map(int ,input().split()))
x = 1000
for i in range(n-1):
l = a[i]
r = a[i+1]
if (l < r):
k = x//l
x %= l
x += k*r
print(x)
``` | output | 1 | 28,021 | 10 | 56,043 |
Provide a correct Python 3 solution for this coding contest problem.
To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.
He is famous across the country for his ability to for... | instruction | 0 | 28,022 | 10 | 56,044 |
"Correct Solution:
```
N=int(input())
A=list(map(int,input().split()))
ans=1000
for i in range(N-1):
if A[i]>=A[i+1]:
pass
else:
T=ans//A[i]
ans+=T*(A[i+1]-A[i])
print(ans)
``` | output | 1 | 28,022 | 10 | 56,045 |
Provide a correct Python 3 solution for this coding contest problem.
To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.
He is famous across the country for his ability to for... | instruction | 0 | 28,023 | 10 | 56,046 |
"Correct Solution:
```
n = input()
li = list(map(int,input().split()))
orl = 1000
for i in range(len(li)-1):
if li[i] < li[i+1]:
orl = int(orl/li[i]) * (li[i+1]) + (orl - li[i] * int(orl/li[i]))
print(orl)
``` | output | 1 | 28,023 | 10 | 56,047 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.... | instruction | 0 | 28,024 | 10 | 56,048 |
Yes | output | 1 | 28,024 | 10 | 56,049 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.... | instruction | 0 | 28,025 | 10 | 56,050 |
Yes | output | 1 | 28,025 | 10 | 56,051 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.... | instruction | 0 | 28,026 | 10 | 56,052 |
Yes | output | 1 | 28,026 | 10 | 56,053 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.... | instruction | 0 | 28,027 | 10 | 56,054 |
Yes | output | 1 | 28,027 | 10 | 56,055 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.... | instruction | 0 | 28,028 | 10 | 56,056 |
No | output | 1 | 28,028 | 10 | 56,057 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.... | instruction | 0 | 28,029 | 10 | 56,058 |
No | output | 1 | 28,029 | 10 | 56,059 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.... | instruction | 0 | 28,030 | 10 | 56,060 |
No | output | 1 | 28,030 | 10 | 56,061 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
To become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.... | instruction | 0 | 28,031 | 10 | 56,062 |
No | output | 1 | 28,031 | 10 | 56,063 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A customer came to Bob and asked to sell him a 2x MB memory stick. If Bob had such a stick, he sold it and got... | instruction | 0 | 28,538 | 10 | 57,076 |
Tags: brute force, dp, greedy
Correct Solution:
```
N = int(input())
winsell = (N)*[-1]
pow = (2001)*[-1];
ans = int(0)
for i in range(0,N):
S, x = input().split()
x = int(x)
if S == "win":
winsell[i] = x
else:
pow[x] = i;
for i in range(2000,-1,-1):
if pow[i]!=-1 and pow[i]>0:
... | output | 1 | 28,538 | 10 | 57,077 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A customer came to Bob and asked to sell him a 2x MB memory stick. If Bob had such a stick, he sold it and got... | instruction | 0 | 28,539 | 10 | 57,078 |
Tags: brute force, dp, greedy
Correct Solution:
```
import math
if __name__ == '__main__':
n = int(input())
win = [[]]
sell = [0]*5000
res = 0
for i in range(n):
temp = input().split()
s = temp[0]
x = int(temp[1])
if s == "sell":
sell[x] = i
if ... | output | 1 | 28,539 | 10 | 57,079 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A customer came to Bob and asked to sell him a 2x MB memory stick. If Bob had such a stick, he sold it and got... | instruction | 0 | 28,540 | 10 | 57,080 |
Tags: brute force, dp, greedy
Correct Solution:
```
n = int(input())
dp = [0]*2001
ans = 0
for i in range(n):
s = input().split()
move = s[0]
d = int(s[1])
if move == "win":
dp[d] = ans + 2**d
else:
ans = max(ans, dp[d])
print(ans)
# Thu Mar 26 2020 09:12:32 GMT+0300 (MSK)
``` | output | 1 | 28,540 | 10 | 57,081 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A customer came to Bob and asked to sell him a 2x MB memory stick. If Bob had such a stick, he sold it and got... | instruction | 0 | 28,541 | 10 | 57,082 |
Tags: brute force, dp, greedy
Correct Solution:
```
n = int(input())
v = [0 for i in range(2006)]
ans = 0
for i in range(n):
s = input().split()
x = int(s[1])
if s[0] == 'win':
v[x] = ans + 2**x
else:
ans = max(ans,v[x])
print(ans)
``` | output | 1 | 28,541 | 10 | 57,083 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A customer came to Bob and asked to sell him a 2x MB memory stick. If Bob had such a stick, he sold it and got... | instruction | 0 | 28,542 | 10 | 57,084 |
Tags: brute force, dp, greedy
Correct Solution:
```
import math
n = int(input())
Size = 2002
dp = [0] * (Size)
for i in range(0, Size, 1) :
dp[i] = -1
dp[0] = 0
for i in range (1 , n+1 , 1):
s = input()
In = s.split()
x = int(In[1])
x = x + 1
if In[0] == "win" :
dp[x] = max(0, dp[0])
... | output | 1 | 28,542 | 10 | 57,085 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A customer came to Bob and asked to sell him a 2x MB memory stick. If Bob had such a stick, he sold it and got... | instruction | 0 | 28,543 | 10 | 57,086 |
Tags: brute force, dp, greedy
Correct Solution:
```
n = (int)(input())
d = [0 for i in range(2333)]
ans = 0
for i in range(0, n):
s = input().split()
x = (int)(s[1])
if s[0] == 'win':
d[x] = 2 ** x + ans
else:
ans = max(ans, d[x])
print(ans)
``` | output | 1 | 28,543 | 10 | 57,087 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A customer came to Bob and asked to sell him a 2x MB memory stick. If Bob had such a stick, he sold it and got... | instruction | 0 | 28,544 | 10 | 57,088 |
Tags: brute force, dp, greedy
Correct Solution:
```
n = int(input())
d = [0 for i in range(2009)]
ans = 0
for i in range(n):
s = input().split()
x = int(s[1])
if s[0] == 'win':
d[x] = ans+ 2**x
else:
ans = max(d[x], ans)
print(ans)
# Made By Mostafa_Khaled
``` | output | 1 | 28,544 | 10 | 57,089 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A customer came to Bob and asked to sell him a 2x MB memory stick. If Bob had such a stick, he sold it and got... | instruction | 0 | 28,545 | 10 | 57,090 |
Tags: brute force, dp, greedy
Correct Solution:
```
N=int(input())
dp=[0 for t in range(0,5008)]
arr=[0 for t in range(0,2008)]
for i in range(1,N+1):
u,v=input().split()
v=int(v)
if u[0]=='w':
arr[v]=i
elif arr[v]!=0 :
dp[i]=max(dp[i],dp[arr[v]-1]+(1<<v))
dp[i]=max(dp[i],dp[i-1])
pr... | output | 1 | 28,545 | 10 | 57,091 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A customer came to Bob and asked to sell him a 2x MB memory sti... | instruction | 0 | 28,546 | 10 | 57,092 |
Yes | output | 1 | 28,546 | 10 | 57,093 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A customer came to Bob and asked to sell him a 2x MB memory sti... | instruction | 0 | 28,548 | 10 | 57,096 |
Yes | output | 1 | 28,548 | 10 | 57,097 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A customer came to Bob and asked to sell him a 2x MB memory sti... | instruction | 0 | 28,550 | 10 | 57,100 |
No | output | 1 | 28,550 | 10 | 57,101 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A customer came to Bob and asked to sell him a 2x MB memory sti... | instruction | 0 | 28,551 | 10 | 57,102 |
No | output | 1 | 28,551 | 10 | 57,103 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A customer came to Bob and asked to sell him a 2x MB memory sti... | instruction | 0 | 28,552 | 10 | 57,104 |
No | output | 1 | 28,552 | 10 | 57,105 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Last year Bob earned by selling memory sticks. During each of n days of his work one of the two following events took place:
* A customer came to Bob and asked to sell him a 2x MB memory sti... | instruction | 0 | 28,553 | 10 | 57,106 |
No | output | 1 | 28,553 | 10 | 57,107 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the company is the sum of all in... | instruction | 0 | 28,556 | 10 | 57,112 |
Tags: greedy
Correct Solution:
```
a,b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
sums=0
count=0
l=[]
l1=[]
for i in range(0,len(c)):
if(c[i]<0):
l.append(c[i])
count=count+1
else:
l1.append(c[i])
sums=sums+c[i]
if(count==0):
s=sorted(c)
... | output | 1 | 28,556 | 10 | 57,113 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the company is the sum of all in... | instruction | 0 | 28,557 | 10 | 57,114 |
Tags: greedy
Correct Solution:
```
n,k=map(int,input().split())
L=sorted([int(i) for i in input().split()])
neg=sum(i<0 for i in L)
if k>neg:
L=sorted(abs(i) for i in L)
if (k-neg)%2==1:
L[0]=-L[0]
else:
for i in range(k):
L[i]=-L[i]
print(sum(L))
``` | output | 1 | 28,557 | 10 | 57,115 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the company is the sum of all in... | instruction | 0 | 28,558 | 10 | 57,116 |
Tags: greedy
Correct Solution:
```
def solve():
n,k = map(int, input().split())
a = list(map(int, input().split()))
i=0
j=0
while i<n and a[i] < 0 and j<k:
a[i]*=(-1)
i+=1
j+=1
#print(j)
if j==k:
print(sum(a))
return
else:
if not i==n:
... | output | 1 | 28,558 | 10 | 57,117 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the company is the sum of all in... | instruction | 0 | 28,559 | 10 | 57,118 |
Tags: greedy
Correct Solution:
```
n,k=map(int,input().strip().split())
l=list(map(int,input().strip().split()))
ne = []
po= []
zeros=0
for i in l:
if i<0:
ne.append(i)
elif i ==0:
zeros+=1
else:
po.append(i)
# ne.reverse()
if zeros==n:
po =[0]
ne=[0]
elif len(ne)==0:
if k%2==0:
pass
else:
... | output | 1 | 28,559 | 10 | 57,119 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the company is the sum of all in... | instruction | 0 | 28,560 | 10 | 57,120 |
Tags: greedy
Correct Solution:
```
n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(len(a)):
if (a[i]<0 and k>0):
a[i]=a[i]*(-1)
k=k-1
if (k<0):
break
if (k>=0 and k%2==0):
print(sum(a))
elif (k>=0 and k%2!=0):
print(sum(a)-2*min(a))
``` | output | 1 | 28,560 | 10 | 57,121 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the company is the sum of all in... | instruction | 0 | 28,561 | 10 | 57,122 |
Tags: greedy
Correct Solution:
```
def inp():
return map(int, input().split())
def arr_inp():
return [int(x) for x in input().split()]
n, k = inp()
a = arr_inp()
for i in range(n):
if k == 0 or a[i] > 0:
break
a[i] *= -1
k-=1
if k%2:
a[a.index(min(a))]*=-1
print(sum(a))
``` | output | 1 | 28,561 | 10 | 57,123 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the company is the sum of all in... | instruction | 0 | 28,562 | 10 | 57,124 |
Tags: greedy
Correct Solution:
```
n, k = [int(i) for i in input().split()]
sequence = [int(i) for i in input().split()]
for i in range(len(sequence)):
if(k == 0):
break
if(sequence[i] < 0):
k-=1
sequence[i] = -sequence[i]
else:
break
sequence.sort()
if(k%2 != 0):
seque... | output | 1 | 28,562 | 10 | 57,125 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The total income of the company is the sum of all in... | instruction | 0 | 28,563 | 10 | 57,126 |
Tags: greedy
Correct Solution:
```
import sys,math
from collections import deque,defaultdict
import operator as op
from functools import reduce
from itertools import permutations
import heapq
#sys.setrecursionlimit(10**7)
# OneDrive\Documents\codeforces
I=sys.stdin.readline
alpha="abcdefghijklmnopqrstuvwxyz"
mod=1... | output | 1 | 28,563 | 10 | 57,127 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The t... | instruction | 0 | 28,564 | 10 | 57,128 |
Yes | output | 1 | 28,564 | 10 | 57,129 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The t... | instruction | 0 | 28,565 | 10 | 57,130 |
Yes | output | 1 | 28,565 | 10 | 57,131 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The t... | instruction | 0 | 28,566 | 10 | 57,132 |
Yes | output | 1 | 28,566 | 10 | 57,133 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The t... | instruction | 0 | 28,567 | 10 | 57,134 |
Yes | output | 1 | 28,567 | 10 | 57,135 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The t... | instruction | 0 | 28,568 | 10 | 57,136 |
No | output | 1 | 28,568 | 10 | 57,137 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The t... | instruction | 0 | 28,569 | 10 | 57,138 |
No | output | 1 | 28,569 | 10 | 57,139 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The t... | instruction | 0 | 28,570 | 10 | 57,140 |
No | output | 1 | 28,570 | 10 | 57,141 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Roma works in a company that sells TVs. Now he has to prepare a report for the last year.
Roma has got a list of the company's incomes. The list is a sequence that consists of n integers. The t... | instruction | 0 | 28,571 | 10 | 57,142 |
No | output | 1 | 28,571 | 10 | 57,143 |
Provide a correct Python 3 solution for this coding contest problem.
Create a program that reads the sales unit price and sales quantity and outputs the total sales amount and the average sales quantity.
Input
The input is given in the following format:
Sales unit price, sales quantity
Sales unit price, sales qu... | instruction | 0 | 28,981 | 10 | 57,962 |
"Correct Solution:
```
c = 0
s = 0
num = 0
while True:
try:
p, n = [int(x) for x in input().split(",")]
s += p * n
c += n
num += 1
except:
break
print(s)
av = c // num
if c%num >= num//2:
av +=1
print(av)
``` | output | 1 | 28,981 | 10 | 57,963 |
Provide a correct Python 3 solution for this coding contest problem.
Create a program that reads the sales unit price and sales quantity and outputs the total sales amount and the average sales quantity.
Input
The input is given in the following format:
Sales unit price, sales quantity
Sales unit price, sales qu... | instruction | 0 | 28,982 | 10 | 57,964 |
"Correct Solution:
```
ans_n=0
ans_k=0
count=0
while True:
try:
N=list(map(int,input().split(",")))
ans_n +=N[0]*N[1]
ans_k +=N[1]
count +=1
except:
print(ans_n)
ans=ans_k/count
if int(ans)+0.5<=ans:
ans=int(ans+1)
print(ans)
br... | output | 1 | 28,982 | 10 | 57,965 |
Provide a correct Python 3 solution for this coding contest problem.
Create a program that reads the sales unit price and sales quantity and outputs the total sales amount and the average sales quantity.
Input
The input is given in the following format:
Sales unit price, sales quantity
Sales unit price, sales qu... | instruction | 0 | 28,983 | 10 | 57,966 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
import sys
import os
import math
import itertools
prices = []
amounts = []
for s in sys.stdin:
price, amount = map(int, s.split(','))
prices.append(price * amount)
amounts.append(amount)
print(sum(prices))
mean = sum(amounts) / len(amounts) + 0.5
print(int... | output | 1 | 28,983 | 10 | 57,967 |
Provide a correct Python 3 solution for this coding contest problem.
Create a program that reads the sales unit price and sales quantity and outputs the total sales amount and the average sales quantity.
Input
The input is given in the following format:
Sales unit price, sales quantity
Sales unit price, sales qu... | instruction | 0 | 28,984 | 10 | 57,968 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
_sum = 0
_avg = 0
n = 0
while 1:
try:
_s, _a = [int(e) for e in input().split(',')]
_sum += _s * _a
_avg += _a
n += 1
except:
print(_sum)
print(int(_avg / n + 0.5))
break
``` | output | 1 | 28,984 | 10 | 57,969 |
Provide a correct Python 3 solution for this coding contest problem.
Create a program that reads the sales unit price and sales quantity and outputs the total sales amount and the average sales quantity.
Input
The input is given in the following format:
Sales unit price, sales quantity
Sales unit price, sales qu... | instruction | 0 | 28,985 | 10 | 57,970 |
"Correct Solution:
```
total, num, cnt = 0, 0, 0
try:
while True:
n, m = map(int, input().split(","))
total += n*m
num += m
cnt += 1
except EOFError:
print(total)
n = num/cnt
n = int(n) if n%1 < 0.5 else int(n)+1
print(n)
``` | output | 1 | 28,985 | 10 | 57,971 |
Provide a correct Python 3 solution for this coding contest problem.
Create a program that reads the sales unit price and sales quantity and outputs the total sales amount and the average sales quantity.
Input
The input is given in the following format:
Sales unit price, sales quantity
Sales unit price, sales qu... | instruction | 0 | 28,986 | 10 | 57,972 |
"Correct Solution:
```
cnt=0
sell_num=0
total=0
while True:
try:
t,s=map(int,input().split(","))
except:
break
cnt+=1
sell_num+=s
total+=t*s
print(total)
print(int(sell_num/cnt+0.5))
``` | output | 1 | 28,986 | 10 | 57,973 |
Provide a correct Python 3 solution for this coding contest problem.
Create a program that reads the sales unit price and sales quantity and outputs the total sales amount and the average sales quantity.
Input
The input is given in the following format:
Sales unit price, sales quantity
Sales unit price, sales qu... | instruction | 0 | 28,987 | 10 | 57,974 |
"Correct Solution:
```
from decimal import Decimal, ROUND_HALF_UP
c = p = i = 0
while 1:
try:
v, n = map(int, input().split(","))
i += 1
c += n
p += n * v
except:break
print(p)
print(Decimal(c / i).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
``` | output | 1 | 28,987 | 10 | 57,975 |
Provide a correct Python 3 solution for this coding contest problem.
Create a program that reads the sales unit price and sales quantity and outputs the total sales amount and the average sales quantity.
Input
The input is given in the following format:
Sales unit price, sales quantity
Sales unit price, sales qu... | instruction | 0 | 28,988 | 10 | 57,976 |
"Correct Solution:
```
price, num, c = 0, 0, 0
while True:
try:
p, n = map(float, input().split(','))
price += p * n
num += n
c += 1
except:
print(int(price))
num /= c
s = str(num).split('.')
if int(s[1][0]) > 4:
print(int(num) + 1)
... | output | 1 | 28,988 | 10 | 57,977 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.