Problem:


Sum and Average

販売単価と販売数量を読み込んで、販売金額の総合計と販売数量の平均を出力するプログラムを作成してください。

Input

入力は以下の形式で与えられます。

販売単価,販売数量
販売単価,販売数量
:
:

カンマで区切られた販売単価と販売数量の組が、複数行に渡って与えられます。入力される値はすべて 0 以上 1,000 以下で、販売単価と販売数量の組の数は 100 を超えません。

Output

１行目に販売金額の総合計（整数）、２行目に販売数量の平均(整数）を出力してください。
販売数量の平均に端数（小数点以下の数）が生じた場合は小数点以下第 1 位を四捨五入してください。

Sample Input

100,20
50,10
70,35

Output for the Sample Input

4950
22



Sample input:
100,20
50,10
70,35


Sample output:
4950
22

Submission status: Wrong Answer

Solution code:
n = 0
sum = 0
ave = 0
while(True):
    try:
        a,b = map(int,input().split(","))
        sum += a*b
        ave += b
        n+=1
    except EOFError:
        print(sum)
        print("%.0f"%(ave/n))
        break

Submission status: Wrong Answer

Solution code:
n = 0
sum = 0
ave = 0
while(True):
    try:
        a,b = map(int,input().split(","))
        sum += a*b
        ave += b
        n += 1
    except EOFError:
        print(sum)
        print("%.0f"%(ave/n))
        break

Submission status: Wrong Answer

Solution code:
n = 0
sum = 0
ave = 0
while(True):
    try:
        a,b = map(int,input().split(","))
        sum += a*b
        ave += b
        n += 1
    except EOFError:
        print(sum)
        print("%.0f"%round(ave/n))
        break

Submission status: Wrong Answer

Solution code:
n = 0
sum = 0
ave = 0
while(True):
    try:
        a,b = map(int,input().split(","))
        sum += a*b
        ave += b
        n += 1
    except EOFError:
        print(sum)
        print("%d"%round(ave/n))
        break

Submission status: Wrong Answer

Solution code:
a = []
b = []
while True:
 try:
  n, m = map(int, raw_input().strip().split(","))
  a.append(n * m);
  b.append(m);
 except:
  break;

print int(sum(a) / float(len(a)) + 0.5)
print int(sum(b) / float(len(b)) + 0.5)

Submission status: Wrong Answer

Solution code:
import sys
f = sys.stdin

sum_price = sum_amount = kind = 0
for line in f:
    price, amount = map(int, line.split(','))
    sum_price += price * amount
    sum_amount += amount
    kind += 1
    
print(sum_price, round(sum_amount / kind))

Submission status: Wrong Answer

Solution code:
import sys
f = sys.stdin

sum_price = sum_amount = kind = 0
for line in f:
    price, amount = map(int, line.split(','))
    sum_price += price * amount
    sum_amount += amount
    kind += 1
    
print(sum_price)
print(round(sum_amount / kind))

Submission status: Wrong Answer

Solution code:
import sys
f = sys.stdin


sum_price = sum_amount = kind = 0
for line in f:
    price, amount = map(int, line.split(','))
    sum_price += price * amount
    sum_amount += amount
    kind += 1
    
print(sum_price)
print(int(round(sum_amount / kind,0)))

Submission status: Wrong Answer

Solution code:
sum=0
ave=0
num=0
while True:
    try:
        m, n = map(int, input().split(","))
    except:
        break

    ave += n
    sum += m * n
    num += 1


print(sum)
print(round(ave / num))

Submission status: Wrong Answer

Solution code:
import sys
x,y = 0,0
n = 0
for line in sys.stdin.readlines():
  print(line)
  a,b = map(int,line.split(','))
  x += a*b
  y += b
  n += 1
print(x)
print(int(y/n))

Submission status: Wrong Answer

Solution code:
import sys
x,y = 0,0
n = 0
for line in sys.stdin.readlines():
  a,b = map(int,line.split(','))
  x += a*b
  y += b
  n += 1
print(x)
print(int(round(y/n,0)))

Submission status: Wrong Answer

Solution code:
import sys
m = 0
n = 0
c = 0
for line in sys.stdin.readlines():
  a,b = map(int,line.split(','))
  m += a*b
  n += b
  c += 1
print(m)
print(int(round(n/c,0)))

Submission status: Wrong Answer

Solution code:
import sys
m = 0
n = 0
c = 0
for line in sys.stdin.readlines():
  a,b = map(int,line.split(','))
  m += a*b
  n += b
  c += 1
print(m)
print(int(round(n/c)))

Submission status: Wrong Answer

Solution code:
A=[]
while True:
	try:
		x,y=map(int,input().split(','))
		A.append((x,y))
	except EOFError:
		break
amount_of_sales=0
sales_number=0
for i in A:
	amount_of_sales+=i[0]*i[1]
	sales_number+=i[1]
print(amount_of_sales)
print(int(round(sales_number/3,0)))

Submission status: Wrong Answer

Solution code:
A=[]
while True:
	try:
		x,y=map(int,input().split(','))
		A.append((x,y))
	except EOFError:
		break
amount_of_sales=0
sales_number=0
for i in A:
	amount_of_sales+=i[0]*i[1]
	sales_number+=i[1]
print(amount_of_sales)
ans=round(sales_number/3,1)
ans=str(ans)
for i in ans:
	if i!='.':
		print(i,end="")
	else:
		break
print()

Submission status: Wrong Answer

Solution code:
A=[]
while True:
	try:
		x,y=map(int,input().split(','))
		A.append((x,y))
	except EOFError:
		break
amount_of_sales=0
sales_number=0
for i in A:
	amount_of_sales+=i[0]*i[1]
	sales_number+=i[1]
print(amount_of_sales)
ans=round(sales_number/3,1)
ans=str(ans)
for i in ans:
	if i!='.':
		print(i,end="")
	else:
		break

Submission status: Wrong Answer

Solution code:
A=[]
while True:
	try:
		x,y=map(int,input().split(','))
		A.append((x,y))
	except EOFError:
		break
amount_of_sales=0
sales_number=0
for i in A:
	amount_of_sales+=i[0]*i[1]
	sales_number+=i[1]
print(amount_of_sales)
ans=round(sales_number/3,0)
ans=str(ans)
for i in ans:
	if i!='.':
		print(i,end="")
	else:
		break
print()

Submission status: Wrong Answer

Solution code:
A=[]
while True:
	try:
		x,y=map(int,input().split(','))
		A.append((x,y))
	except EOFError:
		break
amount_of_sales=0
sales_number=0
for i in A:
	amount_of_sales+=i[0]*i[1]
	sales_number+=i[1]
print(amount_of_sales)
ans=round(sales_number/3,0)
ans=str(ans)
for i in ans:
	if i!='.':
		print(i,end="")
	else:
		break

Submission status: Wrong Answer

Solution code:
A=[]
while True:
	try:
		x,y=map(int,input().split(','))
		A.append((x,y))
	except EOFError:
		break
amount_of_sales=0
sales_number=0
for i in A:
	amount_of_sales+=i[0]*i[1]
	sales_number+=i[1]
print(amount_of_sales)
print(int(sales_number/3+0.5))

Submission status: Wrong Answer

Solution code:
data = []
while True:
    try:
        data.append(tuple(map(int, input().split(','))))
    except:
        break
print('{:.0f}'.format(sum(data[i][0] * data[i][1] for i in range(len(data)))))
print('{:.0f}'.format(sum(data[i][1] for i in range(len(data))) / len(data)))

Submission status: Wrong Answer

Solution code:
data = []
while True:
    try:
        data.append(tuple(map(int, input().split(','))))
    except:
        break
print('{:d}'.format(sum(data[i][0] * data[i][1] for i in range(len(data)))))
print('{:.0f}'.format(sum(data[i][1] for i in range(len(data))) / len(data) + 0))

Submission status: Wrong Answer

Solution code:
data = []
while True:
    try:
        data.append(tuple(map(int, input().split(','))))
    except:
        break
print('{:d}'.format(sum(data[i][0] * data[i][1] for i in range(len(data)))))
print('{:.0f}'.format(sum(data[i][1] for i in range(len(data))) / len(data) - 0))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

_sum_list = []
_avg_list = []


while 1:
    try:
        _sum, _avg = [int(e) for e in input().split(',')]
        _sum_list.append(_sum)
        _avg_list.append(_avg)
    except:
        __sum, __avg = sum(_sum_list), sum(_avg_list) / len(_avg_list)
        print(round(__sum, 1), round(__avg, 1))
        break

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

_sum_list = []
_avg_list = []


while 1:
    try:
        _sum, _avg = [int(e) for e in input().split(',')]
        _sum_list.append(_sum)
        _avg_list.append(_avg)
    except:
        __sum, __avg = sum(_sum_list), sum(_avg_list) / len(_avg_list)
        print(round(__sum), round(__avg))
        break

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

_sum_list = []
_avg_list = []


while 1:
    try:
        _sum, _avg = [int(e) for e in input().split(',')]
        _sum_list.append(_sum * _avg)
        _avg_list.append(_avg)
    except:
        __sum, __avg = sum(_sum_list), sum(_avg_list) / len(_avg_list)
        print(round(__sum), round(__avg))
        break

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

_sum_list = []
_avg_list = []


while 1:
    try:
        _sum, _avg = [int(e) for e in input().split(',')]
        _sum, _avg = 100, 20
        _sum_list.append(_sum * _avg)
        _avg_list.append(_avg)
    except:
        break
    finally:
        __sum, __avg = sum(_sum_list), sum(_avg_list) / len(_avg_list)
        print(round(__sum))
        print(round(__avg))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

_sum_list = []
_avg_list = []


while 1:
    try:
        _sum, _avg = [int(e) for e in input().split(',')]
        _sum, _avg = 100, 20
        _sum_list.append(_sum * _avg)
        _avg_list.append(_avg)
    except:
        break
    finally:
        __sum, __avg = sum(_sum_list), sum(_avg_list) / len(_avg_list)
        print(round(__sum))
        print(round(__avg), end='')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

_sum_list = []
_avg_list = []


while 1:
    try:
        _sum, _avg = [int(e) for e in input().split(',')]
        _sum_list.append(_sum * _avg)
        _avg_list.append(_avg)
    except:
        __sum, __avg = sum(_sum_list), sum(_avg_list) / len(_avg_list)
        print(round(__sum))
        print(round(__avg))
        break

Submission status: Wrong Answer

Solution code:
P_Sum = 0
N_Sum = 0
Kazu = 0
while True:
    try:
        pri,num = map(int,input().split(","))
        P_Sum += num * pri
        N_Sum += num
        Kazu += 1
    except(EOFError,ValueError):
        print(P_Sum)
        print(round(N_Sum / Kazu))
        break

Submission status: Wrong Answer

Solution code:
P_Sum = 0
N_Sum = 0
Kazu = 0
while True:
    try:
        pri,num = map(int,input().split(","))
        P_Sum += num * pri
        N_Sum += num
        Kazu += 1
    except EOFError:
        print(P_Sum)
        print(round(N_Sum / Kazu))
        break

Submission status: Wrong Answer

Solution code:
P_Sum = 0
N_Sum = 0
Kazu = 0
while True:
    try:
        pri,num = map(int,input().split(","))
        P_Sum += num * pri
        N_Sum += num
        Kazu += 1
    except EOFError:
        print(P_Sum)
        print(int(round(N_Sum / Kazu)))
        break

Submission status: Wrong Answer

Solution code:
import sys

a, b = [], []
for line in sys.stdin:
    x, y = map(int, line.strip().split(","))
    a, b = a+[x*y], b+[y]
print(sum(a))
print(round(sum(b)/len(b)))

Submission status: Wrong Answer

Solution code:
a, b = [], []
while True:
    try:
        x, y = map(int, input().strip().split(","))
        a, b = a+[x*y], b+[y]
    except:
        break
print(sum(a))
print(round(sum(b)/len(b)))

Submission status: Wrong Answer

Solution code:
import sys
a, b = [], []
for line in sys.stdin:
    x, y = map(int, line.strip().split(","))
    a, b = a+[x*y], b+[y]
print(sum(a))
print(round(sum(b)/len(b)))

Submission status: Wrong Answer

Solution code:
import sys

a, b = [], []
for line in sys.stdin:
    x, y = map(int, line.strip().split(","))
    a, b = a+[x*y], b+[y]
print(sum(a))
print(int(round(sum(b)/len(b))))

Submission status: Wrong Answer

Solution code:
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(round(sell_num/cnt))

Submission status: Wrong Answer

Solution code:
x = []
y = []
while True:
    try:
        tmp = list(input().split(','))
        x.append(int(tmp[0]))
        y.append(int(tmp[1]))
    except EOFError:
        break
    
sum = 0
for i in range(len(x)):
    sum += x[i]*y[i]
total = 0
for i in range(len(y)):
    total += y[i]
print(sum)
print(round(total/len(y)))

Submission status: Wrong Answer

Solution code:
A = []
B = []
while True:
    try:
        x,y = map(int,input().split(','))
        A.append(x)
        B.append(y)
    except EOFError:
        break

N = len(A)
print(sum(A [i] * B [i] for i in range(N)),sum(B) * 2 // N - sum(B) // N)

Submission status: Wrong Answer

Solution code:
# -*- 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)
print(round(mean))

Submission status: Wrong Answer

Solution code:
# -*- 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)
print(int(round(mean)))

Submission status: Wrong Answer

Solution code:
Sum, Ave, Cou = 0, 0, 0
while True :
    try :
        a, b = input().split(',')
        Sum += int(a) * int(b)
        Ave += int(b)
        Cou += 1
    except : break
if Ave / Cou - Ave // Cou > 0.5 : print(Sum, Ave // Cou+1)
else : print(Sum,Ave//Cou)

Submission status: Wrong Answer

Solution code:
Sum, Ave, Cou = 0, 0, 0
while True :
    try :
        a, b = input().split(',')
        Sum += int(a) * int(b)
        Ave += int(b)
        Cou += 1
    except : break
print(Sum)
if Ave / Cou - Ave // Cou > 0.5 : print(Ave // Cou+1)
else : print(Ave//Cou)

Submission status: Wrong Answer

Solution code:
ans = [0, 0]
cnt = 0
while True:
    try:
        x, y = map(int, input().split(','))
        cnt += 1
    except:
        break
    ans[0] += x*y
    ans[1] += y
ans[1] = round(ans[1]/cnt)
print(*ans, sep="\n")

Submission status: Wrong Answer

Solution code:
try:
    result = result2 = count = 0
    while True:        
        a, b = map(int, input().split(','))
        result += a*b
        result2 += b
        count += 1
except:
    print(result,"{0:.1f}".format(result2/count))

Submission status: Wrong Answer

Solution code:
try:
    result = result2 = count = 0
    while True:
        a, b = map(int, input().split(','))
        result += a*b
        result2 += b
        count += 1
except:
    print(result)
    print(round(result2/count))

Submission status: Wrong Answer

Solution code:
total=0
s=0
i=0
try:
 while True:
  a,b = map(int,input().split(','))
  total += a*b
  s+=b
  i+=1
except:pass
result=s/i 
print(total)
print(round(result))

Submission status: Wrong Answer

Solution code:
total=0
s=0
i=0
try:
 while True:
  a,b = map(int,input().split(','))
  total += a*b
  s+=b
  i+=1
except:
 result=s/i 
 print(total)
 if isinstance(result,float):
    print(round(result))
 else:
    print(result)

Submission status: Wrong Answer

Solution code:
try:
    result = result2 = count = 0
    while True:
        a, b = map(int, input().split(','))
        result += a*b
        result2 += b
        count += 1
except:
    print(result)
    print(int(round(result2/count,0)))

Submission status: Wrong Answer

Solution code:
total=0
s=0
i=0
try:
 while True:
  a,b = map(int,input().split(','))
  total += a*b
  s+=b
  i+=1
except:
 result=s/i 
 print(total)
 if isinstance(result,float):
    print(round(result,1))
 else:
    print(result)

Submission status: Wrong Answer

Solution code:
try:
    result = result2 = count = 0
    while True:
        a, b = map(int, input().split(','))
        result += a*b
        result2 += b
        count += 1
except:
    print(result)
    display = round(result2/count)
    print(display)

Submission status: Wrong Answer

Solution code:
try:
    result = result2 = count = 0
    while True:
        a, b = map(int, input().split(','))
        result += a*b
        result2 += b
        count += 1
except:
    print(result)
    print((int)(round(result2/count)))

Submission status: Wrong Answer

Solution code:
import sys
price = 0
array = []
for line in sys.stdin:
    if line == "\n":
        break
    p, q = map(int, line.split(","))
    array.append(q)
    price += p * q
print(price)
print(round(sum(array) / len(array)))

Submission status: Wrong Answer

Solution code:
import sys

c = sv = sn = 0
for line in sys.stdin:
  try:
    v, n = [int(i) for i in line.split(',')]
    sv += v * n
    sn += n
    c += 1
  except:
    break
print(sv)
print(round(sn / c))

Submission status: Wrong Answer

Solution code:
import sys

s = 0
n = 0
c = 0
for i in sys.stdin:
    a,b = map(int, i.split(','))
    s += a * b
    n += b
    c += 1
print(s, round(n/c), sep='\n')

Submission status: Wrong Answer

Solution code:
s = 0
i = 0
n_sum = 0
while True:
    try:
        v, n = map(int, input().split(","))
        s += v*n
        n_sum += n
        i += 1
    except:
        break
print(s)
print(n_sum//i)

Submission status: Wrong Answer

Solution code:
s = 0
i = 0
n_sum = 0
while True:
    try:
        v, n = map(int, input().split(","))
        s += v*n
        n_sum += n
        i += 1
    except:
        break
print(s)
print(round(n_sum/i))

Submission status: Wrong Answer

Solution code:
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
S = 0
T = 0
for l in range(len(N)):
    n = [int(i) for i in N[l].split(",")]
    S += n[0]*n[1]
    T += n[1]
print(S)
print(round(T/len(N)))

Submission status: Wrong Answer

Solution code:
import sys
s=[list(map(int,e.split(',')))for e in sys.stdin]
print(sum(a*n for a,n in s),int([sum(x)for x in zip(*s)][1]/len(s)+.5))

Submission status: Wrong Answer

Solution code:
c = p = 0
while 1:
    try:
        n, v = map(int, input().split(","))
        c += n
        p += n * v
    except:break
print(p)
print(round(p / c))

Submission status: Wrong Answer

Solution code:
from decimal import Decimal, ROUND_HALF_UP
c = p = 0
while 1:
    try:
        n, v = map(int, input().split(","))
        c += n
        p += n * v
    except:break
print(p)
print(Decimal(p / c).quantize(Decimal('0'), rounding=ROUND_HALF_UP))

Submission status: Wrong Answer

Solution code:
import sys
a=[list(map(int,i.split(","))) for i in sys.stdin]
print(sum(map(lambda x:x[0]*x[1],a)))
print(round(sum(map(lambda x:x[1],a))/len(a)))

Submission status: Wrong Answer

Solution code:
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)
    print(round(num/cnt))

Submission status: Wrong Answer

Solution code:
import sys

r = []
for s in sys.stdin.read().rstrip().split('\n'):
    r.append(map(int, s.split(',')))
print sum([i[0]*i[1] for i in r])
print '{:.0f}'.format(sum(([i[1] for i in r])) / float(len(r)))

Submission status: Wrong Answer

Solution code:
import sys

a=0
b=0
c=0
for s in sys.stdin:
    p,n=map(int,s.split(','))
    a += p*n
    b += n
    c += 1
print "%d\n%.0f" %(a,1.0*b/c)

Submission status: Wrong Answer

Solution code:
import sys

a=0
b=0
c=0
for s in sys.stdin:
    p,n=map(int,s.split(','))
    a += p*n
    b += n
    c += 1
print "%d\n%.0f" %(a,b/c)

Submission status: Wrong Answer

Solution code:
import sys

a=0
b=0
c=0
for s in sys.stdin:
    p,n=map(int,s.split(','))
    a += p*n
    b += n
    c += 1
print "%d\n%.0f\n" %(a,b/c)

Submission status: Wrong Answer

Solution code:
i, all, sum = 0, 0, 0
while True:
    try:
        price, n = map(int, raw_input().split(","))
        i += 1; all += n; sum += price
    except:
        break
    
print sum
print int(round(float(all)/i))

Submission status: Wrong Answer

Solution code:
from itertools import starmap, izip
from operator import mul

items = []
while 1:
    try:
        price, amount = map(int, raw_input().split(','))
    except EOFError:
        break
    items.append((price, amount))
print sum(starmap(mul, items))
print sum(map(lambda a: a[1], items))

Submission status: Wrong Answer

Solution code:
import sys

s = c = n = 0
for line in sys.stdin:
    x, y = map(int, line.split(','))
    s += x * y
    c += y
    n += 1
print(s)
print(round(c / n))

Submission status: Time Limit Exceeded

Solution code:
P_Sum = 0
N_Sum = 0
Kazu = 0
while True:
    try:
        pri,num = map(int,input().split(","))
        P_Sum += num * pri
        N_Sum += num
        Kazu += 1
    except EOFError:
        print(P_Sum)
        print(round(N_Sum / Kazu))

Submission status: Time Limit Exceeded

Solution code:
total=0
s=0
i=0
while True:
 try:
  a,b = map(int,input().split(','))
  total += a*b
  s+=b
  i+=1
 except:
   result=s/i
   print(total)
   print(result)

Submission status: Accepted

Solution code:
n = 0
sum = 0
ave = 0
while(True):
    try:
        a,b = map(int,input().split(","))
        sum += a*b
        ave += b
        n += 1
    except EOFError:
        print(sum)
        print(int(ave/n+0.5))
        break

Submission status: Accepted

Solution code:
_sum = _num =  0
cnt = 0
try:
    while True:
        tmp = map(int, raw_input().split(","))
        _sum = _sum + (tmp[0] * tmp[1])
        _num += tmp[1]
        cnt+=1 
except:
    print _sum
    print int(round(_num*1.0/cnt, 0))

Submission status: Accepted

Solution code:
from decimal import Decimal, ROUND_HALF_UP
nsum=0
nave=0
n=0
while 1:
    try:
        a,b=list(map(int,input().split(",")))
        nsum+=a*b
        nave+=b
        n+=1
    except:break
print(nsum)
print(Decimal(str(nave/n)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))

Submission status: Accepted

Solution code:
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)
        else:
            print(int(num))
        break

Submission status: Accepted

Solution code:
a = []
b = []
while True:
 try:
  n, m = map(int, raw_input().strip().split(","))
  a.append(n * m);
  b.append(m);
 except:
  break;

print sum(a)
print int(sum(b) / float(len(b)) + 0.5)

Submission status: Accepted

Solution code:
sum = 0
count = []
while(True):
    try:
        n = map(int, raw_input().split(","))
        sum += n[0] * n[1]
        count.append(n[1])
    except Exception:
        break
print(sum)
countSum = 0
for i in range(len(count)):
    countSum += count[i]
print(int(float(countSum) / len(count) + 0.5))

Submission status: Accepted

Solution code:
from sys import *

su = 0
n = []
for s in stdin:
    d = map(int,s.split(","))
    su += d[0]*d[1]
    n.append(d[1])
print su
print int(round(sum(n)/float(len(n)),0))

Submission status: Accepted

Solution code:
import sys
f = sys.stdin


sum_price = sum_amount = kind = 0
for line in f:
    price, amount = map(int, line.split(','))
    sum_price += price * amount
    sum_amount += amount
    kind += 1
    
print(sum_price)
print(int(sum_amount / kind + 0.5))

Submission status: Accepted

Solution code:
tot_sale = 0
sale_all_num = 0
n = 0
while True:
    try:
        tan, sale_num = map(int,raw_input().split(','))
    except EOFError:
        break

    tot_sale += tan * sale_num
    sale_all_num += sale_num
    n += 1
    
ave = int(round(float(sale_all_num) / float(n)))
print tot_sale
print ave

Submission status: Accepted

Solution code:
sum=0
ave=0
num=0
while True:
    try:
        m, n = map(int, input().split(","))
    except:
        break

    ave += n
    sum += m * n
    num += 1


print(sum)
print(int(ave / num + 0.5))

Submission status: Accepted

Solution code:
sum=0
a=0
i=0
while True:
    try:
        value,num=map(int,raw_input().split(","))
        sum+=value*num
        a+=num
        i+=1
    except:
        break

print sum
print int(round(a/float(i),0))

Submission status: Accepted

Solution code:
import datetime

sum1 = 0
sum2 = 0
c = 0
try:
	while 1:
		s = raw_input().split(",")
		s[0] = int(s[0])
		s[1] = int(s[1])
		
		sum1 += s[0] * s[1]
		sum2 += s[1]
		c += 1
except:
	print(sum1)
	print(int(round(sum2 * 1.0 / c, 0)))
	exit()

Submission status: Accepted

Solution code:
cnt=t=a=0
while 1:
    try:
        x,y=map(int,raw_input().split(","))
        cnt+=1
        t+=x*y
        a+=y
    except:
        break
print t
print int(round((float(a))/cnt))

Submission status: Accepted

Solution code:
A=[]
while True:
	try:
		x,y=map(int,input().split(','))
		A.append((x,y))
	except:
		break
amount_of_sales=0
sales_number=0
for i in A:
	amount_of_sales+=i[0]*i[1]
	sales_number+=i[1]
print(amount_of_sales)
print(int(sales_number/len(A)+0.5))

Submission status: Accepted

Solution code:
import sys
ans1, ans2, count = 0,0.0,0
for line in sys.stdin:
	num = (map(int, line.split(",")))
	ans1, ans2, count = ans1 + num[0]*num[1], ans2 + num[1], count + 1
print ans1
print int(round(ans2/count))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys

price = []
quantity = []
n = 0
for line in sys.stdin:
    p, q = map(int, line.split(','))
    price.append(p)
    quantity.append(q)
    n += 1
sum = ave_q = 0
for i in range(n):
    sum += price[i]*quantity[i]
    ave_q += quantity[i]
ave_q = int(round(float(ave_q)/n, 0))
print sum
print ave_q

Submission status: Accepted

Solution code:
import sys

mny = s = cnt = 0
for line in sys.stdin:
    r = map(int, line.split(","))
    s += r[1]
    mny += r[0] * r[1]
    cnt += 1

print mny
print (s + cnt / 2) / cnt

Submission status: Accepted

Solution code:
data = []
while True:
    try:
        data.append(tuple(map(int, input().split(','))))
    except:
        break
print(sum(data[i][0] * data[i][1] for i in range(len(data))))
print(int(sum(data[i][1] for i in range(len(data))) / len(data) + 0.5))

Submission status: Accepted

Solution code:
# -*- 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

Submission status: Accepted

Solution code:
import sys

count = 0
asum = 0
bsum = 0
for line in sys.stdin:
  count += 1
  l = list(map(int,line.split(",")))
  asum += l[0]*l[1]
  bsum += l[1]
bave = int(bsum / count + 0.5)

print(asum)
print(bave)

Submission status: Accepted

Solution code:
P_Sum = 0
N_Sum = 0
Kazu = 0
while True:
    try:
        pri,num = map(int,input().split(","))
        P_Sum += num * pri
        N_Sum += num
        Kazu += 1
    except(EOFError,ValueError):
        print(P_Sum)
        print(int((N_Sum / Kazu)+ 0.5))
        break

Submission status: Accepted

Solution code:
import sys

a, b = [], []
for line in sys.stdin:
    x, y = map(int, line.strip().split(","))
    a, b = a+[x*y], b+[y]
print(sum(a))
print(int(sum(b)/len(b)+0.5))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
a,b,c=0,0,0
while 1:
    try:x,y=map(int,input().split(','))
    except:
        print(a)
        print(int(b/c+0.5))
        break
    a,b,c=a+x*y,b+y,c+1

Submission status: Accepted

Solution code:
x = []
y = []
while True:
    try:
        tmp = list(input().split(','))
        x.append(int(tmp[0]))
        y.append(int(tmp[1]))
    except EOFError:
        break
    
sum = 0
for i in range(len(x)):
    sum += x[i]*y[i]
total = 0
for i in range(len(y)):
    total += y[i]
print(sum)
print(int(total / len(y) + 0.5))

Submission status: Accepted

Solution code:
A = []
B = []
while True:
    try:
        x,y = map(int,input().split(','))
        A.append(x)
        B.append(y)
    except EOFError:
        break

N = len(A)
print(sum(A [i] * B [i] for i in range(N)))
print(sum(B) * 2 // N - sum(B) // N)

Submission status: Accepted

Solution code:
i = 0
sumsell = 0
sumn = 0
while True:
    try:
        at,n = map(int,input().split(","))
        sumsell += at*n
        sumn += n
        i += 1
    except EOFError: break
print(sumsell)
print((int)(sumn/i+0.5))

Submission status: Accepted

Solution code:
# -*- 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(mean))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0045
Sum and Average
"""
import sys
import math


def main(args):
    sum = 0
    total_pieces = 0
    number_of_data = 0
    for line in sys.stdin:
        unit_price, pieces = line.strip().split(',')
        sum += int(unit_price) * int(pieces)
        total_pieces += int(pieces)
        number_of_data += 1
    print('{0}\n{1}'.format(sum, math.ceil(total_pieces / number_of_data)))


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
Sum, Ave, Cou = 0, 0, 0
while True :
    try :
        a, b = input().split(',')
        Sum += int(a) * int(b)
        Ave += int(b)
        Cou += 1
    except : break
print(Sum)
if Ave / Cou - Ave // Cou >= 0.5 : print(Ave // Cou+1)
else : print(Ave//Cou)

Submission status: Accepted

Solution code:
ans = [0, 0]
cnt = 0
while True:
    try:
        x, y = map(int, input().split(','))
        cnt += 1
    except:
        break
    ans[0] += x*y
    ans[1] += y
ans[1] = ans[1]/cnt
if int(str(ans[1]).split(".")[0]) > 4:
    ans[1] += 1
ans[1] = int(ans[1])
print(*ans, sep="\n")

Submission status: Accepted

Solution code:
try:
    result = result2 = count = 0
    while True:
        a, b = map(int, input().split(','))
        result += a*b
        result2 += b
        count += 1
except:
    print(result)
    print((round(result2/count+0.5)))

Submission status: Accepted

Solution code:
try:
    result = result2 = count = 0
    while True:
        a, b = map(int, input().split(','))
        result += a*b
        result2 += b
        count += 1
except:
    print(result)
    print(round(result2/count+0.5))

Submission status: Accepted

Solution code:
try:
  total=s=i=0 
  while True:
   a,b = map(int,input().split(','))
   total += a*b
   s += b
   i += 1
except:
 print(total)
 print(round(s/i+0.5))

Submission status: Accepted

Solution code:
# Aizu Problem 0045: Sum and Average
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


revenue, total, N = 0, 0, 0
for line in sys.stdin:
    a, b = [int(_) for _ in line.split(',')]
    revenue += a * b
    total += b
    N += 1

print(revenue)
print(math.ceil(total/N))

Submission status: Accepted

Solution code:
import sys
import math

c = sv = sn = 0
for line in sys.stdin:
  try:
    v, n = [int(i) for i in line.split(',')]
    sv += v * n
    sn += n
    c += 1
  except:
    break
print(sv)
print(math.ceil(sn / c))

Submission status: Accepted

Solution code:
def main():
    sum_prise = 0
    sum_number = 0
    count = 0
    while True:
        try:
            prise,number = map(int,input().split(","))
            sum_prise += prise*number
            sum_number += number
        except EOFError:
            break
        count += 1
    print(sum_prise)
    print(int(sum_number/count+0.5))
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
round=lambda x:(x*2+1)//2
s = 0
i = 0
n_sum = 0
while True:
    try:
        v, n = map(int, input().split(","))
        s += v*n
        n_sum += n
        i += 1
    except:
        break
print(s)
print(int(round(n_sum/i)))

Submission status: Accepted

Solution code:
def f(x):
    return int((2*x+1) // 2)

def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
S = 0
T = 0
for l in range(len(N)):
    n = [int(i) for i in N[l].split(",")]
    S += n[0]*n[1]
    T += n[1]
print(S)
print(f(T/len(N)))