Polycarp has $3$ positive integers $a$, $b$ and $c$. He can perform the following operation exactly once.

Choose a positive integer $m$ and multiply exactly one of the integers $a$, $b$ or $c$ by $m$.

Can Polycarp make it so that after performing the operation, the sequence of three numbers $a$, $b$, $c$ (in this order) forms an arithmetic progression ? Note that you cannot change the order of $a$, $b$ and $c$.

Formally, a sequence $x_1, x_2, \dots, x_n$ is called an arithmetic progression (AP) if there exists a number $d$ (called "common difference") such that $x_{i+1}=x_i+d$ for all $i$ from $1$ to $n-1$. In this problem, $n=3$.

For example, the following sequences are AP: $[5, 10, 15]$, $[3, 2, 1]$, $[1, 1, 1]$, and $[13, 10, 7]$. The following sequences are not AP: $[1, 2, 4]$, $[0, 1, 0]$ and $[1, 3, 2]$.

You need to answer $t$ independent test cases.


-----Input-----

The first line contains the number $t$ ($1 \le t \le 10^4$) — the number of test cases.

Each of the following $t$ lines contains $3$ integers $a$, $b$, $c$ ($1 \le a, b, c \le 10^8$).


-----Output-----

For each test case print "YES" (without quotes) if Polycarp can choose a positive integer $m$ and multiply exactly one of the integers $a$, $b$ or $c$ by $m$ to make $[a, b, c]$ be an arithmetic progression. Print "NO" (without quotes) otherwise.

You can print YES and NO in any (upper or lower) case (for example, the strings yEs, yes, Yes and YES will be recognized as a positive answer).


-----Examples-----

Input
11
10 5 30
30 5 10
1 2 3
1 6 3
2 6 3
1 1 1
1 1 2
1 1 3
1 100000000 1
2 1 1
1 2 2
Output
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
YES


-----Note-----

In the first and second test cases, you can choose the number $m=4$ and multiply the second number ($b=5$) by $4$.

In the first test case the resulting sequence will be $[10, 20, 30]$. This is an AP with a difference $d=10$.

In the second test case the resulting sequence will be $[30, 20, 10]$. This is an AP with a difference $d=-10$.

In the third test case, you can choose $m=1$ and multiply any number by $1$. The resulting sequence will be $[1, 2, 3]$. This is an AP with a difference $d=1$.

In the fourth test case, you can choose $m=9$ and multiply the first number ($a=1$) by $9$. The resulting sequence will be $[9, 6, 3]$. This is an AP with a difference $d=-3$.

In the fifth test case, it is impossible to make an AP.

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Implementation


Solutions:
cases = int(input())
answers = []
for i in range(cases):
	l = [int(n) for n in input().split(' ')]
	if (l[1] - l[0] + l[1]) % l[2] == 0 and (l[1] - l[0] + l[1]) / l[2] > 0:
		answers.append('YES')
	elif (l[1] - (l[2] - l[1])) % l[0] == 0 and (l[1] - (l[2] - l[1])) / l[0] > 0:
		answers.append('YES')
	elif ((l[2] - l[0]) / 2 + l[0]) % l[1] == 0 and ((l[2] - l[0]) / 2 + l[0]) / l[1] > 0:
		answers.append('YES')
	else:
		answers.append('NO')
print('\n'.join(answers))


for s in [*open(0)][1:]:
	(a, b, c) = map(int, s.split())
	new_a = 2 * b - c
	if new_a % a == 0 and new_a >= a and (new_a > 0):
		print('YES')
		continue
	new_b = a / 2 + c / 2
	if new_b % b == 0 and new_b >= b and (new_b > 0):
		print('YES')
		continue
	new_c = 2 * b - a
	if new_c % c == 0 and new_c >= c and (new_c > 0):
		print('YES')
		continue
	print('NO')


n = int(input())
s = ''
for i in range(n):
	f = 0
	p = input().split()
	a = int(p[0])
	b = int(p[1])
	c = int(p[2])
	if (b - (c - b)) % a == 0 and (b - (c - b)) / a > 0:
		f = 1
	elif (c + a) / 2 % b == 0 and (c + a) / 2 / b > 0:
		f = 1
	elif (b + (b - a)) % c == 0 and (b + (b - a)) / c > 0:
		f = 1
	if f == 1:
		s += 'YES\n'
	else:
		s += 'NO\n'
print(s)


def Mean(x, y):
	return (x + y) // 2

def can_make_ap(a, b, c):
	if a == b and b == c:
		return True
	if b <= c and 2 * b - c > 0 and ((2 * b - c) % a == 0):
		return True
	if b > c and (2 * b - c) % a == 0:
		return True
	if a <= b and (2 * b - a) % c == 0:
		return True
	if a > b and 2 * b - a > 0 and ((2 * b - a) % c == 0):
		return True
	if a % 2 == c % 2:
		return Mean(a, c) % b == 0
	else:
		return False
