Cod sursa(job #801868)
#include<fstream>
using namespace std;
int n,m,sol;
int a[1010],b[1010],c[1010];
long long hash[3][1010];
long long MOD[3]={666013LL,666019LL,666023LL};
long long f[3]={7LL,11LL,13LL};
int main()
{
int i,j,k,x,y;
bool gasit;
ifstream fin("regiuni.in");
fin>>n>>m;
for(i=1;i<=n;i++)
fin>>a[i]>>b[i]>>c[i];
for(i=1;i<=m;i++)
{
fin>>x>>y;
for(j=1;j<=n;j++)
{
if(a[j]*x+b[j]*y+c[j]>0)
{
for(k=0;k<3;k++)
hash[k][i]=(f[k]*hash[k][i]%MOD[k]+2LL)%MOD[k];
}
else
for(k=0;k<3;k++)
hash[k][i]=f[k]*hash[k][i]%MOD[k];
}
}
fin.close();
for(i=1;i<=m;i++)
{
gasit=false;
for(j=1;j<i && !gasit;j++)
{
if(hash[0][i]==hash[0][j] && hash[1][i]==hash[1][j] && hash[2][i]==hash[2][j])
gasit=true;
}
if(!gasit)
sol++;
}
ofstream fout("regiuni.out");
fout<<sol<<"\n";
fout.close();
return 0;
}