import java.io.*; import java.lang.Long; public class Criado{ public static long newInteger(long N, long k){ // Two options: // - The MSB of N and M is different. Then, M is of the form 10...01...1. // - Their MSB are the same. Then, by removing the MSB, we reduce the problem to k-1 bits. long one= 1; // Go home, Java, you are drunk. long highestbit= Long.highestOneBit(N); if(k==1) return (N==0)?one:(highestbit*2); //base case 1: just one bit. if((one< N) return (one<