import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.exception;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import core.bitop;

alias Point = Tuple !(real, q{x}, real, q{y});

real sp (Point a, Point b, Point c)
{
	return (b.x - a.x) * (c.x - a.x) + (b.y - a.y) * (c.y - a.y);
}

void main ()
{
	int n;
	Point p;
	while (readf (" %s %s %s", &n, &p.x, &p.y) > 0)
	{
		auto a = new Point [n];
		foreach (ref s; a)
		{
			readf (" %s %s", &s.x, &s.y);
		}
		auto d = a.map !(s => hypot (s.y - p.y, s.x - p.x)).array;
		real r1 = d.minPos.front;
		foreach (i; 0..n)
		{
			auto u = a[i];
			auto v = a[(i + 1) % n];
			auto ta = u.y - v.y;
			auto tb = v.x - u.x;
			auto tc = -(u.x * ta + u.y * tb);
			auto td = -(p.x * ta + p.y * tb);
			auto dis = ta ^^ 2 + tb ^^ 2;
			auto delta = (td - tc) / dis;
			auto w = Point (p.x + ta * delta, p.y + tb * delta);
			debug {writeln (u, " ", v, " ", w);}
			if (sp (w, u, v) < 0)
			{
				r1 = min (r1, hypot (w.y - p.y, w.x - p.x));
			}
		}
		real r2 = d.minPos !(q{a > b}).front;
		real res = PI * (r2 ^^ 2 - r1 ^^ 2);
		writefln ("%.20f", res);
	}
}

import std.stdio;
import std.uni;
import std.conv;
import std.container;
import std.functional;
import std.algorithm;
import std.array;
import std.typecons;
import std.range;
import std.numeric;
import std.traits;
import std.math;

void main(string[] args)
{
  string input;
  readf!"%s"(input);
  auto words = input.split;
  debug writeln("words are = ", words);
  auto n = words[0].to!int;
  real[2] p;
  p[] = [words[1].to!real, words[2].to!real];
  auto polygon =  new real[2][](n);
  foreach(i, ref pi; polygon)
    pi = [words[3 + 2 * i].to!real, words[3 + 2 * i + 1].to!real];
  debug writeln("n = ", n, " p = ", p, " polygon = ", polygon);
  auto distances = polygon.map!(point => euclideanDistance([point[0], point[1]],
							   [p[0], p[1]])).array;
  auto minDistance = distances.fold!min;
  auto maxDistance = distances.fold!max;
  foreach(i, pi; polygon)
    {
      auto np = i + 1 >= polygon.length? polygon[0] : polygon[i + 1];
      real[2] d = [np[0] - pi[0], np[1] - pi[1]];
      auto t = (dotProduct(p, d) - dotProduct(pi, d)) / dotProduct(d, d);
      if (0 <= t && t <= 1)
	{
	  real[2] lp = [pi[0] + t * d[0], pi[1] + t * d[1]];
	  minDistance = min(minDistance, euclideanDistance(lp[], p[]));
	}
    }
  auto outerCircle = maxDistance * maxDistance * PI;
  auto innerCircle = minDistance * minDistance * PI;
  auto res = outerCircle - innerCircle;
  stdout.writefln!"%.20s"(res);
}

static this()
{
}

struct Any(T)
{
  static auto read()
  {
    static if (is(T == char))
      {
	auto res = frontChar;
	popChar;
	return res;
      }
  }
}

struct Unsigned(T)
{
  auto read()
  {
    auto res = T(0);
    while(!frontChar.isDigit) popChar;
    do
      {
	res = res * T(10) + T(frontChar - '0');
	popChar;
      }
    while(frontChar.isDigit);
    return res;
  }
}

struct Matrix(T, alias rows, alias cols)
{
  T[][] _cell;
  alias _cell this;
  // Ring constructor
  this(int n)
  {
    final switch(n)
      {
      case 0:
	_cell = new T[][](rows, cols);
	break;
      case 1:
	debug assert(rows == cols);
	_cell = new T[][](rows, cols);
	foreach(i; 0 .. rows)
	  _cell[i][i] = T(1);
	break;
      }
  }
  // Copy constructor
  this(Matrix!(T, rows, cols) other)
  {
    _cell = new T[][](rows, cols);
    foreach(i; 0 .. rows)
      _cell[i][] = other[i][];
  }
  auto opBinary(string op)(Matrix!(T, rows, cols) other)
       if (op == "+" || op == "-")
	 {
	   auto res = Matrix!(T, rows, cols)(0);
	   foreach(i; 0 .. rows)
	     foreach(j; 0 .. cols)
	       res[i][j] = mixin(q{this[i][j]}, op, q{other[i][j]});
	   return res;
	 }
  auto opBinary(string op, alias otherRows, alias otherCols)(Matrix!(T, otherRows, otherCols) other)
       if (op == "*")
	 {
	   debug assert(cols == otherRows);
	   auto res = Matrix!(T, rows, otherCols)(0);
	   foreach(i; 0 .. rows)
	     foreach(k; 0 .. cols)
	       foreach(j; 0 .. otherCols)
		 res[i][j] += this[i][k] * other[k][j];
	   return res;
	 }
  ref auto opOpAssign(string op)(Matrix!(T, rows, cols) other)
  {
    static if (op == "*")
      {
	debug assert(rows == cols);
	alias n = rows;
	auto res = Matrix!(T, n, n)(0);
	T factor;
	foreach(i; 0 .. n)
	  foreach(k; 0 .. n)
	    foreach(j; 0 .. n)
	      res[i][j] += this[i][k] * other[k][j];
	foreach(i; 0 .. n)
	  this[i][] = res[i][];
      }
    else
      {
	foreach(i; 0 .. rows)
	  foreach(j; 0 .. cols)
	    mixin(q{this[i][j] }, text(op, q{=}), q{ other[i][j];});
      }
    return this;
  }
  mixin powMethod;
}

struct Mod(T, alias mod)
{
  alias This = Mod!(T, mod);
  T _rep;
  this(T t)
  {
    _rep = t % mod;
    if (_rep < 0) _rep += mod;
  }
  static auto plain(T t)
  {
    auto res = Mod!(T, mod)();
    res._rep = t;
    return res;
  }
  static auto fromPositive(T t)
  {
    pragma(inline, true);
    return Mod!(T, mod).plain(t % mod);
  }
  static auto fromNegative(T t)
  {
    pragma(inline, true);
    return Mod!(T, mod).plain(t % mod + mod);
  }
  string toString()
  {
    return to!string(_rep);
  }
  debug invariant
  {
    assert(_rep >= 0 && _rep < mod);
  }
  auto opBinary(string op)(This b)
  {
    static if (op == "+")
      {
	T resrep = _rep + b._rep;
	if (resrep >= mod) resrep -= mod;
	return This.plain(resrep);
      }
    else static if (op == "-")
      {
	T resrep = _rep - b._rep;
	if (resrep < 0) resrep += mod;
	return This.plain(resrep);
      }
    else static if (op == "*")
      {
	return This.fromPositive(_rep * b._rep);
      }
  }
  auto opOpAssign(string op)(This b)
  {
    mixin(q{_rep }, text(op, "="), q{b._rep;});
    static if (op == "+")
      {
	if (_rep >= mod) _rep -= mod;
      }
    else static if (op == "-")
      {
	if (_rep < 0) _rep += mod;
      }
    else static if (op == "*")
      {
	_rep %= mod;
      }
    return this;
  }

  auto opBinary(string op)(long exp)
       if (op == "^^")
	 {
	   return pow(exp);
	 }
  mixin powMethod;
}

mixin template powMethod()
{
  auto pow(this ThisType)(long exp)
    {
      auto res = ThisType(1);
      auto pow = ThisType(this);
      while(exp)
	{
	  if (exp & 1) res *= pow;
	  pow *= pow;
	  exp >>= 1;
	}
      return res;
    }
}
// INPUT
char frontChar;
void popChar()
{
  import core.stdc.stdio;
  frontChar = cast(char) getchar;
  if (feof(stdin)) frontChar = ' ';
}
auto makeArray(T, S...)(S s)
{
  enum brackets = () {
    string res;
    foreach(i; 0 .. s.length)
      res ~= "[]";
    return res;
  } ();
  mixin(q{alias Type = T}, brackets, q{;});
  return new Type(s);
}
template isNumberLike(T)
{
  enum isNumberLike = is(typeof((){T test; test = test + test * test; test *= test;}()));
}
void popWhite()
{
  import std.ascii;
  while (frontChar.isWhite) popChar;
}
void print(T...)(T t)
{
  static foreach(ti; t)
    {
      static if (is(typeof(ti) == string))
	{
	  write(ti, " ");
	}
      else static if (isArray!(typeof(ti)))
	{
	  foreach(e; ti) print(e);
	}
      else static if (isTuple!(typeof(ti)))
	{
	  static foreach(i; ti.length) writesp(ti[i]);
	}
      else
	{
	  write(ti, " ");
	}
    }
}
void println(T...)(T t)
{
  static if (t.length == 0)
    writeln;
  static foreach(ti; t)
    {
      print(ti);
      writeln;
    }
}
auto next(alias T, S...)(S s)
{
  pragma(inline, true);
  static if (s.length > 0)
    {
      auto res = makeArray!(typeof(next!T()))(s);
      S t;
      enum loops = () {
	string res;
	foreach(i; 0 .. s.length)
	  {
	    auto ti = text(q{t[}, i, q{]});
	    res ~= text(q{for(}, ti, q{ = 0;}, ti , q{ < s[}, i, q{];}, ti, q{++)});
	  }
	return res;
      } ();
      enum indexing = () {
	string res = "res";
	foreach(i; 0 .. s.length)
	  res ~= text(q{[t[}, i, q{]]});
	return res;
      } ();
      mixin(loops, indexing, q{ = next!T;});
      return res;
    }
  else
    {
      static if (isNumberLike!T)
	{
	  import std.ascii: isDigit;
	  T res;
	  while(frontChar.isWhite) popChar;
	  T multiplier = T(1);
	  if (frontChar == '-')
	    {
	      multiplier = T(-1);
	      popChar;
	    }
	  else if (frontChar == '+')
	    {
	      popChar;
	    }
	  debug assert(frontChar.isDigit);
	  do
	    {
	      res = res * T(10) + T(frontChar - '0');
	      popChar;
	    }
	  while(frontChar.isDigit);
	  return multiplier * res;
	}
      else static if (is(T == string))
	{
	  import std.ascii: isWhite;
	  string res;
	  while(frontChar.isWhite)
	    popChar;
	  while(!frontChar.isWhite)
	    {
	      res ~= frontChar;
	      popChar;
	    }
	  return res;
	}
      else static if (is(T == char))
	{
	  while(frontChar.isWhite) popChar;
	  auto res = frontChar;
	  popChar;
	  return res;
	}
      else static if (isTuple!T)
	{
	  T res;
	  static foreach(i; 0 .. T.length)
	    {
	      res[i] = next!(typeof(res[i]));
	    }
	  return res;
	}
      else
	{
	  return T.read;
	}
    }
}

import std.stdio;
import std.uni;
import std.conv;
import std.container;
import std.functional;
import std.algorithm;
import std.array;
import std.typecons;
import std.range;
import std.numeric;
import std.traits;
import std.math;

void main(string[] args)
{
  string input;
  readf!"%s"(input);
  auto words = input.split;
  auto n = words[0].to!int;
  real[2] p;
  p[] = [words[1].to!real, words[2].to!real];
  auto polygon =  new real[2][](n);
  foreach(i, ref pi; polygon) pi = [words[3 + 2 * i].to!real, words[3 + 2 * i + 1].to!real];

  auto minDistance = iota(0, n)
    .map!(i => segmentPointDistance(p, polygon[i], polygon[(i + 1)%n]))
    .fold!min;
  auto maxDistance = polygon
    .map!(point => euclideanDistance(point[], p[]))
    .fold!max;
  auto outerCircle = maxDistance * maxDistance * PI;
  auto innerCircle = minDistance * minDistance * PI;
  stdout.writefln!"%.20s"(outerCircle - innerCircle);
}

auto segmentPointDistance(T)(T p, T a, T b)
{
  real[2] d = [b[0] - a[0], b[1] - a[1]];
  auto t = (dotProduct(p, d) - dotProduct(a, d)) / dotProduct(d, d);
  if (0 <= t && t <= 1)
    {
      real[2] lp = [a[0] + t * d[0], a[1] + t * d[1]];
      return euclideanDistance(lp[], p[]);
    }
  else
    {
      return min(euclideanDistance(a[], p[]), euclideanDistance(b[], p[]));
    }
}

