This is my code here. I am getting Partially Correct answer. The link to the problem : CodeChef: Practical coding for everyone
#include<bits/stdc++.h>
using namespace std;
#define ld long double
#define int long long
#define MOD 1000000007
#define w(x) int x; cin >> x; while(x--)
#define F first
#define S second
#define PB push_back
string s;
bool ask(int x, int y){
cout << "? " << x << " " << y << endl;
cin >> s;
return (s == "YES");
}
void solve(){
int x = -1;
//Finding the side of square
for(int b = 1000; b >= 1; b/=2)
{
while(ask(x + b, 0)) x += b;
}
int sq = 2*x;
//Finding the height of the figure
int y = -1;
for(int b = 1000; b >= 1; b/=2)
{
while(ask(0, y + b)) y += b;
}
//Height of triangle
int h = y - sq;
// Finding the base of the triangle
int tx = -1;
for(int b = 1000; b >= 1; b/=2)
{
while(ask(tx + b, sq)) tx += b;
}
cout << "! " << sq*sq + h*tx << endl;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t = 1;
//cin >> t;
while(t--)
solve();
return 0;
}
`