Problem:
Score : 100 points

Problem Statement

Three poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right.
We will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, b-a = c-b.

Determine whether the arrangement of the poles is beautiful.

Constraints

1 \leq a,b,c \leq 100

a, b and c are integers.

Input

Input is given from Standard Input in the following format:

a b c

Output

Print YES if the arrangement of the poles is beautiful; print NO otherwise.

Sample Input 1

2 4 6

Sample Output 1

YES

Since 4-2 = 6-4, this arrangement of poles is beautiful.

Sample Input 2

2 5 6

Sample Output 2

NO

Since 5-2 \neq 6-5, this arrangement of poles is not beautiful.

Sample Input 3

3 2 1

Sample Output 3

YES

Since 1-2 = 2-3, this arrangement of poles is beautiful.

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;
#define ll long long
#define cpp mp::cpp_int
#define dequeue deque
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
struct edge {
	int to;
	ll cost;
};

void COME_LET_THE_GAMES_BEGIN() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
}
void reverse(string* s) {
	reverse((*s).begin(), (*s).end());
}
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
string s;
map<string, int> m;
int solve(string a) {
	if (m.find(a) != m.end())return m[a];
	int res = 1000;
	bool flag = 1;
	for (int i = 0; i < a.length(); i++) {
		if (a[i] != 'o') {
			flag = 0;
			for (int k = 0; k < s.length(); k++) {
				string aa = a;
				for (int j = 0; j < s.length(); j++) {
					if (aa[(i + j) % aa.length()] != 'o') {
						aa[(i + j) % aa.length()] = s[(j + k) % s.length()];
					}
				}
				if (a != aa) {
					res = min(res, 1 + solve(aa));
				}
			}
		}
	}
	if (flag)return m[a] = 1;
	return m[a] = res;
}
int main() {
	COME_LET_THE_GAMES_BEGIN();
	int a, b, c;
	cin >> a >> b >> c;
	cout << ((b - a == c - b) ? "YES" : "NO");
}