static this()
{
}

struct Any(T)
{
  static auto read()
  {
    static if (is(T == char))
      {
	auto res = frontChar;
	popChar;
	return res;
      }
  }
}

struct Unsigned(T)
{
  auto read()
  {
    auto res = T(0);
    while(!frontChar.isDigit) popChar;
    do
      {
	res = res * T(10) + T(frontChar - '0');
	popChar;
      }
    while(frontChar.isDigit);
    return res;
  }
}

struct Matrix(T, alias rows, alias cols)
{
  T[][] _cell;
  alias _cell this;
  // Ring constructor
  this(int n)
  {
    final switch(n)
      {
      case 0:
	_cell = new T[][](rows, cols);
	break;
      case 1:
	debug assert(rows == cols);
	_cell = new T[][](rows, cols);
	foreach(i; 0 .. rows)
	  _cell[i][i] = T(1);
	break;
      }
  }
  // Copy constructor
  this(Matrix!(T, rows, cols) other)
  {
    _cell = new T[][](rows, cols);
    foreach(i; 0 .. rows)
      _cell[i][] = other[i][];
  }
  auto opBinary(string op)(Matrix!(T, rows, cols) other)
       if (op == "+" || op == "-")
	 {
	   auto res = Matrix!(T, rows, cols)(0);
	   foreach(i; 0 .. rows)
	     foreach(j; 0 .. cols)
	       res[i][j] = mixin(q{this[i][j]}, op, q{other[i][j]});
	   return res;
	 }
  auto opBinary(string op, alias otherRows, alias otherCols)(Matrix!(T, otherRows, otherCols) other)
       if (op == "*")
	 {
	   debug assert(cols == otherRows);
	   auto res = Matrix!(T, rows, otherCols)(0);
	   foreach(i; 0 .. rows)
	     foreach(k; 0 .. cols)
	       foreach(j; 0 .. otherCols)
		 res[i][j] += this[i][k] * other[k][j];
	   return res;
	 }
  ref auto opOpAssign(string op)(Matrix!(T, rows, cols) other)
  {
    static if (op == "*")
      {
	debug assert(rows == cols);
	alias n = rows;
	auto res = Matrix!(T, n, n)(0);
	T factor;
	foreach(i; 0 .. n)
	  foreach(k; 0 .. n)
	    foreach(j; 0 .. n)
	      res[i][j] += this[i][k] * other[k][j];
	foreach(i; 0 .. n)
	  this[i][] = res[i][];
      }
    else
      {
	foreach(i; 0 .. rows)
	  foreach(j; 0 .. cols)
	    mixin(q{this[i][j] }, text(op, q{=}), q{ other[i][j];});
      }
    return this;
  }
  mixin powMethod;
}

struct Mod(T, alias mod)
{
  alias This = Mod!(T, mod);
  T _rep;
  this(T t)
  {
    _rep = t % mod;
    if (_rep < 0) _rep += mod;
  }
  static auto plain(T t)
  {
    auto res = Mod!(T, mod)();
    res._rep = t;
    return res;
  }
  static auto fromPositive(T t)
  {
    pragma(inline, true);
    return Mod!(T, mod).plain(t % mod);
  }
  static auto fromNegative(T t)
  {
    pragma(inline, true);
    return Mod!(T, mod).plain(t % mod + mod);
  }
  string toString()
  {
    return to!string(_rep);
  }
  debug invariant
  {
    assert(_rep >= 0 && _rep < mod);
  }
  auto opBinary(string op)(This b)
  {
    static if (op == "+")
      {
	T resrep = _rep + b._rep;
	if (resrep >= mod) resrep -= mod;
	return This.plain(resrep);
      }
    else static if (op == "-")
      {
	T resrep = _rep - b._rep;
	if (resrep < 0) resrep += mod;
	return This.plain(resrep);
      }
    else static if (op == "*")
      {
	return This.fromPositive(_rep * b._rep);
      }
  }
  auto opOpAssign(string op)(This b)
  {
    mixin(q{_rep }, text(op, "="), q{b._rep;});
    static if (op == "+")
      {
	if (_rep >= mod) _rep -= mod;
      }
    else static if (op == "-")
      {
	if (_rep < 0) _rep += mod;
      }
    else static if (op == "*")
      {
	_rep %= mod;
      }
    return this;
  }

  auto opBinary(string op)(long exp)
       if (op == "^^")
	 {
	   return pow(exp);
	 }
  mixin powMethod;
}

mixin template powMethod()
{
  auto pow(this ThisType)(long exp)
    {
      auto res = ThisType(1);
      auto pow = ThisType(this);
      while(exp)
	{
	  if (exp & 1) res *= pow;
	  pow *= pow;
	  exp >>= 1;
	}
      return res;
    }
}
// INPUT
char frontChar;
void popChar()
{
  import core.stdc.stdio;
  frontChar = cast(char) getchar;
  if (feof(stdin)) frontChar = ' ';
}
auto makeArray(T, S...)(S s)
{
  enum brackets = () {
    string res;
    foreach(i; 0 .. s.length)
      res ~= "[]";
    return res;
  } ();
  mixin(q{alias Type = T}, brackets, q{;});
  return new Type(s);
}
template isNumberLike(T)
{
  enum isNumberLike = is(typeof((){T test; test = test + test * test; test *= test;}()));
}
void popWhite()
{
  import std.ascii;
  while (frontChar.isWhite) popChar;
}
void print(T...)(T t)
{
  static foreach(ti; t)
    {
      static if (is(typeof(ti) == string))
	{
	  write(ti, " ");
	}
      else static if (isArray!(typeof(ti)))
	{
	  foreach(e; ti) print(e);
	}
      else static if (isTuple!(typeof(ti)))
	{
	  static foreach(i; ti.length) writesp(ti[i]);
	}
      else
	{
	  write(ti, " ");
	}
    }
}
void println(T...)(T t)
{
  static if (t.length == 0)
    writeln;
  static foreach(ti; t)
    {
      print(ti);
      writeln;
    }
}
auto next(alias T, S...)(S s)
{
  pragma(inline, true);
  static if (s.length > 0)
    {
      auto res = makeArray!(typeof(next!T()))(s);
      S t;
      enum loops = () {
	string res;
	foreach(i; 0 .. s.length)
	  {
	    auto ti = text(q{t[}, i, q{]});
	    res ~= text(q{for(}, ti, q{ = 0;}, ti , q{ < s[}, i, q{];}, ti, q{++)});
	  }
	return res;
      } ();
      enum indexing = () {
	string res = "res";
	foreach(i; 0 .. s.length)
	  res ~= text(q{[t[}, i, q{]]});
	return res;
      } ();
      mixin(loops, indexing, q{ = next!T;});
      return res;
    }
  else
    {
      static if (isNumberLike!T)
	{
	  import std.ascii: isDigit;
	  T res;
	  while(frontChar.isWhite) popChar;
	  T multiplier = T(1);
	  if (frontChar == '-')
	    {
	      multiplier = T(-1);
	      popChar;
	    }
	  else if (frontChar == '+')
	    {
	      popChar;
	    }
	  debug assert(frontChar.isDigit);
	  do
	    {
	      res = res * T(10) + T(frontChar - '0');
	      popChar;
	    }
	  while(frontChar.isDigit);
	  return multiplier * res;
	}
      else static if (is(T == string))
	{
	  import std.ascii: isWhite;
	  string res;
	  while(frontChar.isWhite)
	    popChar;
	  while(!frontChar.isWhite)
	    {
	      res ~= frontChar;
	      popChar;
	    }
	  return res;
	}
      else static if (is(T == char))
	{
	  while(frontChar.isWhite) popChar;
	  auto res = frontChar;
	  popChar;
	  return res;
	}
      else static if (isTuple!T)
	{
	  T res;
	  static foreach(i; 0 .. T.length)
	    {
	      res[i] = next!(typeof(res[i]));
	    }
	  return res;
	}
      else
	{
	  return T.read;
	}
    }
}

import std.stdio;
import std.uni;
import std.conv;
import std.container;
import std.functional;
import std.algorithm;
import std.array;
import std.typecons;
import std.range;
import std.numeric;
import std.traits;
import std.math;

void main(string[] args)
{
  string input;
  readf!"%s"(input);
  auto words = input.split;
  auto n = words[0].to!int;
  real[2] p; p[] = [words[1].to!real, words[2].to!real];
  auto polygon =  new real[2][](n);
  foreach(i, ref pi; polygon) pi = [words[3 + 2 * i].to!real, words[3 + 2 * i + 1].to!real];
  auto minMax = iota(0, n)
    .map!(i => segmentPointDistance(p, polygon[i], polygon[(i + 1)%n]),
	  i => euclideanDistance(p[], polygon[i][]))
    .fold!((minmax, x) => tuple(min(minmax[0], x[0]), max(minmax[1], x[1])));
  auto minDistance = minMax[0];
  auto maxDistance = minMax[1];
  auto outerCircle = maxDistance * maxDistance * PI;
  auto innerCircle = minDistance * minDistance * PI;
  stdout.writefln!"%.20s"(outerCircle - innerCircle);
}

auto segmentPointDistance(T)(T p, T a, T b)
{
  real[2] d = [b[0] - a[0], b[1] - a[1]];
  auto t = (dotProduct(p, d) - dotProduct(a, d)) / dotProduct(d, d);
  if (0 <= t && t <= 1)
    {
      real[2] lp = [a[0] + t * d[0], a[1] + t * d[1]];
      return euclideanDistance(lp[], p[]);
    }
  else
    {
      return min(euclideanDistance(a[], p[]), euclideanDistance(b[], p[]));
    }
}

static this()
{
}

struct Any(T)
{
  static auto read()
  {
    static if (is(T == char))
      {
	auto res = frontChar;
	popChar;
	return res;
      }
  }
}

struct Unsigned(T)
{
  auto read()
  {
    auto res = T(0);
    while(!frontChar.isDigit) popChar;
    do
      {
	res = res * T(10) + T(frontChar - '0');
	popChar;
      }
    while(frontChar.isDigit);
    return res;
  }
}

struct Matrix(T, alias rows, alias cols)
{
  T[][] _cell;
  alias _cell this;
  // Ring constructor
  this(int n)
  {
    final switch(n)
      {
      case 0:
	_cell = new T[][](rows, cols);
	break;
      case 1:
	debug assert(rows == cols);
	_cell = new T[][](rows, cols);
	foreach(i; 0 .. rows)
	  _cell[i][i] = T(1);
	break;
      }
  }
  // Copy constructor
  this(Matrix!(T, rows, cols) other)
  {
    _cell = new T[][](rows, cols);
    foreach(i; 0 .. rows)
      _cell[i][] = other[i][];
  }
  auto opBinary(string op)(Matrix!(T, rows, cols) other)
       if (op == "+" || op == "-")
	 {
	   auto res = Matrix!(T, rows, cols)(0);
	   foreach(i; 0 .. rows)
	     foreach(j; 0 .. cols)
	       res[i][j] = mixin(q{this[i][j]}, op, q{other[i][j]});
	   return res;
	 }
  auto opBinary(string op, alias otherRows, alias otherCols)(Matrix!(T, otherRows, otherCols) other)
       if (op == "*")
	 {
	   debug assert(cols == otherRows);
	   auto res = Matrix!(T, rows, otherCols)(0);
	   foreach(i; 0 .. rows)
	     foreach(k; 0 .. cols)
	       foreach(j; 0 .. otherCols)
		 res[i][j] += this[i][k] * other[k][j];
	   return res;
	 }
  ref auto opOpAssign(string op)(Matrix!(T, rows, cols) other)
  {
    static if (op == "*")
      {
	debug assert(rows == cols);
	alias n = rows;
	auto res = Matrix!(T, n, n)(0);
	T factor;
	foreach(i; 0 .. n)
	  foreach(k; 0 .. n)
	    foreach(j; 0 .. n)
	      res[i][j] += this[i][k] * other[k][j];
	foreach(i; 0 .. n)
	  this[i][] = res[i][];
      }
    else
      {
	foreach(i; 0 .. rows)
	  foreach(j; 0 .. cols)
	    mixin(q{this[i][j] }, text(op, q{=}), q{ other[i][j];});
      }
    return this;
  }
  mixin powMethod;
}

