fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4. #include <vector>
  5. #include <map>
  6. #include <sstream>
  7. #include <set>
  8. #include <iomanip>
  9. #include <list>
  10. #include <stack>
  11. #include <queue>
  12. #include <bitset>
  13. #include <numeric>
  14.  
  15. #include <cstdio>
  16. #include <cmath>
  17. #include <climits>
  18. #include <cstring>
  19. #include <cctype>
  20. #include <cstdlib>
  21.  
  22. using namespace std;
  23.  
  24. typedef vector<int> vi;
  25. typedef set<int> si;
  26.  
  27. string split_by_50(const string& s) {
  28. string ns; int prev=0;
  29. if (s.size()>50) {
  30. for (int i=0;i<s.size();++i) {
  31. if (i>0 && i % 50==0 && i<s.size()-1) {
  32. ns+=s.substr(prev,i-prev)+"\n";
  33. prev=i;
  34. } else if (i==s.size()-1) {
  35. ns+=s.substr(prev,i-prev+1);
  36. }
  37. }
  38. }
  39. return ns.size() ? ns : s;
  40. }
  41.  
  42. string to_D(int row, int col, int m, int n, vector<vi>& rows) {
  43. string s = "";
  44. if (m==0 || n==0) {
  45. return s;
  46. }
  47. int common = rows[row][col];
  48. bool same = true;
  49. for (int i=row;i<row+m;++i) {
  50. for (int j=col;j<col+n;++j) {
  51. if (rows[i][j]!=common) {
  52. same = false;
  53. break;
  54. }
  55. }
  56. }
  57. if (same) {
  58. s = common == 1 ? "1" : "0";
  59. } else {
  60. int top = m / 2 + m % 2;
  61. int left = n / 2 + n % 2;
  62. s = "D" + to_D(row,col,top,left,rows) + to_D(row,col+left,top,n-left,rows) +
  63. to_D(row+top,col,m-top,left,rows) + to_D(row+top,col+left,m-top,n-left,rows);
  64. }
  65. return s;
  66. }
  67.  
  68. string to_D(int m, int n, const string& bitmap) {
  69. vector<vi> rows(m);
  70. for (int i=0;i<m;++i) {
  71. for (int j=0;j<n;++j) {
  72. rows[i].push_back(bitmap[i*n+j]-'0');
  73. }
  74. }
  75.  
  76. return split_by_50(to_D(0,0,m,n,rows));
  77. }
  78.  
  79. void fill(int row, int col, int m, int n, vector<vi>& rows,int f) {
  80. for (int i=row;i<row+m;++i) {
  81. for (int j=col;j<col+n;++j) {
  82. rows[i][j]=f;
  83. }
  84. }
  85. }
  86.  
  87. void to_B(int row,int col,int m, int n, vector<vi>& rows, string& bitmap) {
  88. if (m==0 || n==0)
  89. return;
  90. int f = -1;
  91. if (bitmap[0]=='0') {
  92. f = 0;
  93. } else if (bitmap[0]=='1') {
  94. f = 1;
  95. }
  96.  
  97. bitmap=bitmap.substr(1);
  98. if (f>=0) {
  99. fill(row,col,m,n,rows,f);
  100. } else {
  101. int top = m / 2 + m % 2;
  102. int left = n / 2 + n % 2;
  103. to_B(row,col,top,left,rows,bitmap);
  104. to_B(row,col+left,top,n-left,rows,bitmap);
  105. to_B(row+top,col,m-top,left,rows,bitmap);
  106. to_B(row+top,col+left,m-top,n-left,rows,bitmap);
  107. }
  108. }
  109.  
  110. string to_B(int m, int n, string& bitmap) {
  111. vector<vi> rows(m);
  112. for (int i=0;i<m;++i) {
  113. for (int j=0;j<n;++j) {
  114. rows[i].push_back(0);
  115. }
  116. }
  117. to_B(0,0,m,n,rows,bitmap);
  118. string s(m*n,' ');
  119. for (int i=0;i<m;++i) {
  120. for (int j=0;j<n;++j) {
  121. s[i*n+j]=rows[i][j]+'0';
  122. }
  123. }
  124.  
  125. return split_by_50(s);
  126. }
  127.  
  128. int main(int argc, char* argv[])
  129. {
  130. char c;
  131. int m,n;
  132. int state = 0; //0==regular input; 1==bitmap data input; 2==processing of bitmap, transition to regular input;
  133. string input;
  134. string bitmap;
  135. while (true) {
  136. if (state==2) {
  137. //we don't read line in this state, it has been read on a previous loop
  138. state = 0;
  139. if (c=='B') {
  140. cout<<"D"<<setw(4)<<m<<setw(4)<<n<<endl;
  141. cout<<to_D(m,n,bitmap)<<endl;
  142. } else if (c=='D') {
  143. cout<<"B"<<setw(4)<<m<<setw(4)<<n<<endl;
  144. cout<<to_B(m,n,bitmap)<<endl;
  145. }
  146. } else {
  147. //in any other state we first read line
  148. getline(cin,input);
  149. }
  150.  
  151. if (state==0) {
  152. c = input[0];
  153. if (c=='#') {
  154. break;
  155. } else {
  156. sscanf(input.c_str(),"%c %d %d",&c,&m,&n);
  157. state = 1; //we start reading line
  158. bitmap="";
  159. }
  160. } else if (state==1) {
  161. //here we analyze input whether it belongs to bitmap data, or is it just the next line of other input
  162. if (input[0]=='#' || input[1]==' ') {
  163. state = 2;
  164. } else {
  165. bitmap+=input;
  166. }
  167. }
  168. }
  169. return 0;
  170. }
