codeparrot/codecomplex huggingface dataset:
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.io.*;
import java.util.*;

public class CFDiv1 {
	FastScanner in;
	PrintWriter out;

	boolean canBe(int from, long curVal, long l, long r) {
		if (curVal > r)
			return false;
		for (int i = 0; i <= from; i++)
			curVal += 1L << i;
		if (curVal >= l)
			return true;
		return false;
	}

	long stupid(long l, long r) {
		long ans = 0;
		for (long i = l; i <= r; i++)
			for (long j = l; j <= r; j++)
				ans = Math.max(ans, i ^ j);
		return ans;
	}

	long solve2(long l, long r) {
		long min = 0;
		long max = 0;
		for (int i = 62; i >= 0; i--) {
			boolean max0 = canBe(i - 1, max, l, r);
			boolean max1 = canBe(i - 1, max | (1L << i), l, r);
			boolean min0 = canBe(i - 1, min, l, r);
			boolean min1 = canBe(i - 1, min | (1L << i), l, r);
			if (max0 && min1 && max > min) {
				min = min | (1L << i);
			} else {
				if (max1 && min0) {
					max |= (1L << i);
				} else {
					if (max1 && min1) {
						max |= (1L << i);
						min |= 1L << i;
					} else {

					}
				}
			}
		}
		return min ^ max;
	}

	void solve() {
		out.println(solve2(in.nextLong(), in.nextLong()));
//		System.err.println(solve2(4, 9));
//		Random rnd = new Random(312);
//		for (int test = 0; test < 10000; test++) {
//			System.err.println(test);
//			int l = rnd.nextInt(100);
//			int r = rnd.nextInt(100) + l;
//			long v1 = stupid(l, r);
//			long v2 = solve2(l, r);
//			if (v1 != v2) {
//				System.err.println(v1 + " " + v2);
//				System.err.println(l + " " + r);
//				throw new AssertionError();
//			}
//		}
	}

