Basic mathematical functions operate element-wise on arrays. They are available both as operator overloads and as functions in the NumPy module. 

import numpy

a = numpy.array([1,2,3,4], float)
b = numpy.array([5,6,7,8], float)

print a + b                     #[  6.   8.  10.  12.]
print numpy.add(a, b)           #[  6.   8.  10.  12.]

print a - b                     #[-4. -4. -4. -4.]
print numpy.subtract(a, b)      #[-4. -4. -4. -4.]

print a * b                     #[  5.  12.  21.  32.]
print numpy.multiply(a, b)      #[  5.  12.  21.  32.]

print a / b                     #[ 0.2         0.33333333  0.42857143  0.5       ]
print numpy.divide(a, b)        #[ 0.2         0.33333333  0.42857143  0.5       ]

print a % b                     #[ 1.  2.  3.  4.]
print numpy.mod(a, b)           #[ 1.  2.  3.  4.]

print a**b                      #[  1.00000000e+00   6.40000000e+01   2.18700000e+03   6.55360000e+04]
print numpy.power(a, b)         #[  1.00000000e+00   6.40000000e+01   2.18700000e+03   6.55360000e+04]

Task  

You are given two integer arrays, $\mbox{A}$ and $\mbox{B}$ of dimensions $N$X$\mbox{M}$. 

Your task is to perform the following operations:

Add ($\mbox{A}$ + $\mbox{B}$)   
Subtract ($\mbox{A}$ - $\mbox{B}$)  
Multiply ($\mbox{A}$ * $\mbox{B}$)   
Integer Division ($\mbox{A}$ / $\mbox{B}$)  
Mod ($\mbox{A}$ % $\mbox{B}$)  
Power ($\mbox{A}$ ** $\mbox{B}$)

Note 

There is a method numpy.floor_divide() that works like numpy.divide() except it performs a floor division.  

Input Format

The first line contains two space separated integers, $N$ and $\mbox{M}$. 

The next $N$ lines contains $\mbox{M}$ space separated integers of array $\mbox{A}$. 

The following $N$ lines contains $\mbox{M}$ space separated integers of array $\mbox{B}$.  

Output Format

Print the result of each operation in the given order under Task.

Sample Input
1 4
1 2 3 4
5 6 7 8

Sample Output
[[ 6  8 10 12]]
[[-4 -4 -4 -4]]
[[ 5 12 21 32]]
[[0 0 0 0]]
[[1 2 3 4]]
[[    1    64  2187 65536]] 

Use // for division in Python 3.

Source: hackerrank | Difficulty: EASY


Solutions:
import numpy
(N, M) = map(int, input().split())
l1 = []
for _ in range(N):
	l1.append(numpy.array(input().split(), int))
l1 = numpy.array(l1)
l2 = []
for _ in range(N):
	l2.append(numpy.array(input().split(), int))