res = []
n = int(input())
for i in range(n):
	(a, b, c) = input().split(None, 3)
	a = int(a)
	b = int(b)
	c = int(c)
	if can_make_ap(a, b, c):
		res.append('YES')
	else:
		res.append('NO')
for i in range(n):
	print(res[i])


res = []
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	b *= 2
	d = a + c
	if d % b == 0:
		res.append('YES')
		continue
	if b > d and ((b - c) % a == 0 or (b - a) % c == 0):
		res.append('YES')
		continue
	res.append('NO')
print('\n'.join(res))


for s in [*open(0)][1:]:
	(a, b, c) = map(int, s.split())
	x = a + c
	b *= 2
	y = b - a
	z = b - c
	print('NYOE S'[y > 0 == y % c or x % b < 1 > x % 2 or z > 0 == z % a::2])


import math
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(a, b, c) = [int(i) for i in input().split()]
	d = c - b
	if b - d > 0 and (b - d) % a == 0:
		print('YES')
		continue
	d = (c - a) / 2
	if a + d > 0 and (a + d) % b == 0:
		print('YES')
		continue
	d = b - a
	if b + d > 0 and (b + d) % c == 0:
		print('YES')
		continue
	print('NO')


for s in [*open(0)][1:]:
	(a, b, c) = map(int, s.split())
	f = True
	if 2 * b > c and (2 * b - c) % a == 0:
		f = False
	elif (c + a) / 2 % b == 0:
		f = False
	elif 2 * b > a and (2 * b - a) % c == 0:
		f = False
	print('YNEOS'[f::2])


import sys
input = sys.stdin.readline
t = int(input())
while t > 0:
	(a, b, c) = map(int, input().split())
	if b - a == c - b or (a == b and b == c):
		print('YES')
	elif (2 * b - c) % a == 0 and 2 * b - c > 0:
		print('YES')
	elif (2 * b - a) % c == 0 and 2 * b - a > 0:
		print('YES')
	elif (a + c) % (2 * b) == 0:
		print('YES')
	else:
		print('NO')
	t -= 1


import sys
t = sys.stdin.readline()
t = int(t.strip())
res = []
while t:
	line = sys.stdin.readline()
	(a, b, c) = line.strip().split()
	(a, b, c) = (int(a), int(b), int(c))
	ans = 'NO'
	if (a + c) % 2 == 0:
		x = (a + c) / 2
		if x % b == 0:
			ans = 'YES'
	x = b * 2 - a
	if x % c == 0 and x > 0:
		ans = 'YES'
	x = b * 2 - c
	if x % a == 0 and x > 0:
		ans = 'YES'
	res.append(ans)
	t = t - 1
for r in res:
	print(r)


from sys import stdin

