repl.it
@peachyog/

Cutting Cheese Costs

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
start = []
start.append(input().split(' '))

n = int(start[0][0])
k = int(start[0][1])


diffs = []
firsts = []
coupons = []
originals = []
zero = 0
one = 0

for i in range(n):
 
 

  diffs.append(int((input().split(' ')[0]))-int((input().split(' ')[1])))
  firsts.append((input().split(' ')[0]))
diffs.sort()
for i in range(k):
  
  coupons.append(diffs.pop())

print(sum(firsts)-sum(coupons))
  
Fetching token
?