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;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
class Simple {
    int A, B, C, D, E, F;
    void Solve() {
        //input
        A = io.Int;
        B = io.Int;
        C = io.Int;
        D = io.Int;
        E = io.Int;
        F = io.Int;
        //cal
        var kosa = 0D;
        var water = 0;
        var sugar = 0;
        for (int i = 0; i <= 31; ++i) {
            for (int j = 0; j <= 31; ++j) {
                for (int k = 0; k <= 101; ++k) {
                    for (int l = 0; l <= 101; ++l) {
                        var x = 100 * A * i + 100 * B * j;
                        var y = C * k + D * l;
                        if (x + y <= F && y <= E * A * i + E * B * j)
                            if ((100 * y) != 0 && kosa < (100.0 * y) / (y + x)) {
                                kosa = (100.0 * y) / (y + x);
                                sugar = y;
                                water = x + y;
                            }
                    }
                }
            }
        }
        //ret
        Console.WriteLine((water==0?100:water) + " " + sugar);

    }
    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) { new Simple().Stream(); }
    void Stream() {
        Solve();
        io.writeFlush();
    }
}
class SimpleIO {
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] { ' ' };
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if (BufferCnt < nextBuffer.Length)
            return nextBuffer[BufferCnt++];

        string st = Console.ReadLine();
        while (st == "")
            st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}