online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <iostream> #include <bits/stdc++.h> #include <math.h> using namespace std; #define ll long long vector<ll> primeSieve(int *p, int n) { p[0] = 0; p[1] = 0; p[2] = 1; for (ll i = 3; i < n; i = i + 2) { p[i] = 1; } for (ll i = 0; i < n; i = i + 2) { if (p[i]) { for (ll j = i * i; j * j <= n; j = j + i) { p[i] = 0; } } } vector<ll> primes; primes.push_back(2); for (ll i = 3; i <= n; i += 2) { if (p[i] == 1) { primes.push_back(i); } } return primes; } void hasThreeNum(vector<ll> primes, ll m) { vector<int> factors; factors.clear(); ll copy = m; int i = 0; ll p = primes[0]; ll count = 0;// number of factors ll occur = 0;// total sum of indices of all factors while (p * p <= m) { if (m % p == 0) { while (m % p == 0) { m = m / p; occur++; } factors.push_back(p); count++; } i++; p = primes[i]; } if (m > 1) { count++; occur++; factors.push_back(m); } if (count == 1 && occur >= 6) { cout << "YES" << endl; ll f = factors[0]; cout << f << " " << pow(f, 2) << " " << copy / pow(f, 3) << endl; } else if (count == 2) { if (copy % (factors[0] * factors[1]) == 0 && copy / (factors[0] * factors[1]) != 1) { cout << "YES" << endl; cout << factors[0] << " " << factors[1] << " " << copy / (factors[0] * factors[1]) << endl; } else cout << "NO" << endl; } else if (count >= 3) { cout << "YES" << endl; cout << factors[0] << " " << factors[1] << " " << factors[2]; cout << endl; } else { cout << "NO" << endl; } return; } int main() { ll N = 100005; int p[N]; for (int i = 0; i <= N; i++) { p[i] = 0; } vector<ll> primes = primeSieve(p, 100000); int t; cin >> t; while (t--) { ll m; cin >> m; hasThreeNum(primes, m); } return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue