Snuke has four cookies with deliciousness A, B, C, and D. He will choose one or more from those cookies and eat them. Is it possible that the sum of the deliciousness of the eaten cookies is equal to that of the remaining cookies?

-----Constraints-----
 - All values in input are integers.
 - 1 \leq A,B,C,D \leq 10^{8}

-----Input-----
Input is given from Standard Input in the following format:
A B C D

-----Output-----
If it is possible that the sum of the deliciousness of the eaten cookies is equal to that of the remaining cookies, print Yes; otherwise, print No.

-----Sample Input-----
1 3 2 4

-----Sample Output-----
Yes

 - If he eats the cookies with deliciousness 1 and 4, the sum of the deliciousness of the eaten cookies will be equal to that of the remaining cookies.

Difficulty: MEDIUM_HARD

Solutions:
(A, B, C, D) = list(map(int, input().split()))
for i in range(2):
	for j in range(2):
		for k in range(2):
			for l in range(2):
				sum1 = 0
				sum2 = 0
				if i == 1:
					sum1 += A
				else:
					sum2 += A
				if j == 1:
					sum1 += B
				else:
					sum2 += B
				if k == 1:
					sum1 += C
				else:
					sum2 += C
				if l == 1:
					sum1 += D
				else:
					sum2 += D
				if sum1 == sum2:
					print('Yes')
					return
print('No')


from itertools import product
cookie = list(map(int, input().split()))
for bit in product([0, 1], repeat=4):
	eat = 0
	not_eat = 0
	for (i, b) in enumerate(bit):
		if b == 0:
			eat += cookie[i]
		else:
			not_eat += cookie[i]
	if eat == not_eat:
		print('Yes')
		return
print('No')


a = list(map(int, input().split()))
a.sort()
if sum(a[:3]) == a[3]:
	print('Yes')
elif a[0] + a[3] == a[1] + a[2]:
	print('Yes')
else:
	print('No')


A = list(map(int, input().split()))
sums = sum(A)
for i in range(2 ** 4):
	res = 0
	for j in range(4):
		if i >> j & 1:
			res += A[j]
	if res == sums - res:
		print('Yes')
		break
else:
	print('No')


def main():
	c = list(map(int, input().split()))
	s = sum(c)
	for i in range(2 ** 4):
		tmp = 0
		for j in range(4):
			if i >> j & 1:
				tmp += c[j]
		if tmp == s - tmp:
			print('Yes')
			break
	else:
		print('No')
main()


import itertools
(A, B, C, D) = list(map(int, input().split()))
sums = A + B + C + D
lst = [A, B, C, D]
for i in itertools.permutations(lst, 1):
	if sum(i) == sums - sum(i):
		print('Yes')
		return
for j in itertools.permutations(lst, 2):
	if sum(j) == sums - sum(j):
		print('Yes')
		return
print('No')


import itertools
flag = True
l = list(map(int, input().split()))
for i in itertools.combinations(l, 2):
	if sum(list(i)) * 2 == sum(l):
		print('Yes')
		flag = False
		break
for i in itertools.combinations(l, 1):
	if flag and sum(list(i)) * 2 == sum(l):
		print('Yes')
		flag = False
if flag:
	print('No')


cakes = [int(x) for x in input().split()]
for i in range(2 ** 4):
	(x, y) = (0, 0)
	for j in range(4):
		if i >> j & 1 == 1:
			x += cakes[j]
		else:
			y += cakes[j]
	if x == y:
		print('Yes')
		return
print('No')


import sys, itertools
a = list(map(int, input().split()))
su = sum(a)
for pt in itertools.product(range(2), repeat=4):
	if sum(pt) == 0:
		continue
	now = 0
	for (i, x) in enumerate(pt):
		if x:
			now += a[i]
	if now * 2 == su:
		print('Yes')
		break
else:
	print('No')


A = list(map(int, input().split()))
A.sort()
if A[-1] == sum(A[:-1]) or (A[0] + A[-1]) * 2 == sum(A):
	print('Yes')
else:
	print('No')


