fork download
  1. #include <cstdio>
  2. #include <queue>
  3. using namespace std;
  4.  
  5. int dimension;
  6. char a [28] [28];
  7. queue <int> q;
  8.  
  9. void dfs (int x, int y)
  10. {
  11. q.push (x);
  12. q.push (y);
  13.  
  14. while ( !q.empty () ) {
  15. x = q.front ();
  16. q.pop ();
  17. y = q.front ();
  18. q.pop ();
  19.  
  20. if ( a [x - 1] [y] == '1' ) { // up
  21. q.push (x - 1);
  22. q.push (y);
  23. a [x - 1] [y] = '0';
  24. }
  25.  
  26. if ( a [x + 1] [y] == '1' ) { // down
  27. q.push (x + 1);
  28. q.push (y);
  29. a [x + 1] [y] = '0';
  30. }
  31.  
  32. if ( a [x] [y - 1] == '1' ) { // left
  33. q.push (x);
  34. q.push (y - 1);
  35. a [x] [y - 1] = '0';
  36. }
  37.  
  38. if ( a [x] [y + 1] == '1' ) { // right
  39. q.push (x);
  40. q.push (y + 1);
  41. a [x] [y + 1] = '0';
  42. }
  43.  
  44. if ( a [x - 1] [y + 1] == '1' ) { // up-right
  45. q.push (x - 1);
  46. q.push (y + 1);
  47. a [x - 1] [y + 1] = '0';
  48. }
  49.  
  50. if ( a [x + 1] [y + 1] == '1' ) { // right-down
  51. q.push (x + 1);
  52. q.push (y + 1);
  53. a [x + 1] [y + 1] = '0';
  54. }
  55.  
  56. if ( a [x + 1] [y - 1] == '1' ) { // down-left
  57. q.push (x + 1);
  58. q.push (y - 1);
  59. a [x + 1] [y - 1] = '0';
  60. }
  61.  
  62. if ( a [x - 1] [y - 1] == '1' ) { // up-left
  63. q.push (x - 1);
  64. q.push (y - 1);
  65. a [x - 1] [y - 1] = '0';
  66. }
  67. }
  68. }
  69.  
  70. int main ()
  71. {
  72. int cases = 0;
  73.  
  74. while ( scanf ("%d", &dimension) != EOF ) {
  75. getchar ();
  76.  
  77. for ( int i = 0; i < dimension; i++ )
  78. scanf ("%s", a [i]);
  79.  
  80. int count = 0;
  81.  
  82. for ( int i = 0; i < dimension; i++ ) {
  83. for ( int j = 0; j < dimension; j++ ) {
  84. if ( a [i] [j] == '1' ) {
  85. dfs (i, j);
  86. count++;
  87. }
  88. }
  89. }
  90.  
  91. printf ("Image number %d contains %d war eagles.\n",
  92. ++cases, count);
  93. }
  94.  
  95. return 0;
  96. }
