Indices of elements in an array in order from smallest to largest
Haskell, 41 bytes



f l|z&lt;-zip l[0..]=[sum[1|q&lt;-z,p&gt;=q]|p&lt;-z]


Try it online!

Haskell doesn't have build-in sorting, so we have to roll up our sleeves. We pair each element with its index with z&lt;-zip l[0..], then for each pair counts the number of pairs that are smaller or equal. This first compares the values, then tiebreaks by their index.