struct Mod(T, alias mod)
{
  alias This = Mod!(T, mod);
  T _rep;
  this(T t)
  {
    _rep = t % mod;
    if (_rep < 0) _rep += mod;
  }
  static auto plain(T t)
  {
    auto res = Mod!(T, mod)();
    res._rep = t;
    return res;
  }
  static auto fromPositive(T t)
  {
    pragma(inline, true);
    return Mod!(T, mod).plain(t % mod);
  }
  static auto fromNegative(T t)
  {
    pragma(inline, true);
    return Mod!(T, mod).plain(t % mod + mod);
  }
  string toString()
  {
    return to!string(_rep);
  }
  debug invariant
  {
    assert(_rep >= 0 && _rep < mod);
  }
  auto opBinary(string op)(This b)
  {
    static if (op == "+")
      {
	T resrep = _rep + b._rep;
	if (resrep >= mod) resrep -= mod;
	return This.plain(resrep);
      }
    else static if (op == "-")
      {
	T resrep = _rep - b._rep;
	if (resrep < 0) resrep += mod;
	return This.plain(resrep);
      }
    else static if (op == "*")
      {
	return This.fromPositive(_rep * b._rep);
      }
  }
  auto opOpAssign(string op)(This b)
  {
    mixin(q{_rep }, text(op, "="), q{b._rep;});
    static if (op == "+")
      {
	if (_rep >= mod) _rep -= mod;
      }
    else static if (op == "-")
      {
	if (_rep < 0) _rep += mod;
      }
    else static if (op == "*")
      {
	_rep %= mod;
      }
    return this;
  }

  auto opBinary(string op)(long exp)
       if (op == "^^")
	 {
	   return pow(exp);
	 }
  mixin powMethod;
}

mixin template powMethod()
{
  auto pow(this ThisType)(long exp)
    {
      auto res = ThisType(1);
      auto pow = ThisType(this);
      while(exp)
	{
	  if (exp & 1) res *= pow;
	  pow *= pow;
	  exp >>= 1;
	}
      return res;
    }
}
// INPUT
char frontChar;
void popChar()
{
  import core.stdc.stdio;
  frontChar = cast(char) getchar;
  if (feof(stdin)) frontChar = ' ';
}
auto makeArray(T, S...)(S s)
{
  enum brackets = () {
    string res;
    foreach(i; 0 .. s.length)
      res ~= "[]";
    return res;
  } ();
  mixin(q{alias Type = T}, brackets, q{;});
  return new Type(s);
}
template isNumberLike(T)
{
  enum isNumberLike = is(typeof((){T test; test = test + test * test; test *= test;}()));
}
void popWhite()
{
  import std.ascii;
  while (frontChar.isWhite) popChar;
}
void print(T...)(T t)
{
  static foreach(ti; t)
    {
      static if (is(typeof(ti) == string))
	{
	  write(ti, " ");
	}
      else static if (isArray!(typeof(ti)))
	{
	  foreach(e; ti) print(e);
	}
      else static if (isTuple!(typeof(ti)))
	{
	  static foreach(i; ti.length) writesp(ti[i]);
	}
      else
	{
	  write(ti, " ");
	}
    }
}
void println(T...)(T t)
{
  static if (t.length == 0)
    writeln;
  static foreach(ti; t)
    {
      print(ti);
      writeln;
    }
}
auto next(alias T, S...)(S s)
{
  pragma(inline, true);
  static if (s.length > 0)
    {
      auto res = makeArray!(typeof(next!T()))(s);
      S t;
      enum loops = () {
	string res;
	foreach(i; 0 .. s.length)
	  {
	    auto ti = text(q{t[}, i, q{]});
	    res ~= text(q{for(}, ti, q{ = 0;}, ti , q{ < s[}, i, q{];}, ti, q{++)});
	  }
	return res;
      } ();
      enum indexing = () {
	string res = "res";
	foreach(i; 0 .. s.length)
	  res ~= text(q{[t[}, i, q{]]});
	return res;
      } ();
      mixin(loops, indexing, q{ = next!T;});
      return res;
    }
  else
    {
      static if (isNumberLike!T)
	{
	  import std.ascii: isDigit;
	  T res;
	  while(frontChar.isWhite) popChar;
	  T multiplier = T(1);
	  if (frontChar == '-')
	    {
	      multiplier = T(-1);
	      popChar;
	    }
	  else if (frontChar == '+')
	    {
	      popChar;
	    }
	  debug assert(frontChar.isDigit);
	  do
	    {
	      res = res * T(10) + T(frontChar - '0');
	      popChar;
	    }
	  while(frontChar.isDigit);
	  return multiplier * res;
	}
      else static if (is(T == string))
	{
	  import std.ascii: isWhite;
	  string res;
	  while(frontChar.isWhite)
	    popChar;
	  while(!frontChar.isWhite)
	    {
	      res ~= frontChar;
	      popChar;
	    }
	  return res;
	}
      else static if (is(T == char))
	{
	  while(frontChar.isWhite) popChar;
	  auto res = frontChar;
	  popChar;
	  return res;
	}
      else static if (isTuple!T)
	{
	  T res;
	  static foreach(i; 0 .. T.length)
	    {
	      res[i] = next!(typeof(res[i]));
	    }
	  return res;
	}
      else
	{
	  return T.read;
	}
    }
}

import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.exception;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import core.bitop;

alias Point = Tuple !(real, q{x}, real, q{y});

void main ()
{
	int n;
	Point p;
	while (readf (" %s %s %s", &n, &p.x, &p.y) > 0)
	{
		auto a = new Point [n];
		foreach (ref s; a)
		{
			readf (" %s %s", &s.x, &s.y);
		}
		auto d = a.map !(s => hypot (s.y - p.y, s.x - p.x)).array;
		real r1 = d.minPos.front;
		real r2 = d.minPos !(q{a > b}).front;
		real res = PI * (r2 ^^ 2 - r1 ^^ 2);
		writefln ("%.20f", res);
	}
}

import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.exception;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import core.bitop;

alias Point = Tuple !(real, q{x}, real, q{y});

real sp (Point a, Point b, Point c)
{
	return (b.x - a.x) * (c.x - a.x) + (b.y - a.y) * (c.y - a.y);
}

void main ()
{
	int n;
	Point p;
	while (readf (" %s %s %s", &n, &p.x, &p.y) > 0)
	{
		auto a = new Point [n];
		foreach (ref s; a)
		{
			readf (" %s %s", &s.x, &s.y);
		}
		auto d = a.map !(s => hypot (s.y - p.y, s.x - p.x)).array;
		real r1 = d.minPos.front;
		foreach (i; 0..n)
		{
			auto u = a[i];
			auto v = a[(i + 1) % n];
			auto ta = u.y - v.y;
			auto tb = v.x - u.x;
			auto tc = -(u.x * ta + u.y * tb);
			auto td = -(p.x * ta + p.y * tb);
			auto dis = ta ^^ 2 + tb ^^ 2;
			auto delta = (td - tc) / dis;
			auto w = Point (p.x + ta * delta, p.y + tb * delta);
			debug {writeln (u, " ", v, " ", w);}
			if (sp (w, u, v) < 0)
			{
				r1 = min (r1, delta);
			}
		}
		real r2 = d.minPos !(q{a > b}).front;
		real res = PI * (r2 ^^ 2 - r1 ^^ 2);
		writefln ("%.20f", res);
	}
}

import std.stdio;
import std.uni;
import std.conv;
import std.container;
import std.functional;
import std.algorithm;
import std.array;
import std.typecons;
import std.range;
import std.numeric;
import std.traits;
import std.math;

void main(string[] args)
{
  string input;
  readf!"%s"(input);
  auto words = input.split;
  debug writeln("words are = ", words);
  auto n = words[0].to!int;
  real[2] p;
  p[] = [words[1].to!real, words[2].to!real];
  auto polygon =  new real[2][](n);
  foreach(i, ref pi; polygon)
    pi = [words[3 + 2 * i].to!real, words[3 + 2 * i + 1].to!real];
  debug writeln("n = ", n, " p = ", p, " polygon = ", polygon);
  auto distances = polygon.map!(point => euclideanDistance([point[0], point[1]],
							   [p[0], p[1]])).array;
  auto minDistance = distances.fold!min;
  auto maxDistance = distances.fold!max;
  auto outerCircle = maxDistance * maxDistance * PI;
  auto innerCircle = minDistance * minDistance * PI;
  println(outerCircle - innerCircle);
}

static this()
{
}

struct Any(T)
{
  static auto read()
  {
    static if (is(T == char))
      {
	auto res = frontChar;
	popChar;
	return res;
      }
  }
}

struct Unsigned(T)
{
  auto read()
  {
    auto res = T(0);
    while(!frontChar.isDigit) popChar;
    do
      {
	res = res * T(10) + T(frontChar - '0');
	popChar;
      }
    while(frontChar.isDigit);
    return res;
  }
}

struct Matrix(T, alias rows, alias cols)
{
  T[][] _cell;
  alias _cell this;
  // Ring constructor
  this(int n)
  {
    final switch(n)
      {
      case 0:
	_cell = new T[][](rows, cols);
	break;
      case 1:
	debug assert(rows == cols);
	_cell = new T[][](rows, cols);
	foreach(i; 0 .. rows)
	  _cell[i][i] = T(1);
	break;
      }
  }
  // Copy constructor
  this(Matrix!(T, rows, cols) other)
  {
    _cell = new T[][](rows, cols);
    foreach(i; 0 .. rows)
      _cell[i][] = other[i][];
  }
  auto opBinary(string op)(Matrix!(T, rows, cols) other)
       if (op == "+" || op == "-")
	 {
	   auto res = Matrix!(T, rows, cols)(0);
	   foreach(i; 0 .. rows)
	     foreach(j; 0 .. cols)
	       res[i][j] = mixin(q{this[i][j]}, op, q{other[i][j]});
	   return res;
	 }
  auto opBinary(string op, alias otherRows, alias otherCols)(Matrix!(T, otherRows, otherCols) other)
       if (op == "*")
	 {
	   debug assert(cols == otherRows);
	   auto res = Matrix!(T, rows, otherCols)(0);
	   foreach(i; 0 .. rows)
	     foreach(k; 0 .. cols)
	       foreach(j; 0 .. otherCols)
		 res[i][j] += this[i][k] * other[k][j];
	   return res;
	 }
  ref auto opOpAssign(string op)(Matrix!(T, rows, cols) other)
  {
    static if (op == "*")
      {
	debug assert(rows == cols);
	alias n = rows;
	auto res = Matrix!(T, n, n)(0);
	T factor;
	foreach(i; 0 .. n)
	  foreach(k; 0 .. n)
	    foreach(j; 0 .. n)
	      res[i][j] += this[i][k] * other[k][j];
	foreach(i; 0 .. n)
	  this[i][] = res[i][];
      }
    else
      {
	foreach(i; 0 .. rows)
	  foreach(j; 0 .. cols)
	    mixin(q{this[i][j] }, text(op, q{=}), q{ other[i][j];});
      }
    return this;
  }
  mixin powMethod;
}

struct Mod(T, alias mod)
{
  alias This = Mod!(T, mod);
  T _rep;
  this(T t)
  {
    _rep = t % mod;
    if (_rep < 0) _rep += mod;
  }
  static auto plain(T t)
  {
    auto res = Mod!(T, mod)();
    res._rep = t;
    return res;
  }
  static auto fromPositive(T t)
  {
    pragma(inline, true);
    return Mod!(T, mod).plain(t % mod);
  }
  static auto fromNegative(T t)
  {
    pragma(inline, true);
    return Mod!(T, mod).plain(t % mod + mod);
  }
  string toString()
  {
    return to!string(_rep);
  }
  debug invariant
  {
    assert(_rep >= 0 && _rep < mod);
  }
  auto opBinary(string op)(This b)
  {
    static if (op == "+")
      {
	T resrep = _rep + b._rep;
	if (resrep >= mod) resrep -= mod;
	return This.plain(resrep);
      }
    else static if (op == "-")
      {
	T resrep = _rep - b._rep;
	if (resrep < 0) resrep += mod;
	return This.plain(resrep);
      }
    else static if (op == "*")
      {
	return This.fromPositive(_rep * b._rep);
      }
  }
  auto opOpAssign(string op)(This b)
  {
    mixin(q{_rep }, text(op, "="), q{b._rep;});
    static if (op == "+")
      {
	if (_rep >= mod) _rep -= mod;
      }
    else static if (op == "-")
      {
	if (_rep < 0) _rep += mod;
      }
    else static if (op == "*")
      {
	_rep %= mod;
      }
    return this;
  }

  auto opBinary(string op)(long exp)
       if (op == "^^")
	 {
	   return pow(exp);
	 }
  mixin powMethod;
}

