criyle/codenet-compile-errors huggingface dataset:
Language: C

#include<stdio.h>
  
#define MAXLEN 20000
  
int garea,gareas[(MAXLEN/2)+1],gcnt,gend;
  
  
int getArea( char *inputs, int start, int end )
{
    int i;
    int ravine,water;
     
    gareas[gcnt]=ravine=water=0;
    for( i=start; i!=end; i++ ) {
        if( '\\'== *(inputs+i) ) {
            water+=(ravine*2);
            ravine++;
            water++;
        } else if( 0 != ravine && '/' == *(inputs+i) ) {
            ravine--;
        } else {
            water+=ravine;
        }      
    }
    gareas[gcnt]+=water;
     
    return gareas[gcnt];
}
   
int checkRavine( char *inputs, int start )
{
    int i;
    int ravine, minh, tmpi;
     
    ravine=0;
    tmpi=minh=MAXLEN;
    for( i=start; i<=gend && '\0'!=*(inputs+i); i++ ) {
        if( 0 <= ravine && '\\'== *(inputs+i) ) {
            ravine++;       
        } else if( 0 != ravine && '/' == *(inputs+i) ) {
            ravine--;
            if( ravine < minh ) {
                minh=ravine;
                tmpi=i;
            }
            if( 0 == ravine ) {
                garea+=getArea( inputs, start, i+1 );
                gcnt++;
                gend=MAXLEN;           
                return i-start;
            }
        }
    }
    gend=tmpi;
    if( MAXLEN==tmpi ) { gend=0; }
    return 0;
}
  
  
void getAreas( char *inputs )
{
    int i,next;
      
    next=0;
    for( i=0; i<=gend && '\0'!=inputs[i]; i++ ) {
        if( '_' !=inputs[i] && '/' !=inputs[i] ) {
            next=checkRavine( inputs, i );
            i+=next;
        }
    }
  
    return;
}
  