(A, B, C, D) = map(int, input().split())
if A == B + C + D or B == A + C + D or C == A + B + D or (D == A + B + C):
	print('Yes')
elif A + B == C + D or A + C == B + D or A + D == B + C:
	print('Yes')
else:
	print('No')


import sys
li = list(map(int, input().split()))
s = sum(li)
if s % 2:
	print('No')
	return
for i in range(4):
	for j in range(i + 1, 4):
		if li[i] + li[j] == s // 2 or li[i] == s // 2:
			print('Yes')
			return
print('No')


(A, B, C, D) = map(int, input().split())
S = A + B + C + D
if S % 2 == 0:
	if A == S // 2 or B == S // 2 or C == S // 2 or (D == S // 2) or (A + B == S // 2) or (A + C == S // 2) or (A + D == S // 2):
		print('Yes')
	else:
		print('No')
else:
	print('No')


(a, b, c, d) = sorted(list(map(int, input().split())))
if a + d == b + c or a + b + c == d:
	print('Yes')
else:
	print('No')


def resolve():
	l = list(map(int, input().split()))
	l.sort()
	if l[0] + l[3] == l[1] + l[2] or l[0] + l[1] + l[2] == l[3]:
		print('Yes')
	else:
		print('No')
resolve()


import itertools
l = list(map(int, input().split()))
ans = False
for L in range(1, len(l)):
	for subset in itertools.combinations(l, L):
		if sum(subset) * 2 == sum(l):
			ans = True
			print('Yes')
			break
	if ans:
		break
if not ans:
	print('No')


import itertools
array = list(map(int, input().split()))
ans = 'No'
for i in range(4):
	for tmp in itertools.combinations(array, i + 1):
		if sum(tmp) * 2 == sum(array):
			ans = 'Yes'
print(ans)


A = list(map(int, input().split()))
su = sum(A)
for i in range(2 ** 4):
	a1 = 0
	for j in range(4):
		if i >> j & 1:
			a1 += A[j]
	if a1 == su - a1:
		print('Yes')
		return
print('No')


ans = False
A = list(map(int, input().split()))
for bit in range(1, 2 ** 4):
	a = int(0)
	b = int(0)
	for i in range(4):
		if bit & 1 << i:
			a += A[i]
		else:
			b += A[i]
	if a == b:
		ans = True
if ans:
	print('Yes')
else:
	print('No')


A = list(map(int, input().split()))
A.sort()
if A[0] + A[3] == A[1] + A[2]:
	print('Yes')
elif A[0] + A[1] + A[2] == A[3]:
	print('Yes')
else:
	print('No')


a = list(map(int, input().split()))
if a[0] + a[3] == a[1] + a[2] or a[0] + a[1] == a[2] + a[3] or a[0] + a[2] == a[1] + a[3] or (2 * a[0] == sum(a)) or (2 * a[1] == sum(a)) or (2 * a[2] == sum(a)) or (a[3] * 2 == sum(a)):
	print('Yes')
else:
	print('No')


import sys
INF = 1 << 60
MOD = 10 ** 9 + 7
sys.setrecursionlimit(2147483647)
input = lambda : sys.stdin.readline().rstrip()

def resolve():
	A = list(map(int, input().split()))
	A.sort()
	if sum(A[:3]) == A[3]:
		print('Yes')
	elif A[0] + A[3] == A[1] + A[2]:
		print('Yes')
	else:
		print('No')
resolve()


A = list(map(int, input().split()))
A.sort()
(A, B, C, D) = A
if A + D == B + C or A + B + C == D or A == B == C == D:
	print('Yes')
else:
	print('No')


x = list(map(int, input().split()))
for i in range(3):
	for j in range(i + 1, 4):
		if x[i] > x[j]:
			(x[i], x[j]) = (x[j], x[i])
if x[0] + x[1] + x[2] == x[3]:
	print('Yes')
	return
elif x[0] + x[3] == x[1] + x[2]:
	print('Yes')
	return
else:
	print('No')


