Language: C

main(){ans, num[15][15], w, h, i, j, map[15][15];while (1){scanf("%d%d", &w, &h);if (w + h == 0){break;}memset(map, -1, sizeof(map));for (i = 0; i < h; i++){for (j = 0; j < w; j++){scanf("%d", &map[i][j]);}}memset(num, 0, sizeof(num));for (i = 0; i < w; i++){if (map[0][i] != 1){num[0][i] = 1;}}for (i = 1; i < h; i++){for (j = 0; j < w; j++){if (j > 0 && map[i - 1][j - 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j - 1];}if (map[i - 1][j] == 0){num[i][j] += num[i - 1][j];}if (j < w - 1 && map[i - 1][j + 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j + 1];}if (i > 1 && map[i - 2][j] == 2){num[i][j] += num[i - 2][j];}}}ans = 0;for (j = 0; j < w; j++){if (map[h - 1][j] != 1){ans += num[h - 1][j];}if (h > 1 && map[h - 2][j] == 2){ans += num[h - 2][j];}}printf("%d\n", ans);}return (0);}

Compiler output:
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
    1 | main(){ans, num[15][15], w, h, i, j, map[15][15];while (1){scanf("%d%d", &w, &h);if (w + h == 0){break;}memset(map, -1, sizeof(map));for (i = 0; i < h; i++){for (j = 0; j < w; j++){scanf("%d", &map[i][j]);}}memset(num, 0, sizeof(num));for (i = 0; i < w; i++){if (map[0][i] != 1){num[0][i] = 1;}}for (i = 1; i < h; i++){for (j = 0; j < w; j++){if (j > 0 && map[i - 1][j - 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j - 1];}if (map[i - 1][j] == 0){num[i][j] += num[i - 1][j];}if (j < w - 1 && map[i - 1][j + 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j + 1];}if (i > 1 && map[i - 2][j] == 2){num[i][j] += num[i - 2][j];}}}ans = 0;for (j = 0; j < w; j++){if (map[h - 1][j] != 1){ans += num[h - 1][j];}if (h > 1 && map[h - 2][j] == 2){ans += num[h - 2][j];}}printf("%d\n", ans);}return (0);}
      | ^~~~
main.c: In function 'main':
main.c:1:8: error: 'ans' undeclared (first use in this function)
    1 | main(){ans, num[15][15], w, h, i, j, map[15][15];while (1){scanf("%d%d", &w, &h);if (w + h == 0){break;}memset(map, -1, sizeof(map));for (i = 0; i < h; i++){for (j = 0; j < w; j++){scanf("%d", &map[i][j]);}}memset(num, 0, sizeof(num));for (i = 0; i < w; i++){if (map[0][i] != 1){num[0][i] = 1;}}for (i = 1; i < h; i++){for (j = 0; j < w; j++){if (j > 0 && map[i - 1][j - 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j - 1];}if (map[i - 1][j] == 0){num[i][j] += num[i - 1][j];}if (j < w - 1 && map[i - 1][j + 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j + 1];}if (i > 1 && map[i - 2][j] == 2){num[i][j] += num[i - 2][j];}}}ans = 0;for (j = 0; j < w; j++){if (map[h - 1][j] != 1){ans += num[h - 1][j];}if (h > 1 && map[h - 2][j] == 2){ans += num[h - 2][j];}}printf("%d\n", ans);}return (0);}
      |        ^~~
main.c:1:8: note: each undeclared identifier is reported only once for each function it appears in
main.c:1:13: error: 'num' undeclared (first use in this function)
    1 | main(){ans, num[15][15], w, h, i, j, map[15][15];while (1){scanf("%d%d", &w, &h);if (w + h == 0){break;}memset(map, -1, sizeof(map));for (i = 0; i < h; i++){for (j = 0; j < w; j++){scanf("%d", &map[i][j]);}}memset(num, 0, sizeof(num));for (i = 0; i < w; i++){if (map[0][i] != 1){num[0][i] = 1;}}for (i = 1; i < h; i++){for (j = 0; j < w; j++){if (j > 0 && map[i - 1][j - 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j - 1];}if (map[i - 1][j] == 0){num[i][j] += num[i - 1][j];}if (j < w - 1 && map[i - 1][j + 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j + 1];}if (i > 1 && map[i - 2][j] == 2){num[i][j] += num[i - 2][j];}}}ans = 0;for (j = 0; j < w; j++){if (map[h - 1][j] != 1){ans += num[h - 1][j];}if (h > 1 && map[h - 2][j] == 2){ans += num[h - 2][j];}}printf("%d\n", ans);}return (0);}
      |             ^~~
