ABCDEF - SPOJ (Binary Search) . Facing tle

#include <bits/stdc++.h>
using namespace std;
int main() {
int n,count=0;
cin>>n;
int a[n],b[6];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
for(int k=0;k<n;k++)
{
for(int l=0;l<n;l++)
{
for(int m=0;m<n;m++)
{
b[0] = a[i];
b[1] = a[j];
b[3] = a[k];
b[4] = a[l];
b[5] = a[m];
int c = (((b[4]+b[5])*b[3])-(b[0]*b[1]));
if(binary_search(a,a+n,c)&&b[3]!=0)
{
count++;
}
}
}
}
}
}
cout<<count;
return 0;
}
what are the concepts required which could resolve this problem

Please provide a properly indented code on codingblocks ide.
And also provide the question you are trying to solve. You asked this doubt on a general video about binary search.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.