<p>A <strong>ramp</strong> in an integer array <code>nums</code> is a pair <code>(i, j)</code> for which <code>i &lt; j</code> and <code>nums[i] &lt;= nums[j]</code>. The <strong>width</strong> of such a ramp is <code>j - i</code>.</p>

<p>Given an integer array <code>nums</code>, return <em>the maximum width of a <strong>ramp</strong> in </em><code>nums</code>. If there is no <strong>ramp</strong> in <code>nums</code>, return <code>0</code>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> nums = [6,0,8,2,1,5]
<strong>Output:</strong> 4
<strong>Explanation:</strong> The maximum width ramp is achieved at (i, j) = (1, 5): nums[1] = 0 and nums[5] = 5.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> nums = [9,8,1,0,1,9,4,0,4,1]
<strong>Output:</strong> 7
<strong>Explanation:</strong> The maximum width ramp is achieved at (i, j) = (2, 9): nums[2] = 1 and nums[9] = 1.
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>2 &lt;= nums.length &lt;= 5 * 10<sup>4</sup></code></li>
	<li><code>0 &lt;= nums[i] &lt;= 5 * 10<sup>4</sup></code></li>
</ul>

class Solution:
    def maxWidthRamp(self, a: List[int]) -> int:
        #a = [*map(itemgetter(1),sorted((v,i) for i,v in enumerate(a)))]
        #a = [*map(itemgetter(1),sorted(map(itemgetter(1,0),enumerate(a))))]
        #a = [*map(itemgetter(0),sorted(enumerate(a),key=itemgetter(1)))]
        #a = [*map((g:=itemgetter)(0),sorted(enumerate(a),key=g(1)))]
        #a = [i for _,i in sorted((v,i) for i,v in enumerate(a))]
        #b = accumulate(a,min,initial=a[0])
        '''a = [i for _,i in sorted((v,i) for i,v in enumerate(a))]
        b = accumulate(a,min)

        return max(max(map(sub,a,b)),0)'''
        return max(map(sub,a:=[i for _,i in sorted((v,i) for i,v in enumerate(a))],accumulate(a,min)))
        return max(max(map(sub,a:=[i for _,i in sorted((v,i) for i,v in enumerate(a))],accumulate(a,min,initial=a[0]))),0)
        return max(max(map(sub,a:=[*map((g:=itemgetter)(0),sorted(enumerate(a),key=g(1)))],accumulate(a,min,initial=a[0]))),0)

        a = [i for _,i in sorted((v,i) for i,v in enumerate(a))]
        b = accumulate(a, min, initial=a[0])

        return max(max(map(sub, a, b)), 0)


        a = [*map(itemgetter(1),sorted((v, i) for i,v in enumerate(a)))]
        b = [*accumulate(a, min, initial=inf)][1:]

        return max(max(map(sub,a[1:],b)),0)


        a = [*map(itemgetter(1),sorted((v, i) for i,v in enumerate(a)))]
        b = [*accumulate(a[::-1], max, initial=0)][::-1]

        return max(max(map(sub,b[1:-1],a)),0)
27000