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
23
24
25
n = int(input())
a = 0
A = []
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] == 1:
a+=0.5
elif A[i][j] == 1:
a+= 1
print(int(a))