main.c:1:26: error: 'w' undeclared (first use in this function)
    1 | main(){ans, num[15][15], w, h, i, j, map[15][15];while (1){scanf("%d%d", &w, &h);if (w + h == 0){break;}memset(map, -1, sizeof(map));for (i = 0; i < h; i++){for (j = 0; j < w; j++){scanf("%d", &map[i][j]);}}memset(num, 0, sizeof(num));for (i = 0; i < w; i++){if (map[0][i] != 1){num[0][i] = 1;}}for (i = 1; i < h; i++){for (j = 0; j < w; j++){if (j > 0 && map[i - 1][j - 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j - 1];}if (map[i - 1][j] == 0){num[i][j] += num[i - 1][j];}if (j < w - 1 && map[i - 1][j + 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j + 1];}if (i > 1 && map[i - 2][j] == 2){num[i][j] += num[i - 2][j];}}}ans = 0;for (j = 0; j < w; j++){if (map[h - 1][j] != 1){ans += num[h - 1][j];}if (h > 1 && map[h - 2][j] == 2){ans += num[h - 2][j];}}printf("%d\n", ans);}return (0);}
      |                          ^
main.c:1:29: error: 'h' undeclared (first use in this function)
    1 | main(){ans, num[15][15], w, h, i, j, map[15][15];while (1){scanf("%d%d", &w, &h);if (w + h == 0){break;}memset(map, -1, sizeof(map));for (i = 0; i < h; i++){for (j = 0; j < w; j++){scanf("%d", &map[i][j]);}}memset(num, 0, sizeof(num));for (i = 0; i < w; i++){if (map[0][i] != 1){num[0][i] = 1;}}for (i = 1; i < h; i++){for (j = 0; j < w; j++){if (j > 0 && map[i - 1][j - 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j - 1];}if (map[i - 1][j] == 0){num[i][j] += num[i - 1][j];}if (j < w - 1 && map[i - 1][j + 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j + 1];}if (i > 1 && map[i - 2][j] == 2){num[i][j] += num[i - 2][j];}}}ans = 0;for (j = 0; j < w; j++){if (map[h - 1][j] != 1){ans += num[h - 1][j];}if (h > 1 && map[h - 2][j] == 2){ans += num[h - 2][j];}}printf("%d\n", ans);}return (0);}
      |                             ^
main.c:1:32: error: 'i' undeclared (first use in this function)
    1 | main(){ans, num[15][15], w, h, i, j, map[15][15];while (1){scanf("%d%d", &w, &h);if (w + h == 0){break;}memset(map, -1, sizeof(map));for (i = 0; i < h; i++){for (j = 0; j < w; j++){scanf("%d", &map[i][j]);}}memset(num, 0, sizeof(num));for (i = 0; i < w; i++){if (map[0][i] != 1){num[0][i] = 1;}}for (i = 1; i < h; i++){for (j = 0; j < w; j++){if (j > 0 && map[i - 1][j - 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j - 1];}if (map[i - 1][j] == 0){num[i][j] += num[i - 1][j];}if (j < w - 1 && map[i - 1][j + 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j + 1];}if (i > 1 && map[i - 2][j] == 2){num[i][j] += num[i - 2][j];}}}ans = 0;for (j = 0; j < w; j++){if (map[h - 1][j] != 1){ans += num[h - 1][j];}if (h > 1 && map[h - 2][j] == 2){ans += num[h - 2][j];}}printf("%d\n", ans);}return (0);}
      |                                ^
main.c:1:35: error: 'j' undeclared (first use in this function)
    1 | main(){ans, num[15][15], w, h, i, j, map[15][15];while (1){scanf("%d%d", &w, &h);if (w + h == 0){break;}memset(map, -1, sizeof(map));for (i = 0; i < h; i++){for (j = 0; j < w; j++){scanf("%d", &map[i][j]);}}memset(num, 0, sizeof(num));for (i = 0; i < w; i++){if (map[0][i] != 1){num[0][i] = 1;}}for (i = 1; i < h; i++){for (j = 0; j < w; j++){if (j > 0 && map[i - 1][j - 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j - 1];}if (map[i - 1][j] == 0){num[i][j] += num[i - 1][j];}if (j < w - 1 && map[i - 1][j + 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j + 1];}if (i > 1 && map[i - 2][j] == 2){num[i][j] += num[i - 2][j];}}}ans = 0;for (j = 0; j < w; j++){if (map[h - 1][j] != 1){ans += num[h - 1][j];}if (h > 1 && map[h - 2][j] == 2){ans += num[h - 2][j];}}printf("%d\n", ans);}return (0);}
      |                                   ^