l2 = numpy.array(l2)
print(numpy.add(l1, l2))
print(numpy.subtract(l1, l2))
print(numpy.multiply(l1, l2))
print(l1 // l2)
print(numpy.mod(l1, l2))
print(numpy.power(l1, l2))


import numpy
import sys
c = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if c[0] > 1:
	b = b = list(map(int, input().split()))
a = numpy.array(a)
b = numpy.array(b)

def printing(d):
	print('[', end='')
	if c[0] > 1:
		print(d, end='\n')
		print(' ', end='')
		print(d, end='')
		print(']')
		return
	print(d, end='')
	print(']')
	return
printing(numpy.add(a, b))
printing(numpy.subtract(a, b))
printing(numpy.multiply(a, b))
printing(a // b)
printing(numpy.mod(a, b))
printing(numpy.power(a, b))


import numpy as np
(N, M) = [int(i) for i in input().split()]
a = []
for _ in range(N):
	a.append([int(i) for i in input().split()])
a = np.array(a)
b = []
for _ in range(N):
	b.append([int(i) for i in input().split()])
b = np.array(b)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy as np
(r, c) = [int(x) for x in input().split(' ')]
a = []
b = []
for _ in range(r):
	a.append([int(x) for x in input().split(' ')])
for _ in range(r):
	b.append([int(x) for x in input().split(' ')])
A = np.array(a, int).reshape((r, c))
B = np.array(b, int).reshape((r, c))
print(np.add(A, B))
print(np.subtract(A, B))
print(np.multiply(A, B))
print(A // B)
print(np.mod(A, B))
print(np.power(A, B))


from numpy import array
(N, M) = map(int, input().strip().split())
A = array([[int(i) for i in input().strip().split()] for _ in range(N)])
B = array([[int(i) for i in input().strip().split()] for _ in range(N)])
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy
a = []
b = []
(n, m) = [int(x) for x in input().split()]
for i in range(n):
	a.append([int(x) for x in input().split()])
for i in range(n):
	b.append([int(x) for x in input().split()])
a = numpy.array(a)
b = numpy.array(b)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy as np
[N, M] = list(map(int, input().split()))
(L1, L2) = ([], [])
for i in range(N):
	L1.append(list(map(int, input().split())))
for i in range(N):
	L2.append(list(map(int, input().split())))
npArr1 = np.array(L1)
npArr2 = np.array(L2)
print(np.add(npArr1, npArr2))
print(np.subtract(npArr1, npArr2))
print(np.multiply(npArr1, npArr2))
print(np.floor_divide(npArr1, npArr2))
print(np.mod(npArr1, npArr2))
print(np.power(npArr1, npArr2))


import numpy as np
l = list(map(int, input().split()))
array_A = []
array_B = []
for i in range(l[0]):
	array_A.append(list(map(int, input().split())))
for i in range(l[0]):
	array_B.append(list(map(int, input().split())))
np_array_A = np.array(array_A)
np_array_B = np.array(array_B)
print(np_array_A + np_array_B)
print(np_array_A - np_array_B)
print(np_array_A * np_array_B)
print(np_array_A // np_array_B)
print(np_array_A % np_array_B)
print(np_array_A ** np_array_B)


import numpy
(N, M) = map(int, input().split())
A = numpy.array([list(map(int, input().split())) for i in range(N)])
B = numpy.array([list(map(int, input().split())) for i in range(N)])
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy
s = range(int(input().split()[0]))
a = numpy.array([[int(x) for x in input().split()] for _ in s])
b = numpy.array([[int(x) for x in input().split()] for _ in s])
print(a + b, a - b, a * b, a // b, a % b, a ** b, sep='\n')


import numpy
(N, M) = map(int, input().split())
A = numpy.array([input().split() for _ in range(N)], int)
B = numpy.array([input().split() for _ in range(N)], int)
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy
(N, M) = map(int, input().split())
(Nlist, Mlist) = ([], [])
for _ in range(N):
	Nlist.append(list(map(int, input().split())))
for _ in range(N):
	Mlist.append(list(map(int, input().split())))
Nlist = numpy.array(Nlist)
Mlist = numpy.array(Mlist)
print(Nlist + Mlist)
print(Nlist - Mlist)
print(Nlist * Mlist)
print(Nlist // Mlist)
print(Nlist % Mlist)
print(Nlist ** Mlist)


from numpy import *
(n, m) = map(int, input().split())
a = array([[int(x) for x in input().split()] for _ in range(n)], int)
b = array([[int(x) for x in input().split()] for _ in range(n)], int)
print(a + b, a - b, a * b, a // b, a % b, a ** b, sep='\n')


import numpy
(N, M) = tuple(map(int, input().split()))
A = list()
for _ in range(N):
	A.append(list(map(int, input().split())))
ListA = numpy.array(A)
B = list()
for _ in range(N):
	B.append(list(map(int, input().split())))
ListB = numpy.array(B)
print(ListA + ListB)
print(ListA - ListB)
print(ListA * ListB)
print(ListA // ListB)
print(ListA % ListB)
print(ListA ** ListB)


import numpy
arr_shape = tuple(map(int, input().split()))
arr1 = []
arr2 = []
for i in range(arr_shape[0]):
	arr1.extend(list(map(int, input().split())))
arr1 = numpy.array(arr1)
arr1.shape = arr_shape
for i in range(arr_shape[0]):
	arr2.extend(list(map(int, input().split())))
arr2 = numpy.array(arr2)
arr2.shape = arr_shape
print(numpy.reshape(arr1 + arr2, arr_shape))
print(numpy.reshape(arr1 - arr2, arr_shape))
print(numpy.reshape(arr1 * arr2, arr_shape))
print(numpy.reshape(arr1 // arr2, arr_shape))
print(numpy.reshape(arr1 % arr2, arr_shape))
print(numpy.reshape(arr1 ** arr2, arr_shape))


import numpy
(n, m) = map(int, input().split())
a = numpy.array([input().split() for i in range(n)], int)
b = numpy.array([input().split() for i in range(n)], int)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(n, m) = map(int, input().split())
A = numpy.array([list(map(int, input().split())) for i in range(n)])
B = numpy.array([list(map(int, input().split())) for i in range(n)])
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy
(n, m) = map(int, input().strip().split())
a = numpy.array([list(map(int, input().strip().split())) for line in range(n)])
b = numpy.array([list(map(int, input().strip().split())) for line in range(n)])
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(n, m) = (int(i) for i in input().split())
l = []
for _ in range(n):
	l.append(input().split())
(array_1, l) = (numpy.array(l, int), [])
for _ in range(n):
	l.append(input().split())
array_2 = numpy.array(l, int)
print(array_1 + array_2)
print(array_1 - array_2)
print(array_1 * array_2)
print(array_1 // array_2)
print(array_1 % array_2)
print(array_1 ** array_2)


import numpy
(i, m) = map(int, input().split(' '))
a = numpy.array([input().split(' ') for x in range(i)], int)
b = numpy.array([input().split(' ') for x in range(i)], int)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(n, m) = map(int, input().strip().split())
a = []
b = []
for _ in range(n):
	a.append(list(map(int, input().strip().split())))
for _ in range(n):
	b.append(list(map(int, input().strip().split())))
a = numpy.array(a)
b = numpy.array(b)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
a = []
b = []
(n, m) = map(int, input().split())
for i in range(n):
	a.append(list(map(int, input().split())))
for i in range(n):
	b.append(list(map(int, input().split())))
a = numpy.array(a)
b = numpy.array(b)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(N, M) = map(int, input().split())
a = numpy.array([list(map(int, input().split())) for _ in range(N)])
b = numpy.array([list(map(int, input().split())) for _ in range(N)])
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(n, m) = map(int, input().strip().split())
arr1 = numpy.array([list(map(int, input().strip().split())) for _ in range(n)])
arr2 = numpy.array([list(map(int, input().strip().split())) for _ in range(n)])
print(arr1 + arr2)
print(arr1 - arr2)
print(arr1 * arr2)
print((arr1 / arr2).astype(int))
print(arr1 % arr2)
print(arr1 ** arr2)


import numpy as np
import sys
(N, M) = list(map(int, sys.stdin.readline().split()))
A = np.array([sys.stdin.readline().split() for _ in range(N)], int)
B = np.array([sys.stdin.readline().split() for _ in range(N)], int)
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy
(N, M) = map(int, input().split())
A = numpy.array([list(map(int, input().split())) for n in range(N)])
B = numpy.array([list(map(int, input().split())) for n in range(N)])
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy
from numpy import array
(n, _) = (int(i) for i in input().split())

def get_array(n):
	return array(tuple((input().split() for _ in range(n))), int)
(a, b) = (get_array(n), get_array(n))
print(a + b, a - b, a * b, a // b, a % b, a ** b, sep='\n')


import numpy
(n, m) = map(int, input().split())
temp = []
for i in range(n):
	temp.extend(list(map(int, input().split())))
a = numpy.array(temp)
a.shape = (n, m)
temp = []
for i in range(n):
	temp.extend(list(map(int, input().split())))
b = numpy.array(temp)
b.shape = (n, m)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(n, m) = map(int, input().split())
A = []
for i in range(0, n):
	A.append([int(x) for x in input().split()])
B = []
for i in range(0, n):
	B.append([int(x) for x in input().split()])
my_A = numpy.array(A)
my_B = numpy.array(B)
print(numpy.add(my_A, my_B))
print(numpy.subtract(my_A, my_B))
print(numpy.multiply(my_A, my_B))
print(my_A // my_B)
print(numpy.mod(my_A, my_B))
print(numpy.power(my_A, my_B))


import numpy
(N, M) = map(int, input().split())
A = numpy.array([input().split() for i in range(N)], int)
B = numpy.array([input().split() for j in range(N)], int)
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy as np
(n, m) = list(map(int, input().split()))
a = np.zeros((n, m))
a.shape = (n, m)
b = np.zeros((n, m))
b.shape = (n, m)
for i in range(n):
	s = list(map(int, input().split()))
	for j in range(m):
		a[i, j] = s[j]
for i in range(n):
	s = list(map(int, input().split()))
	for j in range(m):
		b[i, j] = s[j]
print((a + b).astype(int))
print((a - b).astype(int))
print((a * b).astype(int))
print((a // b).astype(int))
print((a % b).astype(int))
print((a ** b).astype(int))


import numpy
(r, c) = map(int, input().split(' '))
a = numpy.array([input().split(' ') for _ in range(r)], int, ndmin=r)
b = numpy.array([input().split(' ') for _ in range(r)], int, ndmin=r)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
l1 = []
l2 = []
d = int(input().split()[0])
for _ in range(d):
	l1.append(list(map(int, input().split())))
for _ in range(d):
	l2.append(list(map(int, input().split())))
a = numpy.array(l1, int)
b = numpy.array(l2, int)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
x = numpy.array(input().split(), int)
a = [numpy.array(input().split(), int) for i in range(x[0])]
b = [numpy.array(input().split(), int) for i in range(x[0])]
print(numpy.add(a, b))
print(numpy.subtract(a, b))
print(numpy.multiply(a, b))
print(numpy.array(numpy.divide(a, b), int))
print(numpy.mod(a, b))
print(numpy.power(a, b))


import numpy
(n, m) = tuple((int(x.strip()) for x in input().split()))
(list_a, list_b) = ([], [])
for j in range(n):
	list_a.append(list((int(x.strip()) for x in input().split())))
for k in range(n):
	list_b.append(list((int(x.strip()) for x in input().split())))
(a, b) = (numpy.array(list_a), numpy.array(list_b))
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(n, m) = map(int, input().split())
A = numpy.array([list(map(int, input().split())) for i in range(n)])
B = numpy.array([list(map(int, input().split())) for i in range(n)])
print(A + B, A - B, A * B, A // B, A % B, A ** B, sep='\n')


import numpy as np
(n, m) = map(int, input().split())
(a, b) = (np.array([list(map(int, input().split())) for _ in range(n)], int), np.array([list(map(int, input().split())) for _ in range(n)], int))
print(a + b, a - b, a * b, a // b, a % b, a ** b, sep='\n')


import numpy
(n, m) = list(map(int, input().strip().split()))
(a, b) = (list(), list())
for i in range(n):
	a.append(list(map(int, input().strip().split())))
for i in range(n):
	b.append(list(map(int, input().strip().split())))
print(numpy.array(a) + numpy.array(b))
print(numpy.array(a) - numpy.array(b))
print(numpy.array(a) * numpy.array(b))
print(numpy.array(a) // numpy.array(b))
print(numpy.array(a) % numpy.array(b))
print(numpy.array(a) ** numpy.array(b))


import numpy as np
(n, m) = map(int, input().split())
lista = []
listb = []
for i in range(2 * n):
	if i < n:
		lista.append(list(map(int, input().split())))
	else:
		listb.append(list(map(int, input().split())))
a = np.array(lista)
b = np.array(listb)
a.shape = (n, m)
b.shape = (n, m)
print(np.add(a, b))
print(np.subtract(a, b))
print(np.multiply(a, b))
print(a // b)
print(np.mod(a, b))
print(np.power(a, b))


import numpy
mojir = input()
hyo = mojir.split(' ')
N = int(hyo[0])
M = int(hyo[1])
aremotoa = []
aremotob = []
for idx in range(0, N, 1):
	mojir = input()
	hyo = mojir.split(' ')
	yokovec = [int(mono) for mono in hyo]
	aremotoa.append(yokovec)
for idx in range(0, N, 1):
	mojir = input()
	hyo = mojir.split(' ')
	yokovec = [int(mono) for mono in hyo]
	aremotob.append(yokovec)
arra = numpy.array(aremotoa)
arrb = numpy.array(aremotob)
print(arra + arrb)
print(arra - arrb)
print(arra * arrb)
print(arra // arrb)
print(arra % arrb)
print(arra ** arrb)


import numpy
(N, M) = map(int, input().strip().split())
alist = list()
for i in range(N):
	alist.append(list(input().split()))
a = numpy.array(alist, int)
blist = list()
for i in range(N):
	blist.append(list(input().split()))
b = numpy.array(blist, int)
print(numpy.add(a, b))
print(numpy.subtract(a, b))
print(numpy.multiply(a, b))
print(a // b)
print(numpy.mod(a, b))
print(numpy.power(a, b))


import numpy
(n, m) = map(int, input().split())
A = numpy.array([[int(x) for x in input().split()] for _ in range(n)])
B = numpy.array([[int(x) for x in input().split()] for _ in range(n)])
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy
N = int(input().split()[0])
(A, B) = [numpy.array([numpy.array(input().split(), int) for _ in range(N)]) for _ in range(2)]
print(A + B, A - B, A * B, A // B, A % B, A ** B, sep='\n')


import numpy as np
(n, m) = map(int, input().split())
A = np.array([list(map(int, input().split())) for i in range(n)])
B = np.array([list(map(int, input().split())) for j in range(n)])
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy
(n, m) = [int(x) for x in input().split()]
n_s = ''
for i in range(n):
	n_s += input()
a = numpy.array(n_s.split(), int)
a.shape = (n, m)
m_s = ''
for i in range(n):
	m_s += input()
b = numpy.array(m_s.split(), int)
b.shape = (n, m)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(n, m) = [int(x) for x in input().split()]
array_a = []
array_b = []
for _ in range(n):
	array_a.append([int(x) for x in input().split()])
for _ in range(n):
	array_b.append([int(x) for x in input().split()])
a = numpy.array(array_a)
b = numpy.array(array_b)
actions = [a + b, a - b, a * b, a // b, a % b, a ** b]
for action in actions:
	print(action)


import numpy as np
import sys
(n, m) = [int(x) for x in input().split()]
a_list = []
b_list = []
for _ in range(n):
	a_list.append([int(x) for x in input().split()])
for _ in range(n):
	b_list.append([int(x) for x in input().split()])
a_array = np.array(a_list, dtype=int)
b_array = np.array(b_list, dtype=int)
for f in ['add', 'subtract', 'multiply', 'floor_divide', 'mod', 'power']:
	print(getattr(np, f)(a_array, b_array))


import operator
import numpy

def read_f(f):
	return f(input())

def read_f_words(f):
	return mapl(f, input().split())

def mapl(f, x):
	return list(map(f, list(x)))

def read_a(f, n):
	ns = []
	for x in range(n):
		ns += read_f_words(f)
	return numpy.array(ns, f)
nm = read_f_words(int)
(n, m) = nm
a = numpy.reshape(read_a(int, n), nm)
b = numpy.reshape(read_a(int, n), nm)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(n, m) = map(int, input().strip().split())
(a, b) = ([], [])
for i in range(n):
	a.append(list(map(int, input().strip().split())))
for i in range(n):
	b.append(list(map(int, input().strip().split())))
a = numpy.array(a)
b = numpy.array(b)
print(numpy.add(a, b))
print(numpy.subtract(a, b))
print(numpy.multiply(a, b))
print(a // b)
print(numpy.mod(a, b))
print(numpy.power(a, b))


import numpy
(N, M) = input().strip().split()
N = int(N)
M = int(M)
arrA = numpy.array([[int(x) for x in input().strip().split()] for _ in range(N)])
arrB = numpy.array([[int(x) for x in input().strip().split()] for _ in range(N)])
print(numpy.add(arrA, arrB))
print(numpy.subtract(arrA, arrB))
print(numpy.multiply(arrA, arrB))
print(arrA // arrB)
print(numpy.mod(arrA, arrB))
print(numpy.power(arrA, arrB))


import numpy
(n, m) = [int(x) for x in input().split()]
(A, B) = ([], [])
for _ in range(n):
	A.append([int(x) for x in input().split()])
for _ in range(n):
	B.append([int(x) for x in input().split()])
(A, B) = (numpy.array(A, int), numpy.array(B, int))
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy
(N, M) = list(map(int, input().strip().split()))
A = []
B = []
for i in range(N):
	A.append(list(map(int, input().strip().split())))
for i in range(N):
	B.append(list(map(int, input().strip().split())))
numA = numpy.array(A)
numB = numpy.array(B)
print(numA + numB)
print(numA - numB)
print(numA * numB)
print(numA // numB)
print(numA % numB)
print(numA ** numB)


import numpy
(n, m) = map(int, input().split())
a = numpy.array([[int(e) for e in input().split()] for i in range(n)])
b = numpy.array([[int(e) for e in input().split()] for i in range(n)])
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(n, m) = map(int, input().split())
a = numpy.array([list(map(int, input().split())) for i in range(n)])
b = numpy.array([list(map(int, input().split())) for i in range(n)])
print(a + b, a - b, a * b, a // b, a % b, a ** b, sep='\n')


import numpy as np
(n, m) = map(int, input().split())
a = np.array([list(map(int, input().split())) for allvals in range(0, n)])
b = np.array([list(map(int, input().split())) for allvals in range(0, n)])
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(n, m) = list(map(int, input().split()))
ar1 = []
ar2 = []
for i in range(n):
	tmp = list(map(int, input().split()))
	ar1.append(tmp)
for i in range(n):
	tmp = list(map(int, input().split()))
	ar2.append(tmp)
np_ar1 = numpy.array(ar1)
np_ar2 = numpy.array(ar2)
print(np_ar1 + np_ar2)
print(np_ar1 - np_ar2)
print(np_ar1 * np_ar2)
print(np_ar1 // np_ar2)
print(np_ar1 % np_ar2)
print(np_ar1 ** np_ar2)


import numpy
(n, m) = map(int, input().split())
A = [0] * n
B = [0] * n
for i in range(n):
	A[i] = list(map(int, input().split()))
for i in range(n):
	B[i] = list(map(int, input().split()))
A = numpy.array(A, int)
B = numpy.array(B, int)
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy
(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(list(map(int, input().split())))
a = numpy.array(a)
b = []
for i in range(n):
	b.append(list(map(int, input().split())))
b = numpy.array(b)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(n, m) = map(int, input().split())
l = list()
for _ in range(n):
	l.append(list(map(int, input().split())))
a = numpy.array(l, int)
l.clear()
for _ in range(n):
	l.append(list(map(int, input().split())))
b = numpy.array(l, int)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy as np
(n, m) = tuple(map(int, input().split()))
(a, b) = ([], [])
for i in range(n):
	a.append(list(map(int, input().split())))
for i in range(n):
	b.append(list(map(int, input().split())))
a = np.array(a)
b = np.array(b)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(N, M) = map(int, input().split())
a = numpy.array([list(map(int, input().split())) for i in range(N)])
b = numpy.array([list(map(int, input().split())) for i in range(N)])
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(n, m) = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(n)]
a = numpy.array(a)
b = numpy.array(b)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy as np
inp = input()
(N, M) = map(int, inp.split())
matrix1 = np.empty((N, M), dtype=int)
matrix2 = np.empty((N, M), dtype=int)
for i in range(N):
	inp = input()
	matrix1[i] = np.array(list(map(int, inp.split())))
for i in range(N):
	inp = input()
	matrix2[i] = np.array(list(map(int, inp.split())))
print(matrix1 + matrix2)
print(matrix1 - matrix2)
print(matrix1 * matrix2)
print(matrix1 // matrix2)
print(matrix1 % matrix2)
print(matrix1 ** matrix2)


import numpy
(n, m) = map(int, input().split())
a = numpy.array([list(map(int, input().split())) for i in range(n)])
b = numpy.array([list(map(int, input().split())) for i in range(n)])
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
import numpy
(N, M) = tuple(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]
B = [list(map(int, input().split())) for i in range(N)]
print(numpy.array(A) + numpy.array(B))
print(numpy.array(A) - numpy.array(B))
print(numpy.array(A) * numpy.array(B))
print(numpy.array(A) // numpy.array(B))
print(numpy.array(A) % numpy.array(B))
print(numpy.array(A) ** numpy.array(B))


import numpy
(n, m) = map(int, input().split())
a = numpy.array([list(map(int, input().split())) for _ in range(n)])
b = numpy.array([list(map(int, input().split())) for _ in range(n)])
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy as np
(n, m) = map(int, input().split())
a = np.fromstring(' '.join([input() for _ in range(n)]), sep=' ', dtype=int).reshape(n, m)
b = np.fromstring(' '.join([input() for _ in range(n)]), sep=' ', dtype=int).reshape(n, m)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy as np
(n, m) = [int(e) for e in input().split()]
la = [input().split() for i in range(n)]
lb = [input().split() for i in range(n)]
a = np.array(la, int)
b = np.array(lb, int)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(N, M) = [int(e) for e in input().split(' ')]
LA = []
for a0 in range(N):
	line = [int(e) for e in input().split(' ')]
	LA.append(line)
A = numpy.array(LA)
LB = []
for a0 in range(N):
	line = [int(e) for e in input().split(' ')]
	LB.append(line)
B = numpy.array(LB)
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy as np

def main():
	(n, m) = map(int, input().split())
	a = []
	for _ in range(n):
		a.append(np.array(input().split(), int))
	b = []
	for _ in range(n):
		b.append(np.array(input().split(), int))
	(a, b) = (np.array(a), np.array(b))
	print(a + b)
	print(a - b)
	print(a * b)
	print(a // b)
	print(a % b)
	print(a ** b)
main()


import numpy as np
a = list(map(int, input().split(' ')))
N = a[0]
M = a[1]
array_a = np.array([[0 for j in range(M)] for i in range(N)])
array_b = np.array([[0 for j in range(M)] for i in range(N)])
for i in range(N):
	temp = list(map(int, input().split(' ')))
	for j in range(M):
		array_a[i, j] = temp[j]
for i in range(N):
	temp = list(map(int, input().split(' ')))
	for j in range(M):
		array_b[i, j] = temp[j]
print(np.add(array_a, array_b))
print(np.subtract(array_a, array_b))
print(np.multiply(array_a, array_b))
print(array_a // array_b)
print(np.mod(array_a, array_b))
print(np.power(array_a, array_b))


import numpy
(n, m) = tuple(map(int, input().split(' ')))
a = numpy.array([numpy.array(input().split(' '), int) for i in range(n)])
b = numpy.array([numpy.array(input().split(' '), int) for i in range(n)])
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(n, m) = map(int, input().split())
a = numpy.array([input().split() for _ in range(n)], int)
b = numpy.array([input().split() for _ in range(n)], int)
print(a + b, a - b, a * b, a // b, a % b, a ** b, sep='\n')


from numpy import array
(N, M) = [int(x) for x in input().split()]
L1 = []
L2 = []
for i in range(N):
	L1.append([int(x) for x in input().split()])
for i in range(N):
	L2.append([int(x) for x in input().split()])
A1 = array(L1)
A2 = array(L2)
print(A1 + A2)
print(A1 - A2)
print(A1 * A2)
print(A1 // A2)
print(A1 % A2)
print(A1 ** A2)


import numpy
(N, M) = [int(x) for x in input().split()]
ll = []
for n in range(N):
	ll += [int(x) for x in input().split()]
a = numpy.array(ll).reshape(N, M)
ll = []
for n in range(N):
	ll += [int(x) for x in input().split()]
b = numpy.array(ll).reshape(N, M)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy as np
(n, m) = map(int, input().split())
a = np.array([tuple(map(int, input().split())) for _ in range(n)])
b = np.array([tuple(map(int, input().split())) for _ in range(n)])
print(a + b, a - b, a * b, a // b, a % b, a ** b, sep='\n')


import numpy
(n, m) = map(int, input().split())
a = numpy.array([input().split() for _ in range(n)], int)
b = numpy.array([input().split() for _ in range(n)], int)
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
i = [i for i in map(int, input().split())]
a = [[i for i in map(int, input().split())] for i in range(i[0])]
b = [[i for i in map(int, input().split())] for i in range(i[0])]
a = numpy.array(a)
b = numpy.array(b)
print('{}'.format(numpy.add(a, b)))
print('{}'.format(numpy.subtract(a, b)))
print('{}'.format(numpy.multiply(a, b)))
print('{}'.format(a // b))
print('{}'.format(numpy.mod(a, b)))
print('{}'.format(numpy.power(a, b)))


import numpy
(n, m) = [int(x) for x in input().strip().split()]
a = numpy.array([[int(x) for x in input().strip().split()] for _ in range(n)])
b = numpy.array([[int(x) for x in input().strip().split()] for _ in range(n)])
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(N, M) = map(int, input().split())
A = numpy.array([list(map(int, input().split())) for _ in range(N)])
B = numpy.array([list(map(int, input().split())) for _ in range(N)])
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy
(N, M) = map(int, input().strip().split())
A = []
B = []
for k in range(N):
	A.append(list(map(int, input().strip().split())))
for k in range(N):
	B.append(list(map(int, input().strip().split())))
A = numpy.array(A, int)
B = numpy.array(B, int)
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy as np
(n, m) = map(int, input().split())
a = np.array([input().split() for x in range(n)], dtype='int')
b = np.array([input().split() for x in range(n)], dtype='int')
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy
(N, M) = list(map(int, input().split()))
first = []
second = []
for _ in range(N):
	first.append(input().split())
for _ in range(N):
	second.append(input().split())
first = numpy.array(first, int)
second = numpy.array(second, int)
print(first + second)
print(first - second)
print(first * second)
print(numpy.array(first / second, int))
print(first % second)
print(first ** second)


import numpy
(n, m) = [int(i) for i in input().strip().split()]
(A, B) = ([], [])
for i in range(n):
	A.append([int(k) for k in input().strip().split()])
for i in range(n):
	B.append([int(k) for k in input().strip().split()])
A = numpy.array(A)
B = numpy.array(B)
print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)
print(A ** B)


import numpy
(N, M) = map(int, input().split())
(A, B) = (numpy.array([list(map(int, input().split())) for _ in range(N)]), numpy.array([list(map(int, input().split())) for _ in range(N)]))
print(A + B, A - B, A * B, A // B, A % B, A ** B, sep='\n')


import numpy as np
(n, m) = list(map(int, input().split()))
arrA = []
arrB = []
for i in range(0, n):
	arrA.append(list(map(int, input().split())))
for i in range(0, n):
	arrB.append(list(map(int, input().split())))
npA = np.array(arrA, int)
npB = np.array(arrB, int)
npC = np.add(npA, npB)
print(np.add(npA, npB))
print(np.subtract(npA, npB))
print(np.multiply(npA, npB))
print(np.array(np.divide(npA, npB), int))
print(np.mod(npA, npB))
print(np.power(npA, npB))


import numpy as np
(n, m) = (int(x) for x in input().split(' '))
a = np.array([[int(x) for x in input().split(' ')] for _ in range(n)])
b = np.array([[int(x) for x in input().split(' ')] for _ in range(n)])
print(a + b)
print(a - b)
print(a * b)
print(a // b)
print(a % b)
print(a ** b)


import numpy as np
(N, M) = map(int, input().split())
A = np.array([list(map(int, input().split())) for _ in range(N)])
B = np.array([list(map(int, input().split())) for _ in range(N)])
print(A + B)
print(A - B)
print(A * B)
print(np.array(A / B, dtype=int))
print(A % B)
print(A ** B)