ls = sorted(list(map(int, input().split())))
if ls[0] + ls[3] == ls[1] + ls[2]:
	print('Yes')
elif sum(ls[:-1]) == ls[-1]:
	print('Yes')
else:
	print('No')


def main():
	a = list(map(int, input().split()))
	for v in a:
		if v == sum(a) - v:
			print('Yes')
			return
	for i in range(4):
		for j in range(4):
			if i == j:
				continue
			if a[i] + a[j] == sum(a) - (a[i] + a[j]):
				print('Yes')
				return
	print('No')

def __starting_point():
	main()
__starting_point()


L = list(map(int, input().split()))
S = sum(L)
N = 4
for i in range(2 ** 4):
	a = 0
	b = S
	for j in range(N):
		if 1 & i >> j:
			a += L[j]
			b -= L[j]
	if a == b:
		print('Yes')
		return
print('No')


L = list(map(int, input().split()))
for i in range(2 ** 4):
	a = 0
	b = 0
	for j in range(4):
		if i >> j & 1:
			a += L[j]
		else:
			b += L[j]
	if a == b:
		print('Yes')
		return
else:
	print('No')


L = list(map(int, input().split()))
Ans = 0
for i in range(4):
	if L[i] == sum(L) - L[i]:
		Ans += 1
for j in range(1, 4):
	if L[0] + L[j] == sum(L) - L[0] - L[j]:
		Ans += 1
if Ans != 0:
	print('Yes')
else:
	print('No')


L = list(map(int, input().split()))
N = len(L)
S = sum(L)
for bit in range(1 << N):
	t = 0
	for i in range(N):
		if bit >> i & 1:
			t += L[i]
	if S - t == t:
		print('Yes')
		return
print('No')


oishisa = list(map(int, input().split()))
souwa = sum(oishisa)
for i in range(2 ** 4):
	wa = 0
	for j in range(4):
		if i >> j & 1:
			wa += oishisa[j]
	if wa == souwa / 2:
		print('Yes')
		break
	if i == 15:
		print('No')


from itertools import product
A = list(map(int, input().split()))
x = sum(A)
ans = 'No'
for p in product(range(2), repeat=4):
	y = 0
	for (p_idx, p_) in enumerate(p):
		if p_ == 1:
			y += A[p_idx]
	if x - y == y:
		ans = 'Yes'
print(ans)


(a, b, c, d) = map(int, input().split())
list = []
list += [a, b, c, d]
for i in range(0, 3):
	if sum(list) - list[i] == list[i]:
		print('Yes')
		return
	else:
		pass
if sum(list) - list[0] - list[1] == list[0] + list[1]:
	print('Yes')
	return
elif sum(list) - list[0] - list[2] == list[0] + list[2]:
	print('Yes')
	return
elif sum(list) - list[0] - list[3] == list[0] + list[3]:
	print('Yes')
	return
elif sum(list) - list[1] - list[2] == list[1] + list[2]:
	print('Yes')
	return
elif sum(list) - list[1] - list[3] == list[1] + list[3]:
	print('Yes')
	return
elif sum(list) - list[2] - list[3] == list[2] + list[3]:
	print('Yes')
	return
else:
	print('No')


l = list(map(int, input().split()))
s = sum(l) / 2
for i in range(16):
	tmp = 0
	for j in range(4):
		if i >> j & 1:
			tmp += l[j]
	if s == tmp:
		print('Yes')
		return
print('No')


A = list(map(int, input().split()))
sumA = sum(A)
for i in range(2 ** 4):
	tmp = 0
	for j in range(4):
		if i >> j & 1:
			tmp += A[j]
	if sumA == tmp * 2:
		print('Yes')
		return
print('No')


import sys

def S():
	return sys.stdin.readline().rstrip()

def I():
	return int(sys.stdin.readline().rstrip())

def MI():
	return map(int, sys.stdin.readline().rstrip().split())

def LI():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def LS():
	return list(sys.stdin.readline().rstrip().split())
(a, b, c, d) = MI()
ans = 'No'
if a == b + c + d:
	ans = 'Yes'