mixin template powMethod()
{
  auto pow(this ThisType)(long exp)
    {
      auto res = ThisType(1);
      auto pow = ThisType(this);
      while(exp)
	{
	  if (exp & 1) res *= pow;
	  pow *= pow;
	  exp >>= 1;
	}
      return res;
    }
}
// INPUT
char frontChar;
void popChar()
{
  import core.stdc.stdio;
  frontChar = cast(char) getchar;
  if (feof(stdin)) frontChar = ' ';
}
auto makeArray(T, S...)(S s)
{
  enum brackets = () {
    string res;
    foreach(i; 0 .. s.length)
      res ~= "[]";
    return res;
  } ();
  mixin(q{alias Type = T}, brackets, q{;});
  return new Type(s);
}
template isNumberLike(T)
{
  enum isNumberLike = is(typeof((){T test; test = test + test * test; test *= test;}()));
}
void popWhite()
{
  import std.ascii;
  while (frontChar.isWhite) popChar;
}
void print(T...)(T t)
{
  static foreach(ti; t)
    {
      static if (is(typeof(ti) == string))
	{
	  write(ti, " ");
	}
      else static if (isArray!(typeof(ti)))
	{
	  foreach(e; ti) print(e);
	}
      else static if (isTuple!(typeof(ti)))
	{
	  static foreach(i; ti.length) writesp(ti[i]);
	}
      else
	{
	  write(ti, " ");
	}
    }
}
void println(T...)(T t)
{
  static if (t.length == 0)
    writeln;
  static foreach(ti; t)
    {
      print(ti);
      writeln;
    }
}
auto next(alias T, S...)(S s)
{
  pragma(inline, true);
  static if (s.length > 0)
    {
      auto res = makeArray!(typeof(next!T()))(s);
      S t;
      enum loops = () {
	string res;
	foreach(i; 0 .. s.length)
	  {
	    auto ti = text(q{t[}, i, q{]});
	    res ~= text(q{for(}, ti, q{ = 0;}, ti , q{ < s[}, i, q{];}, ti, q{++)});
	  }
	return res;
      } ();
      enum indexing = () {
	string res = "res";
	foreach(i; 0 .. s.length)
	  res ~= text(q{[t[}, i, q{]]});
	return res;
      } ();
      mixin(loops, indexing, q{ = next!T;});
      return res;
    }
  else
    {
      static if (isNumberLike!T)
	{
	  import std.ascii: isDigit;
	  T res;
	  while(frontChar.isWhite) popChar;
	  T multiplier = T(1);
	  if (frontChar == '-')
	    {
	      multiplier = T(-1);
	      popChar;
	    }
	  else if (frontChar == '+')
	    {
	      popChar;
	    }
	  debug assert(frontChar.isDigit);
	  do
	    {
	      res = res * T(10) + T(frontChar - '0');
	      popChar;
	    }
	  while(frontChar.isDigit);
	  return multiplier * res;
	}
      else static if (is(T == string))
	{
	  import std.ascii: isWhite;
	  string res;
	  while(frontChar.isWhite)
	    popChar;
	  while(!frontChar.isWhite)
	    {
	      res ~= frontChar;
	      popChar;
	    }
	  return res;
	}
      else static if (is(T == char))
	{
	  while(frontChar.isWhite) popChar;
	  auto res = frontChar;
	  popChar;
	  return res;
	}
      else static if (isTuple!T)
	{
	  T res;
	  static foreach(i; 0 .. T.length)
	    {
	      res[i] = next!(typeof(res[i]));
	    }
	  return res;
	}
      else
	{
	  return T.read;
	}
    }
}

import std.stdio;
import std.uni;
import std.conv;
import std.container;
import std.functional;
import std.algorithm;
import std.array;
import std.typecons;
import std.range;
import std.numeric;
import std.traits;
import std.math;

void main(string[] args)
{
  string input;
  readf!"%s"(input);
  auto words = input.split;
  debug writeln("words are = ", words);
  auto n = words[0].to!int;
  real[2] p;
  p[] = [words[1].to!real, words[2].to!real];
  auto polygon =  new real[2][](n);
  foreach(i, ref pi; polygon)
    pi = [words[3 + 2 * i].to!real, words[3 + 2 * i + 1].to!real];
  debug writeln("n = ", n, " p = ", p, " polygon = ", polygon);
  auto distances = polygon.map!(point => euclideanDistance([point[0], point[1]],
							   [p[0], p[1]])).array;
  auto minDistance = distances.fold!min;
  auto maxDistance = distances.fold!max;
  auto outerCircle = maxDistance * maxDistance * PI;
  auto innerCircle = minDistance * minDistance * PI;
  auto res = outerCircle - innerCircle;
  stdout.writefln!"%.20s"(res);
}

static this()
{
}

struct Any(T)
{
  static auto read()
  {
    static if (is(T == char))
      {
	auto res = frontChar;
	popChar;
	return res;
      }
  }
}

struct Unsigned(T)
{
  auto read()
  {
    auto res = T(0);
    while(!frontChar.isDigit) popChar;
    do
      {
	res = res * T(10) + T(frontChar - '0');
	popChar;
      }
    while(frontChar.isDigit);
    return res;
  }
}

struct Matrix(T, alias rows, alias cols)
{
  T[][] _cell;
  alias _cell this;
  // Ring constructor
  this(int n)
  {
    final switch(n)
      {
      case 0:
	_cell = new T[][](rows, cols);
	break;
      case 1:
	debug assert(rows == cols);
	_cell = new T[][](rows, cols);
	foreach(i; 0 .. rows)
	  _cell[i][i] = T(1);
	break;
      }
  }
  // Copy constructor
  this(Matrix!(T, rows, cols) other)
  {
    _cell = new T[][](rows, cols);
    foreach(i; 0 .. rows)
      _cell[i][] = other[i][];
  }
  auto opBinary(string op)(Matrix!(T, rows, cols) other)
       if (op == "+" || op == "-")
	 {
	   auto res = Matrix!(T, rows, cols)(0);
	   foreach(i; 0 .. rows)
	     foreach(j; 0 .. cols)
	       res[i][j] = mixin(q{this[i][j]}, op, q{other[i][j]});
	   return res;
	 }
  auto opBinary(string op, alias otherRows, alias otherCols)(Matrix!(T, otherRows, otherCols) other)
       if (op == "*")
	 {
	   debug assert(cols == otherRows);
	   auto res = Matrix!(T, rows, otherCols)(0);
	   foreach(i; 0 .. rows)
	     foreach(k; 0 .. cols)
	       foreach(j; 0 .. otherCols)
		 res[i][j] += this[i][k] * other[k][j];
	   return res;
	 }
  ref auto opOpAssign(string op)(Matrix!(T, rows, cols) other)
  {
    static if (op == "*")
      {
	debug assert(rows == cols);
	alias n = rows;
	auto res = Matrix!(T, n, n)(0);
	T factor;
	foreach(i; 0 .. n)
	  foreach(k; 0 .. n)
	    foreach(j; 0 .. n)
	      res[i][j] += this[i][k] * other[k][j];
	foreach(i; 0 .. n)
	  this[i][] = res[i][];
      }
    else
      {
	foreach(i; 0 .. rows)
	  foreach(j; 0 .. cols)
	    mixin(q{this[i][j] }, text(op, q{=}), q{ other[i][j];});
      }
    return this;
  }
  mixin powMethod;
}

struct Mod(T, alias mod)
{
  alias This = Mod!(T, mod);
  T _rep;
  this(T t)
  {
    _rep = t % mod;
    if (_rep < 0) _rep += mod;
  }
  static auto plain(T t)
  {
    auto res = Mod!(T, mod)();
    res._rep = t;
    return res;
  }
  static auto fromPositive(T t)
  {
    pragma(inline, true);
    return Mod!(T, mod).plain(t % mod);
  }
  static auto fromNegative(T t)
  {
    pragma(inline, true);
    return Mod!(T, mod).plain(t % mod + mod);
  }
  string toString()
  {
    return to!string(_rep);
  }
  debug invariant
  {
    assert(_rep >= 0 && _rep < mod);
  }
  auto opBinary(string op)(This b)
  {
    static if (op == "+")
      {
	T resrep = _rep + b._rep;
	if (resrep >= mod) resrep -= mod;
	return This.plain(resrep);
      }
    else static if (op == "-")
      {
	T resrep = _rep - b._rep;
	if (resrep < 0) resrep += mod;
	return This.plain(resrep);
      }
    else static if (op == "*")
      {
	return This.fromPositive(_rep * b._rep);
      }
  }
  auto opOpAssign(string op)(This b)
  {
    mixin(q{_rep }, text(op, "="), q{b._rep;});
    static if (op == "+")
      {
	if (_rep >= mod) _rep -= mod;
      }
    else static if (op == "-")
      {
	if (_rep < 0) _rep += mod;
      }
    else static if (op == "*")
      {
	_rep %= mod;
      }
    return this;
  }

  auto opBinary(string op)(long exp)
       if (op == "^^")
	 {
	   return pow(exp);
	 }
  mixin powMethod;
}

mixin template powMethod()
{
  auto pow(this ThisType)(long exp)
    {
      auto res = ThisType(1);
      auto pow = ThisType(this);
      while(exp)
	{
	  if (exp & 1) res *= pow;
	  pow *= pow;
	  exp >>= 1;
	}
      return res;
    }
}
// INPUT
char frontChar;
void popChar()
{
  import core.stdc.stdio;
  frontChar = cast(char) getchar;
  if (feof(stdin)) frontChar = ' ';
}
auto makeArray(T, S...)(S s)
{
  enum brackets = () {
    string res;
    foreach(i; 0 .. s.length)
      res ~= "[]";
    return res;
  } ();
  mixin(q{alias Type = T}, brackets, q{;});
  return new Type(s);
}
template isNumberLike(T)
{
  enum isNumberLike = is(typeof((){T test; test = test + test * test; test *= test;}()));
}
void popWhite()
{
  import std.ascii;
  while (frontChar.isWhite) popChar;
}
void print(T...)(T t)
{
  static foreach(ti; t)
    {
      static if (is(typeof(ti) == string))
	{
	  write(ti, " ");
	}
      else static if (isArray!(typeof(ti)))
	{
	  foreach(e; ti) print(e);
	}
      else static if (isTuple!(typeof(ti)))
	{
	  static foreach(i; ti.length) writesp(ti[i]);
	}
      else
	{
	  write(ti, " ");
	}
    }
}
void println(T...)(T t)
{
  static if (t.length == 0)
    writeln;
  static foreach(ti; t)
    {
      print(ti);
      writeln;
    }
}
auto next(alias T, S...)(S s)
{
  pragma(inline, true);
  static if (s.length > 0)
    {
      auto res = makeArray!(typeof(next!T()))(s);
      S t;
      enum loops = () {
	string res;
	foreach(i; 0 .. s.length)
	  {
	    auto ti = text(q{t[}, i, q{]});
	    res ~= text(q{for(}, ti, q{ = 0;}, ti , q{ < s[}, i, q{];}, ti, q{++)});
	  }
	return res;
      } ();
      enum indexing = () {
	string res = "res";
	foreach(i; 0 .. s.length)
	  res ~= text(q{[t[}, i, q{]]});
	return res;
      } ();
      mixin(loops, indexing, q{ = next!T;});
      return res;
    }
  else
    {
      static if (isNumberLike!T)
	{
	  import std.ascii: isDigit;
	  T res;
	  while(frontChar.isWhite) popChar;
	  T multiplier = T(1);
	  if (frontChar == '-')
	    {
	      multiplier = T(-1);
	      popChar;
	    }
	  else if (frontChar == '+')
	    {
	      popChar;
	    }
	  debug assert(frontChar.isDigit);
	  do
	    {
	      res = res * T(10) + T(frontChar - '0');
	      popChar;
	    }
	  while(frontChar.isDigit);
	  return multiplier * res;
	}
      else static if (is(T == string))
	{
	  import std.ascii: isWhite;
	  string res;
	  while(frontChar.isWhite)
	    popChar;
	  while(!frontChar.isWhite)
	    {
	      res ~= frontChar;
	      popChar;
	    }
	  return res;
	}
      else static if (is(T == char))
	{
	  while(frontChar.isWhite) popChar;
	  auto res = frontChar;
	  popChar;
	  return res;
	}
      else static if (isTuple!T)
	{
	  T res;
	  static foreach(i; 0 .. T.length)
	    {
	      res[i] = next!(typeof(res[i]));
	    }
	  return res;
	}
      else
	{
	  return T.read;
	}
    }
}


import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long MOD = 10^^9 + 7;

