Language: C

/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/
#include <stdio.h>
signed long n,d,a;
long long test = 0;
signed  long* x;
signed  long* h;
signed long long* count;
signed long* min;
signed long long max_count = -1;
signed long curr_pos = 0;
signed long max_index;
signed long number_of_bombs = 0;
signed long long result = 0;
void quicksort(signed long number[],signed  long first,signed long last){
   signed long i, j, pivot, temp;

   if(first<last){
      pivot=first;
      i=first;
      j=last;

      while(i<j){
         while(number[i]<=number[pivot]&&i<last)
            i++;
         while(number[j]>number[pivot])
            j--;
         if(i<j){
            temp = h[i];
            h[i]=h[j];
            h[j]=h[i]; 
            temp=number[i];
            number[i]=number[j];
            number[j]=temp;
            
         }
      }
      temp=h[pivot];
      h[pivot]=h[j];
      h[j]=temp;
      temp=number[pivot];
      number[pivot]=number[j];
      number[j]=temp;
      quicksort(number,first,j-1);
      quicksort(number,j+1,last);

   }
}





signed long bomb(void)
{
    signed long i;
    if(min[curr_pos]<=a)
     number_of_bombs = 1;
    else
     number_of_bombs = min[curr_pos]/a;
   // printf("min is: %ld\n",min[curr_pos]);
   // printf("number_of_bombs is: %ld\n",number_of_bombs);
    for(i=0;i<=d;i++)
    {
       // printf("decreasing\n");
        if((i+curr_pos)<n)
        {
          //printf("At pos: %ld health was: %ld\n",curr_pos+1+i,h[curr_pos+i]);
          h[curr_pos+i] = h[curr_pos+i] - number_of_bombs*a;
          if(h[curr_pos+i] < 0)
            h[curr_pos+i] = 0;
          //printf("At pos: %ld health is: %ld\n",curr_pos+1+i,h[curr_pos+i]);
        }
        if((curr_pos-i)>=0 && i!=0)  
        {
         //  printf("At pos: %ld health was: %ld\n",curr_pos+1-i,h[curr_pos-i]);
           h[curr_pos-i] = h[curr_pos-i] - number_of_bombs*a;
           if(h[curr_pos-i] < 0)
            h[curr_pos-i] = 0;
          // printf("At pos: %ld health is: %ld\n",curr_pos+1-i,h[curr_pos-i]);
        }
        
      //  printf("decreasing done\n") ;
          
    }
    //h[curr_pos] = h[curr_pos] + number_of_bombs*a;
   // printf("At pos: %ld health is: %ld\n",curr_pos+1,h[curr_pos]);
    return number_of_bombs;
}
    
void count_all_nodes(void)
{
    signed long i,j;
    max_count = 0;
signed long temp = 0;
    for(i=0;i<n;i++)
    {
temp++;
if(temp>10)
    break
        count[i] = 0;
        min[i] = -1;
        for(j=0;(j<=d);j++)
        {
            if((i+j)<n)
             count[i] = count[i] + h[i+j];
            
            if((i-j)>=0)
             count[i] = count[i] + h[i-j];
             
            if((i+j)<n) 
                if(((h[i+j]<= min[i]) || (min[i] == -1)) && h[i+j]!=0)
                    min[i] = h[i+j];
            if((i-j)>=0) 
                if(((h[i-j]<= min[i]) || (min[i] == -1)) && h[i-j]!=0)
                    min[i] = h[i-j]; 
        }
        count[i] = count[i] - h[i];
        if(max_count < count[i])
        {
            max_count = count[i];
            max_index = i;
        }
    }
    curr_pos = max_index;
    //printf("curr_pos: %ld\n",curr_pos+1);
}
int main()
{

    scanf("%ld%ld%ld",&n,&d,&a);
    x = (signed long*) malloc(n * sizeof(signed  long));
    h = (signed  long*) malloc(n * sizeof(signed long));
    count = (signed long long*) malloc(n * sizeof(signed long long));
    min = (signed long*) malloc(n * sizeof(signed long));
    signed long i;
    for(i=0;i<n;i++)
    {
        scanf("%ld%ld",x+i,h+i);
    }

    quicksort(x,0,n-1);
   // printf("*************\n");
    count_all_nodes();
    
    //for(i=0;i<n;i++)
    {
     //   printf("%ld %ld %lld %ld\n",x[i],h[i],count[i],min[i]);
    }
   // printf("*************\n");
signed long temp = 0;
    while(max_count>0)
    {
      //  printf("bombing\n");
        result = result + bomb();
        count_all_nodes();
        temp++;
if(temp>10)
    break;
       // printf("max_count is: %lld , max_pos is: %ld\n",max_count,max_index+1);
    }
  
    printf("%lld\n",result);
    return 0;
}


Compiler output:
main.c: In function 'count_all_nodes':
main.c:105:10: error: expected ';' before 'count'
  105 |     break
      |          ^
      |          ;
  106 |         count[i] = 0;
      |         ~~~~~
main.c: In function 'main':
main.c:137:24: error: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
  137 |     x = (signed long*) malloc(n * sizeof(signed  long));
      |                        ^~~~~~
main.c:9:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    8 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    9 | signed long n,d,a;
main.c:137:24: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
  137 |     x = (signed long*) malloc(n * sizeof(signed  long));
      |                        ^~~~~~
main.c:137:24: note: include '<stdlib.h>' or provide a declaration of 'malloc'