Problem:
Score : 100 points

Problem Statement

We have an N \times N square grid.

We will paint each square in the grid either black or white.

If we paint exactly A squares white, how many squares will be painted black?

Constraints

1 \leq N \leq 100

0 \leq A \leq N^2

Inputs

Input is given from Standard Input in the following format:

N
A

Outputs

Print the number of squares that will be painted black.

Sample Input 1

3
4

Sample Output 1

5

There are nine squares in a 3 \times 3 square grid.
Four of them will be painted white, so the remaining five squares will be painted black.

Sample Input 2

19
100

Sample Output 2

261

Sample Input 3

10
0

Sample Output 3

100

As zero squares will be painted white, all the squares will be painted black.

Solution in C# (Mono 4.6.2.0) (judge verdict: Runtime Error)

using System;
class Program
{
	static void Main(string[] args)
	{
		// ボール数
		int ball_N = int.Parse(Console.ReadLine());
		// BロボットのK値
		int K = int.Parse(Console.ReadLine());
		// 各ボールのx座標
		string[] Xaxis_array = Console.ReadLine().Split(' ');


		// 各ボールの最小距離計算
		int sum = 0;
		foreach (string Xaxis in Xaxis_array) 
		{
			//絶対値を計算
			int A_robot_abs = System.Math.Abs(int.Parse(Xaxis));
			int B_robot_abs = System.Math.Abs(int.Parse(Xaxis) - K);
        	if(A_robot_abs >= B_robot_abs)
			{
				sum += B_robot_abs * 2;
			}
			else
			{
				sum += A_robot_abs * 2;
			}
    	}
		//出力
		Console.WriteLine(sum);
	}
}