fork download
  1. def f(a):
  2. e=enumerate;print sum(i*(x+y==i)for x,r in e(a)for y,i in e(r))
  3.  
  4. f([])
  5. f([[2]])
  6. f([[1,5,2],[9,4,2],[5,9,6]])
  7. f([[0,3,0,4],[0,4,1,4],[4,3,1,2],[-2,4,-2,-1]])
  8. f([[3,-1,3,3],[3,-1,3,1]])
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
0
0
2
11
6