Language: C

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

#define NUM 200001

int lex_smaller(char* s1, char* s2)
{
	int i;
	for (i = 0; s1[i] != 0; i++) {
		if (s1[i] < s2[i]) return 1;
		else if (s1[i] > s2[i]) return -1;
	}
	if (s2[i] != 0) return 1;
	else return 0;
}

void push(char* s, char** heap, int* n)
{
	int i = *n;
	char* tmp;
	heap[(*n)++] = s;
	while (true) {
		if (i == 0) break;
		else if (lex_smaller(heap[i], heap[(i - 1) / 2]) == 1) {
			tmp = heap[(i - 1) / 2];
			heap[(i - 1) / 2] = heap[i];
			heap[i] = tmp;
			i = (i - 1) / 2;
		} else break;
	}
}

char* pop(char** heap, int* n)
{
	int i = 0, j;
	char* tmp, output = heap[0];
	heap[0] = heap[--(*n)];
	while (true) {
		if (i * 2 + 1 >= *n) break;
		else if (i * 2 + 2 >= *n) j = i * 2 + 1;
		else if (lex_smaller(heap[i * 2 + 1], heap[i * 2 + 2]) == 1) j = i * 2 + 1;
		else j = 1 * 2 + 2;
		if (lex_smaller(heap[j], heap[i]) == 1) {
			tmp = heap[j];
			heap[j] = heap[i];
			heap[i] = tmp;
			i = j;
		} else break;
	}
	return heap[0];
}

int main()
{
	int i, N;
	char S[NUM][11];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%s", S[i]);
	
	int j, k, count[NUM] = {};
	for (i = 1; i <= N; i++) {
		for (j = 1; j < i; j++) {
			for (k = 0; S[i][k] == S[j][k] && S[i][k] != 0; k++);
			if (S[i][k] == 0 && S[j][k] == 0) count[j]++;
		}
	}
		
	int max = 0, argmax[NUM] = {}, p = 0;
	for (i = 1; i <= N; i++) {
		if (count[i] > max) {
			max = count[i];
			argmax[0] = i;
			for (; p > 0; argmax[--p] = 0);
		} else if (count[i] == max) argmax[++p] = i;
	}
	
	int n = 0;
	char **heap = (char*)malloc(sizeof(char*) * p);
	for (i = 0; i < p; i++) push(argmax[i], heap, &n);
	for (i = 0; i < p; i++) printf("%s\n", pop(heap, &n));

	fflush(stdout);
	return 0;
}

Compiler output:
main.c: In function 'push':
main.c:22:16: error: 'true' undeclared (first use in this function)
   22 |         while (true) {
      |                ^~~~
main.c:3:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    2 | #include <stdlib.h>
  +++ |+#include <stdbool.h>
    3 | 
main.c:22:16: note: each undeclared identifier is reported only once for each function it appears in
   22 |         while (true) {
      |                ^~~~
main.c: In function 'pop':
main.c:36:29: error: initialization of 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
   36 |         char* tmp, output = heap[0];
      |                             ^~~~
main.c:38:16: error: 'true' undeclared (first use in this function)
   38 |         while (true) {
      |                ^~~~
main.c:38:16: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c: In function 'main':
main.c:78:23: error: initialization of 'char **' from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
   78 |         char **heap = (char*)malloc(sizeof(char*) * p);
      |                       ^
main.c:79:44: error: passing argument 1 of 'push' makes pointer from integer without a cast [-Wint-conversion]
   79 |         for (i = 0; i < p; i++) push(argmax[i], heap, &n);
      |                                      ~~~~~~^~~
      |                                            |
      |                                            int
main.c:17:17: note: expected 'char *' but argument is of type 'int'
   17 | void push(char* s, char** heap, int* n)
      |           ~~~~~~^