Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 1000000
//リストのノード（スタック内の各データ）の定義
typedef struct node{
    char elem;
    struct node *next;
} node;
 
//スタックにデータを追加
void push(node first, char elem){
    //追加する分の領域を確保
    node *new = calloc(1, sizeof(node));
    if(new == NULL) exit(1);
    new->elem = elem;
    new->next = *first;
    *first = new;
}
 
//スタックからデータを取り出す
char pop(node first){
    char elem;
    node *tmp = *first;
    if(tmp == NULL) exit(1);
    elem = tmp->elem;
    *first = tmp->next;
    //取り出したノードのメモリを解放
    free(tmp);
    return elem;
}
 
int main(void){
    char cube[SIZE];
    char under_cube;
    int i,count = 0,answer = 0;
    scanf("%s",cube);
    //最初のノードの指す先
    node first = NULL;
    for ( i = 0; i < strlen(cube); i++)
    {
        if (count == 0)
        {
            push(&first,cube[i]);
            count += 1;
        }
        else
        {
            under_cube = pop(&first);
            if (under_cube == cube[i])
            {
                push(&first,under_cube);
                push(&first,cube[i]);
                count += 1;
            }
            else
            {
                answer += 2;
                count -= 1;
            }

        }

    }
    printf("%d\n",answer);
    return 0;
}

Compiler output:
main.c: In function 'push':
main.c:17:17: error: invalid type argument of unary '*' (have 'node')
   17 |     new->next = *first;
      |                 ^~~~~~
main.c:18:5: error: invalid type argument of unary '*' (have 'node')
   18 |     *first = new;
      |     ^~~~~~
main.c: In function 'pop':
main.c:24:17: error: invalid type argument of unary '*' (have 'node')
   24 |     node *tmp = *first;
      |                 ^~~~~~
main.c:27:5: error: invalid type argument of unary '*' (have 'node')
   27 |     *first = tmp->next;
      |     ^~~~~~
In file included from /usr/include/string.h:33,
                 from main.c:3:
main.c: In function 'main':
main.c:39:18: error: invalid initializer
   39 |     node first = NULL;
      |                  ^~~~
main.c:44:18: error: incompatible type for argument 1 of 'push'
   44 |             push(&first,cube[i]);
      |                  ^~~~~~
      |                  |
      |                  node *
main.c:12:16: note: expected 'node' but argument is of type 'node *'
   12 | void push(node first, char elem){
      |           ~~~~~^~~~~
main.c:49:30: error: incompatible type for argument 1 of 'pop'
   49 |             under_cube = pop(&first);
      |                              ^~~~~~
      |                              |
      |                              node *
main.c:22:15: note: expected 'node' but argument is of type 'node *'
   22 | char pop(node first){
      |          ~~~~~^~~~~
main.c:52:22: error: incompatible type for argument 1 of 'push'
   52 |                 push(&first,under_cube);
      |                      ^~~~~~
      |                      |
      |                      node *
main.c:12:16: note: expected 'node' but argument is of type 'node *'
   12 | void push(node first, char elem){
      |           ~~~~~^~~~~
main.c:53:22: error: incompatible type for argument 1 of 'push'
   53 |                 push(&first,cube[i]);
      |                      ^~~~~~
      |                      |
      |                      node *
main.c:12:16: note: expected 'node' but argument is of type 'node *'
   12 | void push(node first, char elem){
      |           ~~~~~^~~~~