adityaraj5200

solve.cpp for OA-helper

Aug 14th, 2025
63
0
364 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.67 KB | None | 0 0
  1. /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2.  Code written by Aditya ;)   ||  Codechef/codeforces: @adityaraj5200
  3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
  4. //----------HEADER----------
  5. #include<bits/stdc++.h>
  6. using namespace std;
  7.  
  8. //#include<ext/pb_ds/assoc_container.hpp>
  9. //#include<ext/pb_ds/tree_policy.hpp>
  10. //using namespace __gnu_pbds;
  11. //template<class T> using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update >;
  12.  
  13. //----------MACROS----------
  14. #define fastio                        \
  15.     ios_base::sync_with_stdio(false);  \
  16.     cin.tie(NULL);                     \
  17.     cout.tie(NULL)
  18. #define endl                  "\n"
  19. #define all(u)                u.begin(), u.end()
  20. #define rall(v)               v.rbegin(), v.rend()
  21. #define sortall(u)            sort(all(u))
  22. #define lcm(a,b)              (a*b)/__gcd(a,b)
  23. #define gcd(a,b)              __gcd(a,b)
  24. #define summation(n)          (((n)*((n)+1))/2)
  25. #define countDigits(n)             (1+floor(log10(n)))
  26. #define setbits(u)            __builtin_popcount(u)
  27. #define ctz(u)                __builtin_ctz(u)
  28. #define clz(u)                __builtin_clz(u)
  29. #define checkbit(num,i)       (num&(1<<i))  //select the bit of position i of val
  30. #define lowbit(u)             ((u)&((u)^((u)-1))) //get the lowest bit of u
  31. #define trav(u,it)            for(auto it = u.begin(); it != u.end(); it++)
  32. #define in(u, a, b)           (min(a,b) <= u && u <= max(a,b))
  33.  
  34. //----------TYPEDEFS----------
  35. typedef unsigned int          uint;
  36. typedef long long             ll;
  37. typedef unsigned long long    ull;
  38. typedef long double           ld;
  39. typedef pair<int, int>         pii;
  40.  
  41. //----------DEBUG METHODS----------
  42. void __print(int x) { cerr << x; }
  43. void __print(long x) { cerr << x; }
  44. void __print(long long x) { cerr << x; }
  45. void __print(unsigned x) { cerr << x; }
  46. void __print(unsigned long x) { cerr << x; }
  47. void __print(unsigned long long x) { cerr << x; }
  48. void __print(float x) { cerr << x; }
  49. void __print(double x) { cerr << x; }
  50. void __print(long double x) { cerr << x; }
  51. void __print(char x) { cerr << '\'' << x << '\''; }
  52. void __print(const char* x) { cerr << '"' << x << '"'; }
  53. void __print(const string& x) { cerr << '"' << x << '"'; }
  54. void __print(bool x) { cerr << (x ? "true" : "false"); }
  55. template<typename T, typename V>
  56. void __print(const pair<T, V>& x) { cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}'; }
  57. template<typename T>
  58. void __print(const T& x) { int f = 0; cerr << '{'; for (auto& i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}"; }
  59. void _print() { cerr << "]\n"; }
  60. template <typename T, typename... V>
  61. void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); }
  62.  
  63. #ifndef ONLINE_JUDGE
  64. #define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
  65. #define nline cerr << endl
  66. #else
  67. #define debug(x...)
  68. #define nline
  69. #endif
  70.  
  71. //----------CONSTANTS----------
  72. const ll mod = 1000000007;
  73. const ll mod2 = 998244353;
  74. const ld ep = 0.0000001;
  75. const ld pi = acos(-1.0);
  76.  
  77. //----------TEMPLATES---------- Works only in C++ 17
  78. template<typename... T>
  79. void read(T&... args) { ((cin >> args), ...); }
  80. template<typename... T>
  81. void put(T&&... args) { ((cout << args << " "), ...); }
  82. template<typename... T>
  83. void putl(T&&... args) { ((cout << args << " "), ...); cout << endl; }
  84. template<typename... T>
  85. void putnl(T&&... args) { ((cout << args << "\n"), ...);}
  86.  
  87. //----------Custom hash map-------------
  88. struct custom_hash
  89. {
  90.     static uint64_t splitmix64(uint64_t x)
  91.     {
  92.         x += 0x9e3779b97f4a7c15;
  93.         x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
  94.         x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
  95.         return x ^ (x >> 31);
  96.     }
  97.  
  98.     size_t operator()(uint64_t x) const {
  99.         static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
  100.         return splitmix64(x + FIXED_RANDOM);
  101.     }
  102. };
  103. template <typename T1, typename T2> // Key should be integer type
  104. using safe_map = unordered_map<T1, T2, custom_hash>;
  105.  
  106.  
  107. //----------Operator overloads--------------
  108. template <typename T1, typename T2> // cin >> pair<T1, T2>
  109. istream& operator>>(istream& istream, pair<T1, T2>& p) {
  110.     return (istream >> p.first >> p.second);
  111. }
  112. template <typename T> // cin >> vector<T>
  113. istream& operator>>(istream& istream, vector<T>& v) {
  114.     for (auto& it : v)
  115.         cin >> it;
  116.     return istream;
  117. }
  118. template <typename T1, typename T2> // cout << pair<T1, T2>
  119. ostream& operator<<(ostream& ostream, const pair<T1, T2>& p) {
  120.     return (ostream << p.first << " " << p.second);
  121. }
  122. template <typename T> // cout << vector<T>
  123. ostream& operator<<(ostream& ostream, const vector<T>& c) {
  124.     for (auto& it : c)
  125.         cout << it << " ";
  126.     return ostream;
  127. }
  128. template <typename T>
  129. int32_t size_i(T& container) { return static_cast<int32_t>(container.size()); }
  130.  
  131.  
  132. //----------Mathematical functions------------
  133. int GCD_extended(int a, int b, int& x, int& y) {
  134.     x = 1, y = 0;
  135.     int x1 = 0, y1 = 1, a1 = a, b1 = b;
  136.     while (b1){
  137.         int q = a1 / b1;
  138.         tie(x, x1) = make_tuple(x1, x - q * x1);
  139.         tie(y, y1) = make_tuple(y1, y - q * y1);
  140.         tie(a1, b1) = make_tuple(b1, a1 - q * b1);
  141.     }
  142.     return a1;
  143. }
  144.  
  145. ll modpow(ll x, ll n, ll m = mod) {
  146.     if (x == 0 && n == 0)
  147.         return 0; // undefined case
  148.    
  149.     ll res = 1;
  150.     while (n > 0)
  151.     {
  152.         if (n % 2)
  153.             res = (res * x) % m;
  154.         x = (x * x) % m;
  155.         n /= 2;
  156.     }
  157.     return res;
  158. }
  159.  
  160. ll modinv(ll x, ll m = mod) {
  161.     return modpow(x, m - 2, m);
  162. }
  163.  
  164. mt19937 rng;
  165. int getRandomNumber(int l, int r)
  166. {
  167.     uniform_int_distribution<int> dist(l, r);
  168.     return dist(rng);
  169. }
  170.  
  171. /*/------------------------------ CODE BEGINS ------------------------------/*/
  172. void preprocess(){
  173.     rng = mt19937(chrono::steady_clock::now().time_since_epoch().count());
  174. }
  175.  
  176. const int N = 2e5 + 5;
  177.  
  178. void solve(){
  179.    
  180. }
  181.  
  182. void bruteforce(){
  183.     // This function is used to check the correctness of the solution
  184.     // by comparing it with a brute force solution.
  185.     // It should be implemented only if necessary.
  186.     // Otherwise, it can be left empty or removed.
  187.    
  188. }
  189. /*/------------------------------- CODE ENDS -------------------------------/*/
  190.  
  191. int main(){
  192.     fastio;
  193.     // cout << setprecision(12) << fixed;
  194.  
  195.     // Redirects input from input.txt
  196.     // freopen("input.txt", "r", stdin);
  197.  
  198.     // Redirects cout to output.txt
  199.     // freopen("output.txt", "w", stdout);
  200.  
  201.     preprocess();
  202.  
  203.     int num_tc=1;
  204.     cin>>num_tc;
  205.     for(int tc=1;tc<=num_tc;tc++){
  206.         // solve();
  207.         bruteforce();
  208.     }
  209.  
  210.     return 0;
  211. }
Advertisement
Add Comment
Please, Sign In to add comment