void main() {
    auto s = readln.split;
    auto N = s[0].to!int;
    auto L = s[1].to!long;
    auto A = s[2].to!long;
    long[] T, X;
    foreach (i; 0..N) {
        s = readln.split;
        T ~= s[0].to!long;
        X ~= s[1].to!long;
    }
    T ~= L;
    X ~= 0;

    long t = 0;
    long ans = 0;

    foreach (i; 0..N+1) {
        long interaval = T[i] - t;
        ans += interaval / A;
        t = T[i] + X[i];
    }

    ans.writeln;
}

void main() {
  import std.stdio, std.string, std.conv, std.algorithm;

  int n, l, a;
  rd(n, l, a);
  auto s = new int[](n), t = new int[](n);
  foreach (i; 0 .. n)
    rd(s[i], t[i]);

  long cnt = 0;
  foreach (i; 1 .. n) {
    cnt += (s[i] - (s[i - 1] + t[i - 1])) / a;
  }
  if (n > 0) {
    cnt += (s[0]) / a;
    cnt += (l - (s[$ - 1] + t[$ - 1])) / a;
  } else {
    cnt += l / a;
  }
  writeln(cnt);
}

void rd(T...)(ref T x) {
  import std.stdio : readln;
  import std.string : split;
  import std.conv : to;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}


import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

void bAdd(T)(T[] bit, int pos, T val)
in {
  assert(0 <= pos && pos < bit.length, "bAdd: 0 <= pos < |bit| must hold");
}
do {
  for (int x = pos; x < bit.length; x |= x + 1) {
    bit[x] += val;
  }
}

// sum of [0, pos)
T bSum(T)(T[] bit, int pos)
in {
  assert(0 <= pos && pos <= bit.length, "bSum: 0 <= pos <= |bit| must hold");
}
do {
  T ret = 0;
  for (int x = pos - 1; x >= 0; x = (x & (x + 1)) - 1) {
    ret += bit[x];
  }
  return ret;
}

void main() {
  try {
    for (; ; ) {
      const N = readInt();
      auto P = new int[N];
      foreach (i; 0 .. N) {
        P[i] = readInt() - 1;
      }

      auto Q = new int[N];
      foreach (i; 0 .. N) {
        Q[P[i]] = i;
      }

      auto ans = new long[N];

      // move
      int cntL, cntR;
      long sumL, sumR;
      auto setL = new RedBlackTree!int;
      auto setR = new RedBlackTree!int;
      foreach (j; 0 .. N) {
        if (setR.empty || Q[j] < setR.front) {
          cntL += 1;
          sumL += Q[j];
          setL.insert(Q[j]);
        } else {
          cntR += 1;
          sumR += Q[j];
          setR.insert(Q[j]);
        }
        for (; cntL > (j + 1) / 2; ) {
          const i = setL.back;
          cntL -= 1;
          sumL -= i;
          setL.removeKey(i);
          cntR += 1;
          sumR += i;
          setR.insert(i);
        }
        for (; cntL < (j + 1) / 2; ) {
          const i = setR.front;
          cntR -= 1;
          sumR -= i;
          setR.removeKey(i);
          cntL += 1;
          sumL += i;
          setL.insert(i);
        }
        debug {
          writeln("j = ", j);
          writeln("  L: ", cntL, " ", sumL, " ", setL);
          writeln("  R: ", cntR, " ", sumR, " ", setR);
        }
        const long i0 = setR.front;
        debug {
          writeln("  cost L: ", i0 * (i0 - 1) / 2 - (i0 - cntL) * (i0 - cntL - 1) / 2, " - ", sumL);
          writeln("  cost R: ", sumR, " - ", (i0 + cntR) * (i0 + cntR - 1) / 2 - i0 * (i0 - 1) / 2);
        }
        ans[j] += i0 * (i0 - 1) / 2 - (i0 - cntL) * (i0 - cntL - 1) / 2;
        ans[j] -= sumL;
        ans[j] += sumR;
        ans[j] -= (i0 + cntR) * (i0 + cntR - 1) / 2 - i0 * (i0 - 1) / 2;
      }
      debug {
        writeln("ans (move) = ", ans);
      }

      // inversion
      auto bit = new long[N];
      long now;
      foreach (j; 0 .. N) {
        now += j - bit.bSum(Q[j]);
        ans[j] += now;
        bit.bAdd(Q[j], 1);
      }

      foreach (j; 0 .. N) {
        if (j > 0) write(" ");
        write(ans[j]);
      }
      writeln();
    }
  } catch (EOFException e) {
  }
}

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(x => x.to!int-1).array;

    auto B = new int[](N);
    foreach (i, a; A) B[a] = i.to!int;

    auto st = new SegmentTree!(long, (a,b)=>a+b, 0L)(N);
    st.add(B[0], 1);

    auto leftpq = new BinaryHeap!(Array!long, "a < b");
    auto rightpq = new BinaryHeap!(Array!long, "a > b");
    leftpq.insert(B[0]);

    long leftsum = B[0];
    long rightsum = 0;
    long inversion = 0;

    write(0);

    foreach (a; 1..N) {
        auto left = B[a] == 0 ? 0 : st.query(0, B[a] - 1);
        auto right = B[a] == N - 1 ? 0 : st.query(B[a] + 1, N - 1);
        inversion += right;

        if (leftpq.length == rightpq.length) {
            leftpq.insert(B[a]);
            leftsum += B[a];
        } else {
            rightpq.insert(B[a]);
            rightsum += B[a];
        }

        while (leftpq.front > rightpq.front) {
            auto l = leftpq.front;
            auto r = rightpq.front;
            leftpq.removeFront;
            rightpq.removeFront;
            leftsum -= l;
            rightsum -= r;
            leftpq.insert(r);
            rightpq.insert(l);
            leftsum += r;
            rightsum += l;
        }

        auto med = leftpq.front;
        auto n = leftpq.length.to!long - 1;
        auto m = rightpq.length.to!long;

        long ans = inversion + (med * n - (leftsum - med) - n - n * (n - 1) / 2) + (rightsum - med * m - m - m * (m - 1) / 2);

        write(" ", ans);

        st.add(B[a], 1);
    }

    writeln;
}

class SegmentTree(T, alias op, T e) {
    T[] table;
    int size;
    int offset;

    this(int n) {
        size = 1;
        while (size <= n) size <<= 1;
        size <<= 1;
        table = new T[](size);
        fill(table, e);
        offset = size / 2;
    }

    void assign(int pos, T val) {
        pos += offset;
        table[pos] = val;
        while (pos > 1) {
            pos /= 2;
            table[pos] = op(table[pos*2], table[pos*2+1]);
        }
    }

    void add(int pos, T val) {
        pos += offset;
        table[pos] += val;
        while (pos > 1) {
            pos /= 2;
            table[pos] = op(table[pos*2], table[pos*2+1]);
        }
    }

    T query(int l, int r) {
        return query(l, r, 1, 0, offset-1);
    }

    T query(int l, int r, int i, int a, int b) {
        if (b < l || r < a) {
            return e;
        } else if (l <= a && b <= r) {
            return table[i];
        } else {
            return op(query(l, r, i*2, a, (a+b)/2), query(l, r, i*2+1, (a+b)/2+1, b));
        }
    }
}

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(x => x.to!int-1).array;

    auto B = new int[](N);
    foreach (i, a; A) B[a] = i.to!int;

    auto st = new SegmentTree!(long, (a,b)=>a+b, 0L)(N);
    st.add(B[0], 1);

    int leftmost = B[0];
    int rightmost = B[0];
    long move = 0;

    long ans = 0;
    write(ans);

    foreach (a; 1..N) {
        auto left = B[a] == 0 ? 0 : st.query(0, B[a] - 1);
        auto right = B[a] == N - 1 ? 0 : st.query(B[a] + 1, N - 1);
        ans += right;

        if (B[a] < leftmost) {
            ans += 1L * (leftmost - B[a] - 1) * a;
        } else {
            ans += B[a] - leftmost - left;
            ans -= right;
        }

        write(" ", ans);

        st.add(B[a], 1);
        leftmost = min(leftmost, B[a]);
        rightmost = max(rightmost, B[a]);
    }

    writeln;
}

class SegmentTree(T, alias op, T e) {
    T[] table;
    int size;
    int offset;

    this(int n) {
        size = 1;
        while (size <= n) size <<= 1;
        size <<= 1;
        table = new T[](size);
        fill(table, e);
        offset = size / 2;
    }

    void assign(int pos, T val) {
        pos += offset;
        table[pos] = val;
        while (pos > 1) {
            pos /= 2;
            table[pos] = op(table[pos*2], table[pos*2+1]);
        }
    }

    void add(int pos, T val) {
        pos += offset;
        table[pos] += val;
        while (pos > 1) {
            pos /= 2;
            table[pos] = op(table[pos*2], table[pos*2+1]);
        }
    }

    T query(int l, int r) {
        return query(l, r, 1, 0, offset-1);
    }

    T query(int l, int r, int i, int a, int b) {
        if (b < l || r < a) {
            return e;
        } else if (l <= a && b <= r) {
            return table[i];
        } else {
            return op(query(l, r, i*2, a, (a+b)/2), query(l, r, i*2+1, (a+b)/2+1, b));
        }
    }
}


import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional, std.meta;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.ascii, std.typecons;

void main()
{
    auto t = readln.chomp.to!int;

    while (t--) {
        auto n = readln.chomp.to!int;
        auto arr = readln.chomp.split.map!(to!long).array;

        bool solve(long[] arr) {
            if (arr.any!(x => x % 2 == 1)) { return false; }

            arr.sort();

            debug { arr.writeln; }

            long[] sums;
            foreach (i; arr.length.iota.stride(2)) {
                if (arr[i] != arr[i+1]) { return false; }

                sums ~= arr[i] / 2;
            }

            foreach (i; 1 .. sums.length) {
                if (sums[i] == sums[i-1]) { return false; }
            }

            debug { sums.writeln; }

            auto tot = sums[0];
            foreach (i; 1 .. sums.length) {
                auto left = sums.length - i.to!long;
                auto diff = sums[i] - sums[i-1];

                if (diff % i != 0) { return false; }

                tot -= diff / i * left;

                debug { tot.writeln; }
            }

            return tot > 0 && tot % sums.length == 0;
        }

        writeln(solve(arr) ? "YES": "NO");
    }
}

import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

void get(Args...)(ref Args args)
{
    import std.traits, std.meta, std.typecons;

    static if (Args.length == 1) {
        alias Arg = Args[0];

        static if (isArray!Arg) {
          static if (isSomeChar!(ElementType!Arg)) {
            args[0] = readln.chomp.to!Arg;
          } else {
            args[0] = readln.split.to!Arg;
          }
        } else static if (isTuple!Arg) {
            auto input = readln.split;
            static foreach (i; 0..Fields!Arg.length) {
                args[0][i] = input[i].to!(Fields!Arg[i]);
            }
        } else {
            args[0] = readln.chomp.to!Arg;
        }
    } else {
        auto input = readln.split;
        assert(input.length == Args.length);

        static foreach (i; 0..Args.length) {
            args[i] = input[i].to!(Args[i]);
        }
    }
}

void get_lines(Args...)(size_t N, ref Args args)
{
    import std.traits, std.range;

    static foreach (i; 0..Args.length) {
        static assert(isArray!(Args[i]));
        args[i].length = N;
    }

    foreach (i; 0..N) {
        static if (Args.length == 1) {
            get(args[0][i]);
        } else {
            auto input = readln.split;
            static foreach (j; 0..Args.length) {
                args[j][i] = input[j].to!(ElementType!(Args[j]));
            }
        }
    }
}

void main()
{
    int T; get(T);
    while (T--) {
        int N; get(N);
        long[] D; get(D);
        sort(D);
        long[] dd;
        long a;
        for (int i; i < N * 2; i += 2) {
            if (D[i] != D[i+1] || D[i] % 2 != 0) goto ng;
            if (!dd.empty && dd[$-1] == D[i]) goto ng;
            dd ~= D[i];
        }
        if (dd[$-1] % (2 * N) != 0) goto ng;
        a = dd[$-1] / N / 2;
        foreach_reverse (i; 1..N) {
            auto d = dd[i] - dd[i-1];
            if (d % (i*2) != 0) goto ng;
            a -= d / (i*2);
            if (a <= 0) goto ng;
        }
        writeln("YES");
        continue;
        ng:
        writeln("NO");
    }
}

// Cheese-Cracker: cheese-cracker.github.io

