Help me in solving DUPLET problem

My issue

please go through my answer and check the looping conditions i think it is perfect and no futher changes can be made

My code

#include <iostream>
#include<cmath>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    int k=pow(2,30);
	    k=min(k,n);
	   // cout<<"k= "<<k<<endl;
	    for(int i=1;i<=n;i+=2)
	    {
	        int f=0;
	        for(int j=0;j<=i+1;j+=2)
	        {
	            if((i|j)*(i^j)==n)
	            {
	                cout<<i<<" "<<j<<endl;
	                f=1;
	                break;
	            }
	        }
	        if(f==1)
	        break;
	    }
	}
	return 0;
}

Problem Link: DUPLET Problem - CodeChef

Time complexity of your code is O(N 2), which will result in TLE