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.



Sample input:
3
4


Sample output:
5

Submission status: Runtime Error

Solution code:
from sys import  stdin
n = in(stdin.readline())
a = int(stdin.readline())
print n*n-a

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# coding: utf-8

def main():
    A, B, C, D, E, F = [int(x) for x in input().split()]
    max_rate = E / (100 + E)
    best_weight, best_suger, best_rate = A*100, 0, 0.0
    for a in range(F//100 +1):
        for b in range((F-a*A)//100 + 1):
            water = (a*A+b*B)*100
            if water > F:
                continue
            for c in range((F-water)//C + 1):
                d = min((F - water - c*C) // D, int((E*water-100*c*C) / (100*D)))
                if d < 0:
                    continue
                suger = c*C + d*D
                if water + suger > F:
                    continue
                if water + suger == 0:
                    rate = 0.0
                else:
                    rate = suger / (water + suger)
                if rate > max_rate:
                    continue
                if rate > best_rate:
                    best_weight = water + suger
                    best_suger = suger
                    best_rate = rate
    print(best_weight, best_suger)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

inlist = list(map(int, input().split()))
a = inlist[0] * 100
b = inlist[1] * 100
c = inlist[2]
d = inlist[3]
e = inlist[4]
f = inlist[5]

tupleList = []

for i in range((f//a) + 1):
    for j in range((f - a*i)//b + 1):
        for k in range((f - a*i - b*j)//c + 1):
            for l in range((f - a*i - b*j - c*k)//d + 1):
                if (c*k + d*l)*(100 + e) <= (a*i + b*j + c*k + d*l)*e:
                    tupleList.append([i, j, k, l])
tupleList.remove([0, 0, 0, 0])

def concentration(i, j, k, l):
    return (c*k + d*l)/(a*i + b*j + c*k + d*l)

max_con = concentration(tupleList[0][0], tupleList[0][1], tupleList[0][2], tupleList[0][3])
max_tuple = tupleList[0]

for i in range(len(tupleList) - 1):
    if max_con < concentration(tupleList[i+1][0], tupleList[i+1][1], tupleList[i+1][2], tupleList[i+1][3]):
        max_con = concentration(tupleList[i + 1][0], tupleList[i + 1][1], tupleList[i + 1][2], tupleList[i + 1][3])
        max_tuple = tupleList[i + 1]

print(str(a*max_tuple[0] + b*max_tuple[1] + c*max_tuple[2] + d*max_tuple[3]) \
      + " " + str(c*max_tuple[2] + d*max_tuple[3]))

Submission status: Runtime Error

Solution code:
N = int(input())
K = int(input())
x = [int(i) for i in input().split()]

ans = 0
for xi in x:
    if xi < K/2:
        ans += xi*2
    else:
        ans += (K-xi)*2
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
K = int(input())
x = list(map(int,input().split()))
L = 0
for i in range(N):
  if K - x[i] <= x[i]:
    L = L + x[i]
  else:
    L = K -x[i]
print (2 * L)

Submission status: Runtime Error

Solution code:
a = int(raw_input())
b = int(raw_input())
return a*a-b

Submission status: Runtime Error

Solution code:
N = int(input())
K = int(input())
x = [int(i) for i in input().split()]

ans = 0
if K == 1:
    print(2*N)
else:
    for xi in x:
        if xi < K//2:
            ans += xi*2
        else:
            ans += (K-xi)*2
    print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

n = int(input())
k = int(input())
x = list(map(int, input().split())) #x[0->(n-1)]

sum = 0

for i in x:
    if i < k - i:
        sum = sum + i
    else:
        sum = sum + k - i

print(sum)

Submission status: Runtime Error

Solution code:
l = input().split()
n = int(l[0])
a = int(l[1])
ans = n ** 2 - a
print(ans)

Submission status: Runtime Error

Solution code:
N = input()
A = input()

print(N*N-A)

Submission status: Runtime Error

Solution code:
N = int(input())
K = int(input())
x = [int(i) for i in input().split()]

ans = 0
for xi in x:
    if xi < K//2:
        ans += xi*2
    else:
        ans += (K-xi)*2
print(ans)

Submission status: Runtime Error

Solution code:
n = input()
a = input()

print ((n * n) - a)

Submission status: Runtime Error

Solution code:
N = input()
A = input()

print (str(N * N - A))

Submission status: Runtime Error

Solution code:
N = input()
A = input()

print str(N * N - A)

Submission status: Runtime Error

Solution code:
N = input()
A = input()

print (N * N - A)

Submission status: Runtime Error

Solution code:
N = imput()
A = imput()

print (N * N - A)

Submission status: Runtime Error

Solution code:
import sys

# utils
def read_numbers():
    return [int(num) for num in sys.stdin.readline().split()]
def read_string():
    return sys.stdin.readline().rstrip('\r\n')
def list2str(*array):
    return ' '.join([str(i) for i in array])

def main(N, A):
    return N*N - A

def parse_stdin():
    # N = read_numbers()
    # data = []
    # for i in range(N):
    #    data.append(read_numbers())
    N = read_numbers()[0]
    A = read_numbers()[0]
    return N, A

def test_main():
    """run pytest stdin.py to test"""
    #assert main([1,2], 'hi') == '3 hi'
    pass

if __name__ == '__main__':
    N, A = parse_stdin()
    result = main(nums, line)
    print(result)