void theCode(){
    int n;
    n = scan!int;
    auto arr = scanArray;
    arr.sort;
    ll[] ray;
    for(int i = 0; i < n; ++i){
        if(arr[2*i] != arr[2*i + 1]){
            writeln("NO");
            return;
        }else{
            ray ~= arr[2*i];
        }
    }
    ray.reverse;
    show(ray);
    ll[] nums;
    ll msum = 0, tim =  n;
    for(int i = 0; i < n; ++i){
        if(ray[i] % 2 != 0){
            writeln("NO");
            return;
        }else{
            ll cval = ray[i]/2;
            cval -= msum;
            if(cval % tim != 0){
                writeln("NO");
                return;
            }
            ll val = cval/tim;
            nums ~= val;
            msum += val;
            --tim;
        }
    }
    show("NUMS: ", nums);
    for(int i = 1; i < n; ++i){
        if(nums[i] >= nums[i-1]){
            writeln("NO");
            return;
        }
    }
    for(int i = 0; i < n; ++i){
        if(nums[i] <= 0){
            writeln("NO");
            return;
        }
    }
    writeln("YES");
}

void main(){
    long tests = 1;
    tests = scan;        // Toggle!
    while(tests--) theCode();
}

/*********  That's All Folks!  *********/
import std.stdio, std.random, std.functional, std.container, std.algorithm;
import std.numeric, std.range, std.typecons, std.string, std.math, std.conv;
string[] tk; T scan(T=long)(){while(!tk.length)tk = readln.split; string a=tk.front; tk.popFront; return a.to!T;}
T[] scanArray(T=long)(){ auto r = readln.split.to!(T[]); return r; }
void show(A...)(A a){ debug{ foreach(t; a){stderr.write(t, "| ");} stderr.writeln; } }
alias ll = long, tup = Tuple!(long, "x",  long, "y");

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(ref long x, long y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new bool[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;
		auto d = RDA;

		d.sort!"a > b";
		long[] a;
		bool ok = true;
		foreach (i; 0..n)
		{
			if (d[i*2] != d[i*2+1])
			{
				ok = false;
				break;
			}
			a ~= d[i*2];
		}
		if (!ok) continue;

		long tot;
		bool[long] used;
		foreach (i; 0..n)
		{
			auto x = a[i] - tot;
			debug writeln("i:", i, " a[i]:", a[i], " x:", x, " tot:", tot);
			if (x <= 0 || x % ((n-i) * 2))
			{
				ok = false;
				break;
			}
			else
			{
				auto y = x / (n-i);
				if (used.get(y, false))
				{
					ok = false;
					break;
				}
				used[y] = true;
				tot += y;
			}
		}
		ans[ti] = ok;
	}

	foreach (e; ans)
		writeln(e ? "YES" : "NO");
	stdout.flush;
	debug readln;
}

import std.stdio;
import std.math;
import std.numeric;
import std.functional;
import std.container;
import std.typecons;
import std.conv;
import std.array;
import std.string;
import std.range;
import std.algorithm;
import core.bitop;
import core.stdc.stdio : scanf;

T read(T)() { return readln.chomp.to!T; }
T[] readarray(T)() { return readln.chomp.split(" ").map!(to!T).array; }
void chmin(T)(ref T a, in T b) { a = min(a, b); }
void chmax(T)(ref T a, in T b) { a = max(a, b); }

void main() {
    int T = read!int;
    foreach (t; 0 .. T) solve();
}

void solve() {
    int N = read!int;
    long[] D = readarray!long;

    bool C() {
        foreach (d; D) {
            if (d % 2 != 0) return false;
        }
        int[long] M;
        long[] X;
        foreach (d; D) {
            M[d] = M.get(d, 0) + 1;
            if (M[d] % 2 == 0) {
                X ~= d;
            }
        }
        foreach (k, cnt; M) {
            if (cnt % 2 != 0) return false;
        }
        assert(X.length == N);
        sort(X);
        auto A = new long[N];
        long S = X[0] / 2L;
        long Z = 0;
        auto K = new long[N];
        for (int i = 0; i < N-1; i++) {
            if ( (X[i+1] - X[i]) % (2L * (i+1)) != 0 ) return false;
            K[i] = (X[i+1] - X[i]) / (2L * (i+1));
        }
        long A0 = S;{
            for (int i = 0; i < N-1; i++) {
                A0 -= (N - 1L - i) * K[i];
            }
            if (A0 % N != 0) return false;
            A0 /= N;
        }
        A[0] = A0;
        for (int i = 0; i < N-1; i++) {
            A[i+1] = A[i] + K[i];
        }
        /*
        writeln("X: ", X);
        writeln("S: ", S);
        writeln(A);
        */
        auto B = A.dup;
        int m = B.sort.uniq.array.length;
        return A[0] >= 1 && S == sum(A) && m == N;
    }
    writeln(C() ? "YES" : "NO");
}

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

bool solve (int n, long [] d)
{
	sort (d);
	auto g = d.group.array;
	if (!g.all !(q{a[1] == 2}))
	{
		return false;
	}
	auto h = d.stride (2).array;
	if (!h.all !(q{a % 2 == 0}))
	{
		return false;
	}
	h[] /= 2;
	bool [long] s;
	long total = 0;
	foreach_reverse (i; 0..n)
	{
		h[i] -= total;
		if (h[i] % (i + 1) != 0)
		{
			return false;
		}
		auto cur = h[i] / (i + 1);
		if (cur <= 0)
		{
			return false;
		}
		total += cur;
		s[cur] = true;
	}
	return s.length == n;
}

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto d = readln.splitter.map !(to !(long)).array;
		writeln (solve (n, d) ? "YES" : "NO");

	}
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(ref long x, long y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new bool[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;
		auto d = RDA;

		d.sort!"a > b";
		long[] a;
		bool ok = true;
		foreach (i; 0..n)
		{
			if (d[i*2] != d[i*2+1])
			{
				ok = false;
				break;
			}
			a ~= d[i*2];
		}
		if (!ok) continue;

		long tot;
		foreach (i; 0..n)
		{
			auto x = a[i] - tot;
			debug writeln("i:", i, " a[i]:", a[i], " x:", x, " tot:", tot);
			if (x <= 1 || x % (n-i))
			{
				ok = false;
				break;
			}
			else
			{
				tot += x / (n-i);
			}
		}
		ans[ti] = ok;
	}

	foreach (e; ans)
		writeln(e ? "YES" : "NO");
	stdout.flush;
	debug readln;
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(ref long x, long y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new bool[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;
		auto d = RDA;

		d.sort!"a > b";
		bool ok = true;
		int[long] cnt;
		foreach (i; 0..n)
		{
			++cnt[d[i]];
		}
		foreach (e; cnt.values)
		{
			if (e != 2)
			{
				ok = false;
				break;
			}
		}
		if (!ok) continue;

		long[] a;
		foreach (i; 0..n)
		{
			a ~= d[i*2];
		}

		long tot;
		foreach (i; 0..n)
		{
			auto x = a[i] - tot;
			debug writeln("i:", i, " a[i]:", a[i], " x:", x, " tot:", tot);
			if (x <= 0 || x % ((n-i) * 2))
			{
				ok = false;
				break;
			}
			else
			{
				tot += x / (n-i);
			}
		}
		ans[ti] = ok;
	}

	foreach (e; ans)
		writeln(e ? "YES" : "NO");
	stdout.flush;
	debug readln;
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(ref long x, long y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new bool[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;
		auto d = RDA;

		d.sort!"a > b";
		long[] a;
		bool ok = true;
		foreach (i; 0..n)
		{
			if (d[i*2] != d[i*2+1])
			{
				ok = false;
				break;
			}
			a ~= d[i*2];
		}
		if (!ok) continue;

		long tot;
		foreach (i; 0..n)
		{
			auto x = a[i] - tot;
			debug writeln("i:", i, " a[i]:", a[i], " x:", x, " tot:", tot);
			if (x <= 0 || x % ((n-i) * 2))
			{
				ok = false;
				break;
			}
			else
			{
				tot += x / (n-i);
			}
		}
		ans[ti] = ok;
	}

	foreach (e; ans)
		writeln(e ? "YES" : "NO");
	stdout.flush;
	debug readln;
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(ref long x, long y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new bool[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;
		auto d = RDA;

		d.sort!"a > b";
		long[] a;
		bool ok = true;
		foreach (i; 0..n)
		{
			if (d[i*2] != d[i*2+1])
			{
				ok = false;
				break;
			}
			a ~= d[i*2];
		}
		if (!ok) continue;

		long tot;
		foreach (i; 0..n)
		{
			auto x = a[i] - tot;
			debug writeln("i:", i, " a[i]:", a[i], " x:", x, " tot:", tot);
			if (x == 0 || x % ((n-i) * 2))
			{
				ok = false;
				break;
			}
			else
			{
				tot += x / (n-i);
			}
		}
		ans[ti] = ok;
	}

	foreach (e; ans)
		writeln(e ? "YES" : "NO");
	stdout.flush;
	debug readln;
}

import std.stdio;
import std.math;
import std.numeric;
import std.functional;
import std.container;
import std.typecons;
import std.conv;
import std.array;
import std.string;
import std.range;
import std.algorithm;
import core.bitop;
import core.stdc.stdio : scanf;

T read(T)() { return readln.chomp.to!T; }
T[] readarray(T)() { return readln.chomp.split(" ").map!(to!T).array; }
void chmin(T)(ref T a, in T b) { a = min(a, b); }
void chmax(T)(ref T a, in T b) { a = max(a, b); }

void main() {
    int T = read!int;
    foreach (t; 0 .. T) solve();
}

void solve() {
    int N = read!int;
    long[] D = readarray!long;

    bool C() {
        foreach (d; D) {
            if (d % 2 != 0) return false;
            if (d < 0) return false;
        }
        int[long] M;
        long[] X;
        foreach (d; D) {
            M[d] = M.get(d, 0) + 1;
            if (M[d] % 2 == 0) {
                X ~= d;
            }
        }
        foreach (k, cnt; M) {
            if (cnt % 2 != 0) return false;
        }
        assert(X.length == N);
        sort(X);
        auto A = new long[N];
        long S = X[0] / 2L;
        long Z = 0;
        auto K = new long[N];
        for (int i = 0; i < N-1; i++) {
            if ( (X[i+1] - X[i]) % (2L * (i+1)) != 0 ) return false;
            K[i] = (X[i+1] - X[i]) / (2L * (i+1));
        }
        long A0 = S;{
            for (int i = 0; i < N-1; i++) {
                A0 -= (N - 1L - i) * K[i];
            }
            if (A0 % N != 0) return false;
            A0 /= N;
        }
        A[0] = A0;
        for (int i = 0; i < N-1; i++) {
            A[i+1] = A[i] + K[i];
        }
        /*
        writeln("X: ", X);
        writeln("S: ", S);
        writeln(A);
        */
        return A[0] >= 1 && S == sum(A);
    }
    writeln(C() ? "YES" : "NO");
}

import std.stdio;
import std.math;
import std.numeric;
import std.functional;
import std.container;
import std.typecons;
import std.conv;
import std.array;
import std.string;
import std.range;
import std.algorithm;
import core.bitop;
import core.stdc.stdio : scanf;

T read(T)() { return readln.chomp.to!T; }
T[] readarray(T)() { return readln.chomp.split(" ").map!(to!T).array; }
void chmin(T)(ref T a, in T b) { a = min(a, b); }
void chmax(T)(ref T a, in T b) { a = max(a, b); }

void main() {
    int T = read!int;
    foreach (t; 0 .. T) solve();
}

void solve() {
    int N = read!int;
    long[] D = readarray!long;

    bool C() {
        foreach (d; D) if (d % 2 != 0) return false;
        int[long] M;
        long[] X;
        foreach (d; D) {
            M[d] = M.get(d, 0) + 1;
            if (M[d] % 2 == 0) {
                X ~= d;
            }
        }
        if (X.length != N) return false;
        sort(X);
        auto A = new long[N];
        long S = X[0] / 2L;
        long Z = 0;
        auto K = new long[N];
        for (int i = 0; i < N-1; i++) {
            if ( (X[i+1] - X[i]) % (2L * (i+1)) != 0 ) return false;
            K[i] = (X[i+1] - X[i]) / (2L * (i+1));
        }
        long A0 = S;{
            for (int i = 0; i < N-1; i++) {
                A0 -= (N - 1L - i) * K[i];
            }
            if (A0 % N != 0) return false;
            A0 /= N;
        }
        A[0] = A0;
        for (int i = 0; i < N-1; i++) {
            A[i+1] = A[i] + K[i];
        }
        /*
        writeln("X: ", X);
        writeln("S: ", S);
        writeln(A);
        */
        return A[0] >= 1 && S == sum(A);
    }
    writeln(C() ? "YES" : "NO");
}

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

bool solve (int n, long [] d)
{
	sort (d);
	auto g = d.group.array;
	if (!g.all !(q{a[1] == 2}))
	{
		return false;
	}
	auto h = d.stride (2).array;
	if (!h.all !(q{a % 2 == 0}))
	{
		return false;
	}
	if (h.front * 2 <= h.back)
	{
		return false;
	}
	return true;
}

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto d = readln.splitter.map !(to !(long)).array;
		writeln (solve (n, d) ? "YES" : "NO");

	}
}

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

bool solve (int n, int [] d)
{
	sort (d);
	auto g = d.group.array;
	if (!g.all !(q{a[1] == 2}))
	{
		return false;
	}
	auto h = d.stride (2).array;
	if (!h.all !(q{a % 2 == 0}))
	{
		return false;
	}
/*
	if (h.front * 2 <= h.back)
	{
		return false;
	}
*/
	return true;
}

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto d = readln.splitter.map !(to !(int)).array;
		writeln (solve (n, d) ? "YES" : "NO");

	}
}

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

