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())
density = 0
for i in range(F//(100*A) +1):
    for j in range((F-100*A*i)//(100*B)+1):
        water = 100*A*i + 100*B*j
        if water == 0:
            continue
        for k in range((F-water)//C+1):
            for l in range((F-water-C*k)//D+1):
                sugar = C*k + D*l
                if density < sugar/(sugar + water) and sugar <= (E/100)*water:
                    density = sugar/(sugar + water)
                    ans = [sugar+water, sugar]
print(ans[0], ans[1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#pypyは内包表記使わない
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    A, B, C, D, E, F = map(int, input().split())
    rate = 0
    res_water = min(A, B) * 100
    res_sugar = 0
    for i in range(30//A+1):
        for j in range(30//B+1):
            if i==0 and j==0:
                continue
            water = A*i + B*j
            if water*100 > F:
                continue
            limit = water * E
            for s in range(limit//C+1):
                sugar = limit - (limit-C*s)%D
                if water*100 + sugar > F:
                    continue
                if rate < sugar/(sugar+water*100):
                    rate = sugar/(sugar+water*100)
                    res_water = water * 100
                    res_sugar = sugar
    print(res_water+res_sugar, res_sugar)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N**2-A

Submission status: Runtime Error

Solution code:
print(N**2-A)

Submission status: Runtime Error

Solution code:
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
# 辺の必要性
f = [[True] * n for _ in range(n)]
for k in range(n):
    for i in range(n):
        for j in range(n):
            # ワーシャルフロイドの更新が適用されたらダメ
            # 迂回路も最短コストなら直結路は不要
            if a[i][k] + a[k][j] < a[i][j]:
                print(-1)
                exit()
            elif a[i][k] + a[k][j] == a[i][j] and i != k and k != j:
                f[i][j] = False

ans = 0
for i in range(n):
    for j in range(n):
        if f[i][j]:
            ans += a[i][j]
ans //= 2
print(ans)

Submission status: Runtime Error

Solution code:
A,B,C,D,E,F=map(int,input().split())
maxx=0
s=1
t=0
for i in range(F//(100*B)+1):
    for j in range((F-i*100*B)//(100*A)+1):
        for k in range(((i*B+j*A)*E)//D+1):
            for l in range (((i*B+j*A)*E-k*D)//C+1):
                if i==0 and j==0 and k==0 and l==0:
                    continue
                if (100*(i*B+j*A)+k*D+l*C)>F:
                    break
                elif (k*D+l*C)/(k*D+l*C+100*(i*B+j*A))>maxx:
                    maxx=(k*D+l*C)/(k*D+l*C+100*(i*B+j*A))
                    s=(k*D+l*C+100*(i*B+j*A))
                    t=k*D+l*C

print(s,t)

Submission status: Runtime Error

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

print(n*n-a)

Submission status: Runtime Error

Solution code:
from scipy.sparse.csgraph import floyd_warshall
N = int(input())
dic = [0]*N
for i in range(N):
  dic[i] = [int(c) for c in input().split()]

d = floyd_warshall(dic)
ans = 0
for i in range(N-1):
  for j in range(i+1,N):
    if d[i][j] < dic[i][j]:
      print(-1)
      break
    elif dic[i][j] == d[i][j]:
      flag = False
      for k in range(N):
        if k==i or k==j:
          continue
        if d[i][j] == d[i][k]+d[k][j]:
          flag = True
          ans = -1
          break
      if flag:
        continue
    ans += dic[i][j]

print(ans)

Submission status: Runtime Error

Solution code:
int s = int(input());
int s1 = int(input());
print(s*s-s1);

Submission status: Runtime Error

Solution code:
a=open(0).read();print(int(a[0])**2-int(a[2]))

Submission status: Runtime Error

Solution code:
A, B, C, D, E, F = [int(x) for x in input().split()]
a_water = 0
a_sugar = 0
a_conc = 0
max_conc = 100 * E / (100 + E)
for i in range(F//(100*A) + 1):
    for j in range(F//(100*B) + 1):
        water = i * 100 * A + j * 100 * B
        ms = E * water
        for k in range(ms//C + 1):
            for l in range(ms//D + 1):
                sugar = k * C + l * D
                conc = 100 * sugar / (water + sugar) if water + sugar > 0 else 0
                if water + sugar <= F and conc <= max_conc and a_conc < conc:
                    a_water = water
                    a_sugar = sugar
                    a_conc = conc
                else:
                    pass
print(a_water + a_sugar, a_sugar)

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:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, A;
  cin >> N >> A;
  cout << N*N-A << endl;
}

Submission status: Runtime Error

Solution code:
# 入力 : 数字2つ
N, A = map(int, input().split())

# 出力　N^2-A
ans = N * N - A
print(ans)

Submission status: Runtime Error

Solution code:
# 入力 : 数字2つ
N, A = map(int, input().split())

# 出力　N^2-A
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 = input(int())
a = input(int())
print(n*n-a)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:


#import numpy as np

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

Submission status: Runtime Error

Solution code:


import numpy as np

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

Submission status: Runtime Error

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

print(abs(n**2-a)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

water=[]
for i in range(31):
    for j in range(30):
        if (A*i+B*j)*100<=F:
            water.append((A*i+B*j)*100)
sugar=[]
for i in range(501):
    for j in range(500):
        if C*i+D*j<=F//2:
            sugar.append(C*i+D*j)

ans_sum=A*100
ans_sugar=0
ans_rate=0
for i in water:
    for j in sugar:
        if i==0:
            continue
        if i+j<=F and ans_rate<j/i<=E/100:
            ans_sum=i+j
            ans_sugar=j
            ans_rate=j/i

print(ans_sum,ans_sugar)

Submission status: Runtime Error

Solution code:
n = int(input())
k = int(input())
b = list(map(int, input().split())) 

sum = 0
for ball in b:
  sum += ball - 0 if (ball - 0) < k - ball else k - ball
  
  print(sum*2)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A, B, C, D, E, F = map(int, input().split())
max_sugar = E / (100 + E)
res = 0 
ans = [0, 0]
for a in range(F // 100*A + 1): 
        for b in range(F // 100*B + 1): 
                for c in range(int(F * max_sugar) // C + 1):
                        for d in range(int(F * max_sugar) // D + 1): 
                                mass = 100*A*a + 100*B*b + C*c + D*d 
                                sugar = C*c + D*d 
                                if 0 < mass <= F and sugar / mass <= max_sugar:
                                        if res <= sugar / mass:
                                                res = sugar / mass 
                                                ans = [mass, sugar]
                                else:
                                        break
print(str(ans[0]) + " " + str(ans[1]))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math

A,B,X = map(int,input().split())

# A * N + B * d(N) yen 

check_num = [1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000]

if((A*1+B*1)>X):
    print(0)
else:
    flag = True
    for i in range(len(check_num)):
        if((A*check_num[i]+B*(i+1)) > X):
            flag = False
            i=i-1
            break
    if(flag):
        print(10**9)
    else:
        value = math.ceil((X - B*(i))/A)
        print(value-1)

Submission status: Runtime Error

Solution code:
a,b,c,d,e,f=map(int,input().split())
a*=100
b*=100
x=set()
for i in range(f//a+1):
    for j in range(f//b+1):
        if 0<(a*i+b*j)<=f:
            x.add(a*i+b*j)
y=set()
for i in range(f//c+1):
    for j in range(f//d+1):
        if 0<(c*i+d*j)<=f:
            y.add(c*i+d*j)

ans=[]
noudoma=e/100
for n in x:
    for m in y:
        if n==0:
            continue
        if m/n<=noudoma and (n+m)<=f:
            ans.append([n+m,m,m/(n+m)])

ans.sort(key=lambda x:x[2], reverse=True)


print(ans[0][0],ans[0][1])

Submission status: Runtime Error

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

w = {0}
s = {0}

for i in range(f+1):
    for j in range(f+1):
        x = 100 * (a * i + b * j)
        if x <= f:
            w.add(x)

for i in range(f+1):
    for j in range(f+1):
        y = c * i + d * j
        if y <= f:
            s.add(y)

s_list = list(s)
s_list.sort()
w_list = list(w)
w_list.sort()


c_ans = 0
s_ans = 0
w_ans = 0

for i in range(1, len(w_list)):
    for j in range(1, len(s_list)):
        z = int(100 * s_list[j] / (s_list[j] + w_list[i]))
        sum = w_list[i] + s_list[j]
        if z <= int(100 * e / (e + 100)) and z > c_ans and sum <= f:
            c_ans = z
            w_ans = w_list[i]
            s_ans = s_list[j]

print(str(w_ans + s_ans) + " " + str(s_ans))

Submission status: Runtime Error

Solution code:
from sys import stdin
import math
A, B, C, D, E, F = [int(x) for x in stdin.readline().rstrip().split()]

water = set()
for i in range(0, F//(100*A)+1):
    for j in range(0, F//(100*B)+1):
        water.add(A*i*100+B*j*100)

sugar = set()
capa = math.ceil(F/100)*E
for k in range(0, capa//C+1):
    for l in range(0, capa//D+1):
        sugar.add(C*k+D*l)

W = 0
S = 0
conc = 0
#print(water)
#print(sugar)
for w in water:
    for s in sugar:
        if w + s > F:
            continue
        if w+s == 0:
            continue
        if s > (w / 100)*E:
            continue
        tmp = (100*s)/(w+s)
        if tmp >= conc:
            conc = tmp
            W = w
            S = s
        #print(conc,w,s)
print(W+S,S)

Submission status: Runtime Error

Solution code:
# 整数を入力
a = int(input())
# 整数をスペース区切りで入力
b, c = map(int, input().split())
# 文字列を入力
s = input()
# 出力
print("{} {}".format(a+b+c, s))

Submission status: Runtime Error

Solution code:
def main():
    a, b, c, d, e, f = map(int, input().split())
    sugar = 0
    water = 0
    con = 0
    for i in range(f//100+1):
        if i%b == 0 or i%a == 0:
            w = i*100
            x = min(f-w, i*e)
            s = 0
        for j in range(x//c+1):
            ss = j*c
            s = max(s, ss+((x-ss)//d)*d)
        if w != 0:
            if con <= (100*s)/(w+s):
                water = w
                sugar = s
                con = (100*s)/(w+s)
    print(sugar+water, sugar)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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())
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:
n,a = int(input().split())
print((n*n)-a)

Submission status: Runtime Error

Solution code:
A, B, C, D, E, F = map(int, input().split(' '))
maxconc = 0.0
maxwater = 100*A
maxsugar = 0

for i in range(F//(100*A)+1):
  for j in range((F-100*A*i)//(100*B)+1):
    if i == 0 and j == 0:
      continue
    S =min(E*(A*i+B*j),F-100*(A*i+B*j))
    
    sugar=0
    for c in range(S//C+1):
      d = (S-c*C)//D
      sugar = max(sugar,c*C+d*D)
    conc = sugar / (sugar +100*(A*i+B*j))
    if conc > maxconc:
      maxconc = conc 
      maxwater = 100*(A*i+B*j)
      maxsugar = sugar
print('{0} {1}'.format(maxwater+maxsugar,maxsugar))

Submission status: Runtime Error

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

max_sugar = 0
max_water = 100*A
max_conc = 0.0
A_limit = F // (100*A)
for i in range(A_limit + 1):
    B_limit = (F-100*A*i) // (100*B)
    for j in range(B_limit + 1):
        if i == 0 and j == 0:
            continue
        sugar_limit = min(E * (A*i+B*j), F-100*(A*i+B*j))

        sugar_ = 0
        for c in range(sugar_limit//C + 1):
            d = (sugar_limit-c*C)//D
            temp_sugar = c*C + d*D
            sugar_ = max(sugar_, temp_sugar)
        temp_conc = sugar_/(sugar_+100*(A*i+B*j))
        if temp_conc > max_conc:
            max_conc = temp_conc
            max_water = 100*(A*i + B*j)
            max_sugar = sugar_
print('{0} {1}'.format(max_water+max_sugar, max_sugar))

Submission status: Runtime Error

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

print(N**2-A)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a, b, c, d, e, f = map(int, input().split())
max_a = f // (100*a)
max_b = f // (100*b)
max_c = f // c
max_d = f // d
wat = []
sug = []
for i in range(max_a + 1):
    for j in range(max_b + 1):
        w = 100 * a * i + 100 * b * j
        if w <= f and w > 0:
            wat.append(w)
for i in range(max_c + 1):
    for j in range(max_d + 1):
        s = c*i + d*j
        if s < f:
            sug.append(s)
ans = 0
for x in wat:
    for y in sug:
        if x + y <= f and y <= e * x // 100:
            if ans <= 100 * y // (x + y):
                ans =  100 * y // (x + y)
                out = [x+y, y]
print(*out)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,X=map(int, input().split())
L=list(map(int, input().split()))
s=[x for x in range(N) if sum(L[:x])<=X]
if N>=len(s):
  print(len(s))
else:
  print(N+1)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A, B, C, D, E, F = map(int, input().split())
# A *= 100
# B *= 100

max_solvent = 0
max_solute = 0
max_strength = 0.0

for na in range(0, 31):
    for nb in range(0, 31):
        for nc in range(0, 101):
            for nd in range(0, 101):

                solute = nc * C + nd * D
                solvent = 100 * na * A + 100 * nb * B

                # if not (any([na, nb]) and any([nc, nd])):
                    # continue
                if solvent == 0:
                    break

                if solute + solvent > F:
                    # print("exceeded")
                    break

                else:
                    # if (solvent/100) * E < solute:
                    if solvent/100 * E >= solute:
                    # print("exceeded2")
                    # break
                        strength = 100 * solute / (solute + solvent)
                        # print(strength, solvent+solute, solute)
                        if max_strength <= strength:
                            max_strength = strength
                            max_solute = solute
                            max_solvent = solute + solvent

print(max_solvent, max_solute)

Submission status: Runtime Error

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

x = []
y = []

k=0
i = 0
j = 0

#print(a,b,c,d,e,f)

while( 100*a*i + 100*b*j <= f ):
  while( 100*a*i + 100*b*j <= f):
    x.append(100*a*i + 100*b*j)
    j +=1
  j = 0
  i +=1
  
i = 0
j = 0
while( c*i + d*j <= f ):
  while( c*i + d*j <= f):
    y.append(c*i + d*j)
    j +=1
  j = 0
  i +=1
      
    
x = list(set(x))
y = list(set(y))

x.remove(0)
y.remove(0)
#print( x )
#print( y )

noudo = 0
reg_i = 0
reg_j = 0

for i in range(len(x)):
  for j in range(len(y)):
    tmp_noudo = 100 * y[j] / (x[i] + y[j])
    if  tmp_noudo <= 100 * e / (100 + e) and (x[i] + y[j]) <= f:
      if noudo < tmp_noudo:
        noudo = tmp_noudo
        reg_i = i
        reg_j = j
        

print( x[reg_i]+y[reg_j] , y[reg_j] )
        
      


#print( eki, satou)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N,A;
  cin>>N>>A;
  cout<<N*N-A<<endl;
}

Submission status: Runtime Error

Solution code:
#include <iostream>

using namespace std;

int main() {
	int N, A;
	cin >> N;
	cin >> A;
	cout << N * N - A << endl;
}

Submission status: Runtime Error

Solution code:
#include <iostream>

using namespace std;

int main() {
	int N, A;
	cin >> N;
	cin >> A;
	cout << N * N - A << endl;
	return 0;
}

Submission status: Runtime Error

Solution code:
#include <iostream>

using namespace std;

int main() {
	int N, A;
	cin >> N >> A;
	cout << N * N - A << endl;
	return 0;
}

Submission status: Runtime Error

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

x = []
y = []

k=0
i = 0
j = 0

#print(a,b,c,d,e,f)

while( 100*a*i + 100*b*j <= f ):
  while( 100*a*i + 100*b*j <= f):
    x.append(100*a*i + 100*b*j)
    j +=1
  j = 0
  i +=1
  
i = 0
j = 0
while( c*i + d*j <= f ):
  while( c*i + d*j <= f):
    y.append(c*i + d*j)
    j +=1
  j = 0
  i +=1
      
    
x = list(set(x))
y = list(set(y))

x.remove(0)
y.remove(0)
#print( x )
#print( y )

noudo = 0
reg_i = 0
reg_j = 0

for i in range(len(x)):
  for j in range(len(y)):
    w = (x[i] + y[j])
    tmp_noudo = 100 * y[j] / w
    if  tmp_noudo <= 100 * e / (100 + e) and w <= f:
      if noudo < tmp_noudo:
        noudo = tmp_noudo
        reg_i = i
        reg_j = j
        

print( x[reg_i]+y[reg_j] , y[reg_j] )

Submission status: Runtime Error

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

x = []
y = []

k=0
i = 0
j = 0

#print(a,b,c,d,e,f)

while( 100*a*i + 100*b*j <= f ):
  while( 100*a*i + 100*b*j <= f):
    x.append(100*a*i + 100*b*j)
    j +=1
  j = 0
  i +=1
  
i = 0
j = 0
while( c*i + d*j <= f ):
  while( c*i + d*j <= f):
    y.append(c*i + d*j)
    j +=1
  j = 0
  i +=1
      
    
x = list(set(x))
y = list(set(y))

x.remove(0)
y.remove(0)
#print( x )
#print( y )

noudo = 0
reg_i = 0
reg_j = 0

for i in range(len(x)):
  for j in range(len(y)):
    w = (x[i] + y[j])
    tmp_noudo = 100 * y[j] / w
    if  tmp_noudo <= 100 * e / (100 + e) and w <= f:
      if noudo < tmp_noudo:
        noudo = tmp_noudo
        reg_i = i
        reg_j = j
        

print( x[reg_i]+y[reg_j] , y[reg_j] )
        
      


#print( eki, satou)

Submission status: Runtime Error

Solution code:
n = int(input())

print((n*n) - a)

Submission status: Runtime Error

Solution code:
n = int(input())

print((n**n) - a)

Submission status: Runtime Error

Solution code:
N=input[]
A=input[]
print(N**2-A)

Submission status: Runtime Error

Solution code:
import numpy as np
import sys
sys.setrecursionlimit(4100000)

def sign(string):
    if not isinstance(string, np.str_)|isinstance(string, str):
        return type(string)
    if string=="SE":
        return -1
    elif string=="ES":
        return 1

def reverse(array):
    if not isinstance(array[0], np.str_)|isinstance(array[0], str):
        return type(array)
    if len(array)==1:
        if array[0]=="SE":
            return np.array(["ES"])
        elif array[0]=="ES":
            return np.array(["SE"])

    if array[-1]=="SE":
        return np.append(reverse(array[:-1]), "ES")
    elif array[-1]=="ES":
        return np.append(reverse(array[:-1]), "SE")
    
def wo_duplicate(array1, array2):
    flag = np.zeros(array1.shape)
    for array in array2:
        flag[array1==array] = 1

    return array1[flag==0]

def wo_duplicate_toho(array1, array2):
    flag = np.zeros(array1.shape)
    for array in array2:
        flag[(array1==array+"SE")|(array1==array+"ES")] = 1

    return array1[flag==0]

def split(array):
    if not isinstance(array, np.ndarray):
        if (isinstance(array, np.str_)|isinstance(array, str)):
            return np.array([array[:-2],array[-2:]])
        return
    if len(array)==1:
        return np.array([array[0][:-2],array[0][-2:]])[None]
#        return np.array(array[0][:-2]), np.array(array[0][-2:])
    return np.concatenate((split(array[:-1]), np.array([array[-1][:-2],array[-1][-2:]])[None]), axis=0)
#    return np.append(split(array[:-1])[0], array[-1][:-2]), np.append(split(array[:-1])[1], array[-1][-2:])
    
def merge(array1, array2):
    if not isinstance(array1, np.ndarray)&isinstance(array2, np.ndarray):
        if (isinstance(array1, np.str_)|isinstance(array1, str))&(isinstance(array2, np.str_)|isinstance(array2, str)):
            return np.array(["{}{}".format(array1,array2)])
        return
    if not len(array1)==len(array2):
        return
    if len(array1)==1:
        return np.array(["{}{}".format(array1[-1],array2[-1])])
    
    return np.append(merge(array1[:-1], array2[:-1]), "{}{}".format(array1[-1],array2[-1]))
    

def route(pos_now, pos_next, dist_next, goal, car_flag0, car_flag1, intersections, roads, max_v=2**32):
    
    #sort
    pos = np.argsort(dist_next)
    dist_next = dist_next[pos]
    pos_now = pos_now[pos]
    pos_next = pos_next[pos]

    #
    if pos_now[0] == goal:
        return int(dist_next[0])
    if np.all(dist_next == max_v):
        return -1

    car_flag1[car_flag0==pos_now[0]] = 1
    pos_now[0] = pos_next[0]
    renew = intersections[:,2][intersections[:,1]==pos_now[0]]
    renew = wo_duplicate(renew, car_flag0[car_flag1==1])
#    renew = np.unique(np.concatenate((renew, car_flag0[car_flag1==1])), return_counts=True)

    if pos_now[0] != goal:
        if len(renew) == 0:
            dist_next[0] = max_v    
        else:    
            pos_next[0] = renew[0]
            dist_next[0] += int(roads[:,1][roads[:,0]==pos_now[0][:-2]][0])
            
            if len(renew) > 1:
                pos_next = np.concatenate((pos_next, renew[1:]))
                pos_now = np.concatenate((pos_now, np.repeat(pos_now[0],len(renew)-1)))
                dist_next = np.concatenate((dist_next, np.repeat(dist_next[0],len(renew)-1)))
    
    return route(pos_now, pos_next, dist_next, goal, car_flag0, car_flag1, intersections, roads)

def route_toho(pos_now, pos_next, dist_next, goal, roads, toho_flag, road_co, dist_g, max_v=2**32):
    
    #sort
    pos = np.argsort(dist_next)
    dist_next = dist_next[pos]
    pos_now = pos_now[pos]
    pos_next = pos_next[pos]

    #
    if pos_now[0][:-2] == goal:
        return int(dist_next[0])
    if np.all(dist_next == max_v):
        return -1

    toho_flag[roads==pos_now[0][:-2]] = 1
    pos_now[0] = pos_next[0]
    
    renew = road_co[np.where(road_co==pos_next[0])[0]]
    if len(renew)!=0:      
        renew = renew[0,2:2+int(renew[0,1])]
        renew = split(renew[renew!=pos_next[0]])
        renew = merge(renew[:,0], reverse(renew[:,1]))
        renew = wo_duplicate_toho(renew, roads[toho_flag==1])

    if pos_now[0][:-2] == goal:
        dist_next[0] += int(roads[:,1][roads[:,0]==goal][0])*(1+sign(pos_now[0][-2:]))/2 - sign(pos_now[0][-2:])*int(dist_g)
    
    elif len(renew) == 0:
        dist_next[0] = max_v
    
    else:    
        pos_next[0] = renew[0]
        dist_next[0] += int(roads[:,1][roads[:,0]==pos_now[0][:-2]][0])
        
        if len(renew) > 1:
            pos_next = np.concatenate((pos_next, renew[1:]))
            pos_now = np.concatenate((pos_now, np.repeat(pos_now[0],len(renew)-1)))
            dist_next = np.concatenate((dist_next, np.repeat(dist_next[0],len(renew)-1)))
    
    return route_toho(pos_now, pos_next, dist_next, goal, roads, toho_flag, road_co, dist_g)

def main():
    header = np.array(list(map(int,input().split())))
    roads = np.array([input().split() for i in range(header[0])])
    intersections = np.array([input().split() for i in range(header[1])])
    parking_lots = np.array([input().split() for i in range(header[2])])
    delivery_destinations = np.array([input().split() for i in range(header[3])])
    query = np.array([input().split() for i in range(header[4])])
    car_flag0 = np.unique(intersections[:,1])
    toho = np.concatenate((parking_lots, delivery_destinations), axis=0)
    
    tmp = np.unique(intersections[:,0])
    road_co = np.full((len(tmp),len(roads)+2),"", dtype=intersections.dtype)
    road_co[:,0] = tmp[:]
    for i,intersection in enumerate(road_co[:,0]):
        tmp = intersections[:,2][intersections[:,0]==intersection]
        tmp = split(tmp)
        tmp = merge(tmp[:,0],reverse(tmp[:,1]))
        tmp = np.unique(np.concatenate((intersections[:,1][intersections[:,0]==intersection],tmp)))
        road_co[i,1] = len(tmp)
        road_co[i,2:2+len(tmp)] = tmp

    for q, pos1, pos2 in query:
                    
        if q == "0":
            car_flag1 = np.zeros_like(car_flag0, dtype=np.int8)
            road, dist_r = parking_lots[:,1:][parking_lots[:,0]==pos1][0]
            goal, dist_g = parking_lots[:,1:][parking_lots[:,0]==pos2][0]
    
            #道が同じだった場合
            if road == goal:
                if int(dist_r)*sign(road[-2:]) >= int(dist_g)*sign(goal[-2:]):
                    print( int(abs(int(dist_r) - int(dist_g))) )
                    continue
            else:
                car_flag1[car_flag0==road] = 1
                
            pos_next = intersections[:,2][intersections[:,1]==road+pos1[-2:]]
            l = int(roads[:,1][roads[:,0]==road][0])*(1-sign(pos1[-2:]))/2 + sign(pos1[-2:])*int(dist_r) + \
                int(roads[:,1][roads[:,0]==goal][0])*(1+sign(pos2[-2:]))/2 - sign(pos2[-2:])*int(dist_g)
            print( route(np.repeat(road+pos1[-2:], len(pos_next)), pos_next, \
                        np.repeat(l, len(pos_next)), goal+pos2[-2:], car_flag0, \
                        car_flag1, intersections, roads) )
        
        elif q == "1":
			continue
            toho_flag = np.zeros_like(roads, dtype=np.int8)
            road, dist_r = toho[:,1:][toho[:,0]==pos1][0]
            goal, dist_g = toho[:,1:][toho[:,0]==pos2][0]
            
#            for i in range(len(road_co)):
#                print(road_co[i,0],road_co[i,2:2+int(road_co[i,1])])
#            print(road_co)
#            print(roads)
#            return
            #道が同じだった場合
            if road == goal:
                print( int(abs(int(dist_r) - int(dist_g))) )
                continue
            else:
                toho_flag[roads==road] = 1

            pos_now = np.full(0, "")
            pos_next = np.full(0, "")
            l = np.zeros(0,dtype="i")
            for direction in ["SE", "ES"]:
                tmp = road_co[np.where(road_co==road+direction)[0]]
                tmp = tmp[0,2:2+int(tmp[0,1])]
                tmp = split(tmp[tmp!=road+direction])
                tmp = merge(tmp[:,0], reverse(tmp[:,1]))
                pos_now = np.concatenate((pos_now,np.repeat(road+direction,len(tmp))))
                pos_next = np.concatenate((pos_next,tmp))
                l = np.concatenate((l,np.repeat(int(roads[:,1][roads[:,0]==road][0])*(1-sign(direction))/2 + sign(direction)*int(dist_r),len(tmp))))
            print( route_toho(pos_now, pos_next, l, goal, roads, toho_flag, road_co, dist_g) )
            
        else:
            print(-1)
            

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N,A = open(0).read().split()
print(N**2-A)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input().split())
if a == b:
    print(c)
elif a == c:
    print(b)
else:
    print(a)

Submission status: Runtime Error

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

int main(){
  int N, A;
  cin >> N;
  cin >> A;
  int M;
  M = N * N;
  int ans;
  ans = M - A;
  cout << ans;
  return 0;
}

Submission status: Runtime Error

Solution code:
n, k = int(input()), int(input())
a = map(int, input().split())
sum = 0
for x in a :
  sum += min(x, abs(k-x)) * 2
print(sum)

Submission status: Runtime Error

Solution code:
import sys

N = int(input())
a = list(map(int,input().split()))

if a[0] != a[len(a)-1]^a[1]:
    print('No')
    sys.exit()

for i in range(1,N-1):
    if a[i] != a[i-1]^a[i+1]:
        print('No')
        sys.exit()

if a[len(a)-1] != a[len(a)-2]^a[0]:
    print('No')
    sys.exit()

print('Yes')

Submission status: Runtime Error

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

maxStrength = 0
ansMass = 100*A
ansSugar = 0
for i in range(100*A, F+1, 100*A):
        for j in range(0, F-i+1, 100*B):
                for k in range(0, F-i-j+1, C):
                        for l in range(0, F-i-j-k+1, D):
                                a = i + j
                                b = k + l
                                mass = a + b
                                if (a / 100)*E >= b and mass <= F and mass != 0:
                                        strength = (100*b) / mass
                                        if strength > maxStrength:
                                                maxStrength = strength
                                                ansMass = mass
                                                ansSugar = b

print(ansMass, ansSugar)