B - Nearest Smaller Values

Languages: C, C++, Java, Python, Kotlin, CSharp
Time & Memory limits: (details)

Input

Output

Sample test(s)

Input
8 2 5 1 4 8 3 2 5
--- Showing first 30 lines (click "Copy" to get full content) ---
Output
0 1 0 3 4 3 3 7
--- Showing first 30 lines (click "Copy" to get full content) ---