bool solve (int n, int [] d)
{
	sort (d);
	auto g = d.group.array;
	if (!g.all !(q{a[1] == 2}))
	{
		return false;
	}
	auto h = d.stride (2).array;
	if (!h.all !(q{a % 2 == 0}))
	{
		return false;
	}
	if (h.front * 2 <= h.back)
	{
		return false;
	}
	return true;
}

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto d = readln.splitter.map !(to !(int)).array;
		writeln (solve (n, d) ? "YES" : "NO");

	}
}

import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

void get(Args...)(ref Args args)
{
    import std.traits, std.meta, std.typecons;

    static if (Args.length == 1) {
        alias Arg = Args[0];

        static if (isArray!Arg) {
          static if (isSomeChar!(ElementType!Arg)) {
            args[0] = readln.chomp.to!Arg;
          } else {
            args[0] = readln.split.to!Arg;
          }
        } else static if (isTuple!Arg) {
            auto input = readln.split;
            static foreach (i; 0..Fields!Arg.length) {
                args[0][i] = input[i].to!(Fields!Arg[i]);
            }
        } else {
            args[0] = readln.chomp.to!Arg;
        }
    } else {
        auto input = readln.split;
        assert(input.length == Args.length);

        static foreach (i; 0..Args.length) {
            args[i] = input[i].to!(Args[i]);
        }
    }
}

void get_lines(Args...)(size_t N, ref Args args)
{
    import std.traits, std.range;

    static foreach (i; 0..Args.length) {
        static assert(isArray!(Args[i]));
        args[i].length = N;
    }

    foreach (i; 0..N) {
        static if (Args.length == 1) {
            get(args[0][i]);
        } else {
            auto input = readln.split;
            static foreach (j; 0..Args.length) {
                args[j][i] = input[j].to!(ElementType!(Args[j]));
            }
        }
    }
}

void main()
{
    int T; get(T);
    while (T--) {
        int N; get(N);
        long[] D; get(D);
        if (N == 1) {
            writeln(D == [0, 0] ? "YES" : "NO");
            continue;
        }
        sort(D);
        long[] dd;
        long a;
        for (int i; i < N * 2; i += 2) {
            if (D[i] != D[i+1] || D[i] % 2 != 0) goto ng;
            dd ~= D[i];
        }
        if (dd[$-1] % (2 * N) != 0) goto ng;
        a = dd[$-1] / N / 2;
        foreach_reverse (i; 1..N) {
            auto d = dd[i] - dd[i-1];
            if (d % (i*2) != 0) goto ng;
            a -= d / (i*2);
            if (a <= 0) goto ng;
        }
        writeln("YES");
        continue;
        ng:
        writeln("NO");
    }
}

import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

void get(Args...)(ref Args args)
{
    import std.traits, std.meta, std.typecons;

    static if (Args.length == 1) {
        alias Arg = Args[0];

        static if (isArray!Arg) {
          static if (isSomeChar!(ElementType!Arg)) {
            args[0] = readln.chomp.to!Arg;
          } else {
            args[0] = readln.split.to!Arg;
          }
        } else static if (isTuple!Arg) {
            auto input = readln.split;
            static foreach (i; 0..Fields!Arg.length) {
                args[0][i] = input[i].to!(Fields!Arg[i]);
            }
        } else {
            args[0] = readln.chomp.to!Arg;
        }
    } else {
        auto input = readln.split;
        assert(input.length == Args.length);

        static foreach (i; 0..Args.length) {
            args[i] = input[i].to!(Args[i]);
        }
    }
}

void get_lines(Args...)(size_t N, ref Args args)
{
    import std.traits, std.range;

    static foreach (i; 0..Args.length) {
        static assert(isArray!(Args[i]));
        args[i].length = N;
    }

    foreach (i; 0..N) {
        static if (Args.length == 1) {
            get(args[0][i]);
        } else {
            auto input = readln.split;
            static foreach (j; 0..Args.length) {
                args[j][i] = input[j].to!(ElementType!(Args[j]));
            }
        }
    }
}

void main()
{
    int T; get(T);
    while (T--) {
        int N; get(N);
        long[] D; get(D);
        sort(D);
        long[] dd;
        long a;
        for (int i; i < N * 2; i += 2) {
            if (D[i] != D[i+1] || D[i] % 2 != 0) goto ng;
            dd ~= D[i];
        }
        if (dd[$-1] % (2 * N) != 0) goto ng;
        a = dd[$-1] / N / 2;
        foreach_reverse (i; 1..N) {
            auto d = dd[i] - dd[i-1];
            if (d % (i*2) != 0) goto ng;
            a -= d / (i*2);
            if (a <= 0) goto ng;
        }
        writeln("YES");
        continue;
        ng:
        writeln("NO");
    }
}

import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional, std.meta;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.ascii, std.typecons;

void main()
{
    auto t = readln.chomp.to!int;

    while (t--) {
        auto n = readln.chomp.to!int;
        auto arr = readln.chomp.split.map!(to!long).array;

        bool solve(long[] arr) {
            if (arr.any!(x => x % 2 == 1)) { return false; }

            arr.sort();

            debug { arr.writeln; }

            long[] sums;
            foreach (i; arr.length.iota.stride(2)) {
                if (arr[i] != arr[i+1]) { return false; }

                sums ~= arr[i] / 2;
            }

            debug { sums.writeln; }

            auto tot = sums[0];
            foreach (i; 1 .. sums.length) {
                auto left = sums.length - i.to!long;
                auto diff = sums[i] - sums[i-1];

                if (diff % i != 0) { return false; }

                tot -= diff / i * left;

                debug { tot.writeln; }
            }

            return tot >= 0 && tot % sums.length == 0;
        }

        writeln(solve(arr) ? "YES": "NO");
    }
}

// Cheese-Cracker: cheese-cracker.github.io

void theCode(){
    int n;
    n = scan!int;
    auto arr = scanArray;
    arr.sort;
    ll[] ray;
    for(int i = 0; i < n; ++i){
        if(arr[2*i] != arr[2*i + 1]){
            writeln("NO");
            return;
        }else{
            ray ~= arr[2*i];
        }
    }
    ray.reverse;
    show(ray);
    ll[] nums;
    ll msum = 0, tim =  n, maxval;
    for(int i = 0; i < n; ++i){
        if(ray[i] % 2 != 0){
            writeln("NO");
            return;
        }else{
            ll cval = ray[i]/2;
            cval -= msum;
            if(cval % tim != 0){
                writeln("NO");
                return;
            }
            ll val = cval/tim;
            nums ~= val;
            msum += val;
            --tim;
        }
    }
    show("NUMS: ", nums);
    for(int i = 1; i < n; ++i){
        if(nums[i] > nums[i-1]){
            writeln("NO");
            return;
        }
    }
    for(int i = 0; i < n; ++i){
        if(nums[i] <= 0){
            writeln("NO");
            return;
        }
    }
    writeln("YES");
}

void main(){
    long tests = 1;
    tests = scan;        // Toggle!
    while(tests--) theCode();
}

/*********  That's All Folks!  *********/
import std.stdio, std.random, std.functional, std.container, std.algorithm;
import std.numeric, std.range, std.typecons, std.string, std.math, std.conv;
string[] tk; T scan(T=long)(){while(!tk.length)tk = readln.split; string a=tk.front; tk.popFront; return a.to!T;}
T[] scanArray(T=long)(){ auto r = readln.split.to!(T[]); return r; }
void show(A...)(A a){ debug{ foreach(t; a){stderr.write(t, "| ");} stderr.writeln; } }
alias ll = long, tup = Tuple!(long, "x",  long, "y");


import std.stdio;
import std.uni;
import std.conv;
import std.container;
import std.functional;
import std.algorithm;
import std.array;
import std.typecons;
import std.range;
import std.numeric;
import std.traits;
import std.variant;
import std.concurrency;

void main(string[] args)
{
  auto n = next!int;
  auto q = next!int;
  assert(q == 0);
  auto a = next!int(n);
  auto totalCount = new int[](200_000 + 1);
  foreach(i, ref ai; a)
    totalCount[ai]++;
  auto count = new int[](200_000 + 1);
  int openIntervals = 0;
  int biggestOpen = 0;
  int res = 0;
  size_t firstPosition = 0;
  foreach(i, ref ai; a)
    {
      if (openIntervals == 0)
	{
	  firstPosition = i;
	  assert(count[ai] == 0);
	}
      if (count[ai] == 0)
	{
	  openIntervals++;
	  biggestOpen = max(biggestOpen, totalCount[ai]);
	}
      count[ai]++;
      if (count[ai] == totalCount[ai])
	{
	  openIntervals--;
	  if (openIntervals == 0)
	    {
	      res += i - firstPosition + 1 - biggestOpen;
	      biggestOpen = 0;
	    }
	}
    }
  res.writeln;
  return;
}

static this()
{
  popChar;
}

struct Any(T)
{
  static auto read()
  {
    static if (is(T == char))
      {
	auto res = frontChar;
	popChar;
	return res;
      }
  }
}

struct Unsigned(T)
{
  auto read()
  {
    auto res = T(0);
    while(!frontChar.isDigit) popChar;
    do
      {
	res = res * T(10) + T(frontChar - '0');
	popChar;
      }
    while(frontChar.isDigit);
    return res;
  }
}

struct Matrix(T, alias rows, alias cols)
{
  T[][] _cell;
  alias _cell this;
  // Ring constructor
  this(int n)
  {
    final switch(n)
      {
      case 0:
	_cell = new T[][](rows, cols);
	break;
      case 1:
	debug assert(rows == cols);
	_cell = new T[][](rows, cols);
	foreach(i; 0 .. rows)
	  _cell[i][i] = T(1);
	break;
      }
  }
  // Copy constructor
  this(Matrix!(T, rows, cols) other)
  {
    _cell = new T[][](rows, cols);
    foreach(i; 0 .. rows)
      _cell[i][] = other[i][];
  }
  auto opBinary(string op)(Matrix!(T, rows, cols) other)
       if (op == "+" || op == "-")
	 {
	   auto res = Matrix!(T, rows, cols)(0);
	   foreach(i; 0 .. rows)
	     foreach(j; 0 .. cols)
	       res[i][j] = mixin(q{this[i][j]}, op, q{other[i][j]});
	   return res;
	 }
  auto opBinary(string op, alias otherRows, alias otherCols)(Matrix!(T, otherRows, otherCols) other)
       if (op == "*")
	 {
	   debug assert(cols == otherRows);
	   auto res = Matrix!(T, rows, otherCols)(0);
	   foreach(i; 0 .. rows)
	     foreach(k; 0 .. cols)
	       foreach(j; 0 .. otherCols)
		 res[i][j] += this[i][k] * other[k][j];
	   return res;
	 }
  ref auto opOpAssign(string op)(Matrix!(T, rows, cols) other)
  {
    static if (op == "*")
      {
	debug assert(rows == cols);
	alias n = rows;
	auto res = Matrix!(T, n, n)(0);
	T factor;
	foreach(i; 0 .. n)
	  foreach(k; 0 .. n)
	    foreach(j; 0 .. n)
	      res[i][j] += this[i][k] * other[k][j];
	foreach(i; 0 .. n)
	  this[i][] = res[i][];
      }
    else
      {
	foreach(i; 0 .. rows)
	  foreach(j; 0 .. cols)
	    mixin(q{this[i][j] }, text(op, q{=}), q{ other[i][j];});
      }
    return this;
  }
  mixin powMethod;
}

