Calculating powers of 2
for i in range ( 2 , n + 1 ) : NEW_LINE INDENT powOf2 [ i ] = ( powOf2 [ i - 1 ] * 2 ) % mod ; NEW_LINE DEDENT rem = n - k ; NEW_LINE arr [ k ] = n + 1 ; NEW_LINE k += 1 NEW_LINE