1154A. Restoring Three Numbers
math, 800, https://codeforces.com/problemset/problem/1154/A
Polycarp has guessed three positive integers 𝑎a, 𝑏b and 𝑐c. He keeps these numbers in secret, but he writes down four numbers on a board in arbitrary order — their pairwise sums (three numbers) and sum of all three numbers (one number). So, there are four numbers on a board in random order: 𝑎+𝑏, 𝑎+𝑐, 𝑏+𝑐 and 𝑎+𝑏+𝑐.
You have to guess three numbers 𝑎, 𝑏 and 𝑐 using given numbers. Print three guessed integers in any order.
Pay attention that some given numbers 𝑎, 𝑏 and 𝑐 can be equal (it is also possible that 𝑎=𝑏=𝑐).
Input
The only line of the input contains four positive integers $𝑥_1,𝑥_2,𝑥_3,𝑥_4 (2≤𝑥_𝑖≤10^9) $— numbers written on a board in random order. It is guaranteed that the answer exists for the given number
Output
Print such positive integers 𝑎, 𝑏 and 𝑐c that four numbers written on a board are values 𝑎+𝑏, 𝑎+𝑐, 𝑏+𝑐 and 𝑎+𝑏+𝑐 written in some order. Print 𝑎, 𝑏 and 𝑐 in any order. If there are several answers, you can print any. It is guaranteed that the answer exists.
Examples
Input
3 6 5 4Output
2 1 3Input
40 40 40 60Output
20 20 20Input
201 101 101 200Output
1 100 100a = list(map(int, input().split()))
a.sort()
print(a[3]-a[0],a[3]-a[1],a[3]-a[2])