struct Mod(T, alias mod)
{
  alias This = Mod!(T, mod);
  T _rep;
  this(T t)
  {
    _rep = t % mod;
    if (_rep < 0) _rep += mod;
  }
  static auto plain(T t)
  {
    auto res = Mod!(T, mod)();
    res._rep = t;
    return res;
  }
  static auto fromPositive(T t)
  {
    pragma(inline, true);
    return Mod!(T, mod).plain(t % mod);
  }
  static auto fromNegative(T t)
  {
    pragma(inline, true);
    return Mod!(T, mod).plain(t % mod + mod);
  }
  string toString()
  {
    return to!string(_rep);
  }
  debug invariant
  {
    assert(_rep >= 0 && _rep < mod);
  }
  auto opBinary(string op)(This b)
  {
    static if (op == "+")
      {
	T resrep = _rep + b._rep;
	if (resrep >= mod) resrep -= mod;
	return This.plain(resrep);
      }
    else static if (op == "-")
      {
	T resrep = _rep - b._rep;
	if (resrep < 0) resrep += mod;
	return This.plain(resrep);
      }
    else static if (op == "*")
      {
	return This.fromPositive(_rep * b._rep);
      }
  }
  auto opOpAssign(string op)(This b)
  {
    mixin(q{_rep }, text(op, "="), q{b._rep;});
    static if (op == "+")
      {
	if (_rep >= mod) _rep -= mod;
      }
    else static if (op == "-")
      {
	if (_rep < 0) _rep += mod;
      }
    else static if (op == "*")
      {
	_rep %= mod;
      }
    return this;
  }

  auto opBinary(string op)(long exp)
       if (op == "^^")
	 {
	   return pow(exp);
	 }
  mixin powMethod;
}

mixin template powMethod()
{
  auto pow(this ThisType)(long exp)
    {
      auto res = ThisType(1);
      auto pow = ThisType(this);
      while(exp)
	{
	  if (exp & 1) res *= pow;
	  pow *= pow;
	  exp >>= 1;
	}
      return res;
    }
}
// INPUT
char frontChar;
void popChar()
{
  import core.stdc.stdio;
  frontChar = cast(char) getchar;
  if (feof(stdin)) frontChar = ' ';
}
auto makeArray(T, S...)(S s)
{
  enum brackets = () {
    string res;
    foreach(i; 0 .. s.length)
      res ~= "[]";
    return res;
  } ();
  mixin(q{alias Type = T}, brackets, q{;});
  return new Type(s);
}
template isNumberLike(T)
{
  enum isNumberLike = is(typeof((){T test; test = test + test * test; test *= test;}()));
}
void popWhite()
{
  import std.ascii;
  while (frontChar.isWhite) popChar;
}
void print(T...)(T t)
{
  static foreach(ti; t)
    {
      static if (is(typeof(ti) == string))
	{
	  write(ti, " ");
	}
      else static if (isArray!(typeof(ti)))
	{
	  foreach(e; ti) print(e);
	}
      else static if (isTuple!(typeof(ti)))
	{
	  static foreach(i; ti.length) writesp(ti[i]);
	}
      else
	{
	  write(ti, " ");
	}
    }
}
void println(T...)(T t)
{
  static if (t.length == 0)
    writeln;
  static foreach(ti; t)
    {
      print(ti);
      writeln;
    }
}
auto next(alias T, S...)(S s)
{
  pragma(inline, true);
  static if (s.length > 0)
    {
      auto res = makeArray!(typeof(next!T()))(s);
      S t;
      enum loops = () {
	string res;
	foreach(i; 0 .. s.length)
	  {
	    auto ti = text(q{t[}, i, q{]});
	    res ~= text(q{for(}, ti, q{ = 0;}, ti , q{ < s[}, i, q{];}, ti, q{++)});
	  }
	return res;
      } ();
      enum indexing = () {
	string res = "res";
	foreach(i; 0 .. s.length)
	  res ~= text(q{[t[}, i, q{]]});
	return res;
      } ();
      mixin(loops, indexing, q{ = next!T;});
      return res;
    }
  else
    {
      static if (isNumberLike!T)
	{
	  import std.ascii: isDigit;
	  T res;
	  while(frontChar.isWhite) popChar;
	  T multiplier = T(1);
	  if (frontChar == '-')
	    {
	      multiplier = T(-1);
	      popChar;
	    }
	  else if (frontChar == '+')
	    {
	      popChar;
	    }
	  debug assert(frontChar.isDigit);
	  do
	    {
	      res = res * T(10) + T(frontChar - '0');
	      popChar;
	    }
	  while(frontChar.isDigit);
	  return multiplier * res;
	}
      else static if (is(T == string))
	{
	  import std.ascii: isWhite;
	  string res;
	  while(frontChar.isWhite)
	    popChar;
	  while(!frontChar.isWhite)
	    {
	      res ~= frontChar;
	      popChar;
	    }
	  return res;
	}
      else static if (is(T == char))
	{
	  while(frontChar.isWhite) popChar;
	  auto res = frontChar;
	  popChar;
	  return res;
	}
      else
	{
	  return T.read;
	}
    }
}

import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return read.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtype!real;
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
void solve(){
	int n = rint;
	int q = rint;
	long[] as = rlong(n);

	int[long] lm, rm;
	foreach(int i, a; as){
		if(a !in lm) lm[a] = i;
		if(a !in rm) rm[a] = i;
		rm[a] = i;
	}

	K[] ks;
	int l, r;
	foreach(int i, a; as){
		if(r < i){
			ks ~= K(l, r);
			l = i;
			r = i;
		}
		r = max(r, rm[a]);
	}
	ks ~= K(l, r);

	int ans;
	foreach(k; ks){
		int[long] cnt;
		int maxcnt = 0;
		foreach(i; k.l .. k.r + 1){
			long a = as[i];
			if(a !in cnt) cnt[a] = 0;
			cnt[a] += 1;
			maxcnt = max(maxcnt, cnt[a]);
		}
		ans += (k.r + 1 - k.l) - maxcnt;
	}

	ans.writeln;
}

struct K{
	int l, r;
}


import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }
double[] rotate(double[] vec, double rad) { return [cos(rad)*vec[0] - sin(rad)*vec[1], sin(rad)*vec[0] + cos(rad)*vec[1]]; }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(ref long x, long y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new string[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;
		auto m = RD!int;

		string[] a, b;
		foreach (i; 0..n)
			a ~= RD!string;
		foreach (i; 0..n-1)
			b ~= RD!string;

		auto cnt = new long[][](m, 26);
		foreach (i; 0..n)
		{
			foreach (j; 0..m)
			{
				++cnt[j][a[i][j]-'a'];
			}
		}
		foreach (i; 0..n-1)
		{
			foreach (j; 0..m)
			{
				--cnt[j][b[i][j]-'a'];
			}
		}

		foreach (i; 0..n)
		{
			bool ok = true;
			foreach (j; 0..m)
			{
				if (cnt[j][a[i][j]-'a'] != 1)
				{
					ok = false;
					break;
				}
			}
			if (ok)
			{
				ans[ti] = a[i].idup;
				break;
			}
		}
	}

	foreach (e; ans)
	{
		writeln(e);
	}
	stdout.flush;
	debug readln;
}

// Vicfred
// https://codeforces.com/contest/1546/problem/B
// greedy
import std.algorithm;
import std.array;
import std.conv;
import std.stdio;
import std.string;

void main() {
    int t = readln.chomp.to!int;
while(t--) {
    int n, m;
    readf("%s %s\n", &n, &m);
    string[] original, shuffled;
    for(int i = 0; i < n; ++i) {
        string s;
        readf("%s\n", &s);
        original ~= s;
    }
    for(int i = 1; i < n; ++i) {
        string s;
        readf("%s\n", &s);
        shuffled ~= s;
    }
    int[char][int] counter;
    foreach(s; original) {
        for(int i = 0; i < m; i++) {
            counter[i][s[i]] += 1;
        }
    }
    foreach(s; shuffled) {
        for(int i = 0; i < m; i++) {
            counter[i][s[i]] += 1;
        }
    }
    for(int i = 0; i < m; ++i) {
        for(char ch = 'a'; ch <= 'z'; ++ch) {
            counter[i][ch] += 0;
            if(counter[i][ch] % 2 == 1) {
                ch.write;
            }
        }
    }
    "".writeln;
}
}

import std.algorithm, std.array, std.container, std.conv, std.math, std.numeric, std.random, std.range, std.stdio, std.string, std.typecons, core.bitop;

void main()
{
  long t;
  readf!" %d "(t);
  while (t--) {
    auto a = readln.strip.split.map!(to!int).array;
    int n = a[0];
    int m = a[1];
    int i, j;
    string[] orig, shuf;
    for (i = 0; i < n; i++)
      orig ~= readln.strip;
    for (i = 0; i < n - 1; i++)
      shuf ~= readln.strip;
    int[][] cnt = new int[][](m, 30);
    foreach (s ; orig) {
      for (i = 0; i < m; i++) {
        cnt[i][s[i] - 'a']++;
      }
    }
    foreach (s ; shuf) {
      for (i = 0; i < m; i++) {
        cnt[i][s[i] - 'a']--;
      }
    }
    char[] result = cnt.map!(x => cast(char)('a' + x.countUntil(1))).array;
    writeln(result.idup);
    stdout.flush;
  }
}

import std.stdio, std.string;
import std.conv, std.typecons;
import std.array, std.range;
import std.math, std.algorithm;
import std.random;

int main(string[] args)
{
    auto t = to!int(readln.strip);
    auto c = new int[26];
    auto sc = new int[26];
    auto lc = new int[][](100010, 26);
    auto cc = new int[][](100010, 26);
    auto scc = new int[][](100010, 26);
    auto s = new string[100010];
    foreach (_; 0 .. t)
    {
        int n, m;
        readf("%d %d\n", &n, &m);
        fill(c, 0);
        foreach (i; 0 .. m) fill(cc[i], 0);
        foreach (i; 0 .. n)
        {
            s[i] = readln.strip;
            fill(lc[i], 0);
            foreach (j; 0 .. m)
            {
                ++ c[s[i][j] - 'a'];
                ++ lc[i][s[i][j] - 'a'];
                ++ cc[j][s[i][j] - 'a'];
            }
        }
        fill(sc, 0);
        foreach (i; 0 .. m) fill(scc[i], 0);
        foreach (i; 0 .. n - 1)
        {
            auto ss = readln.strip;
            foreach (j; 0 .. m)
            {
                ++ sc[ss[j] - 'a'];
                ++ scc[j][ss[j] - 'a'];
            }
        }
        int[] res;
        foreach (i; 0 .. n)
        {
            int j;
            for (j = 0; j < 26; ++ j)
            {
                if (c[j] - lc[i][j] != sc[j]) break;
                int k;
                for (k = 0; k < m; ++ k)
                {
                    if (s[i][k] - 'a' == j && cc[k][j] - 1 != scc[k][j]) break;
                    if (s[i][k] - 'a' != j && cc[k][j] != scc[k][j]) break;
                }
                if (k < m) break;
            }
            if (j == 26)
            {
                writeln(s[i]);
                stdout.flush;
                break;
            }
        }
    }
    return 0;
}

import std.stdio, std.string;
import std.conv, std.typecons;
import std.array, std.range;
import std.math, std.algorithm;

int main(string[] args)
{
    auto t = to!int(readln.strip);
    auto c = new int[26];
    auto sc = new int[26];
    auto lc = new int[][](100010, 26);
    auto s = new string[100010];
    foreach (_; 0 .. t)
    {
        int n, m;
        readf("%d %d\n", &n, &m);
        fill(c, 0);
        fill(sc, 0);
        foreach (i; 0 .. n)
        {
            s[i] = readln.strip;
            fill(lc[i], 0);
            foreach (j; 0 .. m)
            {
                ++ c[s[i][j] - 'a'];
                ++ lc[i][s[i][j] - 'a'];
            }
        }
        foreach (i; 0 .. n - 1)
        {
            auto ss = readln.strip;
            foreach (j; 0 .. m) ++ sc[ss[j] - 'a'];
        }
        foreach (i; 0 .. n)
        {
            int j;
            for (j = 0; j < 26; ++ j) if (c[j] - lc[i][j] != sc[j]) break;
            if (j == 26)
            {
                writeln(s[i]);
                stdout.flush;
                break;
            }
        }
    }
    return 0;
}