int main( void )
{
    char inputs[MAXLEN+1];
    int i;
  
    scanf( "%s", inputs );
    garea=gcnt=0;
    gend=MAXLEN;
    getAreas( inputs );
      
    printf( "%d\n", garea );
     
    if( gcnt ) {
        printf( "%d ", gcnt );
        for( i=0; i<gcnt; i++ ) {
            printf( "%d", gareas[i] );
            if( i < gcnt-1 ) {
                printf( " " ); 
            }
        }
        printf( "\n" );
        
    } else {
        printf( "0\n" );
    }
      
    return 0;

Compiler output:
main.c: In function 'main':
main.c:101:5: error: expected declaration or statement at end of input
  101 |     return 0;
      |     ^~~~~~
Language: C

#include <stdio.h>

#define MAX 128
#define SIZE 10000

int d, top = 0, width[MAX] = {0}, dipth[MAX] = {0};
int area[SIZE] = {0}, tmpArea = 0, i = 0;

int isEmpty(){
  return top == 0;
}
 
int isFull(){
  return MAX - 1 <= top;
}
 
int push(x){
  if (isFull())
    puts("over flow");
  top++;
  dipth[top] = x;
  return 0;
}
 
int pop(){
  if (isEmpty())
    puts("under flow");
  top--;
  return dipth[top + 1];
}

int addWidth(){
  for (d = 1; d <= top; d++)
    width[d]++;
  return 0;
}

int calculate(){
  if (width[top] == 2)
    // triangle
    return width[top] * 1 / 2;
  else
    // trapezoid
    return (width[top] + width[top] - 2) * 1 / 2;
}

int calculateOut(){
  if(0 < tmpArea) {
    area[i] = tmpArea;
    tmpArea = 0;
    i++;
  }
  return 0;
}

int main(void){
  char c;
  int allArea = 0, j;
  while ((c = fgetc(stdin)) != '\n') {
    switch (c) {
    case '\\':
      push(1);
      addWidth();
      break;
    case '/':
      if (isEmpty())
	break;
      addWidth();
      tmpArea += calculate();
      width[top] = 0;
      pop();
      if (!top) {
	calculateOut();
      }
      break;
    case '_':
      addWidth();
      break;
    default:
      puts("Non definition symbol!");
      break;
    }
  }
  
  if (0 < top)
    calculateOut();

  // output
  for (j = 0; j < i; j++)
    allArea += area[j];
  printf("%d\n", allArea);

  printf("%d", i);
  for (j = 0; j < i; j++)
    printf(" %d", sp, area[j]);
  puts("");
  return 0;
}

Compiler output:
main.c: In function 'push':
main.c:17:5: error: type of 'x' defaults to 'int' [-Wimplicit-int]
   17 | int push(x){
      |     ^~~~
main.c: In function 'main':
main.c:95:19: error: 'sp' undeclared (first use in this function)
   95 |     printf(" %d", sp, area[j]);
      |                   ^~
main.c:95:19: note: each undeclared identifier is reported only once for each function it appears in
Language: C

/*
 * 01.c
 *
 *  Created on: 2016/03/17
 *      Author: yui
 */


#include<stdio.h>
#include<string.h>
#define maxS 20  /*?????????????????§??????*/
#define maxL 20000 /*?????§??\????????????*/
#define maxP 40 /*?°´?????????????±??????°????????§*/

int main(void)
{
	struct HILL
	{
		int num;
		char state;
	};
	struct HILL x[maxS];   /*???????????????????????????????????¨???????????°??¢?????±?????\??????????????????*/

	char geo[maxL];   /*??¨????????°??¢?????±???????´???????*/
	scanf("%s", geo);

	int size[maxP][2];  /*???????????°????????????[i][0]??¨?°´?????????????????±???????±??????¢???[i][1]*/

	int i, j, k, total;
	j=0;
	k=0;
	total=0;

	for(i=0; geo[i]!='\0'; i++)
	{
		if(j==0)
		{
			x[j].num=i;
			x[j].state=geo[i];
			j++;
		}
		else if(geo[i]=='\')
		{
			x[j].num=i;
			x[j].state=geo[i];
			j++;
		}
		else if(geo[i]=='/')
		{
			if(x[j-1].state=='a')
			{
				total=total+i-x[j-1].num;
				size[k][0]=x[j-1].num;
				size[k][1]=i-x[j-1].num;
				j--; k++;
			}
			else
			{
				x[j].num=i;
				x[j].state=geo[i];
				j++;
			}
		}
	}

	int check, pond;
	check=20000;
	pond=0;  /*?°´??????????????°*/
	int each[k];  /*????°´??????????????¢???*/
	for(i=0; i<k; i++)
	{
		each[i]=0;
	}

	for(i=k-1; i>=0; i--)
	{
		if(check>size[i][0])
		{
			check=size[i][0];
			pond++;
		}
		each[pond-1]=each[pond-1]+size[i][1];
	}

	printf("%d\n%d ", total, pond);
	for(i=pond-1; i>=0; i--)
	{
		printf("%d ", each[i]);
	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:42:33: warning: missing terminating ' character
   42 |                 else if(geo[i]=='\')
      |                                 ^
main.c:42:33: error: missing terminating ' character
   42 |                 else if(geo[i]=='\')
      |                                 ^~~~
main.c:43:17: error: expected expression before '{' token
   43 |                 {
      |                 ^
main.c:64:9: error: expected expression before '}' token
   64 |         }
      |         ^
Language: C

# coding:utf-8
danmen = input()
S1 = []
S2 = []
area = 0 # ?????????????°´???????????¢???

for i, line in enumerate(danmen):
    if line == '\\':
        S1.append(i)
    elif S1 and line == '/':
        loc = S1.pop()
        area += i-loc

        pond_sum = i-loc
        while S2 and S2[-1][0] > loc:
            pond_sum += S2[-1][1]
            S2.pop()

        S2.append([loc,pond_sum])


print(area)
print(len(S2),*(a for j,a in S2))

Compiler output:
main.c:1:3: error: invalid preprocessing directive #coding
    1 | # coding:utf-8
      |   ^~~~~~
main.c:2:1: warning: data definition has no type or storage class
    2 | danmen = input()
      | ^~~~~~
main.c:2:1: error: type defaults to 'int' in declaration of 'danmen' [-Wimplicit-int]
main.c:2:10: error: implicit declaration of function 'input' [-Wimplicit-function-declaration]
    2 | danmen = input()
      |          ^~~~~
main.c:2:10: error: initializer element is not constant
main.c:3:1: error: expected ',' or ';' before 'S1'
    3 | S1 = []
      | ^~
main.c:5:10: error: stray '#' in program
    5 | area = 0 # ?????????????°´???????????¢???
      |          ^
main.c:5:25: error: stray '\302' in program
    5 | area = 0 # ?????????????<U+00B0><U+00B4>???????????<U+00A2>???
      |                         ^~~~~~~~
main.c:5:38: error: stray '\302' in program
    5 | area = 0 # ?????????????<U+00B0><U+00B4>???????????<U+00A2>???
      |                                                    ^~~~~~~~
Language: C

#include <stdio.h>
 
struct pair {
  int x;
  int ar;
};
int top_stack1 = 0, top_stack2 = 0;
int stack1[20000];
struct pair stack2[20000];
  
void push_stack1(int x) {
  stack1[top_stack1] = x;
  top_stack1++;
}
 
void push_stack2(int j, int a) {
  stack2[top_stack2].x = j;
  stack2[top_stack2].ar = a;
  top_stack2++;
}
 
int pop_stack1(void) {
  int r = 0;
 
  top_stack1--;
   
  if(top_stack1 < 0) {
    top_stack1 = 0;
    return 0;
  }
  r = stack1[top_stack1];
  return r;
 
}
 
struct pair pop_stack2(void) {
  struct pair s;
 
  top_stack2--;
   
  if(top_stack2 < 0) {
    top_stack2 = 0;
    return;
  }
  s = stack2[top_stack2];
  return s;
 
}
int main() {
  int i, j;
  int sum = 0, a;
  struct pair c;
  char input[MAX];
 

  scanf("%s", input);

  for (i = 0; input[i] != '\0'; i++) {
    if(input[i] == '\\') push_stack1(i);
    else if((input[i] == '/') && (top_stack1 > 0)) {
      j = pop_stack1();
      sum += i - j;
      a = i - j;
      while ((top_stack2 > 0) && stack2[top_stack2 - 1].x > j) {
        a += stack2[top_stack2 - 1].ar ;
        c = pop_stack2();
      }
      push_stack2(j, a);
    }
  }

  printf("%d\n", sum);
  printf("%d", top_stack2);
  for(i = 0; i < top_stack2; i++) {
    if(i < top_stack2) printf(" ");
    printf("%d", stack2[i].ar);
  }
  printf("\n");
 
 
  return 0;
}

Compiler output:
main.c: In function 'pop_stack2':
main.c:43:5: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
   43 |     return;
      |     ^~~~~~
main.c:36:13: note: declared here
   36 | struct pair pop_stack2(void) {
      |             ^~~~~~~~~~
main.c: In function 'main':
main.c:53:14: error: 'MAX' undeclared (first use in this function)
   53 |   char input[MAX];
      |              ^~~
main.c:53:14: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdlib.h>
#include <string.h>
 
#define N 20001
char pStr[N];
 
typedef struct Roll{
  int indx;
  int diff;
} Roll;
 
int S1[N];
Roll S2[N];
 
int s1_top = 0;
 
int s1_pop()
{
  return S1[--s1_top];
}
 
void s1_push(int x)
{
  S1[s1_top++] = x;
}
 
int s2_top = 0;
 
PAIR s2_Top()
{
  return S2[s2_top-1];
}
 
PAIR s2_pop()
{
  return S2[--s2_top];
}
 
void s2_push(int indx, int diff)
{
  Roll x;
  x.indx = indx;
  x.diff = diff;
 
  S2[s2_top++] = x;
}

int main()
{
  int j, i,sum,a,c;
  
  scanf("%s", pStr);
 
  sum = 0;
  i = 0;
  while ( (c = pStr[i]) != 0 ) {
    if ( c == '\\' ) {
      s1_push(i);
    } else if ( s1_top > 0 && c == '/') {
      j = s1_pop();
      a = i - j;
      sum += a;
      while ( s2_top > 0 && s2_Top().indx > j) {
	a += s2_pop().diff;
      }
      s2_push(j, a);
    }
    i++;
  }
 
  printf("%d\n", sum);
  printf("%d", s2_top);
  for ( i = 0 ; i < s2_top; i++ ) {
    printf(" ");
    printf("%d", S2[i].diff);   
  }
  printf("\n");   
 
  return 0;
}

Compiler output:
main.c:29:1: error: unknown type name 'PAIR'
   29 | PAIR s2_Top()
      | ^~~~
main.c: In function 's2_Top':
main.c:31:12: error: incompatible types when returning type 'Roll' but 'int' was expected
   31 |   return S2[s2_top-1];
      |          ~~^~~~~~~~~~
main.c: At top level:
main.c:34:1: error: unknown type name 'PAIR'
   34 | PAIR s2_pop()
      | ^~~~
main.c: In function 's2_pop':
main.c:36:12: error: incompatible types when returning type 'Roll' but 'int' was expected
   36 |   return S2[--s2_top];
      |          ~~^~~~~~~~~~
main.c: In function 'main':
main.c:52:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   52 |   scanf("%s", pStr);
      |   ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    2 | #include <string.h>
  +++ |+#include <stdio.h>
    3 | 
main.c:52:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   52 |   scanf("%s", pStr);
      |   ^~~~~
main.c:52:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:63:37: error: request for member 'indx' in something not a structure or union
   63 |       while ( s2_top > 0 && s2_Top().indx > j) {
      |                                     ^
main.c:64:22: error: request for member 'diff' in something not a structure or union
   64 |         a += s2_pop().diff;
      |                      ^
main.c:71:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   71 |   printf("%d\n", sum);
      |   ^~~~~~
main.c:71:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:71:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:71:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <stack>
#include <string>
#include <iostream>
#include <utility>
using namespace std;
int main(void){
    string c;
    cin >> c;
    int length = c.length();
    int depth[length+10];
    for(int i = 0;i < length + 10; i++)
        depth[i] = 0;
      
    stack<pair<int,int> > S;
    for(int i = 0;i<length;i++){
        if(c[i] == '\\'){
            S.push(make_pair(0,i));
        }
          
        else if(c[i] == '_'){
            S.push(make_pair(1,i));
        }
        else if(c[i] == '/'){
            while(!S.empty() && S.top().first != 0 ){
                S.pop();
            }
            if(!S.empty()){
                for(int j=S.top().second;j < i;j++){
                    depth[j+1]++;
                }
                S.pop();
            }
        }
    }
    float amounts[length+10] = {};
    float sum = 0.0;
    int cnt = 0;
    int start = 0;
    for(int i = start;i < length+1;i++){
        if(depth[i] == 0 && amounts[cnt] >= 1.0){
            cnt++;
        }
        amounts[cnt] += (depth[i] + depth[i+1])*0.50;
        sum += (depth[i] + depth[i+1])*0.50;
          
    }
      
    cout << (int)sum << endl;
    cout << cnt;
    if(cnt>0)
        cout << ' ';
    else cout << endl;
    for(int i = 0;i < cnt-1;i++){
        cout << amounts[i] << ' ';
    }
    if(cnt > 0)
        cout << (int)amounts[cnt-1] << endl;
    return 0;
}

Compiler output:
main.c:1:10: fatal error: stack: No such file or directory
    1 | #include <stack>
      |          ^~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
 
typedef struct FOUNTAIN_DATA{
	int area;
	int plane;
	struct FOUNTAIN_DATA *next;
} ST_FOUNTAIN;
 
void push(ST_FOUNTAIN **p, ST_FOUNTAIN *d)
{
	d->next = *p;
	*p = d;
}
 
ST_FOUNTAIN *pop(ST_FOUNTAIN **p)
{
	ST_FOUNTAIN *d = *p;
	
	if(*d != NULL)
	{
		*d = (*d)->next;
	}
	
	return d;
}
 
int main()
{
	char ch;
	int area;
	int plane;
	int total;
	int count;
	int loop;
	ST_FOUNTAIN *w1;
	ST_FOUNTAIN *w2;
	ST_FOUNTAIN *d;
	
	w1 = NULL;
	w2 = NULL;
	while((ch = getchar()) != '\n')
	{
		if(ch == '\\')
		{
			d = (ST_FOUNTAIN*)malloc(sizeof(ST_FOUNTAIN));
			d->area = 0;
			d->plane = 0;
			push(&w1, d);
		}
		else if(ch == '_')
		{
			d = pop(&w1);
			if (d != NULL)
			{
				d->plane++;
				push(&w1, d);
			}
			else
			{
				/* error process */
			}
		}
		else if(ch == '/')
		{
			area = plane = 0;
			while((d = pop(&w1)) != NULL)
			{
				/* merge foutain data with more depth point */
				area += d->area;	
				plane += d->plane;
				if(d->area == 0)	/* if check point */
				{
					break;
				}
				else
				{
					push(&w2,d);
				}
			}
 
			if(d != NULL)	/* calcration or merge foutain data with more depth point */
			{
				d->area = area + plane + 1;
				d->plane = plane + 2;
				push(&w1, d);
				while((d = pop(&w2)) != NULL)
				{
					free(d);
				}
			}
			else if (area > 0)
			{
				while((d = pop(&w2)) != NULL) push(&w1, d);
			}
		}
		else
		{
		}
	}
 
	total = count = 0;
	while((d = pop(&w1)) != NULL)
	{
		if(d->area == 0)
		{
			free(d);
			continue;
		}
 
		total += d->area;
		count++;
		push(&w2, d);
	}
 
	printf("%d\n", total);
	printf("%d", count);
	if (count > 0)
	{
		printf(" ");
		for(loop = 0; loop < count; loop++)
		{
			d = pop(&w2);
			printf("%d", d->area);
			free(d);
			if(loop + 1 < count) printf(" ");
		}
	}
	printf("\n");
 
	return 0;
}



Compiler output:
main.c: In function 'pop':
main.c:21:15: error: invalid operands to binary != (have 'ST_FOUNTAIN' {aka 'struct FOUNTAIN_DATA'} and 'void *')
   21 |         if(*d != NULL)
      |            ~~ ^~
      |            |
      |            ST_FOUNTAIN {aka struct FOUNTAIN_DATA}
main.c:23:26: error: invalid type argument of '->' (have 'ST_FOUNTAIN' {aka 'struct FOUNTAIN_DATA'})
   23 |                 *d = (*d)->next;
      |                          ^~
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
 
typedef struct FOUNTAIN_DATA{
	int area;
	int plane;
	struct FOUNTAIN_DATA *next;
} ST_FOUNTAIN;
 
void push(ST_FOUNTAIN **p, ST_FOUNTAIN *d)
{
	d->next = *p;
	*p = d;
}
 
ST_FOUNTAIN *pop(ST_FOUNTAIN **p)
{
	data *d = *p;
	if(*d != NULL)
	{
		*p = (*p)->next;
	}
	
	return *d;
}
 
int main()
{
	char ch;
	int area;
	int plane;
	int total;
	int count;
	int loop;
	ST_FOUNTAIN *w1;
	ST_FOUNTAIN *w2;
	ST_FOUNTAIN *d;
	
	w1 = NULL;
	w2 = NULL;
	while((ch = getchar()) != '\n')
	{
		if(ch == '\\')
		{
			d = (ST_FOUNTAIN*)malloc(sizeof(ST_FOUNTAIN));
			d->area = 0;
			d->plane = 0;
			push(&w1, d);
		}
		else if(ch == '_')
		{
			d = pop(&w1);
			if (d != NULL)
			{
				d->plane++;
				push(&w1, d);
			}
			else
			{
				/* error process */
			}
		}
		else if(ch == '/')
		{
			area = plane = 0;
			while((d = pop(&w1)) != NULL)
			{
				/* merge foutain data with more depth point */
				area += d->area;	
				plane += d->plane;
				if(d->area == 0)	/* if check point */
				{
					break;
				}
				else
				{
					push(&w2,d);
				}
			}
 
			if(d != NULL)	/* calcration or merge foutain data with more depth point */
			{
				d->area = area + plane + 1;
				d->plane = plane + 2;
				push(&w1, d);
				while((d = pop(&w2)) != NULL)
				{
					free(d);
				}
			}
			else if (area > 0)
			{
				while((d = pop(&w2)) != NULL) push(&w1, d);
			}
		}
		else
		{
		}
	}
 
	total = count = 0;
	while((d = pop(&w1)) != NULL)
	{
		if(d->area == 0)
		{
			free(d);
			continue;
		}
 
		total += d->area;
		count++;
		push(&w2, d);
	}
 
	printf("%d\n", total);
	printf("%d", count);
	if (count > 0)
	{
		printf(" ");
		for(loop = 0; loop < count; loop++)
		{
			d = pop(&w2);
			printf("%d", d->area);
			free(d);
			if(loop + 1 < count) printf(" ");
		}
	}
	printf("\n");
 
	return 0;
}



Compiler output:
main.c: In function 'pop':
main.c:19:9: error: unknown type name 'data'
   19 |         data *d = *p;
      |         ^~~~
main.c:19:19: error: initialization of 'int *' from incompatible pointer type 'ST_FOUNTAIN *' {aka 'struct FOUNTAIN_DATA *'} [-Wincompatible-pointer-types]
   19 |         data *d = *p;
      |                   ^
main.c:20:15: warning: comparison between pointer and integer
   20 |         if(*d != NULL)
      |               ^~
main.c:25:16: error: returning 'int' from a function with return type 'ST_FOUNTAIN *' {aka 'struct FOUNTAIN_DATA *'} makes pointer from integer without a cast [-Wint-conversion]
   25 |         return *d;
      |                ^~
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
 
typedef struct FOUNTAIN_DATA{
	int area;
	int plane;
	struct FOUNTAIN_DATA *next;
} ST_FOUNTAIN;
 
void push(ST_FOUNTAIN **p, ST_FOUNTAIN *d)
{
	d->next = *p;
	*p = d;
}
 
ST_FOUNTAIN *pop(ST_FOUNTAIN **p)
{
	ST_FOUNTAIN *d = *p;
	if(*d != NULL)
	{
		*p = (*p)->next;
	}
	
	return *d;
}
 
int main()
{
	char ch;
	int area;
	int plane;
	int total;
	int count;
	int loop;
	ST_FOUNTAIN *w1;
	ST_FOUNTAIN *w2;
	ST_FOUNTAIN *d;
	
	w1 = NULL;
	w2 = NULL;
	while((ch = getchar()) != '\n')
	{
		if(ch == '\\')
		{
			d = (ST_FOUNTAIN*)malloc(sizeof(ST_FOUNTAIN));
			d->area = 0;
			d->plane = 0;
			push(&w1, d);
		}
		else if(ch == '_')
		{
			d = pop(&w1);
			if (d != NULL)
			{
				d->plane++;
				push(&w1, d);
			}
			else
			{
				/* error process */
			}
		}
		else if(ch == '/')
		{
			area = plane = 0;
			while((d = pop(&w1)) != NULL)
			{
				/* merge foutain data with more depth point */
				area += d->area;	
				plane += d->plane;
				if(d->area == 0)	/* if check point */
				{
					break;
				}
				else
				{
					push(&w2,d);
				}
			}
 
			if(d != NULL)	/* calcration or merge foutain data with more depth point */
			{
				d->area = area + plane + 1;
				d->plane = plane + 2;
				push(&w1, d);
				while((d = pop(&w2)) != NULL)
				{
					free(d);
				}
			}
			else if (area > 0)
			{
				while((d = pop(&w2)) != NULL) push(&w1, d);
			}
		}
		else
		{
		}
	}
 
	total = count = 0;
	while((d = pop(&w1)) != NULL)
	{
		if(d->area == 0)
		{
			free(d);
			continue;
		}
 
		total += d->area;
		count++;
		push(&w2, d);
	}
 
	printf("%d\n", total);
	printf("%d", count);
	if (count > 0)
	{
		printf(" ");
		for(loop = 0; loop < count; loop++)
		{
			d = pop(&w2);
			printf("%d", d->area);
			free(d);
			if(loop + 1 < count) printf(" ");
		}
	}
	printf("\n");
 
	return 0;
}



Compiler output:
main.c: In function 'pop':
main.c:20:15: error: invalid operands to binary != (have 'ST_FOUNTAIN' {aka 'struct FOUNTAIN_DATA'} and 'void *')
   20 |         if(*d != NULL)
      |            ~~ ^~
      |            |
      |            ST_FOUNTAIN {aka struct FOUNTAIN_DATA}
main.c:25:16: error: incompatible types when returning type 'ST_FOUNTAIN' {aka 'struct FOUNTAIN_DATA'} but 'ST_FOUNTAIN *' {aka 'struct FOUNTAIN_DATA *'} was expected
   25 |         return *d;
      |                ^~
Language: C

import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner s=new Scanner(System.in);
        String po=s.nextLine();
        char a[]=po.toCharArray();
        int high[]=new int[20001];
        int mizu[]=new int[10001];
        int i=0;
        for(char a1 : a){
            i++;
            if(a1=='/') high[i]=high[i-1]+1;
            else if(a1=='_') high[i]=high[i-1];
            else high[i]=high[i-1]-1;
        }
        int j=0,tmp=0,cnt=0;
        while(j<i){
            if(high[j]>high[j+1]){
                int m=j;
                while(m<i){
                    m++;
                    if(high[j]==high[m]){
                        mizu[cnt]=menseki(high,j,m);
                        tmp+=mizu[cnt];
                        cnt++;
                        j=m-1;
                        break;
                    }
                }
            }
            j++;
        }
        System.out.println(tmp);
        System.out.print(cnt);
        for(i=0;i<cnt;i++){
            System.out.print(" "+mizu[i]);
        }
        System.out.println("");

    }
    public static int menseki(int[] high,int first,int last){
        int s=0;
        for(int i=first;i<last;i++){
            if(high[i]>high[i+1]){
                s+=((high[first]-high[i+1])*2-1);
            }else if(high[i]==high[i+1]){
                s+=(high[first]-high[i])*2;
            }else{
                s+=((high[first]-high[i])*2-1);
            }
        }
        return s/2;
    }
}


Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.util.Scanner;
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.util.Scanner;
      |            ^
main.c:2:1: error: unknown type name 'public'
    2 | public class Main{
      | ^~~~~~
main.c:2:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
    2 | public class Main{
      |              ^~~~
Language: C

#include<stdio.h>

#define MAX 1000


int EACH_AREA_Calculation(int e_area[], int e_e_idx)//各水溜まりの面積を求める
{
	int e_number = 0,
		each_area = 0;

	while (e_area[e_number] != 0) {
		each_area += e_area[e_number];
		e_number++;
	}

	return each_area;
}

int EACH_AREA_Decision(int snd_stk[], int each_area[])//各水溜まりの面積を求めた時点で、それ以前にその水溜まりより高い水溜まりがないかを確認する。
{
	int share_count = 0,
		number = 0,
		pool_number = 0,
		f_cnt = 0;

	while (1) {
		pool_number++;
		number++;
		if (each_area[number] == 0) {
			break;
		}
	}
	
	pool_number -= 1;
	share_count = 1;

	while ( (pool_number - share_count) != -1) {
		if (snd_stk[pool_number] <= snd_stk[pool_number - share_count]) {//判定した水溜まりと同じ以上の高さがあれば結合する。
			for (f_cnt = 0; f_cnt < share_count; f_cnt++) {
				each_area[pool_number - share_count] += each_area[pool_number - f_cnt];//判定されたほうに入れていく
				snd_stk[pool_number - f_cnt] = 0;//snd_stk[]の結合した部分を初期化
			}



			while (each_area[pool_number - share_count] != 0) {//結合して手前に移動した水溜まりより後の数値を初期化する。
				each_area[pool_number - share_count + 1] = 0;
					share_count--;
			}

			break;
		}
		share_count++;//判定したところから結合した部分の終わりまで
	}

	return f_cnt;
}


int main(void)
{

	int fst_stk[MAX] = { 0 }, f_idx = 0,
		snd_stk[MAX] = { 0 }, s_idx = 0,
		each_area[MAX] = { 0 }, e_idx = 0,
		e_e_area[MAX] = { 0 }, e_e_idx = 0,
		ALL_area = 0;

	int i_idx = 0,
		d_count = 0,
		f_cnt,
		distance = 0;


	char input[MAX];

	fgets(input, MAX, stdin);


	while (input[i_idx] != '\n') {

		switch (input[i_idx]) {
		case '\\':
			d_count++;
			fst_stk[f_idx] = d_count;
			f_idx++;
			i_idx++;
			break;


		case '/':
			fst_stk[f_idx] = d_count;

			for (f_cnt = f_idx - 1; f_cnt >= 0; f_cnt--) {
				distance++;
				if (fst_stk[f_idx] == fst_stk[f_cnt]) {
					e_e_area[e_e_idx] = distance;
					e_e_idx++;
					snd_stk[s_idx] = d_count;//水溜まりの深さを一時的に格納
					s_idx++;
					distance = 0;//次に使うために初期化
					break;
				}
			}

			if (input[i_idx + 1] != '/') {
				each_area[e_idx] = EACH_AREA_Calculation(e_e_area, e_e_idx);
				e_idx++;
				e_e_idx = 0;

				f_cnt = EACH_AREA_Decision(snd_stk, each_area);//水溜まりを結合していた場合、帳尻を合わせる
				s_idx -= f_cnt;
				e_idx -= f_cnt;//結合した分の帳尻を合わせる

			}

			d_count--;
			f_idx++;
			i_idx++;

			break;


		case '_':
			d_count++;
			fst_stk[f_idx] = d_count;
			f_idx++;
			i_idx++;
			if (input[i_idx + 1] != '_') {
				d_count--;
			}
			break;

		}
	}

	for (f_cnt = 0; f_cnt < e_idx; f_cnt++) {
		ALL_area += each_area[f_cnt];
	}

	printf("%d\n", ALL_area);
	printf("%d", e_idx);

	for (f_cnt = 0; f_cnt < e_idx; f_cnt++) {
		printf(" %d", each_area[f_cnt]);
	}
	putchar('\n');

	return 0;




Compiler output:
main.c: In function 'main':
main.c:149:9: error: expected declaration or statement at end of input
  149 |         return 0;
      |         ^~~~~~
Language: C

#include<stdio.h>

#define MAX 1000


int EACH_AREA_Calculation(int e_area[], int e_e_idx)//各水溜まりの面積を求める
{
	int e_number = 0,
		each_area = 0,
		w_cnt = 0;

	while (e_area[e_number] != 0) {
		each_area += e_area[e_number];
		e_number++;
	}

	while (e_area[w_cnt] != 0) {
		e_area[w_cnt] = 0;
		w_cnt++;
	}


	return each_area;
}

int EACH_AREA_Decision(int snd_stk[], int each_area[], int s_idx)//各水溜まりの面積を求めた時点で、それ以前にその水溜まりより高い水溜まりがないかを確認する。
{
	int share_count = 0,
		number = 0,
		pool_number = 0,
		pool_count = 0,
		f_cnt = 0,
		TOP = 0;

	while (1) {
		pool_number++;
		if (each_area[pool_number] == 0) {
			pool_number--;
			break;
		}
	}

	share_count = 1;
	s_idx -= 1;

	while ((pool_number - share_count) != -1) { 

		if (snd_stk[s_idx] < snd_stk[s_idx - share_count]) {//判定した水溜まりとそれ以前の水溜まりが同じ以下の高さであれば（※数値上では高ければ）その間にある水溜まりを結合する。
			each_area[pool_number - share_count] += each_area[pool_number - pool_count];//判定されたほうに入れていく
			each_area[pool_number - pool_count] = 0;//初期化
			
			pool_count++;
		}
		else if (snd_stk[s_idx] >= snd_stk[s_idx - share_count]) {//
			break;
		}

		share_count++;//判定したところから結合した部分の終わりまで
		
	}
	share_count -= 1;

	return share_count;
}


int main(void)
{

	int fst_stk[MAX] = { 0 }, f_idx = 0,
		snd_stk[MAX] = { 0 }, s_idx = 0,
		each_area[MAX] = { 0 }, e_idx = 0,
		ALL_area = 0;

	int i_idx = 0,
		d_count = 0,
		f_cnt = 0,
		distance = 0;


	char input[MAX];

	fgets(input, MAX, stdin);


	while (input[i_idx] != '\n') {

		switch (input[i_idx]) {
		case '\\':
			if (s_idx == 0) {
				snd_stk[s_idx] = 1;
				s_idx++;
			}
			d_count++;
			fst_stk[f_idx] = d_count;
			f_idx++;
			i_idx++;
			break;


		case '/':
			if (d_count == 0) {
				i_idx++;
				break;
			}

			fst_stk[f_idx] = d_count;

			for (f_cnt = f_idx - 1; f_cnt >= 0; f_cnt--) {//Ｘ軸の面積を求める
				distance++;
				if (fst_stk[f_idx] == fst_stk[f_cnt]) {
					each_area[e_idx] = distance;
					e_idx++;
					snd_stk[s_idx] = d_count;//水溜まりの深さを一時的に格納
					s_idx++;
					distance = 0;//次に使うために初期化

					f_cnt = EACH_AREA_Decision(snd_stk, each_area, s_idx);//水溜まりを結合していた場合、帳尻を合わせる
					s_idx -= f_cnt;
					e_idx -= f_cnt;//結合した分の帳尻を合わせる
					break;
				}
			}

			d_count--;
			f_idx++;
			i_idx++;

			break;


		case '_':
			if (d_count == 0) {
				i_idx++;
				break;
			}
			fst_stk[f_idx] = -1;
			f_idx++;
			i_idx++;
			break;

		}
	}

	for (f_cnt = 0; f_cnt < e_idx; f_cnt++) {
		ALL_area += each_area[f_cnt];
	}

	printf("%d\n", ALL_area);
	printf("%d", e_idx);

	for (f_cnt = 0; f_cnt < e_idx; f_cnt++) {
		printf(" %d", each_area[f_cnt]);
	}
	putchar('\n');

	return 0;




Compiler output:
main.c: In function 'main':
main.c:157:9: error: expected declaration or statement at end of input
  157 |         return 0;
      |         ^~~~~~
Language: C

#include<stdio.h>
#include<string.h>
#define N 20001
typedef struct
{
  int x[2];//position of both side of damage
  int depth;//position of depth of damage
  int area;
} damage;
void calcDamage(char*);
void push(damage);
damage pop(void);
void printStack(void);
damage stack[N];
int top=0;
int main(void)
{
  char str[N];//input
  scanf("%s",str);
  calcDamage(str);
  printStack();
  return 0;
}
void calcDamage(char *str)
{
  int i;//counter
  int x=0,y=0;//current position
  int p[N];//array of depth
  p[0]=0;
  int mindepth=0;//minimum depth (default: 0)
  damage temp;
  for(x=1;x<=strlen(str);x++)
    {
      switch(str[x])
        {
        case '\':
          y--;
          p[x]=y;
          #ifdef DEBUG
          printf("(%d,%d)\n",x,y);//debugging
          #endif
          break;
        case '/':
          y++;
          p[x]=y;
          #ifdef DEBUG
          printf("(%d,%d)\n",x,y);//debugging
          #endif
          if(y>mindepth) mindepth=y;
          else
            {
              for(i=x-1;i>=0;i--)
                {
                  if(p[i]==y) break;
                }
              if(i>=0)
                {
                  temp.x[0]=i;
                  temp.x[1]=x;
                  temp.depth=y;
                  temp.area=((x-i)+(x-i-2))/2;
                  #ifdef DEBUG
                  printf("push->%d,%d,%d,%d\n",temp.x[0],temp.x[1],temp.depth,temp.area);//debugging
                  #endif
                  push(temp);
                }
            }
          break;
        case '_':
          p[x]=y;
          #ifdef DEBUG
          printf("(%d,%d)\n",x,y);//debugging
          #endif
          break;
        }
    }
}
void push(damage d)
{
  damage p;//poped element
  while(top>0)
    {
      p=pop();
      if(p.x[0]>d.x[0]&&p.x[1]<d.x[1])
        {
          d.area+=p.area;
          #ifdef DEBUG
          printf(" merged->%d,%d,%d,%d\n",d.x[0],d.x[1],d.depth,d.area);//debugging
          #endif
        }
      else break;
    }
  top++;
  stack[top]=d;
}
damage pop(void)
{
  top--;
  return stack[top+1];
}
void printStack(void)
{
  int i=0;//counter
  int sum=0;//sum of damage
  for(i=1;i<=top;i++) sum+=stack[i].area;
  printf("%d\n",sum);
  printf("%d",top);
  for(i=1;i<=top;i++) printf(" %d",stack[i].area);
  printf("\n");
}


Compiler output:
main.c: In function 'calcDamage':
main.c:36:14: warning: missing terminating ' character
   36 |         case '\':
      |              ^
main.c:36:14: error: missing terminating ' character
   36 |         case '\':
      |              ^~~~
main.c:37:14: error: expected ':' or '...' before ';' token
   37 |           y--;
      |              ^
main.c:38:15: warning: statement will never be executed [-Wswitch-unreachable]
   38 |           p[x]=y;
      |           ~~~~^~
Language: C

#include <stdio.h>
#include <string.h>
#define MAX 20001

typedef struct dx{
  int id;
  int s;
}dx;

void push1(int S[],int x,int *t){
  S[*t]=x;
  (*t)++;
}

void push2(dx S[],int id,int s,int *t){
  S[*t].id=id;
  S[*t].s=s;
  (*t)++;
}

int bpop(int S[],int *t){
  (*t)--;
  return S[*t];
}

void Union(dx S[],int *t){
  int i;
  for(i=(*t)-1;i>0;i--){
    if(S[i].id < S[i-1].id){
      (*t)--;
      S[i-1].id=S[i].id;
      S[i-1].s+=S[i].s;
    }
  }
}

int main(){
  int i,j,id,stack1[MAX],top1=0,top2=0,sum=0;
  cahr str[MAX];
  dx stack2[MAX];

  scanf("%s",str);
  for(i=0;i<strlen(str);i++){

    switch(str[i]){
    case '\\':push1(stack1,i,&top1);
      break;
    case '/' :if(top1==0)break;
      idx=pop(stack1,&top1);
      sum+=(i-id);
      push2(stack2,id,i-id,&top2);
      Union(stack2,&top2);
      break;
    }

  }
  printf("%d\n",sum);
  if(top2 == 0)printf("%d\n",top2);
  else {
    printf("%d ",top2);
    for(i=0;i<top2-1;i++)printf("%d ",stack2[i].s);
    printf("%d\n",stack2[top2-1].s);
  }
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:39:3: error: unknown type name 'cahr'; did you mean 'char'?
   39 |   cahr str[MAX];
      |   ^~~~
      |   char
main.c:43:20: error: passing argument 1 of 'strlen' from incompatible pointer type [-Wincompatible-pointer-types]
   43 |   for(i=0;i<strlen(str);i++){
      |                    ^~~
      |                    |
      |                    int *
In file included from main.c:2:
/usr/include/string.h:407:35: note: expected 'const char *' but argument is of type 'int *'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
main.c:49:7: error: 'idx' undeclared (first use in this function); did you mean 'id'?
   49 |       idx=pop(stack1,&top1);
      |       ^~~
      |       id
main.c:49:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:49:11: error: implicit declaration of function 'pop'; did you mean 'bpop'? [-Wimplicit-function-declaration]
   49 |       idx=pop(stack1,&top1);
      |           ^~~
      |           bpop
Language: C

#include <stdio.h>
#include <string.h>
#define MAX 20001

typedef struct dx{
  int id;
  int s;
}dx;

void push1(int S[],int x,int *t){
  S[*t]=x;
  (*t)++;
}

void push2(dx S[],int id,int s,int *t){
  S[*t].id=id;
  S[*t].s=s;
  (*t)++;
}

int bpop(int S[],int *t){
  (*t)--;
  return S[*t];
}

void Union(dx S[],int *t){
  int i;
  for(i=(*t)-1;i>0;i--){
    if(S[i].id < S[i-1].id){
      (*t)--;
      S[i-1].id=S[i].id;
      S[i-1].s+=S[i].s;
    }
  }
}

int main(){
  int i,j,id,stack1[MAX],top1=0,top2=0,sum=0;
  char str[MAX];
  dx stack2[MAX];

  scanf("%s",str);
  for(i=0;i<strlen(str);i++){

    switch(str[i]){
    case '\\':push1(stack1,i,&top1);
      break;
    case '/' :if(top1==0)break;
      id=pop(stack1,&top1);
      sum+=(i-id);
      push2(stack2,id,i-id,&top2);
      Union(stack2,&top2);
      break;
    }

  }
  printf("%d\n",sum);
  if(top2 == 0)printf("%d\n",top2);
  else {
    printf("%d ",top2);
    for(i=0;i<top2-1;i++)printf("%d ",stack2[i].s);
    printf("%d\n",stack2[top2-1].s);
  }
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:49:10: error: implicit declaration of function 'pop'; did you mean 'bpop'? [-Wimplicit-function-declaration]
   49 |       id=pop(stack1,&top1);
      |          ^~~
      |          bpop
Language: C++

#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
	stack<int> S1;
	stack<pair<int, int> > S2;
	char ch;
	int sum=0;
	for(int i=0;cib>>ch;i++){
		if(ch=='\\') S1.push(i);
		else if(ch=='/'&&S1.size()>0){
			int j=S1.top(); S1.pop();
			sum +=i-j;
			int a=i-j;
			while(S2.size()>0 && S2.top().first>j){
				a +=S2.top.second; S2.pop();
			}
			S2.push(make_pair(j,a));
		}
	}


	vector<int>ans;
	while(S2.size()>0){ans.push_back(S2.top().second); S2.pop();}
	reverse(ans.begin(),ans.end());
	cout<<sum<<endl;
	cout<<ans.size;
	for(int i=0;i<ans.size();i++){
		cout<<" ";
		cout<<ans[i];
	}
	cout<<endl;
	
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: 'cib' was not declared in this scope
   13 |         for(int i=0;cib>>ch;i++){
      |                     ^~~
a.cc:20:40: error: invalid use of member function 'std::stack<std::pair<int, int> >::top' (did you forget the '()' ?)
   20 |                                 a +=S2.top.second; S2.pop();
      |                                     ~~~^~~
a.cc:31:13: error: invalid use of non-static member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]'
   31 |         cout<<ans.size;
      |         ~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_vector.h:992:7: note: declared here
  992 |       size() const _GLIBCXX_NOEXCEPT
      |       ^~~~
Language: C++

#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
	stack<int> S1;
	stack<pair<int, int> > S2;
	char ch;
	int sum=0;
	for(int i=0;cin>>ch;i++){
		if(ch=='\\') S1.push(i);
		else if(ch=='/'&&S1.size()>0){
			int j=S1.top(); S1.pop();
			sum +=i-j;
			int a=i-j;
			while(S2.size()>0 && S2.top().first>j){
				a +=S2.top.second; S2.pop();
			}
			S2.push(make_pair(j,a));
		}
	}


	vector<int>ans;
	while(S2.size()>0){ans.push_back(S2.top().second); S2.pop();}
	reverse(ans.begin(),ans.end());
	cout<<sum<<endl;
	cout<<ans.size;
	for(int i=0;i<ans.size();i++){
		cout<<" ";
		cout<<ans[i];
	}
	cout<<endl;
	
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:40: error: invalid use of member function 'std::stack<std::pair<int, int> >::top' (did you forget the '()' ?)
   20 |                                 a +=S2.top.second; S2.pop();
      |                                     ~~~^~~
a.cc:31:13: error: invalid use of non-static member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]'
   31 |         cout<<ans.size;
      |         ~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_vector.h:992:7: note: declared here
  992 |       size() const _GLIBCXX_NOEXCEPT
      |       ^~~~
Language: C++

#include<iostream>
#include<stack>
#include<string>
#include<vector>
using namespace std;

struct pool{
  int idx;
  int area;
};

void print_stack(stack<pool> s){

  printf("print stack\n");
  while(s.size() > 0){
    pool& p = s.top();
    printf("idx:%d area:%d\n", p.idx, p.area);
    s.pop();
  }
  printf("\n");
}

int main(){
  stack<int> S1;
  stack<pool> S2;
  char c;
  int sum = 0;

  for(int i = 0; cin >> c; i++){
//    fprintf(stderr, "%d\n",i);
    if(c == '\\'){
      S1.push(i);
    }else if(c== '/' && S1.size() > 0){
      int j = S1.top();
      S1.pop();
      sum += i - j;

      int tmp=0;
      if(S2.size() > 0){
        bool flag = false;
        while(S2.size()>0){
          pool& p = S2.top();
          if(p.idx > j){
            S2.pop();
            tmp += p.area;
            flag = true;
          }else{
            pool p2 = {j, tmp+i-j};
            S2.push(p2);
            flag = false;
            break;
          }
        }
        if(flag){
          pool p2 = {j, tmp+i-j};
          S2.push(p2);
        }
      }else{
        pool p2 = {j, i-j};
        S2.push(p2);
      }
//      print_stack(S2);
    }
  }

  printf("%d\n", sum);

  printf("%d", (int)S2.size());

  vector<int> v;

  while(S2.size() > 1){
    pool& p = S2.top();
//    printf("%d(%d) ", p.area, p.idx);
    v.push_back(p.area);
    S2.pop();
  }
  if(S2.size() == 1){
    pool& p = S2.top();
//    printf("%d(%d)\n", p.area, p.idx);
    v.push_back(p.area);
  }
  std::reverse(v.begin(), v.end());
  for(int x: v){
    printf(" %d",x);
  }
  printf("\n");
}



Compiler output:
a.cc: In function 'int main()':
a.cc:83:8: error: 'reverse' is not a member of 'std'
   83 |   std::reverse(v.begin(), v.end());
      |        ^~~~~~~
Language: C++

#include<iostream>
#include<stack>
#include<vector>
using namespace std;

int main(void){
	stack<int> st;
	string s;
	cin >> s;
	int m1[200005], m2[200005], sum, res, SUM;
	vector<int> v;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == '_')continue;
		else if(s[i] == '\\') st.push(i);
		else{
			if(st.empty()!){
				int x = st.top(); st.pop();
				m1[x] += i-x;
				m2[i] -= i-x;
			}
		}
	}
	for(int i = 0; i < s.size(); i++){
		sum += m1[i];
		res += m1[i];
		sum += m2[i];
		if(sum == 0){
			SUM += res;
			if(res != 0){
				v[v.size()] = res; 
				res = 0;
			}
		}
	}
	cout << SUM << endl << v.size();
	for(int i = 0; i < v.size(); i++){
		cout << ' ' << v[i];
	}
	cout << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:38: error: expected ')' before '!' token
   16 |                         if(st.empty()!){
      |                           ~          ^
      |                                      )
Language: C++

#include<iostream>
#include<stack>
#include<vector>
using namespace std;

int main(void){
	stack<int> st;
	string s;
	cin >> s;
	int m1[200005], m2[200005], sum, res, SUM;
	vector<int> v;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == '_')continue;
		else if(s[i] == '\\') st.push(i);
		else{
			if(bool b != st.empty()){
				int x = st.top(); st.pop();
				m1[x] += i-x;
				m2[i] -= i-x;
			}
		}
	}
	for(int i = 0; i < s.size(); i++){
		sum += m1[i];
		res += m1[i];
		sum += m2[i];
		if(sum == 0){
			SUM += res;
			if(res != 0){
				v[v.size()] = res; 
				res = 0;
			}
		}
	}
	cout << SUM << endl << v.size();
	for(int i = 0; i < v.size(); i++){
		cout << ' ' << v[i];
	}
	cout << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:35: error: expected initializer before '!=' token
   16 |                         if(bool b != st.empty()){
      |                                   ^~
a.cc:16:34: error: expected ')' before '!=' token
   16 |                         if(bool b != st.empty()){
      |                           ~      ^~~
      |                                  )
Language: C++

#include<iostream>
#include<stack>
#include<vector>
using namespace std;

int main(void){
	stack<int> st;
	string s;
	cin >> s;
	int m1[200005], m2[200005], sum, res, SUM;
	vector<int> v;
	for(int i = 0; i < s.size(); i++){
		if(s[i] == '_')continue;
		else if(s[i] == '\\') st.push(i);
		else if(s[i] == '/'){
			if(st.empty()) continue;
			int x = st.top(); st.pop();
			m1[x] += i-x;
			m2[i] -= i-x;
			
		}
	}
	for(int i = 0; i < 200005; i++){
		sum += m1[i];
		res += m1[i];
		sum += m2[i];
		if(sum == 0){
			SUM += res;
			if(res != 0){
				v.example_back(res); 
				res = 0;
			}
		}
	}
	cout << SUM << endl << v.size();
	for(int i = 0; i < v.size(); i++){
		cout << ' ' << v[i];
	}
	cout << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:35: error: 'class std::vector<int>' has no member named 'example_back'; did you mean 'emplace_back'?
   30 |                                 v.example_back(res);
      |                                   ^~~~~~~~~~~~
      |                                   emplace_back
Language: C++

#include<iostream>
#include<stack>
#include<vector>
using namespace std;

int main() {
	char input[20000];
	cin >> input;

	stack<int> st1;
	stack<int> st2;
	stack<int> st3;
	int lv = 0;
	int total = 0;
	for (unsigned int i = 0; i < strlen(input); i++) {
		char c = input[i];
		if (c == '\\') {
			lv--;
			st1.push(i);
		}
		else if (c == '/') {
			lv++;
			if (!st1.empty()) {
				int newArea = i - st1.top(); st1.pop();
				total += newArea;
				int prevArea = 0;
				while (!st2.empty() && st3.top() < lv) {
					st3.pop();
					prevArea += st2.top(); st2.pop();
				}
				st2.push(newArea + prevArea);
				st3.push(lv);
			}
			else if (!st3.empty()) {
				st3.pop();
				st3.push(lv);
			}
		}
	}

	cout << total << endl;
	int n = st2.size();
	cout << n;
	vector<int> vec;
	while (!st2.empty()) {
		vec.push_back(st2.top());
		st2.pop();
	}
	for (int i = 0; i < n; i++) {
		cout << " " << vec[n-i-1];
	}
	cout << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:15:38: error: 'strlen' was not declared in this scope
   15 |         for (unsigned int i = 0; i < strlen(input); i++) {
      |                                      ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<vector>
  +++ |+#include <cstring>
    4 | using namespace std;
Language: C++

#include<iostream>
#include<string>
using namespace std;

int main(){
	string inp;
	cin >> inp;
	int inp_size = inp.size();
	int hight[20000] = {0};
	int area[10000] = {0};
	for (int i = 0; i < inp_size; i++){
		if (inp[i] == '/'){
			hight[i+1] = hight[i] + 1;
		}
		else if (inp[i] == '_'){
			hight[i+1] = hight[i];
		}
		else {
			hight[i+1] = hight[i] - 1;
		}
	}

	// calc areas
	int x = inp_size;
	int num = 0;
	while(x > 0){
		if (hight[x] > hight[x-1]){
			int y = x;
			for (int j = x-1; j >= 0; j--){
				if (hight[x] == hight[j]) {
					y = j;
					// calc area
					for (int i = y; i < x; i++){
						if (hight[i] > hight[i+1]){
							area[num] += (hight[y] - hight[i+1] - 1) * 2 + 1;
						}
						else if  (hight[i] == hight[i+1]){
							area[num] += hight[y] - hight[i+1];
						}
					}
					num++;
					x = y;
					break;
				}
				if (j == 0) x = -1;
			}
		}
		else {
			x--;
		}
	}
	cout << sum(area) << endl;
	cout << num;
	for (int i = 0; i < num; i++) cout << " " << area[i];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:17: error: 'sum' was not declared in this scope; did you mean 'num'?
   52 |         cout << sum(area) << endl;
      |                 ^~~
      |                 num
Language: C++

#include<cstdio>
#include<algorithm>
#include<stack>
#include<cstring>
using namespace std;

int main(){
	int i,n,j,k,cur=0,total=0;
	char a[20001];
	int area[10000];
	stack<int> s;
	stack<pair<int,int> > scur;
	gets(a);
	int cua=0;
	int flag=1;
	int l=strlen(a);
	for(i=0;i<l;i++){
		if(a[i]=='\\'){
			s.push(i);
		}
		if(a[i]=='/' && s.size()){
			j=s.top();
			n = i-s.top();
			total+=n;
			s.pop();
			while(scur.size() && scur.top().first > j){
				n+=scur.top().second;
				scur.pop();
			}
			scur.push(make_pair(j,n));
		}
	}
	j=scur.size();
	printf("%d\n%d",total,j);
	for(i=0;i<j;i++){
		area[i]=scur.top().second;
		scur.pop();
	} 
	for(i--;i>=0;i--){
		printf(" %d",area[i]);
	}
	printf("\n");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   13 |         gets(a);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h> 
using namespace std;

int main(){
	int i,n,j,k,cur=0,total=0;
	char a[20001];
	int area[10000];
	stack<int> s;
	stack<pair<int,int> > scur;
	gets(a);
	int cua=0;
	int flag=1;
	int l=strlen(a);
	for(i=0;i<l;i++){
		if(a[i]=='\\'){
			s.push(i);
		}
		if(a[i]=='/' && s.size()){
			j=s.top();
			n = i-s.top();
			total+=n;
			s.pop();
			while(scur.size() && scur.top().first > j){
				n+=scur.top().second;
				scur.pop();
			}
			scur.push(make_pair(j,n));
		}
	}
	j=scur.size();
	printf("%d\n%d",total,j);
	for(i=0;i<j;i++){
		area[i]=scur.top().second;
		scur.pop();
	} 
	for(i--;i>=0;i--){
		printf(" %d",area[i]);
	}
	printf("\n");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   10 |         gets(a);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;

char s[20010];
vector<int> ans;
stack<int> S1;
stack<pair<int, int> > S2;
int main(){
	gets(s);
	int len = strlen(s), sum = 0, a;
	for(int i = 0; i < len; i++){
		if(s[i] == '\\'){
			S1.push(i); 
		} 
		else if(s[i] == '/'){
			if(S1.size() > 0){
				int j = S1.top();
				S1.pop();
				sum += i - j;
				a = i - j;
				while(S2.size() > 0 && S2.top().first > j){
					a += S2.top().second;
					S2.pop();
				}
				S2.push(make_pair(i, a));
			}
		}
	}
	printf("%d\n", sum);
	while(S2.size() > 0){
		ans.push_back(S2.top().second);
		S2.pop();
	}
	reverse(ans.begin(), ans.end());
	printf("%d", ans.size());
	for(int i = 0; i < ans.size(); i++) printf(" %d", ans[i]);
	printf("\n");
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    9 |         gets(s);
      |         ^~~~
      |         getw