fork download
  1. # your code goes here
  2. import sys
  3. while 1:
  4.  
  5. N,M = map(int,input().split())
  6. list1 = []
  7. list2 = []
  8. for i in range(N):
  9. a = list(map(int,sys.stdin.readline().split()))
  10. list1.append(a)
  11.  
  12. for j in range(N):
  13. b = list(map(int,sys.stdin.readline().split()))
  14. list2.append(b)
  15.  
  16.  
  17. for i in range(N):
  18. for j in range(M):
  19. list1[i][j] += list2[i][j]
  20. print(*list1[i])
  21. break
Success #stdin #stdout 0.03s 9776KB
stdin
3 4
1 2 3 4
1 2 3 4
1 2 3 4
2 3 4 5
2 3 4 5
2 3 4 5
stdout
3 5 7 9
3 5 7 9
3 5 7 9