elif b == a + c + d:
	ans = 'Yes'
elif c == a + b + d:
	ans = 'Yes'
elif d == a + b + c:
	ans = 'Yes'
elif a + b == c + d:
	ans = 'Yes'
elif a + c == b + d:
	ans = 'Yes'
elif a + d == b + c:
	ans = 'Yes'
print(ans)


L = [0] + list(map(int, input().split()))
S = sum(L)
if S % 2 == 1:
	print('No')
	return
D = [{} for i in range(5)]
D[0][0] = 1
for i in range(1, 5):
	for (k, v) in list(D[i - 1].items()):
		D[i][k] = 1
		D[i][k + L[i]] = 1
if S // 2 in D[-1]:
	print('Yes')
else:
	print('No')


abcd = list(map(int, input().split()))
for bit in range(1 << 4):
	eat = 0
	rem = 0
	for i in range(4):
		if bit >> i & 1:
			eat += abcd[i]
		else:
			rem += abcd[i]
		if eat == rem:
			print('Yes')
			return
print('No')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inps():
	return input().rstrip()

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

def inpls():
	return list(map(str, input().split()))
from math import gcd, floor, ceil, factorial
import itertools as it
from collections import deque, defaultdict
from collections import Counter

def lcd(a, b):
	return a * b // gcd(a, b)

def chmin(dp, i, x):
	if x < dp[i]:
		dp[i] = x
		return True
	return False

def chmax(dp, i, x):
	if x > dp[i]:
		dp[i] = x
		return True
	return False
a = inpl()
sm = sum(a)
if sm % 2 != 0:
	print('No')
	return
for b in range(2 ** len(a)):
	s = 0
	for i in range(len(a)):
		if 1 & b >> i:
			s += a[i]
	if s == sm // 2:
		print('Yes')
		return
print('No')


a = list(map(int, input().split()))
a = sorted(a)
b = a[0] + a[3]
c = a[1] + a[2]
if b == c:
	print('Yes')
elif a[0] + a[1] + a[2] == a[3]:
	print('Yes')
else:
	print('No')


import itertools
Alist = list(map(int, input().split()))
Blist = Alist
ansflag = False
for i in range(1, 5):
	for v in itertools.combinations(Alist, i):
		if sum(Alist) - sum(v) == sum(v):
			ansflag = True
			break
if ansflag == True:
	print('Yes')
else:
	print('No')


abcd = list(map(int, input().split()))
k = 4
for i in range(2 ** k):
	tmp = 0
	for j in range(k):
		if i >> j & 1:
			tmp += abcd[j]
	if tmp == sum(abcd) - tmp:
		print('Yes')
		return
print('No')


s = list(map(int, input().split()))
for i in range(2 ** 4):
	total = sum(s)
	ans = 0
	for j in range(4):
		if i >> j & 1:
			ans += s[j]
			total -= s[j]
			if ans == total:
				print('Yes')
				return
print('No')


(*a,) = map(int, input().split())
for s in range(1 << 4):
	x = 0
	for i in range(4):
		if 1 << i & s:
			x += a[i]
	if 2 * x == sum(a):
		print('Yes')
		return
print('No')


A = list(map(int, input().split()))
can = False
for bit in range(2 ** 4):
	eat = int(0)
	uneat = int(0)
	for i in range(4):
		if bit & 1 << i:
			eat += A[i]
		else:
			uneat += A[i]
	if eat == uneat:
		can = True
if can:
	print('Yes')
else:
	print('No')


ls = list(map(int, input().split()))
ls = sorted(ls)
if ls[3] == ls[0] + ls[1] + ls[2] or ls[3] + ls[0] == ls[1] + ls[2]:
	print('Yes')
else:
	print('No')


from itertools import combinations
cookies = tuple(map(int, input().split()))
if (S := sum(cookies)) & 1:
	print('No')
else:
	for r in range(4):
		for some_cookies in combinations(cookies, r):
			if sum(some_cookies) == S // 2:
				print('Yes')
				return
	print('No')


