fork(1) download
  1. // iostream is too mainstream
  2. #include <cstdio>
  3. // bitch please
  4. #include <iostream>
  5. #include <algorithm>
  6. #include <cstdlib>
  7. #include <vector>
  8. #include <set>
  9. #include <map>
  10. #include <queue>
  11. #include <stack>
  12. #include <list>
  13. #include <cmath>
  14. #include <iomanip>
  15. #define dibs reserve
  16. #define OVER9000 123456789012345678LL
  17. #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
  18. #define tisic 47
  19. #define soclose 1e-8
  20. #define chocolate win
  21. // so much chocolate
  22. #define patkan 9
  23. #define ff first
  24. #define ss second
  25. #define abs(x) ((x < 0)?-(x):x)
  26. #define uint unsigned int
  27. #define dbl long double
  28. using namespace std;
  29. // mylittledoge
  30.  
  31. int main() {
  32. cin.sync_with_stdio(0);
  33. cin.tie(0);
  34. int A2,P;
  35. cin >> A2 >> P;
  36. set< pair<int,int> > V;
  37. for(int x =0; x <= 5000; x++) for(int y =0; y <= 5000; y++) {
  38. if(x*x*4+y*y*4 > P*P) break;
  39. int d =(int)sqrt(x*x+y*y);
  40. while(d*d < x*x+y*y) d++;
  41. while(d*d > x*x+y*y) d--;
  42. if(d*d == x*x+y*y) V.insert(make_pair(x,y));}
  43.  
  44. int t =0;
  45. ALL_THE(V,it) for(int d =0; d <= 5000; d++) {
  46. if(it->ss == 0 || (A2+it->ff*d)%it->ss != 0) continue;
  47. int c =(A2+it->ff*d)/it->ss;
  48. auto jt =V.find(make_pair(d,c));
  49. if(jt == V.end()) continue;
  50. t++;
  51. int s1 =(int)sqrt(c*c+d*d);
  52. while(s1*s1 < it->ff*it->ff+it->ss*it->ss) s1++;
  53. while(s1*s1 > it->ff*it->ff+it->ss*it->ss) s1--;
  54. int s2 =(int)sqrt(c*c+d*d);
  55. while(s2*s2 < c*c+d*d) s2++;
  56. while(s2*s2 > c*c+d*d) s2--;
  57. int s3 =(int)sqrt((c-it->ff)*(c-it->ff)+(d-it->ss)*(d-it->ss));
  58. while(s3*s3 > (c-it->ff)*(c-it->ff)+(d-it->ss)*(d-it->ss)) s3--;
  59. while(s3*s3 < (c-it->ff)*(c-it->ff)+(d-it->ss)*(d-it->ss)) s3++;
  60. if(s3*s3 != (c-it->ff)*(c-it->ff)+(d-it->ss)*(d-it->ss)) continue;
  61. if(s3+s2+s1 != P) continue;
  62. cout << "Dream\n";
  63. cout << "0 0\n" << it->ff << " " << it->ss << "\n" << c << " " << d << "\n";
  64. return 0;}
  65. cout << "Flag\n";
  66. return 0;}
  67.  
  68. // look at my code
  69. // my code is amazing
  70.  
Success #stdin #stdout 0s 3480KB
stdin
Standard input is empty
stdout
Flag