What is wrong?????

Code: Select all

```
#include <iostream>
#include <cmath>
using namespace std;
struct triple
{
int x, y, z;
};
void q_sort(triple numbers[], int left, int right)
{
int l_hold, r_hold;
triple extra;
int pivot;
l_hold = left;
r_hold = right;
pivot = numbers[left].z;
extra.x=numbers[left].x;
extra.y=numbers[left].y;
extra.z=numbers[left].z;
while (left < right)
{
while ((numbers[right].z >= pivot) && (left < right))
right--;
if (left != right)
{
numbers[left].x = numbers[right].x;
numbers[left].y = numbers[right].y;
numbers[left].z = numbers[right].z;
left++;
}
while ((numbers[left].z <= pivot) && (left < right))
left++;
if (left != right)
{
numbers[right].x = numbers[left].x;
numbers[right].y = numbers[left].y;
numbers[right].z = numbers[left].z;
right--;
}
}
numbers[left].x = extra.x;
numbers[left].y = extra.y;
numbers[left].z = extra.z;
pivot = left;
left = l_hold;
right = r_hold;
if (left < pivot)
q_sort(numbers, left, pivot-1);
if (right > pivot)
q_sort(numbers, pivot+1, right);
}
void quickSort(triple numbers[], int array_size)
{
q_sort(numbers, 0, array_size - 1);
}
void main()
{
int i, j, k, a, b, c, ax1, bx1, cx1, c1, c2;
int n;
int temp[750000];
triple t[250000];
while(cin>>n)
{
c1=0; c2=0;
if(n<5)
{
cout<<c1<<" "<<n<<endl;
}
else
{
for(i=0; i<=n; i++)
{
temp[i]=0;
}
i=1; k=0;
t[0].x=3; t[0].y=4; t[0].z=5;
while(k<i)
{
a=t[k].x;
b=t[k].y;
c=t[k].z;
cx1=2*a-2*b+3*c;
bx1=2*a-b+2*c;
ax1=a-2*b+2*c;
if(cx1<=n)
{
t[i].x=ax1;
t[i].y=bx1;
t[i].z=cx1;
i++;
c1++;
}
cx1=2*a+2*b+3*c;
bx1=2*a+b+2*c;
ax1=a+2*b+2*c;
if(cx1<=n)
{
t[i].x=ax1;
t[i].y=bx1;
t[i].z=cx1;
i++;
c1++;
}
cx1=3*c+2*b-2*a;
bx1=b+2*c-2*a;
ax1=2*b+2*c-a;
if(cx1<=n)
{
t[i].x=ax1;
t[i].y=bx1;
t[i].z=cx1;
i++;
c1++;
}
k++;
}
quickSort(t, c1);
i=1;
while(t[0].z*i<=n)
{
for(j=0; j<=c1; j++)
{
if(t[j].z*i>n)
{
break;
}
temp[(t[j].z)*i]=(t[j].z)*i;
temp[(t[j].x)*i]=(t[j].x)*i;
temp[(t[j].y)*i]=(t[j].y)*i;
}
i++;
}
for(i=1; i<=n; i++)
{
if(temp[i]==0)
{
c2++;
}
}
cout<<c1+1<<" "<<c2<<endl;
}
}
}
```