a = list(map(int, input().split()))
for i in range(4):
	if a[i] == sum(a) - a[i]:
		print('Yes')
		return
for i in range(4):
	for j in range(i + 1, 4):
		if a[i] + a[j] == sum(a) - a[i] - a[j]:
			print('Yes')
			return
print('No')


a = list(map(int, input().split()))
for i in range(16):
	r = 0
	for (j, k) in enumerate(map(int, bin(i)[2:].zfill(4))):
		r += a[j] * k
	if r == sum(a) / 2:
		print('Yes')
		return
print('No')


(a, b, c, d) = map(int, input().split())
cand = [a + b, b + c, c + d, d + a, a + c, b + d, a, b, c, d]
s = sum([a, b, c, d])
if s % 2 == 1:
	print('No')
elif s // 2 in cand:
	print('Yes')
else:
	print('No')


(*I,) = list(map(int, input().split()))
for p in range(1 << 4):
	(s, r) = (0, 0)
	for i in range(4):
		if p & 1 << i:
			s += I[i]
		else:
			r += I[i]
	if s == r:
		print('Yes')
		return
print('No')


s = [int(x) for x in input().split()]
import itertools
l = []
a = itertools.product(range(2), repeat=4)
for i in a:
	l.append(i)
for i in range(16):
	cnt = 0
	dnt = 0
	for j in range(4):
		if l[i][j] == 1:
			cnt += s[j]
		else:
			dnt += s[j]
	if cnt == dnt:
		print('Yes')
		return
print('No')


A = list(map(int, input().split()))
f = 0
for i in range(1 << 4):
	c = 0
	for j in range(4):
		if i >> j & 1:
			c += A[j]
	if sum(A) / 2 == c:
		f = 1
if f:
	print('Yes')
else:
	print('No')


(a, b, c, d) = map(int, input().split())
import copy
w = [a, b, c, d]
flag = False
from itertools import permutations, combinations
for i in range(1, 4):
	for j in combinations(w, i):
		x = copy.copy(w)
		for k in j:
			x.pop(x.index(k))
		if sum(list(j)) == sum(x):
			print('Yes')
			flag = True
			break
	if flag:
		break
else:
	print('No')


li = list(map(int, input().split()))
li.sort()
if li[0] + li[3] == li[1] + li[2] or li[0] + li[1] + li[2] == li[3]:
	print('Yes')
else:
	print('No')


A = list(map(int, input().split()))
n = int(4)
can = False
for bit in range(2 ** n):
	all = int(0)
	for i in range(n):
		if bit & 1 << i:
			all += A[i]
	if 2 * all == sum(A):
		can = True
if can:
	print('Yes')
else:
	print('No')


import itertools
L = list(map(int, input().split()))
total = sum(L)
for i in range(1, 4):
	for comb in itertools.combinations(L, i):
		if sum(comb) == total - sum(comb):
			print('Yes')
			return
print('No')


c = list(map(int, input().split()))
total = sum(c)
ans = 'No'
for i in range(8):
	eat = 0
	for j in range(4):
		if i >> j & 1:
			eat += c[j]
	if eat == total - eat:
		ans = 'Yes'
print(ans)


(a, b, c, d) = map(int, input().split())
s_ = a + b + c + d
ans = 'No'
for i in range(2):
	for j in range(2):
		for k in range(2):
			for l in range(2):
				if s_ - (a * i + b * j + c * k + d * l) == a * i + b * j + c * k + d * l:
					ans = 'Yes'
print(ans)


from itertools import product
l = list(map(int, input().split()))
bit = list(product([0, 1], repeat=len(l)))
for i in range(len(bit)):
	SUM = 0
	for j in range(len(l)):
		SUM += l[j] * bit[i][j]
	if SUM == sum(l) - SUM:
		print('Yes')
		return
else:
	print('No')


