My code is wrong wrong output for 10^14 range;

HEre is my code

hello @Detoxo_16

a) handle the case separately when k=1.
b) for other cases apply a binary search between 0 to 10^8.