fork download
  1. import itertools
  2. import operator
  3.  
  4.  
  5. yoba = lambda s: sum(itertools.starmap(operator.gt, itertools.combinations(s, 2)))
  6.  
  7. seqs = (
  8. (1, 2, 5, 3, 4, 7, 6),
  9. (4, 3, 2, 1),
  10. tuple(reversed(range(10))),
  11. (0, 1, 2, 3, 4),
  12. (4, 3, 2, 1, 0, 1),
  13. )
  14. for seq in seqs:
  15.  
  16. print(yoba(seq))
  17.  
Success #stdin #stdout 0.03s 8736KB
stdin
Standard input is empty
stdout
3
6
45
0
13