int input for in range append list map int input split for in range fo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
n = int(input())
a = 0
A = []
B = []
for i in range(n):
A.append(list(map(int, input().split())))
for i in range(n):
for j in range(n):
if A[i][j] == A[j][i] != 0:
a += 0.5*(A[i][j])
else:
a += A[i][j]
if a >= 2:
B.append(int(a))
else:
B.append(0)
print(sum(B))
print(*B)