main.c:1:38: error: 'map' undeclared (first use in this function)
    1 | main(){ans, num[15][15], w, h, i, j, map[15][15];while (1){scanf("%d%d", &w, &h);if (w + h == 0){break;}memset(map, -1, sizeof(map));for (i = 0; i < h; i++){for (j = 0; j < w; j++){scanf("%d", &map[i][j]);}}memset(num, 0, sizeof(num));for (i = 0; i < w; i++){if (map[0][i] != 1){num[0][i] = 1;}}for (i = 1; i < h; i++){for (j = 0; j < w; j++){if (j > 0 && map[i - 1][j - 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j - 1];}if (map[i - 1][j] == 0){num[i][j] += num[i - 1][j];}if (j < w - 1 && map[i - 1][j + 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j + 1];}if (i > 1 && map[i - 2][j] == 2){num[i][j] += num[i - 2][j];}}}ans = 0;for (j = 0; j < w; j++){if (map[h - 1][j] != 1){ans += num[h - 1][j];}if (h > 1 && map[h - 2][j] == 2){ans += num[h - 2][j];}}printf("%d\n", ans);}return (0);}
      |                                      ^~~
main.c:1:60: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    1 | main(){ans, num[15][15], w, h, i, j, map[15][15];while (1){scanf("%d%d", &w, &h);if (w + h == 0){break;}memset(map, -1, sizeof(map));for (i = 0; i < h; i++){for (j = 0; j < w; j++){scanf("%d", &map[i][j]);}}memset(num, 0, sizeof(num));for (i = 0; i < w; i++){if (map[0][i] != 1){num[0][i] = 1;}}for (i = 1; i < h; i++){for (j = 0; j < w; j++){if (j > 0 && map[i - 1][j - 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j - 1];}if (map[i - 1][j] == 0){num[i][j] += num[i - 1][j];}if (j < w - 1 && map[i - 1][j + 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j + 1];}if (i > 1 && map[i - 2][j] == 2){num[i][j] += num[i - 2][j];}}}ans = 0;for (j = 0; j < w; j++){if (map[h - 1][j] != 1){ans += num[h - 1][j];}if (h > 1 && map[h - 2][j] == 2){ans += num[h - 2][j];}}printf("%d\n", ans);}return (0);}
      |                                                            ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | main(){ans, num[15][15], w, h, i, j, map[15][15];while (1){scanf("%d%d", &w, &h);if (w + h == 0){break;}memset(map, -1, sizeof(map));for (i = 0; i < h; i++){for (j = 0; j < w; j++){scanf("%d", &map[i][j]);}}memset(num, 0, sizeof(num));for (i = 0; i < w; i++){if (map[0][i] != 1){num[0][i] = 1;}}for (i = 1; i < h; i++){for (j = 0; j < w; j++){if (j > 0 && map[i - 1][j - 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j - 1];}if (map[i - 1][j] == 0){num[i][j] += num[i - 1][j];}if (j < w - 1 && map[i - 1][j + 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j + 1];}if (i > 1 && map[i - 2][j] == 2){num[i][j] += num[i - 2][j];}}}ans = 0;for (j = 0; j < w; j++){if (map[h - 1][j] != 1){ans += num[h - 1][j];}if (h > 1 && map[h - 2][j] == 2){ans += num[h - 2][j];}}printf("%d\n", ans);}return (0);}
main.c:1:60: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    1 | main(){ans, num[15][15], w, h, i, j, map[15][15];while (1){scanf("%d%d", &w, &h);if (w + h == 0){break;}memset(map, -1, sizeof(map));for (i = 0; i < h; i++){for (j = 0; j < w; j++){scanf("%d", &map[i][j]);}}memset(num, 0, sizeof(num));for (i = 0; i < w; i++){if (map[0][i] != 1){num[0][i] = 1;}}for (i = 1; i < h; i++){for (j = 0; j < w; j++){if (j > 0 && map[i - 1][j - 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j - 1];}if (map[i - 1][j] == 0){num[i][j] += num[i - 1][j];}if (j < w - 1 && map[i - 1][j + 1] == 0 && map[i][j] != 2){num[i][j] += num[i - 1][j + 1];}if (i > 1 && map[i - 2][j] == 2){num[i][j] += num[i - 2][j];}}}ans = 0;for (j = 0; j < w; j++){if (map[h - 1][j] != 1){ans += num[h - 1][j];}if (h > 1 && map[h - 2][j] == 2){ans += num[h - 2][j];}}printf("%d\n", ans);}return (0);}
      |