Language: C

a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
      |   ^
main.c:1:5: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
      |     ^
main.c:1:7: error: type defaults to 'int' in declaration of 'x' [-Wimplicit-int]
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
      |       ^
main.c:1:9: error: type defaults to 'int' in declaration of 'y' [-Wimplicit-int]
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
      |         ^
main.c:1:11: error: type defaults to 'int' in declaration of 'f' [-Wimplicit-int]
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
      |           ^
main.c:1:13: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
      |             ^
main.c:1:15: error: return type defaults to 'int' [-Wimplicit-int]
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
      |               ^~~~
main.c: In function 'main':
main.c:1:15: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:1:32: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
      |                                ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
main.c:1:32: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
      |                                ^~~~~
main.c:1:32: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:73: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
      |                                                                         ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
  +++ |+#include <stdlib.h>
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
main.c:1:73: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
      |                                                                         ^~~~
main.c:1:73: note: include '<stdlib.h>' or provide a declaration of 'exit'
main.c:1:171: error: lvalue required as left operand of assignment
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
      |                                                                                                                                                                           ^
main.c:1:175: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    1 | a,b,c,x,y,f,t;main(n){while(1){scanf("%d%d%d%d%d",&n,&a,&b,&c,&x);if(!n)exit(0);for(f=t=0;n-->0;t=1){scanf("%d",&y);while(t||x!=y&&f<10001)t=0,f++,x=(a*x+b)%c;}f>10000&&f=-1;printf("%d\n",f);}}
      |                                                                                                                                                                               ^~~~~~
main.c:1:175: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:175: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:175: note: include '<stdio.h>' or provide a declaration of 'printf'