Language: C++

#include<bits/stdc++.h>
#define F(i,a) for(int i=0;i<a;++i)
int n,N,D1,D2;
int i1[40],j1[40],t1;
int i2[40],j2[40],t2;
bool v1[600][600], v2[600][600];
bool c1[600][600], c2[600][600];
int s[4];
void DFS1(int x,int y,bool c){
	if(x<0||y<0||x>=N||y>=N) return;
	if(v1[x][y]) return;
	v1[x][y]=1, c1[x][y]=c;
	F(k,t1){
		DFS1(x+i1[k],y+j1[k],!c);
		DFS1(x+i1[k],y-j1[k],!c);
		DFS1(x-i1[k],y+j1[k],!c);
		DFS1(x-i1[k],y-j1[k],!c);
	}
}
void DFS2(int x,int y,bool c){
	if(x<0||y<0||x>=N||y>=N) return;
	if(v2[x][y]) return;
	v2[x][y]=1, c2[x][y]=c;
	F(k,t1){
		DFS2(x+i2[k],y+j2[k],!c);
		DFS2(x+i2[k],y-j2[k],!c);
		DFS2(x-i2[k],y+j2[k],!c);
		DFS2(x-i2[k],y-j2[k],!c);
	}
}
int main(){
	scanf("%d%d%d",&n,&D1,&D2); N=n+n;
	F(i,N) if(i*i<=D1)
		F(j,N) if(i*i+j*j==D1)
			i1[t1]=i, j1[t1]=j, t1++;
	F(i,N) if(i*i<=D2)
		F(j,N) if(i*i+j*j==D2)
			i2[t2]=i, j2[t2]=j, t2++;
	F(i,N) F(j,N) DFS1(i,j,0);
	F(i,N) F(j,N) DFS2(i,j,0);
	F(i,N) F(j,N)
		++s[c1[i][j]*2+c2[i][j]];
	F(k,4) if(s[k]>=n*n){
		int cnt=0;
		F(i,N) F(j,N) if(c1[i][j]*2+c2[i][j]==k&&cnt<n*n)
			++cnt, printf("%d %d\n",i,j);
		return 0;
	}
}

Compiler output:
a.cc:4:17: error: 'int j1 [40]' redeclared as different kind of entity
    4 | int i1[40],j1[40],t1;
      |                 ^
In file included from /usr/include/features.h:523,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
                 from /usr/include/c++/14/cassert:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:33,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:254:1: note: previous declaration 'double j1(double)'
  254 | __MATHCALL (j1,, (_Mdouble_));
      | ^~~~~~~~~~
a.cc: In function 'void DFS1(int, int, bool)':
a.cc:14:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |                 DFS1(x+i1[k],y+j1[k],!c);
      |                                    ^
a.cc:14:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |                 DFS1(x+i1[k],y+j1[k],!c);
      |                              ~^~~~~~
a.cc:14:31: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
   14 |                 DFS1(x+i1[k],y+j1[k],!c);
      |                              ~^~~~~~
      |                               |
      |                               double (*)(double) noexcept
a.cc:9:21: note:   initializing argument 2 of 'void DFS1(int, int, bool)'
    9 | void DFS1(int x,int y,bool c){
      |                 ~~~~^
a.cc:15:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   15 |                 DFS1(x+i1[k],y-j1[k],!c);
      |                                    ^
a.cc:15:31: error: invalid operands of types 'int' and 'double(double) noexcept' to binary 'operator-'
   15 |                 DFS1(x+i1[k],y-j1[k],!c);
      |                              ~^~~~~~
      |                              |     |
      |                              int   double(double) noexcept
a.cc:16:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   16 |                 DFS1(x-i1[k],y+j1[k],!c);
      |                                    ^
a.cc:16:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   16 |                 DFS1(x-i1[k],y+j1[k],!c);
      |                              ~^~~~~~
a.cc:16:31: error: invalid conversion from 'double (*)(double) noexcept' to 'int' [-fpermissive]
   16 |                 DFS1(x-i1[k],y+j1[k],!c);
      |                              ~^~~~~~
      |                               |
      |                               double (*)(double) noexcept
a.cc:9:21: note:   initializing argument 2 of 'void DFS1(int, int, bool)'
    9 | void DFS1(int x,int y,bool c){
      |                 ~~~~^
a.cc:17:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   17 |                 DFS1(x-i1[k],y-j1[k],!c);
      |                                    ^
a.cc:17:31: error: invalid operands of types 'int' and 'double(double) noexcept' to binary 'operator-'
   17 |                 DFS1(x-i1[k],y-j1[k],!c);
      |                              ~^~~~~~
      |                              |     |
      |                              int   double(double) noexcept
a.cc: In function 'int main()':
a.cc:35:40: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   35 |                         i1[t1]=i, j1[t1]=j, t1++;
      |                                        ^
a.cc:35:41: error: assignment of read-only location '*(j1 + ((sizetype)t1))'
   35 |                         i1[t1]=i, j1[t1]=j, t1++;
      |                                   ~~~~~~^~