import sys
from math import gcd, factorial, ceil, floor, sqrt
from bisect import bisect_left, bisect_right
from copy import deepcopy
from heapq import heapify, heappop, heappush
from itertools import permutations, combinations, product, accumulate
from collections import defaultdict, deque, Counter
from functools import lru_cache
sys.setrecursionlimit(10 ** 8)
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))
ls = li()
total = sum(ls)
for x in product([0, 1], repeat=4):
	if x == (0, 0, 0, 0):
		continue
	cur = 0
	for (i, y) in enumerate(x):
		if y == 1:
			cur += ls[i]
	if 2 * cur == total:
		print('Yes')
		return
print('No')


C = sorted(list(map(int, input().split())))
print('Yes' if C[0] + C[3] == C[1] + C[2] or sum(C[:3]) == C[3] else 'No')


Cooky = list(map(int, input().split()))
ans = 'No'
for i in range(1, 15):
	tmp = str(bin(i))
	tmp = tmp[2:]
	if len(tmp) != 4:
		tmp = '0' * (4 - len(tmp)) + tmp
	(sum1, sum2) = (0, 0)
	for j in range(4):
		if tmp[j] == '1':
			sum1 += Cooky[j]
		else:
			sum2 += Cooky[j]
	if sum1 == sum2:
		ans = 'Yes'
		break
print(ans)


(a, b, c, d) = map(int, input().split())
if a == b + c + d:
	print('Yes')
elif b == a + c + d:
	print('Yes')
elif c == a + b + d:
	print('Yes')
elif d == a + b + c:
	print('Yes')
elif a + b == c + d:
	print('Yes')
elif a + c == b + d:
	print('Yes')
elif a + d == b + c:
	print('Yes')
elif b + c == c + d:
	print('Yes')
elif b + d == a + d:
	print('Yes')
else:
	print('No')


A = list(map(int, input().split()))
yes = False
for bitset in range(1, 2 ** 4):
	eat_sum = 0
	left_sum = 0
	for j in range(4):
		if bitset >> j & 1 == 1:
			eat_sum += A[j]
		else:
			left_sum += A[j]
	if eat_sum == left_sum:
		yes = True
		break
if yes:
	print('Yes')
else:
	print('No')


a = list(map(int, input().split()))
s = sum(a)
a.sort(reverse=True)
if s % 2 == 1:
	print('No')
elif s // 2 == a[0] or s // 2 == a[0] + a[-1]:
	print('Yes')
else:
	print('No')


import sys
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

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

def main():
	(A, B, C, D) = list(map(int, input().split()))
	for i in range(2 ** 4):
		eat = 0
		rest = 0
		for (j, x) in enumerate([A, B, C, D]):
			if i & 1 << j:
				eat += x
			else:
				rest += x
		if eat == 0:
			continue
		if eat == rest:
			print('Yes')
			return
	else:
		print('No')

def __starting_point():
	main()
__starting_point()


import itertools
a = list(map(int, input().split()))
total = sum(a)
if total % 2 != 0:
	print('No')
	return
p = list(itertools.product([0, 1], repeat=4))
for i in range(len(p)):
	if a[0] * p[i][0] + a[1] * p[i][1] + a[2] * p[i][2] + a[3] * p[i][3] == total // 2:
		print('Yes')
		return
print('No')


taste = list(map(int, input().split()))
ans = 'No'
for i in range(2 ** 4):
	tmp = sum(taste)
	res = 0
	for j in range(4):
		if i >> j & 1:
			res += taste[j]
			tmp -= taste[j]
	if tmp == res:
		ans = 'Yes'
		break
print(ans)


def dfs(i, a, b):
	nonlocal ans
	if i == 3:
		if a == b:
			ans = 1
	else:
		dfs(i + 1, a + t[i], b)
		dfs(i + 1, a, b + t[i])
t = list(map(int, input().split()))
ans = 0
dfs(-1, 0, 0)
if ans == 1:
	print('Yes')
else:
	print('No')


(a, b, c, d) = map(int, input().split())
sum = a + b + c + d
ans = 'No'
if a == sum - a or b == sum - b or c == sum - c or (d == sum - d):
	ans = 'Yes'
if a + b == c + d or a + c == b + d or a + d == b + c:
	ans = 'Yes'
print(ans)