How to solve RPOWER ?
We have to find the minimum c to get maximum value for strength=( ( ( ( a ^ b )  c ) ^ d )  e ) where a,b,d,e are given and c < 2 power 60. (^  binary XOR operator ,  binary or operator )
firstly, a^b is a new constant say f.
we wish that the strength has every bit set (it may or may not be possible).
since the last operation is an or, if any bit is set in e we don’t need to think about bit in c . to minimise c we can make it zero simply.
let’s consider a few cases when bit in e is 0.

if the same bit in d and f is also zero then it must be set in c .

if that bit is set in d then we wish to not set it in fc so we should make it 0 in c but we can do
nothing about it in f as it’s given.
so finally whenever a certain bit is not set in all three e,f,and d , set it in c
#include <stdio.h>
typedef long long int ll;
int main(void) {
ll a,b,c,d,e,t,T;
scanf("%lld",&T);
while(T–){
scanf("%lld%lld%lld%lld",&a,&b,&d,&e);
t=a^b;
ll ans=0,ch;
for(int i=0;i<60;i++){
ch=1LL<<i;
if((!(ch&e))&&(!(ch&t))&&(!(ch&d)))ans+=ch;
}
printf("%lld\n",ans);
}
return 0;
}
link to solution. https://www.codechef.com/viewsolution/33165208
Thanks