Help with bronze problem lost cow

Hi everyone! I am doing this problem and I have wrote the python solution, and now I am attempting the c++ version. This is my code:

// The following code is written by Bessie-Troublemaker
// Copyright Bessie-Troublemaker 1/16/2020
// This document may be reproduced for educational purposes only

#include <iostream>
#include <fstream>
#include <cmath>

using namespace std;

int main() {
    int x, y; 
    cin >> x >> y;
    bool is_add = true;
    int count = 0;
    int i = 0;
    while (true) { 
        if (is_add) {
            if (x <= y <= x + pow(2, i)) {
                count += y - x;
                cout << count << endl;  
                break;
        } else {
            if (x - pow(2, i) <= y <= x) {
                count += x - y;
                cout << count << endl;
                break;
            }
        }
            count += pow(2, (i+1));
            is_add = !is_add;
            i += 1;
        }
    }
    return 0;
}

And the idea is similar my python code. Can anyone help?

In C++ its invalid to do if (x <= y <= x + pow(2, i)) {; change it to x<=y && y<=x+pow(2,i). i’m pretty sure that c++ compiler reads (x <= y <= x + pow(2, i)) as (x<=y) <= x+pow(2,i)

Oh I’m such a noob, but also I think it can’t break out of the while loop now.