	void run() {
		try {
			in = new FastScanner(new File("test.in"));
			out = new PrintWriter(new File("test.out"));

			solve();

			out.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}

	void runIO() {

		in = new FastScanner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		public FastScanner(InputStream f) {
			br = new BufferedReader(new InputStreamReader(f));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return null;
				st = new StringTokenizer(s);
			}
			return st.nextToken();
		}

		boolean hasMoreTokens() {
			while (st == null || !st.hasMoreTokens()) {
				String s = null;
				try {
					s = br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (s == null)
					return false;
				st = new StringTokenizer(s);
			}
			return true;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

	public static void main(String[] args) {
		new CFDiv1().runIO();
	}
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
/**
 * Created with IntelliJ IDEA.
 * User: brzezinsky
 * Date: 12/16/12
 * Time: 7:44 PM
 * To change this template use File | Settings | File Templates.
 */


import java.io.*;
import java.util.*;
import java.util.StringTokenizer;

public class E extends Thread {
    public E(String inputFileName, String outputFileName) {
        try {
            if (inputFileName != null) {
                this.input = new BufferedReader(new FileReader(inputFileName));
            } else {
                this.input = new BufferedReader(new InputStreamReader(System.in));
            }
            if (outputFileName != null) {
                this.output = new PrintWriter(outputFileName);
            } else {
                this.output = new PrintWriter(System.out);
            }
            this.setPriority(Thread.MAX_PRIORITY);
        } catch (Throwable e) {
            System.err.println(e.getMessage());
            e.printStackTrace();
            System.exit(666);
        }
    }




    private void solve() throws Throwable {
        long l = nextLong(), r = nextLong();
        int []bitL = new int[63];
        int []bitR = new int[63];
        int szL = doit(l, bitL);
        int szR = doit(r, bitR);
        int ret = szR;
        while (ret >= 0 && bitL[ret] == bitR[ret]) --ret;
        if (ret < 0) {
            output.println(0);
        } else {
            output.println((1L << (ret + 1)) - 1);
        }
    }

    static final int doit(long q, int []a) {
        int sz = 0;
        while (q != 0L) {
            a[sz++] = (int)(q &1L);
            q >>= 1;
        }
        return sz;
    }

    public void run() {
        try {
            solve();
        } catch (Throwable e) {
            System.err.println(e.getMessage());
            e.printStackTrace();
            System.exit(666);
        } finally {
            output.close();
        }
    }

    public static void main(String... args) {
        new E(null, null).start();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    private String next() throws IOException {
        while (tokens == null || !tokens.hasMoreTokens()) {
            tokens = new StringTokenizer(input.readLine());
        }
        return tokens.nextToken();
    }

    private StringTokenizer tokens;
    private BufferedReader input;
    private PrintWriter output;
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.io.*;
import java.util.*;

public class Main {
    static BufferedReader f;
    static StringTokenizer st;
    public static void main (String [] args) throws Exception {
        
        // Use BufferedReader rather than RandomAccessFile; it's much faster
        f = new BufferedReader(new java.io.InputStreamReader(System.in));
        
        long unixTime = System.currentTimeMillis();
        
        long l=nextLong();
        long r=nextLong();
        
        String ll=Long.toBinaryString(l);
        String rr=Long.toBinaryString(r);
        
        System.err.println(ll);
        System.err.println(rr);
        
        System.err.println(Long.parseLong(rr,2));
        
        int len=0;
        if(ll.length()!=rr.length()){
            len=Math.max(ll.length(),rr.length());
        }else{
            //same
            for(int i=0;i<ll.length();i++){
                if(ll.charAt(i)!=rr.charAt(i)){
                    len=ll.length()-i;
                    break;
                }
            }
        }
        System.err.println(len);
        //long out=0;
        StringBuffer s=new StringBuffer();
        for(int i=0;i<len;i++){
            //out+=Math.pow(2, i);
            s.append(1);
        }
        
        if(len==0){
            System.out.println(0);
        }else{
            System.out.println(Long.parseLong(s.toString(),2));
        }
        
//      System.out.println("Time elapsed (ms): "+(System.currentTimeMillis()-unixTime));
        
        System.exit(0);                               // don't omit this!
      }
    
    //Library

    static long nextLong() throws Exception{
        return Long.parseLong(next());
    }
    static int nextInt() throws Exception {
         return Integer.parseInt(next());
     }
    
    static String next() throws Exception {
             while (st == null || !st.hasMoreTokens()) {
                     st = new StringTokenizer(f.readLine());
             }
             return st.nextToken();
     }
    
}
class ii{
    int a;
    int b;
    public ii(int a, int b){
        this.a=a;
        this.b=b;
    }
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.util.*;

public class D {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long L = sc.nextLong();
		long R = sc.nextLong();
		long res = Math.max(2 * Long.highestOneBit(L ^ R) - 1, 0);
		System.out.println(res);
	}
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;


public class D {
	
	static StringTokenizer st;
	static BufferedReader in;
	public static void main(String[] args) throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		long L = nextLong();
		long R = nextLong();
		if (L==R) {
			System.out.println(0);
			return;
		}
		String s1 = Long.toBinaryString(L), s2 = Long.toBinaryString(R);
		while (s1.length() != s2.length())
			s1 = "0"+s1;
		for (int i = 0; i < s1.length(); i++) {
			if (s1.charAt(i) != s2.charAt(i)) {
				int pow = s1.length()-i;
				System.out.println((long)Math.pow(2, pow)-1);
				return;
			}
		}
		pw.close();
	}
	private static int nextInt() throws IOException{
		return Integer.parseInt(next());
	}
	
	private static long nextLong() throws IOException{
		return Long.parseLong(next());
	}
	
	private static double nextDouble() throws IOException{
		return Double.parseDouble(next());
	}
	
	private static String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class con169_D {

	private static final boolean DEBUG = false;

	public static void main( final String[] args ) throws Exception {
		final BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
		final String line = br.readLine();
		final StringTokenizer tok = new StringTokenizer( line );

		final long L = Long.parseLong( tok.nextToken() );
		final long R = Long.parseLong( tok.nextToken() );

		System.out.println( solve( L, R ) );
	}

	public static long solve( final long L, final long R ) {
		if ( L == R ) return L ^ R;
		if ( DEBUG ) System.out.printf( "L=%d (%s), R=%d (%s)\n", L, Long.toBinaryString( L ), R,
				Long.toBinaryString( R ) );

		final int ld = length( L );
		final int ldm1 = ld - 1;
		final int rd = length( R );

		if ( ld < rd ) {
			long max = 1;
			while ( length( max ) < rd ) {
				max <<= 1;
			}
			long min = 1;
			while ( length( min ) < rd - 1 ) {
				min <<= 1;
				++min;
			}
			if ( DEBUG ) System.out.printf( "min=%d (%s), max=%d (%s)\n", min, Long.toBinaryString( min ), max,
						Long.toBinaryString( max ) );
			return min ^ max;
		} else {
			final char[] minStr = Long.toBinaryString( L ).toCharArray();
			final char[] maxStr = Long.toBinaryString( R ).toCharArray();
			final char[] res = new char[minStr.length];
			Arrays.fill( res, '0' );
			{
				int i = 0;
				while ( i < res.length ) {
					if ( minStr[ i ] == maxStr[ i ] ) {
						res[ i ] = '0';
					} else {
						break;
					}
					++i;
				}
				if ( DEBUG ) System.out.println( "diff at pos: " + i );
				if ( minStr[ i ] == '0' ) {
					res[ i++ ] = '1';
					for ( int j = i; j < res.length; ++j ) {
						res[ j ] = '1';
					}
				} else {
					throw new IllegalArgumentException();
				}
			}
			return Long.parseLong( new String( res ), 2 );
		}
	}

	private static int length( long l ) {
		int res = 0;
		while ( l > 0 ) {
			++res;
			l >>= 1;
		}
		return res;
	}

}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.io.*;
import java.util.*;

public class pr169D implements Runnable {

	BufferedReader in;
	PrintWriter out;
	StringTokenizer str;

	public void solve() throws IOException {
		long l = nextLong();
		long r = nextLong();
		long x = l ^ r;
		long i = 1;
		while (x >= i)
			i *= 2;
		out.println(x > i ? x : i - 1);
	}

	public String nextToken() throws IOException {
		while (str == null || !str.hasMoreTokens()) {
			str = new StringTokenizer(in.readLine());
		}
		return str.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (IOException e) {
		}
	}

	public static void main(String[] args) {
		new Thread(new pr169D()).start();
	}
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;

public class A {
	public static BufferedReader in;
	public static PrintWriter out;

	public static void main(String[] args) throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

		boolean showLineError = true;
		if (showLineError) {
			solve();
			out.close();
		} else {
			try {
				solve();
			} catch (Exception e) {
			} finally {
				out.close();
			}
		}

	}

	static void debug(Object... os) {
		out.println(Arrays.deepToString(os));
	}

	private static void solve() throws IOException {
		String[] line = in.readLine().split(" ");
		String l = Long.toBinaryString(Long.parseLong(line[0]));
		String r = Long.toBinaryString(Long.parseLong(line[1]));
		if(l.equals(r)){
			out.println(0);
			return;
		}
		int dif = r.length()-l.length();
		for(int i =0;i<dif;i++)
			l= "0"+l;
		int index=0;
		for(;index<r.length();index++){
			if(l.charAt(index)!=r.charAt(index))
				break;
		}
		long ret=1;
		for(int i=0;i<l.length()-index;i++)
			ret+=ret;
		ret--;
		out.println(ret);
		
	}

}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.io.*;
import java.util.*;
import java.util.StringTokenizer;

public class SolutionD {
   BufferedReader in;
   StringTokenizer str;
   PrintWriter out;
   String SK;

   String next() throws IOException {
      while ((str == null) || (!str.hasMoreTokens())) {
      SK = in.readLine();
      if (SK == null)
      return null;
      str = new StringTokenizer(SK);
      }
      return str.nextToken();
   }

   int nextInt() throws IOException {
      return Integer.parseInt(next());
   }

   double nextDouble() throws IOException {
      return Double.parseDouble(next());
   }

   long nextLong() throws IOException {
      return Long.parseLong(next());
   }
   void run() throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        //in = new BufferedReader(new FileReader("input.txt"));
        //out = new PrintWriter("output.txt");
        solve();
        out.close();
   }

   public static void main(String[] args) throws IOException {
      new SolutionD().run();
   }
   void solve() throws IOException {
        long l=Long.parseLong(next());
        long r=Long.parseLong(next());
        String low=Long.toBinaryString(l);
        String up=Long.toBinaryString(r);
        
        int n=low.length();
        int m=up.length();
        for(int i=0;i<m-n;i++){
             low="0"+low;
        }
        String ret="";
        boolean fu=false;
        boolean fd=false;
        boolean su=false;
        boolean sd=false;
        if(m>n){
             su=true;
             fd=true;
        }
        for(int i=0;i<m;i++){
           if(low.charAt(i)==up.charAt(i)){
                if(low.charAt(i)=='1'){
                     if(fd){
                          ret+="1";
                          fu=true;
                     }
                     else if(sd){
                          ret+="1";
                          su=true;
                     }
                     else ret+="0";
                }
                else{
                     if(fu){
                          ret+="1";
                          fd=true;
                     }
                     else if(su){
                          ret+="1";
                          sd=true;
                     }
                     else ret+="0";
                }
           }else{
                if(up.charAt(i)=='1'){
                     su=true;
                     fd=true;
                }
                
                ret+="1";
           }
        }
        
        out.println(Long.parseLong(ret, 2));
        
        
      
         
   }
 

}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;


public class Main {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        long a,b;
        a = scn.nextLong();
        b = scn.nextLong();
        long diff = b -a , tot = 0;
        int ind = 0;
        while(true) {
            long res = (long)Math.pow(2.0, ind);
            if (res > b) break;
            if (((a>>ind) != (b>>ind)) || diff >= res)
                tot += res;
            ind++;
        }
        System.out.println(tot);
    }                                                                                                                                                                                                                          

}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class D {
	static long l, r;
	static long[][][][][] dp;
	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader();
		l = in.nextLong();
		r = in.nextLong();
		dp = new long[65][2][2][2][2];
		for(int i = 0 ; i < 65;i++)
		for(int j = 0 ; j < 2;j++)
		for(int k = 0 ; k < 2;k++)
		for(int a = 0 ; a<2;a++)
		dp[i][j][k][a][0]=dp[i][j][k][a][1]=-1;
		System.out.println(go(63, 0, 0, 0, 0));
	}

	public static long go(int i, int a1, int a2, int b1, int b2) {
		if(i==-1)return 0;
		if(dp[i][a1][a2][b1][b2]!=-1)
			return dp[i][a1][a2][b1][b2];
		
		int f1 = 3, f2 = 3;
		int bl = (int) ((l >> i)) & 1, br = (int) ((r >> i) & 1);
		if (a2 == 0 && br==0)
			f1 &= 1;
		if(a1 == 0 && bl==1)
			f1 &= 2;
		if (b2 == 0 && br==0)
			f2 &= 1;
		if(b1 == 0 && bl==1)
			f2 &= 2;
		long res = 0;
		for(int x = 0 ; x<2;x++){
			for(int y = 0 ; y<2;y++){
				if(((f1>>x)&1) == 1 &&((f2>>y)&1) == 1){
					res = Math.max(res, (((long)(x^y))<<i)+go(i-1,x>bl||a1==1?1:0,x<br||a2==1?1:0,y>bl||b1==1?1:0,y<br||b2==1?1:0));
				}
			}
		}
		return dp[i][a1][a2][b1][b2]=res;
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer st;

		public InputReader() throws IOException {
			in = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(in.readLine());
		}

		public String next() throws IOException {
			while (!st.hasMoreElements())
				st = new StringTokenizer(in.readLine());
			return st.nextToken();
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}
	}
}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.io.PrintWriter;
import java.util.Scanner;

public class D {
	
	public static void main(String [] args){
		Scanner cin = new Scanner(System.in);
		PrintWriter cout = new PrintWriter(System.out);
		long l = cin.nextLong(), r = cin.nextLong(), k = 1;
		if (l == r)cout.println(0);
		else {
			while (((r>>k)<<k)>l)k++;k--;
			cout.println(((r>>k)<<k)^(((r>>k)<<k)-1));
		}
		cout.flush();
	}

}
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author vadimmm
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long l = in.nextLong();
        long r = in.nextLong();
        /*
        long max = 1;
        boolean good = false;
        for (int i = 0; i < 62; ++i) {
            max <<= 1;
            if (max > r) {
                max >>= 1;
                if (max >= l) {
                    good = true;
                }
                break;
            }
        }
        if (good) {
            if (max - 1 >= l)
                out.println(max ^ (max - 1));
            else
                out.println(max ^ r);
            return;
        }
        */
        boolean[][] answer = new boolean[2][100];
        int cur = 0;
        while (r > 0) {
            answer[0][cur] = (r % 2 != 0);
            ++cur;
            r >>= 1;
        }
        cur = 0;
        while (l > 0) {
            answer[1][cur] = (l % 2 != 0);
            ++cur;
            l >>= 1;
        }
        int old = -1;
        for (int i = 63; i >= 0; --i) {
            if (answer[0][i] && !answer[1][i]) {
                old = i;
                break;
            }
        }
        if (old == -1) {
            out.println(0);
            return;
        }
        long a = 1;
        for (int i = 0; i < old; ++i) {
            a <<= 1;
            a += 1;
        }
        out.println(a);
    }
}

class InputReader {

    private static BufferedReader bufferedReader;
    private static StringTokenizer stringTokenizer;

    public InputReader(InputStream inputStream) {
        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        stringTokenizer = null;
    }

    public String next() {
        while(stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            try {
                stringTokenizer = new StringTokenizer(bufferedReader.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return stringTokenizer.nextToken();
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    }
// Problem: 276_D. Little Girl and Maximum XOR
// Time complexity: logn
import java.util.Scanner;

public class Main2 {
	
    public static void main(String args[]){
        Scanner input = new Scanner(System.in);
        long s = input.nextLong();
        long e = input.nextLong();
        System.out.println(count(s,e));
    }
    
    public static long count(long s,long e){
    	int ncount = 0;
    	long es = e;
    	while(es != 0){
    		es /= 2;
    		ncount++;
    	}
    	while(ncount >= 0){
    		if(((s>>ncount-1)&1) == 1 && ((e>>ncount-1)&1) == 0 || ((s>>ncount-1)&1) == 0 && ((e>>ncount-1)&1) == 1){
    			break;
    		}
    		ncount--;
    	}
    	if(ncount >= 0){
    		return (long)Math.pow(2, ncount)-1;
    	}else{
    		return 0;
    	}
    }

}