def solve():
	for _ in range(int(stdin.readline().rstrip())):
		(a, b, c) = map(int, stdin.readline().rstrip().split())
		if a - b == b - c:
			print('YES')
			continue
		if a == 1 and c == 1:
			print('YES')
			continue
		if abs(a - c) % 2 == 0:
			if c - a >= 0 and (a + (c - a) // 2) % b == 0:
				print('YES')
				continue
			elif a - c >= 0 and (a - (a - c) // 2) % b == 0:
				print('YES')
				continue
		if b + (b - a) > 0 and (b + (b - a)) % c == 0:
			print('YES')
			continue
		if b + (b - c) > 0 and (b + (b - c)) % a == 0:
			print('YES')
			continue
		print('NO')
solve()


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_ls():
	return list(map(int, sys.stdin.readline().strip().split()))

def main():
	t = int(input())
	for i in range(t):
		(a, b, c) = get_ints()
		x = 2 * b - c
		y = 2 * b - a
		z = a + c
		if x % a == 0 and x > 0 or (y % c == 0 and y > 0) or z % (2 * b) == 0:
			print('YES')
		else:
			print('NO')
main()


import sys
input = sys.stdin.readline
t = int(input())
R = []
for _ in range(t):
	(a, b, c) = map(int, input()[:-1].split())
	is_valid = False
	s = b - (c - b)
	if a <= s and s % a == 0:
		is_valid = is_valid or True
	else:
		is_valid = is_valid or False
	s = (a + c) / 2
	if s % 1 > 0:
		is_valid = is_valid or False
	else:
		s = int(s)
		if b <= s and s % b == 0:
			is_valid = is_valid or True
		else:
			is_valid = is_valid or False
	s = b + (b - a)
	if c <= s and s % c == 0:
		is_valid = is_valid or True
	else:
		is_valid = is_valid or False
	R.append('YES' if is_valid else 'NO')
print('\n'.join(R))


for s in [*open(0)][1:]:
	(a, b, c) = map(int, s.split())
	na = (2 * b - c) / a
	if na.is_integer() and na > 0:
		print('YES')
		continue
	nb = (c + a) / (2 * b)
	if nb.is_integer() and nb > 0:
		print('YES')
		continue
	nc = (2 * b - a) / c
	if nc.is_integer() and nc > 0:
		print('YES')
		continue
	print('NO')


from functools import lru_cache as cache
import math
from heapq import *
import sys

def get_int():
	return int(input())

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

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

def main():
	testcases = get_int()
	for i in range(testcases):
		(a, b, c) = get_ints()
		if solve(a, b, c):
			print('YES')
		else:
			print('NO')

def solve(a, b, c):
	if b + (b - a) > 0 and (b + (b - a)) % c == 0:
		return True
	if b - (c - b) > 0 and (b - (c - b)) % a == 0:
		return True
	if c < a:
		(a, c) = (c, a)
	if (c - a) % 2 == 0 and a + (c - a) // 2 > 0 and ((a + (c - a) // 2) % b == 0):
		return True
	return False
main()


t = int(input())
l = []
for i in range(t):
	lst = list(map(int, input().split()))
	l.append(lst)
for i in range(t):
	(a, b, c) = (l[i][0], l[i][1], l[i][2])
	if (b * 2 - c) % a == 0 and b * 2 - c > 0:
		print('YES')
	elif (b * 2 - a) % c == 0 and b * 2 - a > 0:
		print('YES')
	elif (a + c) % (2 * b) == 0:
		print('YES')
	else:
		print('NO')


num = int(input())
ans = ''
for i in range(num):
	(a, b, c) = list(map(int, input().split()))
	if b - a == c - b:
		ans += 'YES\n'
	elif (2 * b - c) % a == 0 and (2 * b - c) / a > 0:
		ans += 'YES\n'
		z = 2 * b - c
	elif int(0.5 * (a + c)) % b == 0 and (a + c) % 2 == 0 and (0.5 * (a + c) / b > 0):
		ans += 'YES\n'
		z = 0.5 * (a + c)
	elif (2 * b - a) % c == 0 and (2 * b - a) / c > 0:
		ans += 'YES\n'
		z = 2 * b - a
	else:
		ans += 'NO\n'
print(ans)


t = int(input())
answers = []
for i in range(t):
	(a, b, c) = map(int, input().split())
	if 2 * b > c and (2 * b - c) % a == 0:
		answers.append('YES')
	elif 2 * b > a and (2 * b - a) % c == 0:
		answers.append('YES')
	elif (a + c) % (2 * b) == 0:
		answers.append('YES')
	else:
		answers.append('NO')
for answer in answers:
	print(answer)


def ap(a, b, c):
	ms = b + b - c
	if ms > 0 and ms % a == 0:
		return True
	ms += c - a
	if ms > 0 and ms % c == 0:
		return True
	if (a + c) % 2:
		return False
	ms = (a + c) // 2
	return ms % b == 0
t = int(input())
tests = [False for i in range(t)]
a = b = c = 0
for i in range(t):
	(a, b, c) = map(int, input().split())
	if ap(a, b, c):
		tests[i] = True
for test in tests:
	if test:
		print('YES')
	else:
		print('NO')


import sys, os
if os.path.exists('input'):
	sys.stdin = open('input', 'r')
input = sys.stdin.readline

def solve():
	a = list(map(int, input().split()))
	left = 2 * a[1] - a[2]
	middle = (a[0] + a[2]) // 2
	right = 2 * a[1] - a[0]
	if left % a[0] == 0 and left > 0:
		return 'YES'
	elif (a[0] + a[2]) % 2 == 0 and middle % a[1] == 0:
		return 'YES'
	elif right % a[2] == 0 and right > 0:
		return 'YES'
	return 'NO'
for _ in range(int(input())):
	print(solve())


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	r = 'NO'
	d = (b - (c - b)) / a
	if d % 1 == 0 and d > 0:
		r = 'YES'
	d = (b - (a - b)) / c
	if d % 1 == 0 and d > 0:
		r = 'YES'
	d = (a + c) / 2 / b
	if d % 1 == 0 and d >= 0:
		r = 'YES'
	print(r)


n = int(input())
ans = list()
for i in range(0, n):
	[a, b, c] = [int(x) for x in input().split()]
	e = (a + c) / 2
	d = 2 * b - c
	f = 2 * b - a
	if d > 0 and d % a == 0:
		ans.append('YES')
		continue
	if e > 0 and e % b == 0:
		ans.append('YES')
		continue
	if f > 0 and f % c == 0:
		ans.append('YES')
		continue
	ans.append('NO')
for s in ans:
	print(s)


import sys
from sys import stdin, stdout
from math import ceil, floor, sqrt, log, log2, log10
from collections import Counter
int_max = float('inf')
int_min = -float('inf')
mod = 10 ** 9 + 7
ANS = []
input = stdin.readline

def solve():
	pass
t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	d = c - b
	if b - d > 0 and (b - d) % a == 0:
		print('YES')
		continue
	d = (c - a) / 2
	if a + d > 0 and (a + d) % b == 0:
		print('YES')
		continue
	d = b - a
	if b + d > 0 and (b + d) % c == 0:
		print('YES')
		continue
	print('NO')


import os
import math as mt
import sys
import itertools as it
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(x, y, z) = I()
	f = lambda n: n % 1 == 0 and n > 0
	if f((y + (y - x)) / z) or f((y - (z - y)) / x) or f((x + (z - x) / 2) / y):
		print('YES')
		continue
	print('NO')


def solve(a, b, c):
	if c - b == b - a:
		return True
	if b != 0:
		m = (c + a) / (2.0 * b)
		if m > 0 and m == round(m):
			return True
	if c != 0:
		m = (2.0 * b - a) / c
		if m > 0 and m == round(m):
			return True
	if a != 0:
		m = (2.0 * b - c) / a
		if m > 0 and m == round(m):
			return True
	return False
out = []
n = int(input())
for i in range(n):
	s = list(map(int, input().split(' ')))
	(a, b, c) = (s[0], s[1], s[2])
	if solve(a, b, c):
		out.append('YES')
	else:
		out.append('NO')
print('\n'.join(out))


def cop(x):
	a = x[0]
	b = x[1]
	c = x[2]
	x = float(a + c) / 2
	cop = 0
	if x % 1 == 0:
		cop = 1
	if b - (c - b) == a:
		print('YES')
	elif (b - (c - b)) % a == 0 and a < b - c + b:
		print('YES')
	elif cop == 1 and (a + c) / 2 % b == 0 and (b < (a + c) / 2):
		print('YES')
	elif (2 * b - a) % c == 0 and b * 2 - a > c:
		print('YES')
	else:
		print('NO')
t = []
for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	t.append([a, b, c])
for x in t:
	cop(x)


import heapq
import sys
import math
from collections import deque
from bisect import bisect_left, bisect_right
I = sys.stdin.readline
II = lambda : int(I())
IN = lambda x: map(int, x.split())
FN = lambda x: map(float, x.split())
L = lambda x: list(IN(x))
M = 1000000007
P = print
T = True
F = False
total = int(input())
while total > 0:
	l1 = L(I())
	total -= 1
	m1 = (l1[0] + l1[2]) / (2 * l1[1])
	if m1 > 1:
		if m1.is_integer():
			print('YES')
		else:
			print('NO')
		continue
	else:
		m2 = (2 * l1[1] - l1[0]) / l1[2]
		if m2.is_integer():
			print('YES')
			continue
		m3 = (2 * l1[1] - l1[2]) / l1[0]
		if m3.is_integer():
			print('YES')
		else:
			print('NO')


t = int(input())
s = []
for i in range(t):
	(a, b, c) = map(int, input().split())
	if (2 * b - a) / c == (2 * b - a) // c and (2 * b - a) / c > 0 or ((2 * b - c) / a == (2 * b - c) // a and (2 * b - c) / a > 0) or ((a + c) / (2 * b) == (a + c) // (2 * b) and (a + c) / (2 * b) > 0):
		s.append('YES')
	else:
		s.append('NO')
for i in s:
	print(i)


import sys
input = sys.stdin.readline

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

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solution(a, b, c):
	fa = 2 * b - c
	fb = c + a
	fc = 2 * b - a
	if fa > 0 and fa % a == 0 or fb % (2 * b) == 0 or (fc > 0 and fc % c == 0):
		return 'YES'
	else:
		return 'NO'
t = inp()
result = []
while t:
	t -= 1
	(a, b, c) = inlt()
	result.append(solution(a, b, c))
for r in result:
	print(r)


def ap(a, b, c):
	m1 = (a + c) / (2 * b)
	if m1 == int(m1) and m1 > 0:
		return 'YES'
	m2 = (2 * b - c) / a
	if m2 == int(m2) and m2 > 0:
		return 'YES'
	m3 = (2 * b - a) / c
	if m3 == int(m3) and m3 > 0:
		return 'YES'
	return 'NO'
t = int(input())
c = []
while t > 0:
	a = list(map(int, input().split()))
	c.append(a)
	t -= 1
for i in c:
	print(ap(i[0], i[1], i[2]))


from collections import Counter
from math import ceil, floor, log, gcd
import bisect as bs
import sys
input = sys.stdin.readline
inp_lis = lambda : list(map(int, input().split()))
inp_multi = lambda : map(int, input().split())
inp_int = lambda : int(input().strip())
for _ in range(int(input().strip())):
	(a, b, c) = inp_multi()
	s = a + c
	if b - a == c - b or (2 * b - a > 0 and (2 * b - a) % c == 0) or (2 * b - c > 0 and (2 * b - c) % a == 0) or (s % (2 * b) == 0):
		print('YES')
	else:
		print('NO')


def mAP(l):
	a = l[0]
	b = l[1]
	c = l[2]
	d = b - c
	an = b + d
	if (an % a == 0) & (an >= b) & (an >= a):
		return 'YES'
	d = c - b
	an = b - d
	if (an % a == 0) & (an >= a) & (an <= b):
		return 'YES'
	d = b - a
	cn = b + d
	if (cn % c == 0) & (cn >= b) & (cn >= c):
		return 'YES'
	d = a - b
	cn = b - d
	if (cn % c == 0) & (cn >= c) & (cn <= b):
		return 'YES'
	if abs(c - a) % 2 == 0:
		d = (c - a) // 2
		bn = a + d
		if (bn % b == 0) & (bn >= b) & (bn <= c):
			return 'YES'
		d = (a - c) // 2
		bn = c + d
		if (bn % b == 0) & (bn >= b) & (bn <= a):
			return 'YES'
	return 'NO'
t = int(input())
ls = []
for x in range(t):
	s = str(input())
	ls.append(s)
la = []
for i in range(len(ls)):
	l = []
	for s in ls[i].split(' '):
		l.append(int(s))
	ans = mAP(l)
	la.append(ans)
for a in la:
	print(a)


import sys
input = sys.stdin.readline

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

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def valid_ap(a, b, c):
	d = b - a
	new_c = a + 2 * d
	if new_c % c == 0 and new_c >= c and (new_c != 0):
		return True
	d = (c - a) / 2
	new_b = a + d
	if new_b % b == 0 and new_b >= b and (new_b != 0):
		return True
	new_a = 2 * b - c
	if new_a % a == 0 and new_a >= a and (new_a != 0):
		return True
	return False

def main():
	n = inp()
	for _ in range(n):
		arr = inlt()
		(a, b, c) = (arr[0], arr[1], arr[-1])
		if valid_ap(a, b, c):
			print('YES')
		else:
			print('NO')
	return 0
main()


import sys

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

def read_ints_line():
	return [int(x) for x in read_line().split()]
t = int(read_line())
for _ in range(t):
	(a, b, c) = tuple(read_ints_line())
	p_a = b - (c - b)
	t_a = p_a // a
	p_b = (a + c) / 2
	t_b = p_b // b
	p_c = b + (b - a)
	t_c = p_c // c
	print('YES' if t_a > 0 and t_a * a == p_a or (t_b > 0 and t_b * b == p_b) or (t_c > 0 and t_c * c == p_c) else 'NO')


y = []
t = int(input())
for i in range(t):
	x = input()
	y.append(x.split())
for i in y:
	a = int(i[0])
	b = int(i[1])
	c = int(i[2])
	if (c + a) % (2 * b) == 0:
		print('YES')
		continue
	if (2 * b - c) % a == 0 and 2 * b > c:
		print('YES')
		continue
	if (2 * b - a) % c == 0 and 2 * b > a:
		print('YES')
		continue
	print('NO')


def getlistint():
	return list(map(int, stdin.readline().split()))

def getmapint():
	return map(int, stdin.readline().split())

def getliststr():
	return list(stdin.readline().split())

def getint():
	return int(stdin.readline().strip())

def getstr():
	return stdin.readline().strip()

def pr(s):
	stdout.write(str(s) + '\n')

def prlist(l):
	stdout.write(' '.join(list(map(str, l))) + '\n')
from sys import stdin, stdout
for _ in range(getint()):
	(a, b, c) = getmapint()
	(a, c == min(a, c), max(a, c))
	if c - b == b - a:
		pr('YES')
		continue
	moy = (a + c) // 2
	if (a + c) / 2 == int((a + c) / 2) and moy % b == 0:
		pr('YES')
		continue
	a1 = 2 * b - c
	c1 = 2 * b - a
	if a1 % a == 0 and a1 > 0 and (c - b == b - a1):
		pr('YES')
	elif c1 % c == 0 and c1 > 0 and (c1 - b == b - a):
		pr('YES')
	else:
		pr('NO')


w = int(input())
l = []
import math
for i in range(w):
	k = list(map(int, input().split()))
	l.append(k)
for i in l:
	a = i[0]
	b = i[1]
	c = i[2]
	if 2 * b <= a + c:
		if math.ceil((a + c) / (2 * b)) == math.floor((a + c) / (2 * b)):
			print('YES')
		else:
			print('NO')
	elif math.floor((2 * b - c) / a) == math.ceil((2 * b - c) / a) or math.floor((2 * b - a) / c) == math.ceil((2 * b - a) / c):
		print('YES')
	else:
		print('NO')


testCase = int(input())
boolArray = []
i = 0
while i < testCase:
	inpArr = input().split()
	inpArray = list(map(int, inpArr))
	a = inpArray[0]
	b = inpArray[1]
	c = inpArray[2]
	d = sum(inpArray)
	p_2 = (a + c) % (2 * b) == 0
	p_5 = (2 * b - c) % a == 0 and 2 * b > c
	p_9 = (2 * b - a) % c == 0 and 2 * b > a
	finBool = p_2 or p_5 or p_9
	boolArray.append(finBool)
	i += 1
for x in boolArray:
	if x == True:
		print('YES')
	else:
		print('NO')


x = int(input(''))
l = []
for i in range(x):
	y = input()
	d = y.split()
	a = int(d[0])
	b = int(d[1])
	c = int(d[2])
	if (a + c) / 2 % b == 0 and (a + c) * b > 0:
		l.append('YES')
	elif (2 * b - c) % a == 0 and (2 * b - c) * a > 0:
		l.append('YES')
	elif (2 * b - a) % c == 0 and (2 * b - a) * c > 0:
		l.append('YES')
	else:
		l.append('NO')
for k in l:
	print(k)


t = int(input())
ans = []
for i in range(t):
	ans.append(0)
	(a, b, c) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	r = b - (c - b)
	if r // a == r / a and r / a > 0:
		ans[i] = 1
	r = a + (c - a) / 2
	if r // b == r / b and r / b > 0:
		ans[i] = 1
	r = b + (b - a)
	if r // c == r / c and r / c > 0:
		ans[i] = 1
for i in range(t):
	if ans[i] == 1:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def is_pos_int(x):
	return x % 1 == 0 and x > 0

def valid(a, b, c):
	x1 = (2 * b - c) / a
	x2 = (c + a) / (2 * b)
	x3 = (2 * b - a) / c
	return is_pos_int(x1) or is_pos_int(x2) or is_pos_int(x3)
n = int(input())
for _ in range(n):
	nums = list(map(int, input().split(' ')))
	ans = 'YES' if valid(*nums) else 'NO'
	print(ans)


t = int(input())
l = []
for i in range(t):
	x = input()
	x = x.split()
	a = int(x[0])
	b = int(x[1])
	c = int(x[2])
	if (2 * b - a) % c == 0 and (2 * b - a) / c > 0 or ((2 * b - c) % a == 0 and (2 * b - c) / a > 0) or ((a + c) % (2 * b) == 0 and (a + c) / (2 * b) > 0):
		l.append('YES')
	else:
		l.append('NO')
for i in l:
	print(i)


res = []
n = int(input())
for i in range(n):
	(a, b, c) = input().split(None, 3)
	a = int(a)
	b = int(b)
	c = int(c)
	if b <= c and 2 * b - c > 0 and ((2 * b - c) % a == 0):
		res.append('YES')
	elif b > c and (2 * b - c) % a == 0:
		res.append('YES')
	elif a <= b and (2 * b - a) % c == 0:
		res.append('YES')
	elif a > b and 2 * b - a > 0 and ((2 * b - a) % c == 0):
		res.append('YES')
	elif a % 2 == c % 2:
		if (a + c) // 2 % b == 0:
			res.append('YES')
		else:
			res.append('NO')
	else:
		res.append('NO')
for i in range(n):
	print(res[i])


answers = []
for i in range(int(input())):
	ans = 'NO'
	(a, b, c) = map(int, input().split())
	new_a = b - (c - b)
	if new_a >= a and (not new_a % a) and (new_a != 0):
		ans = 'YES'
	new_b = a + (c - a) / 2
	if new_b >= b and (not new_b % b) and (not (c - a) % 2) and (new_b != 0):
		ans = 'YES'
	new_c = a + 2 * (b - a)
	if new_c >= c and (not new_c % c) and (new_c != 0):
		ans = 'YES'
	answers.append(ans)
for i in answers:
	print(i)


N = int(input())
A = []

def solve(a, b, c):
	new_a = b - (c - b)
	new_b = a + (c - a) / 2
	new_c = a + 2 * (b - a)
	if new_a >= a and new_a % a == 0 and (new_a != 0):
		A.append('YES')
		return
	if new_b >= b and (c - a) % 2 == 0 and (new_b % b == 0) and (new_b != 0):
		A.append('YES')
		return
	if new_c >= c and new_c % c == 0 and (new_c != 0):
		A.append('YES')
		return
	else:
		A.append('NO')
		return
for i in range(N):
	(a, b, c) = list(map(int, input().split()))
	solve(a, b, c)
for i in A:
	print(str(i))


from collections import defaultdict, deque
import sys
input = lambda : sys.stdin.readline().strip()
test_cases = int(input())
while test_cases > 0:
	test_cases -= 1
	(a, b, c) = list(map(int, input().split()))
	help = 'NO'
	if (2 * b - c) % a == 0 and 2 * b > c:
		help += 'YES'
	elif (a + c) % (2 * b) == 0 and a > -c:
		help += 'YES'
	elif (2 * b - a) % c == 0 and 2 * b > a:
		help += 'YES'
	print('YES' if 'YES' in help else 'NO')


import sys
for _ in range(int(sys.stdin.readline())):
	(a, b, c) = map(int, sys.stdin.readline().split())
	if (2 * b - c) % a == 0 and (2 * b - c) // a > 0:
		print('YES')
	elif (2 * b - a) % c == 0 and (2 * b - a) // c > 0:
		print('YES')
	elif (a + c) % (2 * b) == 0 and (a + c) // (2 * b) > 0:
		print('YES')
	else:
		print('NO')


number_of_test_case = int(input())
arr = []
for i in range(number_of_test_case):
	user_input = list(map(int, input().split()))
	arr.append(user_input)

def valid(number):
	if number > 0 and number == float(int(number)):
		return True
	return False
for ar in arr:
	a = ar[0]
	b = ar[1]
	c = ar[2]
	if a == b and b == c:
		print('YES')
		continue
	take_a = (2 * b - c) / a
	take_b = (a + c) / (2 * b)
	take_c = (2 * b - a) / c
	if valid(take_a):
		print('YES')
		continue
	if valid(take_b):
		print('YES')
		continue
	if valid(take_c):
		print('YES')
		continue
	print('NO')


n = input()
p = []
for i in range(0, int(n)):
	l = input()
	hlt = [int(i) for i in l.split() if i.isdigit()]
	p.append(hlt)
for i in range(0, len(p)):
	ans = 'NO'
	if p[i][2] + p[i][0] == 2 * p[i][1]:
		ans = 'YES'
	elif p[i][2] + p[i][0] > 2 * p[i][1]:
		if (p[i][2] + p[i][0]) % (2 * p[i][1]) == 0:
			ans = 'YES'
	elif (2 * p[i][1] - p[i][2]) % p[i][0] == 0:
		ans = 'YES'
	elif (2 * p[i][1] - p[i][0]) % p[i][2] == 0:
		ans = 'YES'
	print(ans)


n = int(input())
l1 = []
for i in range(n):
	l1.append(input().split())

def ans(a, b, c):
	if 2 * b - c > 0 and (2 * b - c) % a == 0:
		print('YES')
	elif (a + c) % 2 == 0 and (a + c) // 2 % b == 0:
		print('YES')
	elif 2 * b - a > 0 and (2 * b - a) % c == 0:
		print('YES')
	else:
		print('NO')
for i in range(n):
	x = int(l1[i][0])
	y = int(l1[i][1])
	z = int(l1[i][2])
	ans(x, y, z)


from collections import Counter
from sys import stdin, stdout

def get_inputs():
	return map(int, stdin.readline().strip().split())

def main():
	(a, b, c) = list(get_inputs())
	count = 0
	for k in range(3):
		if k == 0:
			d = b - a
			if (d + b) % c == 0 and (d + b) // c > 0:
				count += 1
		if k == 1:
			d = c - a
			if d % 2 == 0:
				d = d // 2
				if (d + a) % b == 0 and (d + a) // b > 0:
					count += 1
		else:
			d = c - b
			if (b - d) % a == 0 and (b - d) // a > 0:
				count += 1
	if count == 0:
		print('NO')
	else:
		print('YES')
n = int(stdin.readline())
for k in range(n):
	main()


import sys
import math
from fractions import Fraction
from decimal import *
input = sys.stdin.readline
t = int(input())
while t > 0:
	inp = input().strip()
	arr = [int(x) for x in inp.split(' ')]
	a = arr[0]
	b = arr[1]
	c = arr[2]
	if c - b == b - a:
		print('YES')
		t -= 1
		continue
	else:
		na = b - (c - b)
		m = na // a
		if na > 0 and a * m == na:
			print('YES')
			t -= 1
			continue
		na = (a + c) / 2
		m = na // b
		if na > 0 and b * m == na:
			print('YES')
			t -= 1
			continue
		na = b + b - a
		m = na // c
		if na > 0 and c * m == na:
			print('YES')
			t -= 1
			continue
	print('NO')
	t -= 1


import sys
from typing import Tuple
input = sys.stdin.readline

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

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
T = inp()
for _ in range(T):
	(a, b, c) = invr()
	if b - a == c - b:
		print('YES')
	elif (a + c) % (2 * b) == 0:
		print('YES')
	elif (2 * b - a) % c == 0 and 2 * b - a > 0:
		print('YES')
	elif (2 * b - c) % a == 0 and 2 * b - c > 0:
		print('YES')
	else:
		print('NO')


t = int(input())
all_results = []
for _ in range(t):
	(a, b, c) = list(map(int, input().split()))
	fl = False
	result = 'NO'
	new_a = b - (c - b)
	if new_a >= a and new_a % a == 0 and (a != 0):
		result = 'YES'
	new_b = a + (c - a) / 2
	if new_b >= b and new_b % b == 0 and (b != 0):
		result = 'YES'
	new_c = b - (a - b)
	if new_c >= c and new_c % c == 0 and (c != 0):
		result = 'YES'
	all_results.append(result)
for item in all_results:
	print(item)


def divisibility(x, y):
	if x > 0:
		if x % y == 0:
			return 1
		else:
			return 0
	return 0
possibilities = []
for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	if divisibility(2 * b - a, c) or divisibility((a + c) / 2, b) or divisibility(2 * b - c, a):
		possibilities.append('YES')
	else:
		possibilities.append('NO')
for i in possibilities:
	print(i)


t = int(input())
a = [0 for i in range(t)]
b = [0 for i in range(t)]
c = [0 for i in range(t)]
for i in range(t):
	(a[i], b[i], c[i]) = input().split()
for i in range(t):
	d = 2 * int(b[i]) - int(c[i])
	k = int(a[i])
	f = 2 * int(b[i]) - int(a[i])
	r = int(c[i])
	p = int(c[i]) + int(a[i])
	s = 2 * int(b[i])
	if p / s % 1 == 0 and p / s > 0 or (d / k % 1 == 0 and d / k > 0) or (f / r % 1 == 0 and f / r > 0):
		print('YES')
	else:
		print('NO')


N = int(input())
for i in range(N):
	(a, b, c) = map(int, input().split())
	if (2 * b - c) % a == 0 and 2 * b - c > 0 or (a + c) % (2 * b) == 0 or ((2 * b - a) % c == 0 and 2 * b - a > 0):
		print('YES')
	else:
		print('NO')


def solve():
	(a, b, c) = map(int, input().split())
	d1 = c - b
	flag = 0
	if (b - d1) % a == 0 and b - d1 > 0:
		return 'YES'
	d2 = c - a
	if (a + d2 // 2) % b == 0 and d2 % 2 == 0:
		return 'YES'
	d3 = b - a
	if (b + d3) % c == 0 and b + d3 > 0:
		return 'YES'
	return 'NO'
t = int(input())
for i in range(t):
	print(solve())


z = int(input())
for q in range(z):
	r = 1
	if 1 + 5 == 6:
		r = 0
	(x, y, z) = map(int, input().split())
	f = z - y
	o = y - f
	if o % x == 0 and o >= x:
		if 1 + 1 == 2:
			print('YES')
			continue
	f = y - x
	o = y + f
	if o % z == 0 and o >= z:
		if 1 + 1 == 2:
			print('YES')
			continue
	f = z - x
	if f % 2 != 0:
		if 2 + 3 == 5:
			print('NO')
			continue
	o = z - f // 2
	t = o // y
	if o >= y and o % y == 0:
		if 1 + 1 == 2:
			print('YES')
			continue
	if 2 + 3 == 5:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b, c) = [int(i) for i in input().split()]
	ans = False
	if (2 * b - c) % a == 0 and 2 * b > c:
		ans = True
	elif (2 * b - a) % c == 0 and 2 * b > a:
		ans = True
	elif (a + c) % (2 * b) == 0:
		ans = True
	if ans:
		print('YES')
	else:
		print('NO')


from math import ceil, log10
import bisect
import math
from collections import defaultdict
from itertools import groupby
from collections import defaultdict, Counter
from heapq import heappop, heappush
from collections import deque
for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	if (a + c) / 2 % b == 0 or ((2 * b - a) % c == 0 and 2 * b - a > 0) or ((2 * b - c) % a == 0 and 2 * b - c > 0):
		print('YES')
	else:
		print('NO')


def isanswer(n):
	if int(n) != n:
		return False
	if n <= 0:
		return False
	return True
t = int(input())
for _ in range(t):
	(a, b, c) = list(map(int, input().split()))
	if isanswer((2 * b - c) / a):
		print('YES')
		continue
	if isanswer((a + c) / 2 / b):
		print('YES')
		continue
	if isanswer((2 * b - a) / c):
		print('YES')
		continue
	print('NO')


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split(' '))
	if a + c != 0 and (a + c) % (2 * b) == 0:
		print('YES')
	elif 2 * b - c > 0 and (2 * b - c) % a == 0:
		print('YES')
	elif 2 * b - a > 0 and (2 * b - a) % c == 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	import math as m
	p = 2 * b - c
	q = 2 * b - a
	t = a + c
	if p > 0 and p % a == 0 or (q > 0 and q % c == 0) or (t > 0 and t % (2 * b) == 0):
		print('YES')
	else:
		print('NO')