Hard
Shared Counter With a Lock
Run n coroutines with gather; each reads a shared counter, awaits
asyncio.sleep(0), then writes counter + 1. Protect the update with asyncio.Lock so no update is lost. Print the final counter.Input
One integer n ≥ 1.
Output
n
Sample 1
Input
10
Output
10
Sample 2
Input
1
Output
1
Output appears here