int input list map int input split for in range for in range ans for i

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
n = int(input())
a = [list(map(int,input().split())) for i in range(n)]
c = [i for i in range(1,n+1)]
ans = 0
for i in range(n-1):
l = 1000000000
for j in range(n):
if c[j] == 1:
for g in range(n):
if c[g] != 1:
p = a[j][g]
if l > p :
h = c[g]
l = p
ans += l
for j in range(n):
if c[j] == h:
c[j] = 1
print(ans)