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:
A,B,C,D,E,F=map(int, input().split())
cnt_A=0
cnt_B=0
cnt_C=0
cnt_D=0
max_noudo=0
water=A*100
sugar=0
while cnt_A*100*A <= F:
  cnt_B=0
  while cnt_B*100*B <= F-cnt_A*100*A:
    cnt_C=0
    while cnt_C*C <= F-cnt_A*100*A-cnt_B*100*B:
      cnt_D=0
      while cnt_D*D <= F-cnt_A*100*A-cnt_B*100*B-cnt_C*C:
        if (cnt_A*A+cnt_B*B)*E >= cnt_C*C+cnt_D*D >0:
          if max_noudo < 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B):
            max_noudo = 100*(cnt_C*C+cnt_D*D)/(cnt_A*A+cnt_B*B)
            water=cnt_A*A*100+cnt_B*B*100+cnt_C*C+cnt_D*D
            sugar=cnt_C*C+cnt_D*D
          cnt_D+=1
        else:
          break
      cnt_C+=1
    cnt_B+=1
  cnt_A+=1

print(water,sugar)

Submission status: Runtime Error

Solution code:
n = int(input())**2
print(n-int(input())

Submission status: Runtime Error

Solution code:
N=input();A=input()
print(N*N-A)

Submission status: Runtime Error

Solution code:
import sys
A, B, C, D, E, F = map(int, input().split())


def concentration(water, suger):
    if water * E/100 < suger or water + suger == 0:
        return 0
    return (100 * suger/(water + suger))

lst_w = []
limit_w = (F+A*100-1)//(A*100)
for i in range(limit_w):
    for j in range(limit_w):
        if 100 * (A * i + B * j) <= F:
            lst_w += [100 * (A * i + B * j)]

lst_s = []
limit_s = (F+C-1)//C
for i in range(limit_s):
    for j in range(limit_s):
        if C* i + D * j <= F:
            lst_s += [C * i + D * j]

# print (lst_w)
# print (lst_s)
set_w = set(lst_w)
set_s = set(lst_s)

# print (set_w)
# print (set_s)

ans = 0
ans_total = 0
ans_suger = 0
for water in set_w:
    for suger in set_s:
        if water + suger <= F:
            a = concentration(water, suger)
            if ans < a:
                ans = a
                ans_total = water + suger
                ans_suger = suger
            if ans == 50:
                print (ans_total, ans_suger)
                sys.exit()

if ans = 0:
    print (set_w[1], 0)
else:
    print (ans_total, ans_suger)

# print (ans)

Submission status: Runtime Error

Solution code:
N, A = map(int, input().split())
print(N**2-A)

Submission status: Runtime Error

Solution code:
N, A = map(int, input().split())
print(N ** 2 - A)

Submission status: Runtime Error

Solution code:
age, price = map(int, input().split())
ans = 0

if age <= 5:
    ans = 0
elif age >= 6 and age <= 12:
    ans = price // 2
else:
    ans = price 

print(ans)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

typedef vector<vector<int> > Matrix;

const int INF = 100000000;
Matrix d; // グラフの距離を格納した2次元配列（隣接行列）
Matrix D; // d[u][v]は辺e=(u,v)のコスト（辺が存在しない場合はINF、ただしd[i][i]=0）

void warshall_floyd(int n) { // nは頂点数
  for (int i = 0; i < n; i++)      // 経由する頂点
    for (int j = 0; j < n; j++)    // 開始頂点
      for (int k = 0; k < n; k++)  // 終端
        d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
}




int main() {
  int n;
  cin >> n;

  d = Matrix(n, vector<int>(n, INF));
  D = Matrix(n, vector<int>(n, INF));
  for (int i = 0; i < n; i++) d[i][i] = 0;
  
  int tmp;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin>>tmp;
      d[i][j] = tmp;
      d[j][i] = tmp;
      D[i][j] = tmp;
      D[j][i] = tmp;
    }
  }
  
  warshall_floyd(n);
  
  int ans=100000000;
  tmp=0;
  
  if (D!=d){ cout<< -1 <<endl;
  }else{
      cout<<"1"<<endl;
      
      
  }
}

Submission status: Runtime Error

Solution code:
    s = input().split()
     
    if s.count('5') == 2 and s.count('7') == 1:
      print('YES')
    else:
      print('NO')

Submission status: Runtime Error