Success #stdin #stdout 0.01s 5320KB
stdin
B 178 178
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111100000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000001111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000011111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111100000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000001111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000011111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
10000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000001111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000011111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111110000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000001111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000011111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111110000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000011111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111110000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000011111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111110000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11100000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000011111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111110000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111100000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000011
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111110000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111100000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00001111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111110000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111100000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000001111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111110
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111100000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000001111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111100000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000001111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111100000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000001111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000011111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111100000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000001111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000011111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
10000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000001111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000011111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111110000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000001111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000011111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111110000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000011111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111110000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000011111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111110000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11100000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000011111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111110000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111100000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000011
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111110000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111100000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00001111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111110000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111100000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000001111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111110
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111100000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000001111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111100000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000001111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111100000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000001111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000011111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111100000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000001111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000011111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
10000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000001111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000011111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111110000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000001111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000011111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111110000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000011111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111110000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000011111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111110000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11100000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000011111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111110000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111100000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000011
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111110000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111100000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00001111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111110000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111100000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000001111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111110
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111100000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000001111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111100000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000001111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111100000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000001111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000011111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111100000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000001111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000011111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
10000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000001111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000011111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111110000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000001111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000011111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111110000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000011111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111110000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000011111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111110000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11100000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000001111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000011111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111100
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000001111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000011111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11110000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000001111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000011111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111110000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000001
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000011111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111110000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000011111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111110000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000011111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111110000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111100000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000011111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111110000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111100000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
01111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111110000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111100000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000001111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111110000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111100000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000001111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111100000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000001111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111100000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000001111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00011111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111100000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000001111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000011111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111100
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000001111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000011111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11110000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000001111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000011111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111110000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000001
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000011111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111110000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000011111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111110000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000011111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111110000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111100000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000011111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111110000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111100000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
01111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111110000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111100000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000001111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111110000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111100000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000001111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111100000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000001111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111100000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000001111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00011111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111100000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000001111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000011111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111100
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000001111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000011111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11110000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000001111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000011111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111110000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000001
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000011111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111110000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000011111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111110000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000011111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111110000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111100000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000011111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111110000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111100000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
01111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111110000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111100000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000001111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111110000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111100000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000001111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111100000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000001111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111100000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000001111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00011111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111100000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000001111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000011111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111100
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000001111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000011111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11110000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000001111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000011111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111110000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000001
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000011111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111110000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000011111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111110000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000011111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111110000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111100000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000011111
11111111111111111111111111111111111111111111111111
1111111111111111111111111111111111
#
stdout
D 178 178
D1001