Success #stdin #stdout 0.01s 5288KB
stdin
13
1110100101001
0100111001110
1110010011000
1100100110000
0010011100111
0000011010011
0110110010100
1011011001110
0001010011101
1111110111110
1111010110010
0111001000000
1100011010010
21
100010101001100010011
001101110010011101101
001110010100001001111
111001001010000000100
010100001011110111100
110010011111000000110
101011100110101000100
001100000001001000000
010111110100101111001
101111011000100100011
000101100110101011001
011101011011000110001
111111110110010111000
010000100011001000010
011110111110010001111
111011111110110110010
111000100100100010010
010001101010011000001
111010110011110010000
001001001011001101010
011101011001110100010
24
011001111100101101011101
000010010001010100100111
010010100110010111011100
011100010100100010010100
001110000000001101100000
011110101011000001100110
010010101100101000101110
101000111011110101010111
100110000101110000101010
111011100101011001011001
110011011010110100011001
011111010010010010110000
001001000100001110001100
100110111101011011110010
100010010010001011001111
000101000101000111110000
000010010010001110010010
100110110111001100110000
100011011101111000010000
001111010011011001011000
001000001100110111011101
010110101100001100011100
011000001110100000101100
111011000101101101011101
7
0010010
1001111
0110111
1111100
0010101
0001000
0101110
22
0111010010111101010101
0110100110111111101111
0011111011111011010000
1010100110101100010011
1110001010001001101000
0000111101000100001111
0111011001110111110000
1111100100110111001010
0101010001111010011001
0001110000101111111101
0001111110110110011010
1011110101110010010000
1000000100001100010010
0110010100100010010011
0110100101111100110111
0000000111101101011100
0110011111010111000010
1111101100000100000101
1110000001101011110101
1001111101011010100001
1100000111011100100000
0111110101001010101000
24
011110110101001100111001
010111110011011011000011
001001110101011110100010
100010010100000110000110
000010101010000110000111
110001000001111000000101
011011001010111000001010
110000101101110101001000
101100010001100110110010
110111001010011010111111
101111110011101111011100
010110100011000101101001
000111011100001110000110
101010111000110111001110
111111101000101011010010
001000000110011010001111
101000100001111000001011
110000101110110111010010
011100101001010111001000
010011111100010001001001
111101001001111100100011
101011111110001010010011
101100010011010100101110
001011000101100011011100
25
0111000010100011000000101
0111001011011001001110110
0110011101001101100111001
0000100110011111100101011
0011111000001100101101000
0000001011011011111110110
0111111111111010000111100
1111001011001001001111101
0101000111100100001100101
0000000011011101100011100
0111001100001011111001011
0011110100111100000000010
0101000111001110101000010
0110000001011001101000000
1011001010010100011110001
0000111010001010110000111
1100100001100110010000011
1101000110000110011111010
0101100101100011101000100
1100000001101010011011001
0000111101011101100001101
1101000110110100111000101
1101001000110110011001110
0100111101011001001000101
0110010111110010010010010
7
1001000
1111000
0010000
1001100
0001000
1110000
1101001
11
10111011000
00100111010
00100110101
01110001011
01110110001
11100011100
11110100101
11100010101
11110110101
00110000110
11001011100
5
10000
00000
00111
00010
00000
5
00000
01111
11100
11111
00111
1
1
14
00000111111111
10010110111100
10111010101111
01111011101101
01001001001100
01010100001010
11111111000010
11000110111000
01101111010010
10000110101001
11011101110010
10011001111011
10010110111110
00011010110111
19
1011001111100110100
0101001001100100111
0110001101111010010
1100001111010100110
1011010011001000001
0010011001010110011
1110111100101111001
1110011000011101010
0001010110110110101
0110111101101101011
0110011100011001110
0000100001101000001
1111111101011010101
0110111000001101001
0000111000110010011
0011101001100101111
1110001010010011100
0010110011010101100
1100111000000010111
18
011100001001111001
001110101111111110
001000001110011001
110100001101001001
101010100100110100
101100000110000110
111101110001010010
111000110110011010
000101110000001111
110101101010000001
110110001110101101
100000110100111100
110110111001001100
010111010011000100
101100111111101001
001110111011001001
001011111100110111
110010111001110101
19
1000110111101010101
1010111001001010101
0110110011011001010
0011100111011100000
0110110000100110010
1110011111100110001
1010000001010110101
1111110111110001100
1110011010101000100
1000011101110101000
1111011101011101011
0010001110010100001
1011010000011001000
1101101010100000011
1101111011111010011
1011001011110110000
1110001100110100011
0111000111011100101
0001001010110101010
25
1100101100011100001011101
1110100000000001010010011
0001100010101011011000011
0000000001100111001110111
0000100000000011000111001
0110000000010101110001001
0101000100000001100111011
0001010110100100000011001
0110100111111100000001010
0000001001001110111111000
0101000001101110011010011
0111111110110101001100101
1101001101001001111001010
1100001100000010110010111
0101001010110011110001011
1010111000110010110001010
0010110110100100011111111
1111000111101110111000110
0010010110010011001110101
1101110011111110110100111
1100011111110011111101010
1100011000111110110011010
0011111011110000101001100
0011001010001010010101001
1000001100111100010001100
2
01
01
22
0001101100111011001000
0011100111010110110011
0000000000011101110101
1001010100010001011110
0001001011001110101101
0000011111011101010110
0111011101101100110100
1111110100100011111010
1001010110111110000001
1110100100100001101001
0001011100010010101001
0101000100111010000111
1010110001101001101100
0111011010010101001110
1101010011101010001000
0000010000010010110011
1011001101100000110110
1110011110001111000101
0110110110100010010111
1110000111101100111100
1001000101111010000100
1101101010001000000000
16
1010010001011000
0110001000010111
0011011101010010
1001111001000011
0101011110011100
1001111011000101
0101101001101001
1101000011100010
0010111010101011
0001000110111101
0000110011010000
0111000100001101
0011101001001011
1010001000011100
0110000100101000
0010111110111011
1
0
22
0011010000110010101011
0011101111111101111001
1000110001010100010100
0010100110001000011000
1111001011101010011101
0011011100101110001001
0010111000001011011001
1010111111011110111011
1011100110100011100110
1101100111110110001110
0001100010011011111011
1001100000000000111100
0110001001101110001111
1011001101000110011100
0100100010010010000000
1111001011010010000011
1011001011101000000100
0011110010100100010001
1101000010111011000111
0100100001001010100011
1100010001010111010001
1011011010010010011110
16
0011101110110110
0011001110010101
1110011111001010
1001111000100011
1000101101111101
1110111101011001
1000000001010000
1100001010000111
1011011111111101
1000010110100111
1011010100010010
0001111101011101
1011010010001001
1101110111001011
0000110101111011
1101001101101101
11
01111111111
11111101101
11101000110
11000110101
10001111111
01001011011
10110100010
00100000010
01110111001
10101011111
00010000010
20
00101110110100111110
11001110110000111100
11110111100000010101
01010001100110110110
00110101101001010000
01111101011110000110
00110000001001100011
11100100110010001011
11100100010101110010
10101010001100011001
11100110100001000111
10001000101011001011
00110100100001111000
11111101000110100010
11101001101010010010
11100101011010011011
11011100100111000110
00111100000000001011
11100110000010101011
00110111010001010100
24
011110110100010101101010
100101010110010100110000
000111101100011110100111
000111111100111001100111
110100111011110110101100
100110000011000011011111
101100110011111001110010
011100111110100011001101
000110111011001110110111
010001110011110111110110
001101100001111001010011
100101001001111100001101
011001100101010011101111
111001001000110101100011
000010010011110101111011
111011110000010011000010
010010111111000101001001
100111101011000000111100
011100001011110111101001
110011111001111110101001
001010011100001011101000
111110010010010110110011
100001110011100111111110
101111111110100010101011
18
001011101011011101
100011001101010010
101001100111010010
011011011010001101
101001100111001111
001100110110010111
100010001100111000
011101001101100101
111011100001010100
111011111111101001
110100010011100000
010011111011100000
010100111111101001
110111110100110001
011110010101011011
001110101100000000
110100011100101100
110101110001110011
5
01111
10110
00110
00011
01011
17
11001000011000100
10000010110010010
10010110000111110
11000100100100111
10100000000111011
01000011100110110
00101101001100111
10010111010001100
00011001100010100
00001011111001001
11110011011111001
01100110010000010
10101100101110011
01111110010111001
00101101011111100
11011001001011100
01110011010101011
18
111100101111101010
001100010011101010
101100101111011010
000001000101101110
100011010101010010
010110001111110110
000110001100110001
000000011110011001
110010001000111000
011101110010010001
010100001010100001
101001000010100000
000001101101110101
011110110010110110
011001111110110001
111011101100100001
010110100100110100
110101100111011000
4
1011
0111
1110
0110
0
12
010010111001
100000111110
001011101001
010101001111
100111111101
010101001010
101010110001
101010001001
001111000010
111100110010
010001110011
000000101001
16
1110001000000100
0101001000100100
0001111111110100
0101000001111110
0100110111111101
1010110001010010
1101001001111100
0011101000110010
1101110010100011
0100000100000100
0110110100010001
0100100111010100
1100000101100011
0100101010111110
0000001000111011
0111100001100000
6
000011
101010
100000
001100
011100
111001
6
011000
110111
010011
100111
101100
011110
23
01001110000001011011010
00010110110110010001100
10001011011011100001100
01001001011000111000010
10010110001010110110100
10100010111011010010011
00011100000101011100111
01111111010111100101101
11000101100110001100100
10010001111101010110101
01110111000111011110110
11110111001010111101111
01100100111111010101111
10111100110110100010011
11001101011100110000110
11010001010111011100101
10100001011000001000010
10101101011001000110000
10100111000101000111010
01011100000010010010100
00100100100110001000001
10111100111100000101010
11111010110011011001000
22
1010011000100011001100
1011101001110000011011
1111110100111001011111
1101011010000111100010
0111101111110110100010
0101111111000110100001
0000010011010101101101
1100001110101100100000
0011011000110111100011
0100101100011110101101
0111011111100100110100
0010010000110111010110
1010000011111101011010
0101001000110100100000
0000100010111011111100
1110110111001001000010
1100101100110100110000
1110001111110111011110
0010111110001011111101
0001011000101010101001
0011100100101101110100
1010101011011011101101
25
0111000111010010011000011
1001000100011000110100011
0000001111011110000101010
0001100011110110001111101
0001011101100010111010110
1011011000010101010110110
1001010111000110001111100
1010000101100001111110011
0101011010000001001100011
1011000100101111001101011
0001111000011010100100110
1100000110011001111000101
1100000001111111110111010
1000001110111001101011011
0011100110000001010011100
1000001110001010101110101
0111010010101111011001111
1010011010010010110010111
1111110001110011101000100
0000110001111101110010110
1010111001110101101001011
1101001101101111101011010
0000111101110001110111010
0110001111010100001000111
0000111100001101101111000
11
01100101111
11110111111
01011101000
01110100011
01000110110
10000001110
11111101111
00011011100
00001110100
11111011000
01110011111
3
111
000
101
19
1111100000010111111
0000100101100110101
1001111001001111100
1001110101111110000
0110111111011000111
1010011010000011111
0010110100010001000
0100001010100001010
1101001000011100011
0100000000110000101
1001001010001100101
1001101100101111110
0000100100101010110
0010111010000101101
0111111101011010000
0000011111001011010
1011000000010110000
1101010110001001110
1001001001100000110
23
10000011110100110010010
01111111100111010111010
01011000110111111000101
01001100100101101000010
10001001100101110111011
11101011100101110000110
01011010101101011100010
00101001111001101101110
00001110110100010010010
11101001000101110100110
00110010100100000011100
10100010011110001111110
10110000111100101110000
01001100011011000010110
00100101110001011010101
01011111101111011100111
00000111000111110000101
01111110110101111000110
11001010111100101110010
00101111111100100101010
00100111101011111100001
10000110110010001111011
00110010101011010000110
1
0
0
22
1000110110010100111001
0101111001101111111010
1100001101100101010111
0011001111101001111100
1011110000010100101110
1110100101110010110011
0100100110000010111101
0011101111111011010001
0100100111111111001010
1100000100001101111111
1111110000110111000010
0000111011001101001010
1111001100000011000101
1010011011000010000000
1110101001011000110000
1001011010101010111111
1111101111110011001100
1000100101001111101011
1110011101111110110111
0100111011111100000010
0010000111000000011001
1011111101000111000000
10
1100110111
1110010100
0001010010
0111000111
1110111110
0100101101
1101110111
1000011111
0000100100
1101010100
12
110011110011
101100101000
100010101110
110010111011
100101111110
101100111010
001110001101
100101100011
001001111000
110101110110
001100010101
001001110111
15
100101010101111
001000110010010
111101100010000
110001100110100
010010011111101
001011001001101
100011100110100
110000100001001
111101111011000
100001110111010
010000111001011
101000101001000
011000101100011
010011011001001
101000001101111
14
00111010101010
01010000110100
01000111111111
11010011111011
01101001111110
01000010111010
11101010011101
01010000101001
01101011001110
00101011011000
01100111000111
01111100101111
11010010111000
00110000011010
7
1110101
1011100
1111110
0001100
1101000
0110010
0101010
7
0001011
0011011
0010001
0011001
1100111
1010001
1111010
25
1101100101001011000101000
0100010000000100000011101
0010101000101010011011010
1000011111101110011111001
0100111111110110001000010
1000010011000111011110010
1111101001000100001001111
0110001011000101010000100
1000111101010010000010010
1100011111010110001010101
0110010011111111001101001
1101011111111001100001110
0011101010101001001011001
0100010011010001101000100
1111100001100111101100010
1111010000001111101111101
0000000000010010001111010
0111010000011111011010110
1111111011110101000111110
0110000100001011100100001
1001110001000101110010010
0011010000100100100000111
0110000000101101001011101
1100010101011111111111100
0001110100111000110100010
25
1110100110100010000001010
1000000110010001101001100
1010110010101101000001111
1110010100110111001001100
0011010001100101100110100
1000000011000101110000001
0011100001101110001111010
0101111001010001101011101
0110001010011001011000100
0101010100111010100010100
0111111010000001110111111
1111101100100001010001100
0111101010011110000101111
0101010000101111001000010
1100011110000110101010100
1000111001010011011101001
0000101100010100100110101
0011011100001101011010110
1110011111110001100010111
0011111000010100110011101
0010011000110011110011000
1000001010111110011001011
1000111111100001100000001
1011010010100110011100111
0000011111001011001010010
20
10101100100010101000
10011001111011110011
01011001011000100110
01011000000010010101
01001101101110101000
11110110000111101011
00101011111110011101
01111000001101010011
10111011010011000001
10000111001000000111
10011011111010101100
00000111011100110000
00111000000111110000
11011011011011110011
00101111110011111000
11001011001111110010
10101010101111101011
01010111001011001011
01101000001110001101
00101000100111011000
22
0111001011101110000110
1101011101000110001000
0101000010111111001101
1110010011111111100111
0000000000001111000110
1010110111100000011110
1111010111001000000101
0010100111111101010111
0100000011101111110010
0011011010111010011010
1000001101010010110000
1110111011011111001000
0010000101010001010010
0111111001101001111101
1110001111110001001111
0110101000001010101101
0111100101011011010000
0001010010010110100011
0011101010100010110101
1011100010011010110100
1001001001101011001111
0111000001000000100001
24
101000010000010001010110
011111110000111000000011
100110111101110001111001
011100011110010011110100
001100111110100111100101
111010010100000001010000
010101111010011011110101
111010101010000100110011
010000110101100010001000
100011100000110111110000
100011010110101101011111
100110000101001110001000
000000011100010000001010
010111001100100111111011
101100101011101111010111
001111101010000000100010
011100100100110010000100
000011110001011101100010
000000101111101100000001
100000101000111100000111
011100100010000111011010
011000010000001010000011
001101111011011000110001
010100010000011101010010
25
0100101101011101101111010
0111101001000110110000010
0010111101001100000011011
1101010001001100000010110
1110111001011100101100000
1010100001011100001110111
1111011001111111011000001
0110011000110101101111100
1011011111000100001110100
0000001010101001111100001
1010101010100001010011000
1111111011111001010110010
0001111110101000000101001
1110011110101100111011000
1000001101010101111010001
0010110101011011100010010
1001000000000110101010100
0001010001011101001011001
0100000110010111000100111
0000101011001101000001100
1101100001010111110110111
1010011111100101111010010
0100110010111100010001110
0100000001101010101010011
1001011110010010000110110
12
000110100110
010101000010
010000011101
110101110010
001110001000
110010000000
101100111001
100101010110
110011010010
100010110010
100100111100
000010110000
1
0
14
00011100010111
10101000010110
11101101101000
01110000000011
11010011001101
01111100010111
11001100010011
00000110011001
01110111010000
00011110111001
00111001010001
10010000010101
10010000000111
01100011000111
9
100110100
101110011
110000010
111010100
001010000
100110000
011110100
011101110
111110110
18
111001100010011111
001100011101001111
011101001110110000
001101100100011110
100110001110111111
001110001110000010
100101100011010100
111111001100011001
101011000110001001
000000111110000111
011000101010000100
010011111100011011
001000100010100001
111000010111011101
111111011001100111
011111110101101010
100001010111110101
010000010001000000
15
101010110011010
110011110111010
101001001010110
101110001100000
000111010001011
101011011001110
000111111000101
011101100001010
100100001101001
001000011101110
100111010100000
000001000011100
111111011010100
111011011000111
000001000100011
15
010110111100011
010101101011100
000011111000110
101000111100010
001011110001100
110010110010001
011001111010110
111110000011111
110000000011110
111101100001001
100101000100110
101000100001100
010000011011010
110001000010011
001100100010011
2
00
01
6
111010
100000
111001
110101
000010
011101
7
0110000
1111001
0110000
0011000
0001000
0011001
0100110
20
01111101010101011010
00111100111110000001
10101000100100111010
11011100100011000010
11000110011011000101
11001101000101101101
01110011000111001110
01000001100110000010
00110010001011111011
00110001110011000111
00000100011001101000
00111100101101100011
11100111110100111001
00100010001111001000
11110111110001011100
10000101010101011101
11100101111110111100
00001101010111001010
00011110000010111101
01111100101100000010
11
11101000001
01000111101
10000010110
00110100111
10011011000
11100001110
11110101011
01010110101
00001011111
01010110101
10101111011
17
01101100100110101
00011100001010010
11101111010001110
11100000101111111
00111111001010101
00011000000000100
10111101010110000
10011110001110011
11100011011100000
01101100000111010
10010111000011001
10101111001101101
01011110000000010
00010101111110111
11111001011111101
01100001100100101
01110110100100000
12
000110001001
001100101000
010001111010
011110000111
110001010011
100110001001
100111111111
100001101100
100110100111
110000101111
010001111100
101000110100
13
1001001011001
0111011011101
1111011011001
0000100111001
1001111100011
0101001101111
1111010110011
0111011001111
0000111111011
1101010001010
0100111101110
0110110010011
1010110011010
22
1001100011101001001111
1000001000111010100010
0001110100101100101111
1110011100111010000011
1100000001011101101001
0101010110000111010110
1100110110111001100111
0111000110101010011001
1001001011100110110110
0110000101101100010110
1111101000011001011010
0101111111011110010000
0001011011000100101100
0000111101100000110110
0001100111111001000000
0000110000111010110100
1111110111010101001010
0011000110010010001011
1000100001100000011110
0100101101011010110001
0101100100000110100100
0101011110011111111100
20
00100110101111110100
00101010010001001000
00000010010110001011
10000100101110001110
10010010111110100101
01110010010101101001
01001000001110101011
01010001000110011001
00001100101100100011
11001000110010010100
01011011000000010011
11111011010001000010
11110010001100110000
01011011000111000110
10011111001100111011
01100011001100101010
00010001100101001001
11000000101101001010
00110110000110100000
10001010101000010111
5
00001
00001
10111
01010
00000
11
11011100011
00001000110
11010011011
00111110011
01010010000
11001000010
00001111011
01001111000
01100110110
11010000001
11110100011
2
00
01
6
010010
110111
010001
100101
110111
001110
7
1010000
0011100
0100010
1011101
1111001
1100001
1110100
2
00
10
7
1110001
1011100
1010001
0011000
0010000
1010010
0100000
14
10010011100011
11110010100010
11101100011110
00101110000110
10101100101110
11101110111011
11111001110001
10001011011001
11100111110010
11010101100000
01011110011100
01011000101001
00110010110110
10110110100001
16
1101100000110010
0001100011100001
0110110010011000
0111111110010000
1100001010110100
1101001010110110
1101010110111001
0110000111101001
0111001010000101
0101111000101110
1011011110101101
0011101001110110
1000101100001101
0000001001000100
1100100011000011
1111001001110011
13
0001000100001
0101000110111
0010101100001
0000001011101
1001110001101
0001010110100
1111000101010
1000111010011
1000100010111
0111011100001
1100010111010
1111001011101
1000111010010
18
111011100100001101
101000001000101000
101011010101100101
100100100010011110
100111100100110010
000001110010010010
011101000110011101
001000110100001101
100111010100111110
101010110010010010
101100100000011111
110011110100010110
011111100110010001
101000110111100100
110000101111000001
001110000001010110
010100110110010111
010100111001001001
24
101000111010011011100100
001011101111100000110100
100011100101111011101011
101100101111100101000110
111101111010110100111110
010111010110011011001100
000010001000100010101101
110101101010101100010001
111100000011000100000000
110010001011000001100001
001000100001000101100101
000101000101010001110000
101010010001000001101111
011000101001001000111100
101000011101100010001011
101111000011110001110001
010001011100101101111110
011101001010110000001010
110100110100000100001001
000111011101001000111011
000000010001100100010000
110111110100011011101101
001001100011010111110101
011011001111110101001101
24
001101100101101100010111
111101001001001010001101
110110001010111100101011
100101010100010001011011
100111110011000100011101
010100010000001100111001
010000110001101110111111
110110100100110101000011
101110111101100001101001
000100001100000101111011
010111010100011101010111
001110010001000000101100
101011010000000100101001
010011010011011101001111
000011111010111001011110
011110011010111001011011
001000111010110010011000
001010111010110111011111
100001111010111111110000
000110100000011100010010
011011000010001001011011
110100101100011010101110
110100000110000010010001
100000000100100100001011
0
25
1001100011010101000111111
1100111010111100010111100
1100001100111101001111000
1000001000010011111000001
1111010111011111101000101
0111100101000001010000000
1011110101101011110001011
0000101110110110100000101
1110011010101110110010100
0101010011000100000000011
1010100011011010110111110
1000011000110100111110001
0010011011100101010111111
1000001000100000100001110
1011000100011100110011010
0010010100011010100000101
0100100001101101100001100
1100111001110100110110110
1010011111001110001011001
1010110000010100010001101
1011100010101010110110101
0000101101111011100001001
1110001100100001111011000
1111000001011111110110010
1110100001111001100001011
16
0000101011100111
1010100111001100
1100101100010010
0100110110110010
0110111110101001
1100001110110000
0001001110010101
1111100100011011
0100110101000111
1111000000110100
0001111010110101
0110000001110110
1010110110001001
0111110011000000
1100101111111000
1000000011110101
20
00001110100110111000
11101101100001110011
11000000000011001100
10000100110000111001
11100001101101010011
11101001100111111000
01111101110001011000
10100011000110111101
11001100011111001110
00011000011010001001
00000000000101001001
00000000001110101110
11100010100100111101
11010010010010011001
00101100100101011101
11110001100001001000
00111100101111111001
10111011011110000101
01110010101101010110
00111100111011011001
22
1011101000101000101101
1000100111110110010000
0111000000000011011010
1011111110000100111110
0100101000101011001011
0111010101101011000110
1011001000110111001110
0001001101001110011010
1011111111001110001001
0010010001100111110100
0011100101100110011000
1101010010001001100001
0000001011110000000001
1010110011111101001100
0100111000011010111100
0111111100010111111001
0011011100011100100011
0001010011001111110011
0010100001001010111011
1001001101110011111000
0110001101110000110110
0010110110110111100110
24
001110011000101100110010
010011011000100010110110
101000000011000011001011
111100000111111110001000
001110100001001101110101
001011010101101001001010
001111111110111111110001
111011010011000110100101
010000000011110101010000
110010100000100010101000
011101100110000100000001
100011011001100011000011
000110111001001110000111
000111001001101001110110
100110000101011001111110
110001001101100011010110
111010010101101101000000
100001011010010010100101
100010001011110000100111
010101000011010111111010
101101101001101110010011
111010100001010110011000
111010100101111010101011
100110110000110101011001
6
111110
001010
000111
001111
100001
001011
17
01110000010101101
00000111101110110
00101001101001110
01011100101001001
01101000111101000
01110110101010000
00001011000001111
11101110010011101
10001111011001110
01111010101111010
10111110100001011
11011011000111010
01010100001110101
10100001110111010
00010100101101111
00110110100000110
11000100001110011
16
1101100000001010
0011011110110010
1110111101001010
1111100101001010
0111100101010100
0110100101011111
0010000000000111
1001101011010011
1010011001011010
0001010001000001
0000100101000001
1100001101000000
0110110010011101
1011001111110001
1111101100000111
0011101011101101
17
10001101101001110
00110101011011010
11100110001010100
01010100001010000
10010110001111100
11111001110100011
00110011101100101
00101001001111001
01111000011000001
01111110101100011
11000010011001011
01100001001110000
10001101010110110
00111010100011011
01001011000011101
10011111011111101
00001011100110101
17
11000001101100100
10011010110000000
11101000101110010
01000100111100011
01011001111111100
01000000111101010
10010101101111111
10101000010011011
11000100101111101
11101111101001011
11011111110001110
01000101001111110
11011010000000000
10110100110011010
01011100110000010
00000111101000111
00100100101110000
16
1111010001010000
0101101100111111
0000100010110101
0010110011111011
1111000100011000
1010111011111111
0100111010001111
0111100110110001
0011001100111010
0111111011100110
0101111110001100
1001100101100101
1001101110010000
1101000011010000
0011000001110001
1011110110101001
stdout
Image number 1 contains 4 war eagles.
Image number 2 contains 5 war eagles.
Image number 3 contains 10 war eagles.
Image number 4 contains 3 war eagles.
Image number 5 contains 5 war eagles.
Image number 6 contains 2 war eagles.
Image number 7 contains 6 war eagles.
Image number 8 contains 3 war eagles.
Image number 9 contains 2 war eagles.
Image number 10 contains 2 war eagles.
Image number 11 contains 1 war eagles.
Image number 12 contains 1 war eagles.
Image number 13 contains 1 war eagles.
Image number 14 contains 1 war eagles.
Image number 15 contains 4 war eagles.
Image number 16 contains 7 war eagles.
Image number 17 contains 11 war eagles.
Image number 18 contains 1 war eagles.
Image number 19 contains 6 war eagles.
Image number 20 contains 5 war eagles.
Image number 21 contains 0 war eagles.
Image number 22 contains 7 war eagles.
Image number 23 contains 2 war eagles.
Image number 24 contains 1 war eagles.
Image number 25 contains 5 war eagles.
Image number 26 contains 4 war eagles.
Image number 27 contains 7 war eagles.
Image number 28 contains 2 war eagles.
Image number 29 contains 8 war eagles.
Image number 30 contains 6 war eagles.
Image number 31 contains 1 war eagles.
Image number 32 contains 0 war eagles.
Image number 33 contains 3 war eagles.
Image number 34 contains 6 war eagles.
Image number 35 contains 5 war eagles.
Image number 36 contains 1 war eagles.
Image number 37 contains 6 war eagles.
Image number 38 contains 6 war eagles.
Image number 39 contains 7 war eagles.
Image number 40 contains 1 war eagles.
Image number 41 contains 3 war eagles.
Image number 42 contains 9 war eagles.
Image number 43 contains 3 war eagles.
Image number 44 contains 0 war eagles.
Image number 45 contains 0 war eagles.
Image number 46 contains 4 war eagles.
Image number 47 contains 3 war eagles.
Image number 48 contains 3 war eagles.
Image number 49 contains 8 war eagles.
Image number 50 contains 3 war eagles.
Image number 51 contains 3 war eagles.
Image number 52 contains 1 war eagles.
Image number 53 contains 6 war eagles.
Image number 54 contains 10 war eagles.
Image number 55 contains 4 war eagles.
Image number 56 contains 7 war eagles.
Image number 57 contains 11 war eagles.
Image number 58 contains 9 war eagles.
Image number 59 contains 2 war eagles.
Image number 60 contains 0 war eagles.
Image number 61 contains 4 war eagles.
Image number 62 contains 2 war eagles.
Image number 63 contains 2 war eagles.
Image number 64 contains 6 war eagles.
Image number 65 contains 6 war eagles.
Image number 66 contains 1 war eagles.
Image number 67 contains 2 war eagles.
Image number 68 contains 2 war eagles.
Image number 69 contains 5 war eagles.
Image number 70 contains 2 war eagles.
Image number 71 contains 3 war eagles.
Image number 72 contains 2 war eagles.
Image number 73 contains 2 war eagles.
Image number 74 contains 4 war eagles.
Image number 75 contains 8 war eagles.
Image number 76 contains 1 war eagles.
Image number 77 contains 5 war eagles.
Image number 78 contains 1 war eagles.
Image number 79 contains 1 war eagles.
Image number 80 contains 3 war eagles.
Image number 81 contains 1 war eagles.
Image number 82 contains 4 war eagles.
Image number 83 contains 3 war eagles.
Image number 84 contains 7 war eagles.
Image number 85 contains 4 war eagles.
Image number 86 contains 5 war eagles.
Image number 87 contains 13 war eagles.
Image number 88 contains 7 war eagles.
Image number 89 contains 0 war eagles.
Image number 90 contains 9 war eagles.
Image number 91 contains 4 war eagles.
Image number 92 contains 4 war eagles.
Image number 93 contains 5 war eagles.
Image number 94 contains 6 war eagles.
Image number 95 contains 3 war eagles.
Image number 96 contains 4 war eagles.
Image number 97 contains 5 war eagles.
Image number 98 contains 2 war eagles.
Image number 99 contains 5 war eagles.
Image number 100 contains 4 war eagles.