For this Question: Given an integer N, your task is to find the maximum value of X such that sum of some X consecutive natural numbers is N.Input contains a single integer N.

Constraints:-
1 <= N <= 1000000000Print the maximum value of X such that sum of some X consecutive natural numbers is N.Sample Input:-
5

Sample Output:-
2

Explanation:-
2 + 3 = 5

Sample Input:-
50

Sample Output:-
5

Explanation:-
8 + 9 + 10 + 11 + 12 = 50, I have written this Solution Code: 
#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795
#define max1 1000001
#define MOD 1000000000000007

#define read(type) readInt<type>()

#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
#define int long long
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int cnt[max1];
signed main(){
int t;
t=1;
while(t--){
    int n;
    cin>>n;
    int x=1;
    int p=2*sqrt(n);
    int ans=1,t=1;
    while(t<=n){

    if((n-t)%x==0){ans=x;}
    x++;
    t=x*(x+1);
    t=t/2;
    }
    out(ans);
}

}



, In this Programming Language: C++, Now tell me if this Code is compilable or not?