Language: C

#include <stdio.h>
#include <stdlib.h>

typedef struct {
    int a;
    int b;
    int ans;
} gcd_cache;

gcd_cache gcd_caches[10000000] = {};
int gcd_cache_count = 0;

int gcd(int a, int b) {
	for( int i=0; i<gcd_cache_count; i++ )
		if(gcd_caches[i].a == a && gcd_caches[i].b == b){
			return gcd_caches[i].ans;
		}
	}
	if ( a < b ) {
		int t = a;
		a = b;
		b = t;
	}
	if ( b == 0 ){
		return a;
	}

	int c = a % b;
	int ans = gcd( b, c );
	gcd_cache gc;
	gc.a = a;
	gc.b = b;
	gc.ans = ans;
	gcd_caches[gcd_cache_count] = gc;
	gcd_cache_count += 1;
	return ans;
}

int gcds(int list[], int N) {
	int old = list[0];
	for ( int i = 1; i < N-1; ++i ){
		old = gcd( old, list[i] );
	}
	return old;
}

int max( int list[], int size ){
	int detect = -10000000;
	for( int i=0; i<size; i++ ){
		if (detect < list[i]) {
			detect = list[i];
		}
	}
	return detect;
}


int resolv(int list[], int N){
	int *res = (int *)malloc(sizeof(int) * N);
	int *list2 = (int*)malloc(sizeof(int) * N-1);;
	for ( int skip = 0; skip < N; ++skip ){
		for ( int i = 0, j = 0; i < N; i++ ){
			if ( skip != i ){ 
				*(list2 + j) = list[i];
				j++;
			}
		}
		res[skip] = gcds(list2, N);
	}
	return max(res, N);
}

int main(void) {
        int N = -1;
	scanf("%d\n", &N);

	int *A = (int*)malloc(sizeof(int) * N);
	for( int i=0; i<N; i++ ){
		scanf("%d", A + i);
		if( i != N-1 ) scanf(" "); 
	}
	printf("%d\n", resolv(A, N));

	return 0;
}


Compiler output:
main.c:19:9: error: expected identifier or '(' before 'if'
   19 |         if ( a < b ) {
      |         ^~
main.c:24:9: error: expected identifier or '(' before 'if'
   24 |         if ( b == 0 ){
      |         ^~
main.c:28:17: error: 'a' undeclared here (not in a function)
   28 |         int c = a % b;
      |                 ^
main.c:28:21: error: 'b' undeclared here (not in a function)
   28 |         int c = a % b;
      |                     ^
main.c:31:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
   31 |         gc.a = a;
      |           ^
main.c:32:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
   32 |         gc.b = b;
      |           ^
main.c:33:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
   33 |         gc.ans = ans;
      |           ^
main.c:34:9: warning: data definition has no type or storage class
   34 |         gcd_caches[gcd_cache_count] = gc;
      |         ^~~~~~~~~~
main.c:34:9: error: type defaults to 'int' in declaration of 'gcd_caches' [-Wimplicit-int]
main.c:34:9: error: variably modified 'gcd_caches' at file scope
main.c:34:9: error: conflicting types for 'gcd_caches'; have 'int[1]'
main.c:10:11: note: previous definition of 'gcd_caches' with type 'gcd_cache[10000000]'
   10 | gcd_cache gcd_caches[10000000] = {};
      |           ^~~~~~~~~~
main.c:34:39: error: invalid initializer
   34 |         gcd_caches[gcd_cache_count] = gc;
      |                                       ^~
main.c:35:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before '+=' token
   35 |         gcd_cache_count += 1;
      |                         ^~
main.c:36:9: error: expected identifier or '(' before 'return'
   36 |         return ans;
      |         ^~~~~~
main.c:37:1: error: expected identifier or '(' before '}' token
   37 | }
      | ^