AtCoder Beginner Contest 115 - Christmas Eve Eve

In some other world, today is the day before Christmas Eve.
Mr. Takaha is buying N items at a department store. The regular price of the i-th item (1 \leq i \leq N) is p_i yen (the currency of Japan).
He has a discount coupon, and can buy one item with the highest price for half the regular price. The remaining N-1 items cost their regular prices. What is the total amount he will pay?

-----Constraints-----
 - 2 \leq N \leq 10
 - 100 \leq p_i \leq 10000
 - p_i is an even number.

-----Input-----
Input is given from Standard Input in the following format:
N
p_1
p_2
:
p_N

-----Output-----
Print the total amount Mr. Takaha will pay.

-----Sample Input-----
3
4980
7980
6980

-----Sample Output-----
15950

The 7980-yen item gets the discount and the total is 4980 + 7980 / 2 + 6980 = 15950 yen.
Note that outputs such as 15950.0 will be judged as Wrong Answer.

Difficulty: EASY

Starter code:

Solutions:
p = [int(input()) for _ in range(int(input()))]
print(sum(p) - max(p) // 2)


N = int(input())
p = []
for i in range(N):
	p.append(int(input()))
max_p = max(p)
ans = int(max_p / 2) + sum(p) - max_p
print(ans)


a = int(input())
l = []
for i in range(a):
	l.append(int(input()))
b = max(l)
print(sum(l) - b // 2)


n = int(input())
s = [int(input()) for i in range(n)]
print(sum(s) - int(max(s) / 2))


N = int(input())
p = []
for i in range(N):
	p.append(int(input()))
a = max(p)
p.remove(a)
s = 0
for i in p:
	s += i
print(s + a // 2)


n = int(input())
p = [int(input()) for i in range(n)]
p.sort()
p[n - 1] /= 2
print(int(sum(p)))


n = int(input())
a = [int(input()) for _ in range(n)]
print(sum(a) - max(a) // 2)


s = int(input())
p = [int(input()) for i in range(s)]
print(sum(p) - max(p) // 2)


n = int(input())
l = sorted((int(input()) for i in range(n)))
print(sum(l) - l[-1] // 2)


N = int(input())
present = []
for i in range(N):
	price = int(input())
	present.append(price)
present.sort(reverse=True)
max_price = present.pop(0)
ans = max_price // 2 + sum(present)
print(ans)


n = int(input())
l = [int(input()) for _ in range(n)]
print(sum(l) - int(max(l) / 2))


n = int(input())
p = [int(input()) for i in range(n)]
print(sum(p) - int(max(p) / 2))


N = int(input())
l = []
a = 0
for i in range(N):
	x = int(input())
	a += x
	l.append(x)
n = max(l) / 2
print(round(a - n))


(n, *p) = map(int, open(0).read().split())
print(sum(sorted(p)[:-1]) + sorted(p)[-1] // 2)


N = int(input())
p = [int(input()) for i in range(N)]
ans = 0
for i in p:
	ans += i
ans -= int(max(p) / 2)
print(ans)


(a, *n) = map(int, open(0))
print(int(sum(n) - max(n) / 2))


N = int(input())
l = [int(input()) for _ in range(N)]
print(sum(l) - max(l) // 2)


n = int(input())
p = list((int(input()) for _ in range(n)))
print(sum(p) - max(p) // 2)


(_, *p) = map(int, open(0).readlines())
print(sum(p) - max(p) // 2)


N = int(input())
A = [int(input()) for i in range(N)]
print(sum(A) - max(A) // 2)


(N, *d) = map(int, open(0).read().split())
print(int(sum(d) - max(d) / 2))


n = int(input())
l = [int(input()) for i in range(n)]
ans = sum(l) - max(l) + max(l) // 2
print(ans)


N = int(input())
A = [int(input()) for _ in range(N)]
print(sum(A) - max(A) // 2)


l = [int(input()) for i in range(int(input()))]
print(sum(l) - max(l) // 2)


N = int(input())
p = [int(input()) for i in range(N)]
print(int(sum(p) - max(p) / 2))


N = int(input())
P = []
for i in range(N):
	P.append(int(input()))
print(sum(P) - max(P) // 2)


n = int(input())
P = [int(input()) for i in range(n)]
print(sum(P) - max(P) + max(P) // 2)


a = int(input())
b = [int(input()) for _ in range(a)]
print(sum(b) - max(b) // 2)


p = sorted([int(input()) for i in range(int(input()))])
print(sum(p) - p[-1] // 2)


n = int(input())
l = [int(input()) for _ in range(n)]
print(sum(l) - int(0.5 * max(l)))


N = int(input())
P = []
for n in range(N):
	P.append(int(input()))
P = sorted(P, reverse=True)
print(sum(P) - P[0] // 2)


N = int(input())
pi = [int(input()) for _ in range(N)]
print(sum(pi) - max(pi) // 2)


P = [int(input()) for _ in range(int(input()))]
print(sum(P) - int(max(P) / 2))


(N, *p) = map(int, open(0).read().split())
p.sort()
p[-1] /= 2
print(int(sum(p)))


n = int(input())
p = [int(input()) for i in range(n)]
print(int(sum(p) - max(p) * 0.5))


n = int(input())
list_p = sorted([int(input()) for n in range(0, n)])
print(sum(list_p[:n - 1]) + list_p[n - 1] // 2)


p = [int(input()) for _ in range(int(input()))]
print(int(sum(p) - 0.5 * max(p)))


n = int(input())
ans = 0
ml = []
for i in range(n):
	a = int(input())
	ml.append(a)
x = max(ml) / 2
ans = sum(ml) - x
print(int(ans))


n = int(input())
P = sorted([int(input()) for _ in range(n)])
print(sum(P) - P[n - 1] // 2)


N = int(input())
n = [int(input()) for i in range(N)]
print(sum(n) - max(n) // 2)


n = int(input())
a = [int(input()) for i in range(n)]
print(int(sum(a) - max(a) / 2))


def readinput():
	n = int(input())
	p = []
	for _ in range(n):
		p.append(int(input()))
	return (n, p)

def main(n, p):
	p.sort(reverse=True)
	p[0] = p[0] // 2
	return sum(p)

def __starting_point():
	(n, p) = readinput()
	ans = main(n, p)
	print(ans)
__starting_point()


import math
import collections
from itertools import product
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))
n = ii()
p = [ii() for i in range(n)]
p.sort()
p[-1] //= 2
print(sum(p))


def main():
	p = [int(input()) for i in range(int(input()))]
	print(sum(p) - max(p) // 2)

def __starting_point():
	main()
__starting_point()


def answer(n: int, p: []) -> int:
	p.append(p.pop(p.index(max(p))) // 2)
	return sum(p)

def main():
	n = int(input())
	p = list((int(input()) for _ in range(n)))
	print(answer(n, p))

def __starting_point():
	main()
__starting_point()


p = sorted([int(input()) for _ in range(int(input()))])
print(sum(p[0:-1]) + p[-1] // 2)


(N, *P) = map(int, open(0).read().split())
print(sum(P) - max(P) + max(P) // 2)


total_item = int(input())
item_cost = []
for i in range(total_item):
	item_cost.append(int(input()))
print(sum(item_cost) - max(item_cost) // 2)


(_, *a) = map(int, open(0).read().split())
print(sum(a) - max(a) // 2)


a = int(input())
b = [int(input()) for i in range(a)]
b.sort()
b[len(b) - 1] = int(b[len(b) - 1] / 2)
print(sum(b))


n = int(input())
l = [int(input()) for _ in [0] * n]
print(sum(l) - max(l) // 2)


N = int(input())
L = [int(input()) for _ in range(N)]
print(sum(L) - max(L) + max(L) // 2)


(N, *P) = map(int, open(0))
print(sum(P) - max(P) // 2)


N = int(input())
p = [int(input()) for x in range(N)]
print(int(sum(p) - max(p) / 2))


pn = [int(input()) for _ in range(int(input()))]
print(sum(pn) - max(pn) // 2)


N = int(input())
p = []
for i in range(N):
	p.append(int(input()))
p.sort()
ans = sum(p) - p[-1] // 2
print(ans)


n = int(input())
s = [int(input()) for _ in range(n)]
print(int(sum(s) - max(s) / 2))


n = int(input())
L = sorted(list((int(input()) for _ in range(n))))
ans = 0
for i in range(n):
	if i == n - 1:
		ans += L[i] // 2
	else:
		ans += L[i]
print(ans)


N = int(input())
l = [input() for _ in range(N)]

def ans115(N: int, l: list):
	l = sorted(map(int, l))
	count = 0
	for i in range(0, N - 1):
		count += l[i]
	return int(count + l[N - 1] * 0.5)
print(ans115(N, l))


def lcm(a, b):
	return a * b // math.gcd(a, b)
MOD = 10 ** 9 + 7
N = int(input())
ans = 0
P = []
for i in range(N):
	p = int(input())
	P.append(p)
	ans += p
ans -= max(P) // 2
print(ans)


(_, *a) = map(int, open(0).readlines())
print(sum(a) - max(a) // 2)


n = int(input())
prices = []
for i in range(0, n):
	prices.append(int(input()))
payment = int(max(prices) / 2 + sum(prices) - max(prices))
print(payment)


N = int(input())
arr = [int(input()) for i in range(N)]
print(sum(arr) - int(max(arr) / 2))


N = int(input())
p = [int(input()) for n in range(N)]
print(sum(p) - max(p) // 2)


(n, *l) = map(int, open(0))
l.sort()
l[-1] = l[-1] // 2
print(sum(l))


n = int(input())
ps = [int(input()) for _ in range(n)]
print(sum(ps) - max(ps) // 2)


n = int(input())
li = []
for i in range(n):
	li.append(int(input()))
li.sort()
li[-1] = li[-1] // 2
print(sum(li))


(_, *D) = map(int, open(0).read().split())
print(sum(D) - max(D) // 2)


N = int(input())
a = []
for _ in range(0, N):
	a.append(int(input()))
a1 = sorted(a, reverse=True)
price = a1[0] // 2 + sum(a1) - a1[0]
print(price)


import sys

def input():
	return sys.stdin.readline().strip()

def I():
	return int(input())

def LI():
	return list(map(int, input().split()))

def IR(n):
	return [I() for i in range(n)]

def LIR(n):
	return [LI() for i in range(n)]

def SR(n):
	return [S() for i in range(n)]

def S():
	return input()

def LS():
	return input().split()
INF = float('inf')
n = I()
p = IR(n)
p.sort()
ans = sum(p[:-1]) + p[-1] // 2
print(ans)


N = int(input())
lists = []
for _ in range(1, N + 1):
	lists.append(int(input()))
sums = 0
for i in range(0, N):
	sums += lists[i]
sums -= int(max(lists) / 2)
print(sums)


n = int(input())
p = list((int(input()) for _ in range(n)))
p.append(p.pop(p.index(max(p))) // 2)
print(sum(p))


al = [int(input()) for _ in range(int(input()))]
print(sum(al) - max(al) // 2)


N = int(input())
my_list = []
for i in range(0, N):
	my_list.append(int(input()))
my_list = sorted(my_list, reverse=True)
my_list[0] = int(my_list[0] / 2)
answer = sum(my_list)
print(answer)


(n, *p) = map(int, open(0).read().split())
print(sum(p) - max(p) // 2)


n = int(input())
a = [int(input()) for _ in [0] * n]
print(sum(a) - max(a) // 2)


pnum = int(input())
plist = list()
for pcnt in range(0, pnum, 1):
	plist.append(int(input()))
half = max(plist) // 2
psum = sum(plist) - half
print(psum)


N = int(input())
a = [int(input()) for i in range(N)]
m = int(sum(a) - max(a) / 2)
print(m)


(n, *l) = map(int, open(0))
print(sum(l) - max(l) // 2)


n = int(input())
l = []
for i in range(n):
	l.append(int(input()))
i = l.index(max(l))
l[i] = l[i] // 2
print(sum(l))


N = int(input())
P = [int(input()) for j in range(N)]
print(sum(P) - max(P) // 2)


n = int(input())
d = [int(input()) for i in range(n)]
print(int(sum(d) - max(d) / 2))


N = int(input())
p = [int(input()) for _ in [0] * N]
print(sum(p) - max(p) // 2)


n = int(input())
ps = [int(input()) for i in range(n)]
print(sum(ps) - max(ps) // 2)


n = int(input())
k = [int(input()) for i in range(n)]
print(sum(k) - max(k) // 2)


N = int(input())
p = [int(input()) for k in range(N)]
print(sum(p) - max(p) // 2)


N = int(input())
p = [int(input()) for i in range(N)]
answer = sum(p)
print(int(answer - max(p) * 0.5))


print(int((lambda x: sum(x) - max(x) / 2)([int(input()) for i in range(int(input()))])))


n = int(input())
L = [int(input()) for i in range(n)]
print(int(sum(L) - max(L) / 2))


lis = [int(input()) for i in range(int(input()))]
print(sum(lis) - max(lis) // 2)


(n, *p) = map(int, open(0))
print(sum(p) - max(p) // 2)


(*s, h) = sorted((int(input()) for _ in range(int(input()))))
print(sum(s) + h // 2)


a = int(input())
g = [int(input()) for _ in range(a)]
ma = max(g)
del g[g.index(ma)]
print(int(sum(g) + ma / 2))


(n, *p) = list(map(int, open(0).read().split()))
p.sort()
print(sum(p[:-1]) + p[-1] // 2)


n = int(input())
ans = 0
lis = [int(input()) for _ in range(n)]
ma = lis.pop(lis.index(max(lis)))
print(sum(lis) + int(ma * 0.5))


N = int(input())
S_list = [int(input()) for i in range(N)]
p_max = max(S_list)
p_sum = sum(S_list)
result = int(p_max / 2) + p_sum - p_max
print(result)


def christmas_eve_eve(price_list: list):
	price_list.sort()
	price_list[-1] /= 2
	return int(sum(price_list))

def __starting_point():
	prices = []
	n = int(input())
	for i in range(n):
		prices.append(int(input()))
	print(christmas_eve_eve(prices))
__starting_point()


N = int(input())
list = [int(input()) for i in range(N)]
expensive = max(list)
discount = expensive // 2
total = sum(list) - expensive + discount
print(total)


n = int(input())
li = [int(input()) for _ in range(n)]
print(sum(li) - max(li) // 2)


N = int(input())
a = []
for _ in range(0, N):
	a.append(int(input()))
price = max(a) // 2 + sum(a) - max(a)
print(price)


N = int(input())
p = [int(input()) for _ in range(N)]
m = max(p)
print(sum(p) - m + int(m / 2))


n = int(input())
max_price = 0
prices = []
for _i in range(n):
	price = int(input())
	prices.append(price)
	if max_price < price:
		max_price = price
print(sum(prices) - max_price // 2)


N = int(input())
L = [int(input()) for i in range(N)]
print(sum(L) - max(L) // 2)


N = int(input())
li = [int(input()) for i in range(N)]
print(sum(li) - max(li) // 2)


def atc_115b(N: int, Pi_input: int) -> int:
	Pi_input = sorted(Pi_input)
	max_price = Pi_input.pop()
	return int(sum(Pi_input) + max_price / 2)
N_input_value = int(input())
Pi_input_value = []
for i in range(0, N_input_value):
	Pi_input_value.append(int(input()))
print(atc_115b(N_input_value, Pi_input_value))


N = int(input())
P = [int(input()) for _ in range(N)]
sortP = sorted(P)
ans = sum(sortP[:-1]) + sortP[-1] / 2
print(int(ans))


N = int(input())
p = [int(input()) for i in range(N)]
p = sorted(p)
harai = 0
harai = sum(p) - p[-1] // 2
print(harai)


n = int(input())
x = [int(input()) for i in range(n)]
print(sum(x) - max(x) // 2)


N = int(input())
List = [int(input()) for i in range(N)]
print(sum(List) - max(List) // 2)


import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque, Counter
from decimal import Decimal
import functools

def v():
	return input()

def k():
	return int(input())

def S():
	return input().split()

def I():
	return list(map(int, input().split()))

def X():
	return list(input())

def L():
	return list(input().split())

def l():
	return list(map(int, input().split()))

def lcm(a, b):
	return a * b // math.gcd(a, b)
sys.setrecursionlimit(10 ** 6)
mod = 10 ** 9 + 7
cnt = 0
ans = 0
inf = float('inf')
al = 'abcdefghijklmnopqrstuvwxyz'
AL = al.upper()
(n, *a) = list(map(int, open(0)))
print(sum(a) - max(a) // 2)


n = int(input())
p = [int(input()) for i in range(n)]
p = sorted(p, reverse=True)
result = p[0] // 2
for i in range(n - 1):
	result += p[i + 1]
print(result)


n = int(input())
p = [int(input()) for _ in range(n)]

def answer(n: int, p: int) -> int:
	a = sum(p) - max(p) // 2
	return a
print(answer(n, p))


n = int(input())
list01 = []
for i in range(n):
	list01.append(int(input()))
print(sum(list01) - max(list01) // 2)


N = int(input())
P = [int(input()) for n in range(N)]
print(sum(P) - max(P) // 2)


N = int(input())
PP = [int(input()) for _ in range(N)]
print(sum(PP) - max(PP) // 2)


N = int(input())
p = [int(input()) for i in range(N)]
descending_p = sorted(p, reverse=True)
discount_price = descending_p[0] // 2
list_price = sum(descending_p[1:])
total_price = discount_price + list_price
print(total_price)


N = int(input())
P = list((int(input()) for i in range(N)))
expensive = max(P)
other = sum(P) - expensive
print(expensive // 2 + other)


n = int(input())
p = [int(input()) for i in range(n)]
k = 0
m = max(p)
l = int(m / 2)
for i in p:
	k = k + i
print(k - l)


N = int(input())
p = []
for i in range(N):
	p.append(int(input()))
Expensive = max(p)
p.remove(Expensive)
print(Expensive // 2 + sum(p))


N = int(input())
p_sum = 0
p_max = 0
for i in range(N):
	p = int(input())
	p_sum += p
	p_max = max(p_max, p)
print(p_sum - p_max // 2)


N = int(input())
P = sorted([int(input()) for x in range(N)])
m = P[N - 1]
P = P[:N - 1]
print(sum(P) + m // 2)


N = int(input())
list = [int(input()) for i in range(N)]
print(sum(list) - max(list) // 2)


n = int(input())
A = [int(input()) for i in range(n)]
print(sum(A) - max(A) // 2)


N = int(input())
p = []
for i in range(N):
	p.append(int(input()))
p.sort()
cost = 0
for i in range(N - 1):
	cost += p[i]
print(cost + p[N - 1] // 2)


N = int(input())
sum = 0
price_list = []
for i in range(N):
	price_list.append(int(input()))
ex_product = max(price_list)
dis_ex_product = ex_product // 2
for i in price_list:
	sum += i
answer = sum - dis_ex_product
print(answer)


def mapt(fn, *args):
	return tuple(map(fn, *args))

def Input():
	return mapt(int, input().split(' '))

def main():
	n = int(input())
	data = sorted((int(input()) for _ in range(n)))
	(x, y) = (data[:-1], data[-1])
	print(sum(x) + y // 2)
main()


def main():
	p = []
	sum_cost = 0
	n = int(input())
	for i in range(n):
		p.append(int(input()))
	max_p = max(p)
	p[p.index(max_p)] = max_p / 2
	print(int(sum(p)))

def __starting_point():
	main()
__starting_point()


N = int(input())
prices = []
for _ in range(N):
	prices.append(int(input()))
prices.append(max(prices) // 2)
prices.remove(max(prices))
print(sum(prices))


N = int(input())
data = list(range(N))
m = 0
while m < N:
	data[m] = int(input())
	m += 1
kei = 0
max = 0
for i in range(len(data)):
	kei += data[i]
	if max < data[i]:
		max = data[i]
kei = kei - max / 2
print(int(kei))


N = int(input())
P = [int(input()) for i in range(N)]
A = sorted(P)
print(sum(A) - A[-1] // 2)


import math
N = int(input())
p = []
for i in range(N):
	p.append(int(input()))
total_price = max(p) / 2 + sum(p) - max(p)
print(math.floor(total_price))


print((lambda a: sum(a) - max(a) // 2)([int(input()) for i in range(int(input()))]))


N = int(input())
P = [int(input()) for i in range(N)]
P.sort()
print(sum(P) - P[-1] // 2)


(n, *l) = map(int, open(0).read().split())
print(sum(l) - max(l) // 2)


N = int(input())
p = []
for i in range(N):
	p.append(int(input()))
p.sort()
p.reverse()
p[0] //= 2
print(sum(p))


N = int(input())
P = sorted(list((int(input()) for _ in range(N))), reverse=True)
P[0] = int(P[0] * 0.5)
print(sum(P))


(N, *p) = map(int, open(0).read().split())
print(sum(sorted(p)[:-1]) + max(p) // 2)


N = int(input())
p = [int(input()) for _ in range(N)]
p.sort()
print(sum(p[0:N - 1]) + p[-1] // 2)


N = int(input())
(m, *P) = sorted([int(input()) for x in range(N)], reverse=True)
print(sum(P) + m // 2)


ns = [int(input()) for _ in range(int(input()))]
print(sum(ns) - max(ns) // 2)


N = int(input())
P = [int(input()) for i in range(N)]
print(round(sum(P) - 1 / 2 * max(P)))


n = int(input())
al = [int(input()) for _ in range(n)]
mm = max(al)
print(sum(al) - mm // 2)


d = [int(input()) for _ in range(int(input()))]
print(sum(d) - max(d) // 2)


n = int(input())
p = []
for _ in range(0, n):
	p.append(int(input()))
print(int(sum(p) - max(p) / 2))


count_gift = int(input())
price_list = []
total_payment = 0
for _ in range(count_gift):
	price_list.append(int(input()))
price_list.sort(reverse=True)
total_payment = price_list.pop(0) // 2
for i in price_list:
	total_payment += i
print(total_payment)