Help me in solving XOR_ORDER problem

My issue

For input
1
1 2 3
the value x = 4 is valid, it’s even given in sample 1. When my code produces the same output, it shows that my code failed the test case. I realize that my code may fail on some other test case, but when I click on debug my code, it’s showing me the case where my code produces the correct output.

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
	// your code goes here
	int t; cin >> t;
	while(t--){
	    
	    int a, b, c;
	    cin >> a >> b >> c;
	    
	    bool ascending = ( a < b and b < c );
	    bool descending = ( a > b and b > c );
	    
	    int largest = max({ a, b, c });
	    
	    bitset<32> binary( largest );
	    string binaryStr = binary.to_string();
	    int pos = binaryStr.find('1');
	    int result = 1 << ( 32-pos );
	    
	    if( ascending )
	    {
	        cout << result << endl;
	        continue;
	    }
	    if( descending )
	    {
	        cout << result - 1 << endl;
	        continue;
	    }
	    cout << -1 << endl;
	}
}

Problem Link: Order by XOR Practice Coding Problem