Language: C

#define r(a,i)for(i=0;i<a;i++)
#define s (scanf("%d",&w),w)
#define c(a,b)a=a<b?a:b
d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}

Compiler output:
main.c:4:1: warning: data definition has no type or storage class
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      | ^
main.c:4:1: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int]
main.c:4:8: error: type defaults to 'int' in declaration of 'p' [-Wimplicit-int]
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      |        ^
main.c:4:15: error: return type defaults to 'int' [-Wimplicit-int]
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      |               ^~~~
main.c: In function 'main':
main.c:4:15: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:4:15: error: type of 'j' defaults to 'int' [-Wimplicit-int]
main.c:4:15: error: type of 'w' defaults to 'int' [-Wimplicit-int]
main.c:4:15: error: type of 'n' defaults to 'int' [-Wimplicit-int]
main.c:4:15: error: type of 'm' defaults to 'int' [-Wimplicit-int]
main.c:4:15: error: type of 'q' defaults to 'int' [-Wimplicit-int]
main.c:2:12: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    2 | #define s (scanf("%d",&w),w)
      |            ^~~~~
main.c:4:35: note: in expansion of macro 's'
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      |                                   ^
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | #define r(a,i)for(i=0;i<a;i++)
main.c:2:12: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    2 | #define s (scanf("%d",&w),w)
      |            ^~~~~
main.c:4:35: note: in expansion of macro 's'
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      |                                   ^
main.c:2:12: note: include '<stdio.h>' or provide a declaration of 'scanf'
    2 | #define s (scanf("%d",&w),w)
      |            ^~~~~
main.c:4:35: note: in expansion of macro 's'
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      |                                   ^
main.c:4:85: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion]
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      |                                                                                     ^
main.c:4:92: error: invalid type argument of unary '*' (have 'int')
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      |                                                                                            ^~
main.c:3:15: note: in definition of macro 'c'
    3 | #define c(a,b)a=a<b?a:b
      |               ^
main.c:4:92: error: invalid type argument of unary '*' (have 'int')
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      |                                                                                            ^~
main.c:3:17: note: in definition of macro 'c'
    3 | #define c(a,b)a=a<b?a:b
      |                 ^
main.c:4:96: error: subscripted value is neither array nor pointer nor vector
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      |                                                                                                ^
main.c:3:19: note: in definition of macro 'c'
    3 | #define c(a,b)a=a<b?a:b
      |                   ^
main.c:4:92: error: invalid type argument of unary '*' (have 'int')
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      |                                                                                            ^~
main.c:3:21: note: in definition of macro 'c'
    3 | #define c(a,b)a=a<b?a:b
      |                     ^
main.c:4:96: error: subscripted value is neither array nor pointer nor vector
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      |                                                                                                ^
main.c:3:23: note: in definition of macro 'c'
    3 | #define c(a,b)a=a<b?a:b
      |                       ^
main.c:4:113: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      |                                                                                                                 ^~~~~~
main.c:4:113: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:4:113: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:4:113: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:4:131: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      |                                                                                                                                   ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
  +++ |+#include <stdlib.h>
    1 | #define r(a,i)for(i=0;i<a;i++)
main.c:4:131: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
    4 | d[999],p[999];main(i,j,w,n,m,q){n=s;m=s;r(n,i)d[i]=s;r(n,i)p[i]=1e9;r(m,j){s;r(n,i)q=p+i,c(*q,q[i]+w*d[n-i-1]);}printf("%d\n",*p),exit(0);}
      |                                                                                                                                   ^~~~
main.c:4:131: note: include '<stdlib.h>' or provide a declaration of 'exit'