Language: C

#define E 0.00000001
#define zero(n) (fabs(n)<E)
main(n,a,b,c,d,p,q,r,D,f){
	for(scanf("%d",&n);n;n--){
		scanf("%d%d%d%d",&a,&b,&c,&d); //fx=ax3+bx2+cx+d
		if(a<0)a=-a,b=-b,c=-c,d=-d;// won't lose generality
		p=3*a,q=2*b,r=c,D=q*q-4*p*r; //f'x=3ax2+2bx+c D: f'x=0?
		if(D>0){
			double x1=(-q-sqrt(D))/p/2,x2=(-q+sqrt(D))/p/2;
			double y1=a*x1*x1*x1+b*x1*x1+c*x1+d;
			double y2=a*x2*x2*x2+b*x2*x2+c*x2+d;
			if(!zero(y1)&&!zero(y2)>E&&y1*y2>0)goto one;
			if(zero(x1)){
				if(d==0)k[0]=1,k[1]=0;
				else k[0]=2,k[1]=1;
			}else if(zero(x2)){
				if(d==0)k[0]=0,k[1]=1;
				else k[0]=1,k[1]=2;
			}else if(x1>0){
				if(d>0)k[0]=2,k[1]=1;
				else if(d<0)k[0]=3,k[1]=0;
				else k[0]=2,k[1]=0;
			}else if(x2<0){
				if(d>0)k[0]=0,k[1]=3;
				else if(d<0)k[0]=1,k[1]=2;
				else k[0]=0,k[1]=2;
			}else{
				if(d>0)k[0]=2,k[1]=1;
				else if(d<0)k[0]=1,k[1]=2;
				else k[0]=1,k[1]=1;
			}
		}else if(D==0){
			if(d>0)k[0]=0,k[1]=3;
			else if(d<0)k[0]=1,k[1]=0;
		}else{
one:
			if(d>0)k[0]=0,k[1]=1;
			else if(d<0)k[0]=1,k[1]=0;
		}
		printf("%d %d\n",k[0],k[1]);
	}
	return 0;
}

Compiler output:
main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int]
    3 | main(n,a,b,c,d,p,q,r,D,f){
      | ^~~~
main.c: In function 'main':
main.c:3:1: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:3:1: error: type of 'a' defaults to 'int' [-Wimplicit-int]
main.c:3:1: error: type of 'b' defaults to 'int' [-Wimplicit-int]
main.c:3:1: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:3:1: error: type of 'd' defaults to 'int' [-Wimplicit-int]
main.c:3:1: error: type of 'p' defaults to 'int' [-Wimplicit-int]
main.c:3:1: error: type of 'q' defaults to 'int' [-Wimplicit-int]
main.c:3:1: error: type of 'r' defaults to 'int' [-Wimplicit-int]
main.c:3:1: error: type of 'D' defaults to 'int' [-Wimplicit-int]
main.c:3:1: error: type of 'f' defaults to 'int' [-Wimplicit-int]
main.c:4:13: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    4 |         for(scanf("%d",&n);n;n--){
      |             ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #define E 0.00000001
main.c:4:13: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    4 |         for(scanf("%d",&n);n;n--){
      |             ^~~~~
main.c:4:13: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:9:39: error: implicit declaration of function 'sqrt' [-Wimplicit-function-declaration]
    9 |                         double x1=(-q-sqrt(D))/p/2,x2=(-q+sqrt(D))/p/2;
      |                                       ^~~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'sqrt'
  +++ |+#include <math.h>
    1 | #define E 0.00000001
main.c:9:39: warning: incompatible implicit declaration of built-in function 'sqrt' [-Wbuiltin-declaration-mismatch]
    9 |                         double x1=(-q-sqrt(D))/p/2,x2=(-q+sqrt(D))/p/2;
      |                                       ^~~~
main.c:9:39: note: include '<math.h>' or provide a declaration of 'sqrt'
main.c:2:18: error: implicit declaration of function 'fabs' [-Wimplicit-function-declaration]
    2 | #define zero(n) (fabs(n)<E)
      |                  ^~~~
main.c:12:29: note: in expansion of macro 'zero'
   12 |                         if(!zero(y1)&&!zero(y2)>E&&y1*y2>0)goto one;
      |                             ^~~~
main.c:2:18: note: include '<math.h>' or provide a declaration of 'fabs'
    2 | #define zero(n) (fabs(n)<E)
      |                  ^~~~
main.c:12:29: note: in expansion of macro 'zero'
   12 |                         if(!zero(y1)&&!zero(y2)>E&&y1*y2>0)goto one;
      |                             ^~~~
main.c:2:18: warning: incompatible implicit declaration of built-in function 'fabs' [-Wbuiltin-declaration-mismatch]
    2 | #define zero(n) (fabs(n)<E)
      |                  ^~~~
main.c:12:29: note: in expansion of macro 'zero'
   12 |                         if(!zero(y1)&&!zero(y2)>E&&y1*y2>0)goto one;
      |                             ^~~~
main.c:2:18: note: include '<math.h>' or provide a declaration of 'fabs'
    2 | #define zero(n) (fabs(n)<E)
      |                  ^~~~
main.c:12:29: note: in expansion of macro 'zero'
   12 |                         if(!zero(y1)&&!zero(y2)>E&&y1*y2>0)goto one;
      |                             ^~~~
main.c:2:18: warning: incompatible implicit declaration of built-in function 'fabs' [-Wbuiltin-declaration-mismatch]
    2 | #define zero(n) (fabs(n)<E)
      |                  ^~~~
main.c:13:28: note: in expansion of macro 'zero'
   13 |                         if(zero(x1)){
      |                            ^~~~
main.c:2:18: note: include '<math.h>' or provide a declaration of 'fabs'
    2 | #define zero(n) (fabs(n)<E)
      |                  ^~~~
main.c:13:28: note: in expansion of macro 'zero'
   13 |                         if(zero(x1)){
      |                            ^~~~
main.c:14:41: error: 'k' undeclared (first use in this function)
   14 |                                 if(d==0)k[0]=1,k[1]=0;
      |                                         ^
main.c:14:41: note: each undeclared identifier is reported only once for each function it appears in
main.c:40:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   40 |                 printf("%d %d\n",k[0],k[1]);
      |                 ^~~~~~
main.c:40:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:40:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:40:17: note: include '<stdio.h>' or provide a declaration of 'printf'