Solution code:
A, B, C, D, E, F= (int(i) for i in input().split())

dens=0
for a in range(30+1):
  for b in range(30+1):
    waterA=100*a*A
    waterAB=waterA+100*b*B
    if  waterA<= F and 0 < waterAB <= F:
      for c in range(100+1):
        for d in range(100+1):
          if waterAB+c*C+d*D <= F:
            if c*C+d*D <= (a*A+b*B)*E:
              if dens < (c*C+d*D)/(waterAB+c*C+d*D):
                dens=(c*C+d*D)/(waterAB+c*C+d*D)
                max=waterAB+c*C+d*D
              
print(max,int(max*dens))

Submission status: Runtime Error

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
K = int(stdin.readline().rstrip())
X = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 0
for i in x:
    if i < K - i:
        ans += 2 * i
    else:
        ans += 2 * (K - i)
print(ans)

Submission status: Runtime Error

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
K = int(stdin.readline().rstrip())
X = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 0
for i in x:
    if i < K - i:
        ans += 2 * i
    else:
        ans += 2 * (K - i)
print(route)

Submission status: Runtime Error

Solution code:
a,b,c,d,e,f=map(int,input().split())
l=[]
for i in range(0,f//(100*a)+1):
  for j in range(0,f//(100*b)+1):
    if 100*a*i+100*b*j>=f:
      pass
    else:
      l.append(100*a*i+100*b*j)
l1=[]
del l[0]
max1=0
g=0
h=0
for i in l:
  l2=[]
  m=min(f-i,(i//100)*e)
  max2=0
  for j in range(0,m//c+1):
    for k in range(0,m//d+1):
      if j*c+k*d<=m and j*c+k*d>max2:
        max2=j*c+k*d
  if max1<100*max2/(i+max2):
    g=i
    f=max2
    max1=100*max2/(i+max2)
print(i+max2,max2)

Submission status: Runtime Error

Solution code:
N,A = [input() for _ in range(2)]
print(N**2 - A)

Submission status: Runtime Error

Solution code:
a=input().split()
n = int(a[0])
m = int(a[1])
white=[]
black=[]
b = []
for i in range(n):
    b.append(input())

for i in range(n):
    for j in range(m):
        if b[i][j] == '.':
            white.append([i,j])
        else:
            black.append([i,j])


max_d=0
l_white =  len(white)
l_black = len(black)
for i in range(l_white):
    min_d=float('inf')
    for j in range(l_black):
        d = abs(white[i][0] - black[j][0]) + abs(white[i][1] - black[j][1])
        if d < min_d:
            min_d =d
    if min_d > max_d:
        max_d = min_d
print(max_d)

Submission status: Runtime Error

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n,a = f()
    print(n*n - a)

solve()

Submission status: Runtime Error

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

n=int(input())
k=int(input())
x=list(map(int,input().split()))
ans=0

for i in range(n):
    ans+=min(x[i],abs(k-x[i]))

print(ans*2)

Submission status: Runtime Error

Solution code:
a=int(input())
print(a**2-int(input())

Submission status: Runtime Error

Solution code:
N=int(input)
print(N**2-int(input()))

Submission status: Runtime Error

Solution code:
N = int(input())
A = int(inout())
print(N**2 - A)

Submission status: Runtime Error

Solution code:
//encoding:utf-8
//#include <iostream> //c++
//#include<stack> //スタックに関して　最新のデータから捨てる
//#include<queue> //キューに関して　最古のデータから捨てる
//#include<math.h>
//#include<vector>
//#include<algorithm> //sort とかにいる
#include<bits/stdc++.h>//vector,algorithm,que
#include<time.h> //時間にかんして

#define ll long long
#define MOD 1000000007
using namespace std;
int main(){
  int N,A;
  cin>>N>>A;
  int ans = N*N-A;
  cout<<ans<<endl;
  return 0;
}

Submission status: Runtime Error

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

print(int(n ** 2) - a)

Submission status: Runtime Error

Solution code:
N, A = int(input().split())
B = N * N - A
print(B)

Submission status: Runtime Error

Solution code:
N, A = map(int, input().split())
B = N * N - A
print(B)

Submission status: Runtime Error

Solution code:
N,A = map(int, input().split())
B = N * N - A
print(B)

Submission status: Runtime Error

Solution code:
N,A = int(input().split())
B = N * N - A
print(B)

Submission status: Runtime Error

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

a,b,c,d,e,f = map(int,input().split())

max_water = f // 100 * a
max_sugar = f // c

water = []
for i in range(max_water):
    for j in range(max_water):
        water.append(100*a*i+100*b*j)

sugar = []
for i in range(max_sugar):
    for j in range(max_sugar):
        sugar.append(c*i+d*j)

answer = 0
anssugar = 0
answater = 0

for i in range(len(water)):
    for j in range(len(sugar)):
        if water[i] == 0 and sugar[j] == 0:
            continue
        con = 100 * sugar[j] / (water[i] + sugar[j])
        if answer < con and con <= e and sugar[j] + water[i] <= f :
            answer = con
            anssugar = sugar[j]
            answater = water[i]

print(answater+anssugar,anssugar)

Submission status: Runtime Error

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

n = int(input(n))
a = int(input(a))

print(n*n-a)

Submission status: Runtime Error

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

n = input(n)
a = input(a)

print(n*n-a)

Submission status: Runtime Error

Solution code:
# https://atcoder.jp/contests/abc074/tasks/abc074_a

import itertools
import collections
import bisect

def main():
    N = int(input())
    A = int(input())
    print(N * N - a)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
num1,num2=input().split()
num1=int(num1)
num2=int(num2)
print(num1*num1-num2)

Submission status: Runtime Error

Solution code:
n=int(input())
k=int(input())

x=list(map(int,input().split()))
a=0
for i in range(n):
  a+=min(x[i]*2,(k-x[i])*2)
  
print(a)

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((N*N)-A)

Submission status: Runtime Error

Solution code:
N,A = map(int,input().split())
print((N*N)-A)

Submission status: Runtime Error

Solution code:
print(int(input)**2-int(input()))

Submission status: Runtime Error

Solution code:
N = int(input())
S = input()

used_list = []
num = 0

def DFS(i,used_list,num):
    if i == N:
        num += 1
        return num

    s = S[i]
    # S[i]を使わない場合
    num = DFS(i+1,used_list,num)

    # S[i]を使う場合
    if s not in used_list:
        used_list.append(s)
        num=DFS(i+1,used_list,num)
        if len(use_list)>0:
            used_list.pop(-1)
    return num
    
       
ans = DFS(0,used_list,num)
print(ans-1)

Submission status: Runtime Error

Solution code:
import scipy as sp

total_cost = 0

N, M = (map(int, input().split()))
A = sp.array(list(map(int, input().split())))
B = sp.array(list(map(int, input().split())))

AB_list = sp.stack([A, B]).T

AB = AB_list[:, AB_list[0,:].argsort()]

A_list = AB[0,:]
B_list = AB[1,:]
for i in range(N):
    if B_list[i]<M:
        M = M - B_list[i]
        total_cost =  total_cost + A_list[i] * B_list[i]
    else:
        total_cost = total_cost + M * A_list[i]
print(total_cost)

Submission status: Runtime Error

Solution code:
N=int,input()
A=int,input()
print(N*N-A)

Submission status: Runtime Error

Solution code:
N,A=map(int,input().split())
print(N*N-A)

Submission status: Runtime Error

Solution code:
#ABC074C
A,B,C,D,E,F=map(int,input().split())
ans=-1
sw=100*A #SugarWater
s=0 #Sugar
for a in range(0,F+1,100*A):
	for b in range(0,F-a+1,100*B):
		if a+b!=0:
			for c in range(0,F-a-b+1,C):
				d=(E*(a+b)//100 -c)//D
				d*=D
				if d<0:
					break
				if 0<a+b+c+d<=F and 0<a+b:
					if ans < (c+d)/(a+b+c+d):
						ans=(c+d)/(a+b+c+d)
						sw=a+b+c+d
						s=c+d
print(sw,s)

Submission status: Runtime Error

Solution code:
def get_num():
    n = int(input())
    w = int(input())
    return n,w

def check_range(n,w):
    return n in range(1,101) and w in range(n**2)


def black_tiles(n,w):
    if (check_range(n,w)):
        return n**2 - w
    else:
        raise Exception('Value out of range')


if (__name__=='__main__'):
    n,w = get_num()
    print(black_tiles(n,w))

Submission status: Runtime Error

Solution code:
def get_num():
    n = int(input())
    w = int(input())
    return n,w

def check_range(n,w):
    return n in range(1,101) and w in range(n**2)

def black_tiles(n,w):
    if (check_range(n,w)):
        return n**2 - w
    else:
        raise Exception('Value out of range')

if (__name__=='__main__'):
    print(black_tiles(*get_num()))

Submission status: Runtime Error

Solution code:
n,a=map(int, input().split());print(n**2-a)

Submission status: Runtime Error

Solution code:
print(input()**2-input())

Submission status: Runtime Error

Solution code:
n = int(input())
l = list(map(int, input().split()))
def memo(n) :
    me = [-1]*(n+1)
    global l
    def f(n) :
        if n == 0 :
            return 0
        elif n == 1 :
            return abs(l[0] - l[1])
        else :
            if me[n] != -1 :
                return me[n]
            else :
                me[n] = min([f(n - 2) + abs(l[n - 2] - l[n]),f(n - 1) + abs(l[n - 1] - l[n])])
                return me[n]
    return f(n)
print(memo(n - 1))

Submission status: Runtime Error

Solution code:

import collections

def get_lim(n):
    # for i in range(n):
    #     if i * i > n:
    #         return i + 1
    return pow(10, int((len(str(n)) / 2)))

def prime_factor(n, length):
    ass = collections.defaultdict(int)
    # break_num = pow()
    # for i in range(2,int(n**0.5)+1):
    lim = get_lim(n)
    for i in range(2, lim + 1):
        # print(pow(i, length),  n)
        # if pow(i, length) > n:
        #     break
        if i > n or n == 1:
            break
        # i = pow(i, num)
        while n % i==0:
            ass[i] += 1
            n = n//i

    if n != 1:
        ass[n] += 1
    return ass

if __name__ == '__main__':
    length, num = list(map(int, input().split()))

    if length == 1:
        print(num)
    else:

        soinnsuu = prime_factor(num, length)
        ans = 1
        # print(soinnsuu)
        for data in soinnsuu.keys():
            if soinnsuu[data] >= length:
               ans *= data
        print(ans)

Submission status: Runtime Error

Solution code:
#encoding:utf-8

import math
import sympy

N,P = map(int,input().split())

facters = sympy.factorint(P)

ans = 1
for key in facters.keys():
    if facters[key]/N >= 1:
        ans *= key**(facters[key]//N)
print(int(ans))

Submission status: Runtime Error

Solution code:
n, a = [int(input) for _ in range(2)]
print(n*n - a)

Submission status: Runtime Error

Solution code:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(x, y):
    return (x * y) // gcd(x, y)



M, N = map(int, input().split())
S = input()
T = input()

MA = [S[0]]
NA = [T[0]]

L = lcm(M, N)

m = L/M
n = L/N

for i in range(M):
    if i % n == 0:
        MA.append(S[i])

for i in range(N):
    if i % m == 0:
        NA.append(T[i])

if MA == NA:
    print(L)
else:
    print("-1")

Submission status: Runtime Error

Solution code:
N,A = map(int,input().split())

M = N*N-A

print(M)

Submission status: Runtime Error

Solution code:
N,A = map(int,input().split())

print(N**2-A)

Submission status: Runtime Error

Solution code:
print(int(input()**2-int(input()))

Submission status: Runtime Error

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

print(N*N-A)

Submission status: Runtime Error

Solution code:
def solve():
    A, B, C, D, E, F = map(int, input().split())
    memo = {}
    
    for a in range(31):
        for b in range(31):
            for c in range(101):
                for d in range(101):
                    w = (100*A)*a + (100*B)*b
                    s = C*c + D*d
                    if w ==0:
                        break
                    if w+s > F:
                        break
                    else:
                        if w/100 * E >= s:
                            dist = 100*s/(w+s)
                            memo[a,b,c,d] = dist
    
    max_v = max(memo.values())
    
    for k, v in memo.items():
        if v == max_v:
            print((100*A)*k[0] + (100*B)*k[1] + C*k[2] + D*k[3], C*k[2] + D*k[3] )
            break
 
if __name__ == '__main__':
	solve()

Submission status: Runtime Error

Solution code:
A,B,C,D,E,F= map(int, input().split())
res_dict = {}
x_list = []
for i in range(F // A + 1):
    for j in range((F - 100 * A * i) // B + 1):
        x = 100 * (i * A + j * B)
        if x <= F:
            x_list.append(x)
x_uniq = list(set(x_list))
for x in x_uniq:
    for i in range((F - x) // C + 1):
        for j in range((F - x - C * i ) // D + 1):
            y = i * C + j * D
            if x + y <= F and x + y != 0 and x != 0 and ((y / (x + y) <= (E / (100 + E)))):
                res_dict[x] = y
res_dict2 = {}
for i in res_dict:
    res_dict2[res_dict[i]/i] = i
print(res_dict)
print("{0} {1}".format(int(((1 + max(res_dict2))*res_dict2[max(res_dict2)])),int(max(res_dict2)*res_dict2[max(res_dict2)])))

Submission status: Runtime Error

Solution code:
N = int(input())
K = int(input())
x = list(map(int,input().split()))

cnt = 0
for i in x:
    cnt += 2 * min(i,K - i)

print(cnt)

Submission status: Runtime Error

Solution code:
print('{}'.format(int(input())**2-int(input()))

Submission status: Runtime Error

Solution code:
a, b, c, d, e, f = map(int, input().split())
max_concentration = 0
for i in range(0, f + 1, 100 * a):
    for j in range(0, f - i + 1, 100 * b):
        if i == 0 and j == 0:
            continue
        y = min((i + j) * e // 100, f - i - j)
        for k in range(0, y + 1, c):
            for l in range(0, y - k + 1, d):
                concentration = 100 * (k + l) / (i + j + k + l)
                if max_concentration < concentration:
                    max_concentration = concentration
                    res1 = i + j + k + l
                    res2 = k + l
print(str(res1) + ' ' + str(res2))

Submission status: Runtime Error

Solution code:
1 2 10 20 15 200

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
print(N * N - M)

Submission status: Runtime Error

Solution code:

a,b,c,d,e,f=(int(i) for i in input().split())
w,s,num=set(),set(),0
ans=[0,0]
max_salt=int(e*f/((100+e)*1.0))
for i in range(((f-f%(a*100))//(a*100))+1):#//は切り捨て除算
    #Aの何倍が最適かを網羅的に走査
    for j in range(((f-f%(b*100))//(b*100))+1):
        if i*a*100+j*b*100<=f:
            w.add(i*a*100+j*b*100)
        else:
            break
for i in range((max_salt-max_salt%c)//c+1):
    for j in range((max_salt-max_salt%d)//d+1):
        if i*c+j*d<=max_salt:
            s.add(i*c+j*d)
        else:break

w2,s2=sorted(list(w)),sorted(list(s))
for i in w2:
    for j in s2:
        if 0<i+j<=f and e*i-100*j>=0 and (i+j)*num<j:
            num=j/((i+j)*1.0)
            ans[0]=i
            ans[1]=j
print(sum(ans),ans[1])

Submission status: Runtime Error

Solution code:

a,b,c,d,e,f=(int(i) for i in input().split())
w,s,num=set(),set(),0
ans=[0,0]
max_salt=int(e*f/((100+e)*1.0))
for i in range(((f-f%(a*100))//(a*100))+1):
    for j in range(((f-f%(b*100))//(b*100))+1):
        if i*a*100+j*b*100<=f:
            w.add(i*a*100+j*b*100)
        else:
            break
for i in range((max_salt-max_salt%c)//c+1):
    for j in range((max_salt-max_salt%d)//d+1):
        if i*c+j*d<=max_salt:
            s.add(i*c+j*d)
        else:break

w2,s2=sorted(list(w))[::-1],sorted(list(s))[::-1]
for i in w2:
    for j in s2:
        if 0<i+j<=f and e*i-100*j>=0 and (i+j)*num<j:
            num=j/((i+j)*1.0)
            ans[0]=i
            ans[1]=j
print(sum(ans),ans[1])

Submission status: Runtime Error

Solution code:
a,b,c,d,e,f = (int(i) for i in input().split())
w,s,num,answer = set(),set(),0,[a*100,0]
for i in range((f-f%(a*100))//(a*100)+1):
	for j in range((f-f%(b*100))//(b*100)+1):
		if i*a*100+j*b*100 <= f:
			w.add(i*a*100+j*b*100)
		else:
			break
smax = int(e*f/((100+e)*1.0))
for i in range((smax-smax%c)//c+1):
	for j in range((smax-smax%d)//d+1):
		if i*c+j*d <= smax:
			s.add(i*c+j*d)
		else:
			break
w2,s2 = sorted(list(w))[::-1],sorted(list(s))[::-1]
for i in w2:
	for j in s2:
		if 0 < i+j <= f and e*i>=100*j and num<(j/((i+j)*1.0)):
			num =  j/((i+j)*1.0)
			answer = [i,j]
print(sum(answer),answer[1])

Submission status: Runtime Error

Solution code:
n=int(input())
k=int(input())
l=[int(x) for x in input().split()]
s=0
for i in range(n):
  if abs(l[i]-k)>abs(l[i]):
    s+=abs(l[i])
  else:
    s+=abs(l[i]-k)
print(s*2)

Submission status: Runtime Error

Solution code:
n,a=(int(input() for i in range(2))
print(n**2-a)

Submission status: Runtime Error

Solution code:
n,a = list(map(lambda x: int(x), input().split(" ")))
print(n**2-a)

Submission status: Runtime Error

Solution code:
A, B, C, D, E, F = map(int, input().split())
def gcd(x, y):
    xx = (abs(x+y)-abs(x-y)) // 2
    yy = (abs(x+y)+abs(x-y)) // 2
    if yy % xx == 0:
        return xx
    else:
        return gcd(yy % xx, xx)
 
g = gcd(C, D)
Cmax = 0
Hmax = 0
Smax = 0
for p in range(F // (100*A) + 2):
    for q in range((F - 100*p*A) // (100*B) + 2):
        H2O = 100 * p * A + 100 * q * B
        lev = min([F - H2O, E*H2O // 100])
        sugar = 0
        if lev > 0 and H2O != 0:
            if lev < C:
                sugar = 0
            elif lev < C + D - q:
                sugar = max([(lev // C)*C, (lev//D)*D,])
            else:
                sugar = (lev // g) * g
            if Cmax*(H2O+sugar) <= sugar:
                Cmax = sugar / (H2O+sugar)
                Hmax = H2O
                Smax = sugar
import time
time.sleep(A*0.08)
print("{0} {1}".format(Smax+Hmax, Smax))

Submission status: Runtime Error

Solution code:
A, B, C, D, E, F = map(int, input().split())
def gcd(x, y):
    xx = (abs(x+y)-abs(x-y)) // 2
    yy = (abs(x+y)+abs(x-y)) // 2
    if yy % xx == 0:
        return xx
    else:
        return gcd(yy % xx, xx)

g = gcd(C, D)
Cmax = 0
Hmax = 0
Smax = 0
for p in range(F // (100*A) + 2):
    for q in range((F - 100*p*A) // (100*B) + 2):
        H2O = 100 * p * A + 100 * q * B
        lev = min([F - H2O, E*H2O // 100])
        sugar = 0
        if lev > 0 and H2O != 0:
            if lev < C:
                sugar = 0
            elif lev < C + D - q:
                sugar = max([(lev // C)*C, (lev//D)*D,])
            else:
                sugar = (lev // g) * g
            if Cmax*(H2O+sugar) <= sugar:
                Cmax = sugar / (H2O+sugar)
                Hmax = H2O
                Smax = sugar

print("{0} {1}".format(Smax+Hmax, Smax))

Submission status: Runtime Error

Solution code:
n,a=map(int,input().split())
print((n*n)-a)

Submission status: Runtime Error

Solution code:
n,a=map(int,input().split())
print(n*n-a)

Submission status: Runtime Error

Solution code:
n,a=map(int,input().split())
print(n**2-a)

Submission status: Runtime Error

Solution code:
n,a=map(int,input().split)
print(n**2-a)

Submission status: Runtime Error

Solution code:
N=int(input())
n,a=[int(input()) for i in range(N)]
print(n**n - a)

Submission status: Runtime Error

Solution code:
a,b = map(int,input().sp;lit())
print(a**2 -b)

Submission status: Runtime Error

Solution code:
"""
    N×N のマス目があります。
    このマス目の各マスを白色または黒色に塗ることにしました  (すべてのマスをどちらか片方の色に塗ります)。
    ちょうど A マスを白色に塗るとき、黒色に塗ることになるマスはいくつあるでしょうか。
"""

"""
    標準入力は以下の形式で与えられる
    -------------------------------
    N
    A
"""

"""
    N,Aの条件
    ------------------
    1 <= N & N <= 100
    0 <= A & A <= N**2
"""

"""
    出力
    -----------------
    黒色に塗るマスの個数を出力する
"""

if __name__ == "__main__":

# Nの入力チェック---------------------------------------------------
    while True:   
        try:
            N = int( input("整数Nを入力してください。:") )
            if (1 <= N) & (N <= 100):
                break
            else:
                print("入力が規定の範囲内に収まっていません。")
                print("--------------------------------------")

        except ValueError:
            print("Nの入力エラーです")
            print("--------------------------------------")            

# Aの入力チェック----------------------------------------------------
    while True:   
        try:
            A = int( input("整数Aを入力してください。:") )
            if (1 <= A) & (A <= N*N):
                break
            else:
                print("入力が規定の範囲内に収まっていません。")
                print("--------------------------------------")

        except ValueError:
            print("Aの入力エラーです")
            print("--------------------------------------")            

# 関数の実行--------------------------------------------------
    print(" ###### Result ######")
    print(N**2 - A)

Submission status: Runtime Error

Solution code:
n = int(input())
print(n**2 - int(input())

Submission status: Runtime Error

Solution code:
N,A = map(int,input().split())
print(N * N - A)

Submission status: Runtime Error

Solution code:
A.py

Submission status: Runtime Error

Solution code:
N, A = map(int,input().split())
t=N**2-A
print(t)

Submission status: Runtime Error

Solution code:
N, A = map(int,input().split())
t=N^2-A
print(t)

Submission status: Runtime Error

Solution code:
 N=int(raw_input())
A=int(raw_input())
prom N*N-A

Submission status: Runtime Error

Solution code:
#import numpy as np

def FindMaxCon(res, water, C, D, E):
  c = 0
  d = 0
  tmpCon = 0
  dp = list([False] * 3001)
  dp[0] = True
  for i in range(3001):
    if(i - C >= 0 and i - D >= 0):
      dp[i] = dp[i - C] or dp[i - D]
    elif(i - C >= 0):
      dp[i] = dp[i - C]
    elif(i - D >= 0):
      dp[i] = dp[i - D]
  tmpSugar = 0
  for i in range(min(res, int(E * water / 100)) + 1):
    if(dp[i]):
      tmpSugar = i
  ans = tmpSugar
  return ans

A, B, C, D, E, F = (int(_) for _ in input().split())
amax = F / (A * 100)
bmax = F / (B * 100)
amax = int(amax)
bmax = int(bmax)
water = 0
sugar = 0
waterAns= 100 * A
sugarAns = 0
con = 0
conAns = 0
for a in range(1, amax + 1):
  for b in range(bmax + 1):
    water = 100 * (a * A + b * B)
    if(water > F):
      continue
    else:
      res = F - water
      tmp = FindMaxCon(res, water, C, D, E)
      sugar = tmp
      con = sugar / water
      if(con > conAns):
        conAns = con
        waterAns = water
        sugarAns = sugar
answer = str(waterAns + sugarAns) + " " + str(sugarAns)
print(answer)

Submission status: Runtime Error

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

print(a*a-b)

Submission status: Runtime Error

Solution code:

if __name__ == "__main__":
  input1 = input()
  input2 = input()

  print (input1*input1 - input2)

Submission status: Runtime Error

Solution code:

input1 = input()
input2 = input()

print (input1*input1 - input2)

Submission status: Runtime Error

Solution code:
n = int(raw_input())
m = int(raw_input())
print( n*n - m )

Submission status: Runtime Error

Solution code:
a,b = list(map(int,input().split()))
print(a*a-b)

Submission status: Runtime Error

Solution code:
if __name__ == "__main__":
    N = int(input())
    K = int(input())
    x = list(map(int, input().split()))
    ans = 0
    for i in range(N):
        r = min(x[i],abs(K-x[i]))
        ans += 2*r
    print(ans)

Submission status: Runtime Error

Solution code:
if __name__ =='__main__':
    N = input()
    A = input()
    ans = N**2-A
    print(ans)

Submission status: Runtime Error

Solution code:
if __name__ =='__main__':
    N ＝ input()
    A = input()
    ans = N**2 - A
    print(ans)

Submission status: Runtime Error

Solution code:
if __name__ =='__main__':
    N ＝ input()
    A = input()
    ans = N**2 - A
    print ans

Submission status: Runtime Error

Solution code:
if __name__ =='__main__':
    N ＝ raw_input()
    A = raw_input()
    ans = N**2 - A
    print ans

Submission status: Runtime Error

Solution code:
if __name__ =='__main__':
    N ＝ raw_input()
    A = raw_input()
    ans = N**2 - A
    return N-A

Submission status: Runtime Error

Solution code:
if __name__ =='__main__':
    N ＝ raw_input()
    A = raw_input()
    N = N**2
    return N-A

Submission status: Runtime Error

Solution code:
NUM = int(input())
K = int(input())
POS = list(map(int, input().split()))
sum = 0
for i in POS:
    a = pow(i, 2)
    b = pow(abs((i - K)), 2)
    sum += min(a, b)
print(sum)

Submission status: Runtime Error

Solution code:
inf = 10 ** 9

n = int(input())
dp = [[inf for i in range(n)] for j in range(n)]
a = [[0 for i in range(n)] for j in range(n)]

for i in range(n):
	j = 0
	for e in map(int, input().split()):
		a[i][j] = e
		dp[i][j] = e
		j += 1
for i in range(n):
	dp[i][i] = inf

# washal_floyd
ret = 0
for i in range(n):
	for j in range(n):
		for k in range(n):
			if i == j or j == k or i == k:
				continue
			if dp[i][k] == inf or dp[k][j] == inf:
				continue
			if dp[i][k] + dp[k][j] == a[i][j]:
				dp[i][j] = inf
			elif dp[i][k] + dp[k][j] < a[i][j]:
				ret = -1
				break
if ret == 0:
	for i in range(n):
		for j in range(n):
			if dp[i][j] != inf:
				ret += dp[i][j]
print(int(ret/2))

Submission status: Runtime Error

Solution code:
a = list(map(int,input().split()))
big = a[1] * 100
small = a[0] * 100
concentration = 0
maxtotal = 0
maxsugar = 0
timesb = int(a[5] / big)
timess = int(a[5] / small)
for i in range(timesb + 1):
	waterb = big * i
	for j in range(timess + 1):
		waters = small * j
		watert = waterb + waters
		if watert >= a[5]:
			break
		else:
			for c in range(0,a[5] - watert,a[2]):
				for d in range(0,a[5] - watert - c,a[3]):
					sugart = c + d
					total = watert + sugart
					if watert != 0 and total <= a[5] and sugart <= (watert / 100) * a[4]:
						tempconcentration = (sugart / total) * 100
						if tempconcentration > concentration:
							concentration = (sugart / total) * 100
							maxtotal = total
							maxsugar = sugart
print('{0} {1}'.format(maxtotal,maxsugar))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b,c,d,e,f= map(int, input().split())
youeki=0
yousitu=0
noudo=0
n_a=int(f/(100*a))


for i in range(2+n_a):
 for j in range(2+int((f-100*i*a)/(100*b))):
  for k in range(2+int((f-100*i*a-100*j*b)/c)):
   for l in range(2+int((f-100*i*a-100*j*b-k*c)/d)):
    S=100.0*a*i+100.0*b*j+c*k+d*l
    T=c*k+d*l
    if S!=0:
     L=100.0*T/S
     if S<=f and L<=100*e/(100+e) and L>noudo:
      noudo=L
      youeki=S
      yousitu=T
print(int(youeki),int(yousitu))

Submission status: Runtime Error

Solution code:
N=int(input())
a=int(input())

print(N**2-A)

Submission status: Runtime Error

Solution code:
def Warshall_Floyd(edges,N):
  """頂点N個のグラフ上の隣接行列edgesが与えられたとき, 
  2点間の最短距離距離を隣接行列で返す"""
  for k in range(N):
    for i in range(N):
      for j in range(N):
        edges[i][j]=min(edges[i][j],edges[i][k]+edges[k][j])
  return edges
 
import sys
from sys import stdin
input = stdin.readline
N=int(input())
A=[list(map(int,input().split())) for i in range(N)]
B=Warshall_Floyd(A,N)
if A!=B:
  print(-1)
  sys.exit()
 
ans=0
for i in range(N):
  for j in range(i):
    need=1
    for k in range(N):
      if k!=i and k!=j:
        if A[i][j]==A[i][k]+A[k][j]:
          need=0
          break
    ans+=need*A[i][j]
print(ans)