fork download
  1. #include<bits/stdc++.h>
  2. #define ll long long
  3. #define nl '\n'
  4. #define MOD 1000000000000000007
  5. #define fori(i,n) for(ll i=0;i < n;i++)
  6. #define forn(i,n) for(ll i=1;i <= n;i++)
  7. #define forx(i,x,n) for(ll i=x;i <= n;i++)
  8. using namespace std;
  9. #include <ext/pb_ds/assoc_container.hpp>
  10. #include <ext/pb_ds/tree_policy.hpp>
  11. using namespace __gnu_pbds;
  12. template<typename T>
  13. using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  14. using namespace __gnu_pbds;
  15. #define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
  16.  
  17. /*ll Mod(ll base, ll exp, ll MOD){
  18.   if(exp == 0) return 1;
  19.   ll res = Mod(base,exp/2,MOD);
  20.   if(exp % 2)
  21.   return (((res * res) % MOD)*base) % MOD;
  22.   else
  23.   return (res*res) % MOD;
  24. }
  25.  
  26. ll gcd(ll x,ll y){
  27.   ll b = min(x,y);
  28.   ll a = max(x,y);
  29.   while(b != 0){
  30.   ll temp = b;
  31.   b = a % b;
  32.   a = temp;
  33.   }
  34.   return a;
  35. }*/
  36.  
  37. void div(vector<ll> &x){
  38. for(ll i=1;i <= 1000007;i++){
  39. for(ll j=i;j <= 1000007;j+=i){
  40. x[j]++;
  41. }
  42. }
  43. }
  44.  
  45. int main(){
  46. ios::sync_with_stdio(false);
  47. cin.tie(nullptr);
  48. vector<ll> x(1000007,0);
  49. vector<int> p;
  50. div(x);
  51. int a,b,c,d,mx=0;
  52. cin >> a >> b >> c >> d;
  53. forx(i,a,b+d){
  54. if(x[i] == 2){
  55. p.push_back(i);
  56. }
  57. }
  58. forx(i,a,b){
  59. auto it = lower_bound(p.begin(),p.end(),i+c);
  60. if(it == p.end()) continue;
  61. int dis = *it - i;
  62. mx = max(mx,dis);
  63. }
  64. if(mx > d || mx < c) cout << "Takahashi";
  65. else cout << "Aoki";
  66. }
Success #stdin #stdout 0.07s 11052KB
stdin
Standard input is empty
stdout
Aoki