Loading...
Submission
Id When Author Problem Language CPU Memory Verdict
19749 2024-05-01 23:45:04 SajidAbdullah Worst C++ 17 0 ms 0 kb Accepted
Test Cases
CPU Memory Verdict
Source Code
program.cpp
Download
  1.  
  2.  
  3. #include<bits/stdc++.h>
  4. //#include <ext/pb_ds/assoc_container.hpp>
  5. //#include <ext/pb_ds/tree_policy.hpp>
  6. #define endl "\n"
  7. #define FF ios_base::sync_with_stdio(0);cin.tie(0)
  8. #define binary(value, size) cout << bitset<size>(value) << '\n'
  9. #define Tp template<class T>
  10. #define Tpp template<typename T>
  11. #define Tppp template<typename T1,typename T2>
  12. #define eps 1e-9
  13. #define pf printf
  14. #define sf scanf
  15. #define clr(arr,val) memset((arr),val,(sizeof(arr)))
  16. #define rep(i,a,b) for(long long int i=a;i<b;i++)
  17. #define repb(i,a,b) for(long long int i=a;i>=b;i--)
  18. #define all(v) (v).begin(),(v).end()
  19. #define asort(a) sort(a.begin(),a.end())
  20. #define arev(a) reverse(a.begin(),a.end())
  21. #define F first
  22. #define S second
  23. #define pb push_back
  24. #define eb emplace_back
  25. #define pbb pop_back
  26. #define mp make_pair
  27. #define V vector
  28. #define P pair
  29. #define M map
  30. #define mt make_tuple
  31. #define BS(v,x) binary_search(v.begin(),v.end(),x) //return true /false
  32. #define LB(v,x) lower_bound(v.begin(),v.end(),x)-v.begin()//found and that value and not found than greater value pos
  33. #define UB(v,x) upper_bound(v.begin(),v.end(),x)-v.begin() //found and greater value pos && not found also greater pos
  34. #define sma(c) towlower(c)
  35. #define rt(x) sqrt(x)
  36. #define cap(c) towupper(c)
  37. #define sq(a) ((a)*(a))
  38. #define cube(a) ((a)*(a)*(a))
  39. #define SUM(v) accumulate (v.begin(),v.end(),0)//sum of the vector
  40. #define MAX(v) *max_element(v.begin(),v.end())//max element of the vector
  41. #define MIN(v) *min_element(v.begin(),v.end())//min element of the vector
  42. #define SZ(x) long long int(x.size())
  43. #define Ceil(n) (long long int)ceil(n)
  44. #define Floor(n) (long long int)floor(n)
  45. #define deb(x) cout << #x << " = " << x << "\n";
  46. #define deb2(x,y) cout << #x << " = " << x << ", "; cout << #y << " = " << y << "\n";
  47. #define deb3(x,y,z) cout << #x << " = " << x << ", "; cout << #y << " = " << y << ", "; cout << #z << " = " << z << "\n";
  48. #define deb4(x,y,z,r) cout << #x << " = " << x << ", "; cout << #y << " = " << y << ", "; cout << #z << " = " << z << ", ";cout << #r << " = " << r << "\n";
  49. #define out(ans) cout<<ans<<"\n"
  50. #define outs(ans) cout<<ans<<" "<<"\n"
  51. #define FI freopen ("in.txt", "r", stdin)
  52. #define FO freopen ("out.txt", "w", stdout)
  53.  
  54. using namespace std;
  55. //using namespace __gnu_pbds;
  56.  
  57. typedef long long int ll;
  58. typedef double lf;
  59. typedef long double llf;
  60. typedef unsigned long long int ull;
  61. typedef vector<ll> vll;
  62. typedef vector<vector<ll> > v2d;
  63. typedef vector<vector<vector<ll> > > v3d;
  64. typedef pair<ll,ll> pll;
  65. typedef vector<pll> vpll;
  66. typedef map<ll,ll> mpl;
  67. typedef priority_queue<ll> heap;// heap max value from top
  68. typedef priority_queue<ll, vector<ll>, greater<ll> > revheap;//heap min value from top
  69.  
  70. //vector<vector<int>> grid(n, vector<int>(n, 0)); // 2D Array inititalize with 0 n*n size
  71.  
  72. bool isLetter(char c) { return (c >= 'A' and c <= 'Z') or (c >= 'a' and c <= 'z');}
  73. bool isUpperCase(char c) {return c >= 'A' and c <= 'Z';}
  74. bool isLowerCase(char c) { return c >= 'a' and c <= 'z';}
  75. bool isDigit(char c) {return c >= '0' and c <= '9';}
  76. bool isVowel(char c) {return c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u';}
  77. bool isConsonant(char c){ return !isVowel(c); }
  78.  
  79. Tp void Debug(T v) { for(int i=0; i<(int)v.size(); i++) cout << v[i] <<" "; cout<<"\n"; }
  80.  
  81. Tp void Input(T &v){ for(int i=0; i<(int)v.size(); i++) cin >> v[i]; }
  82.  
  83. Tp string toString(T n) { ostringstream ost; ost << n; ost.flush(); return ost.str();}
  84.  
  85. //string to int
  86. string intTobinary(int x) { std::string binary = std::bitset<32>(x).to_string(); return binary;}
  87. string lltobinary(ll x) {std::string binary = std::bitset<64>(x).to_string(); return binary;}
  88. ll toNumber(string s) {stringstream aa(s);ll mm;aa>>mm; return mm;}
  89. ll binaryToDecimal(string n) { string num = n; ll dec_value = 0; ll base = 1; ll len = num.length(); for (int i = len - 1; i >= 0; i--) { if (num[i] == '1') dec_value += base; base = base * 2; } return dec_value;}
  90.  
  91. //nCr
  92.  
  93. Tpp T nCr(T n, T r) { if(r > n - r) r = n - r; int ans = 1,i;for(i = 1; i <= r; i++) { ans *= n - r + i; ans /= i; } return ans; }
  94.  
  95. //Binary exponentiation (a^p)
  96. ll Binpow(ll a, ll p){ ll ret = 1; while(p>0){ if(p & 1)ret = (1LL * ret * a) ; a = (1LL * a * a) ; p >>= 1LL; } return ret; }
  97.  
  98. //BigMod (a^p)%mod
  99. template<typename A, typename P>
  100. ll BigMod(A a, P p, ll mod){ ll ret = 1; while(p){ if(p & 1)ret = ( (ret%mod) * (a%mod)) % mod; a = ( (a%mod) * (a%mod)) % mod; p >>= 1LL; } return ret; }
  101.  
  102. //Base (value,base)
  103. Tpp T toBase(T n, T base){T ret= 0LL; while(n){ ret += n % base; ret *= 10LL; n /= base;} return ret;}
  104.  
  105. // Divisor
  106.  
  107. Tpp vector<T> Divisor(T value){ vector<T> v; for(int i = 1LL; i * i <= value; ++i){
  108. if(value % i == 0){v.push_back(i); if(i * i != value) v.push_back(value / i);} } return v;}
  109.  
  110. //Primes
  111.  
  112. Tpp bool prime(T n){ if(n==2) return 1; if (n % 2 == 0) return 0; for (T i = 3; i*i <= n; i += 2){if (n % i == 0) return 0;}return 1;}
  113.  
  114. //Sieve
  115. Tpp void Sieve(T n){bool prime[n+1];memset(prime, true, sizeof(prime));
  116. for (T p=2; p*p<=n; p++){ if (prime[p] == true){
  117. for (int i=p*p; i<=n; i += p) prime[i] = false;} } }
  118. //Math
  119.  
  120. Tpp ll sum(std::vector<T> &v){return std::accumulate(all(v), 0);}
  121. Tpp T minval(std::vector<T> &v){return *std::min_element(all(v));}
  122. Tpp T maxval(std::vector<T> &v){return *std::max_element(all(v));}
  123. Tpp void make_unique(std::vector<T> &v){v.resize(unique(all(v)) - v.begin());}
  124. Tpp void make_unique_sorted(std::vector<T> &v){asort(v);v.resize(unique(all(v)) - v.begin());}
  125. Tpp int lowerBound(std::vector<T> &v, T x){return v.back() < x ? -1 : lower_bound(all(v), x) - v.begin();}
  126. Tpp int upperBound(std::vector<T> &v, T x){return v.back() < x ? -1 : upper_bound(all(v), x) - v.begin();}
  127.  
  128. double startTime = clock();
  129. void showCurrentTime(){ printf("%.6lf\n", ((double)clock() - startTime) / CLOCKS_PER_SEC);}
  130.  
  131.  
  132.  
  133. //Bit Hacks
  134. ll MakeOneBit(ll decimalvalue, int pos) { return (decimalvalue | (1 << pos));} //make pos bit of value 1
  135. ll MakeZeroBit(ll decimalvalue, int pos) {return (decimalvalue & ~(1 << pos));} //make pos of value bit 0
  136. ll FlipBit(ll decimalvalue, int pos) { return (decimalvalue ^ (1 << pos));} //flip pos bit of value reverse
  137. bool CheckBit(ll decimalvalue, int pos) { return (decimalvalue & (1 << pos)); }
  138. int MSB(ll k) { return ( 63 - __builtin_clzll(k));} // leftmost set bit
  139. int LSB(ll k) { return __builtin_ffs(k)-1 ;} // right most set bit
  140. int Totalset(ll decimalvalue) {return __builtin_popcountll(decimalvalue); } //total 1 in value
  141.  
  142. int Totolnotset(ll decimalvalue) { return MSB(decimalvalue) - Totalset(decimalvalue) + 1;} //total 0 in value
  143. bool ispow2(int i) { return i&&(i&-i)==i; }
  144.  
  145. ll nC2(ll n) { return (n * (n - 1)) / 2;}
  146. ll nc3(ll n){ return (n * (n - 1) * (n - 2)) / 6; }
  147. ll arithsum(ll n, ll a = 1, ll d = 1){ return (n * (a + a + (n - 1) * d) ) / 2; }
  148. ll LCM(ll a, ll b){return (a / __gcd(a, b) ) * b;}
  149. ll OnetoNsum(ll n){return (n*(n+1))/2;}
  150. ll longdivision(string s,ll a){ ll ans=0; ll temp=0; rep(i,0,s.length()){ temp=temp*10+(s[i]-'0');ans+=(temp/a);ans*=10;temp=temp%a;}return (ans/10);}
  151.  
  152.  
  153. const long long int INF=LLONG_MAX;
  154. const double EPS = 1e-9;
  155. const double PI = acos(-1.0);
  156. const double PIby2=asin(1.0);
  157. const int MOD = 1e9 + 7;
  158.  
  159. //debug
  160. Tppp void dvpll(vector<pair<T1,T2> > v) { for(ll i=0;i<v.size();i++){deb(i);deb(v[i].F);deb(v[i].S);cout<<"\n";}}
  161. void dpos(vll v,ll pos){ cout<<pos<<"="<<v[pos]<<"\n"; }
  162. Tppp void dmap(map<T1,T2> m) {ll i=0;for(auto x:m) {deb(i);deb(x.F);deb(x.S);cout<<"\n";i++;}}
  163. Tpp void dset(set<T> s) {for(auto x:s) {deb(x);cout<<"\n";}}
  164. Tpp void dmset(multiset<T> s) {for(auto x:s) {deb(x);cout<<"\n";}}
  165.  
  166. Tpp void dpqueue(priority_queue<T> pq) {while(!pq.empty()){deb(pq.top());pq.pop();} }
  167. Tpp void dstack(stack<T> st) {while(!st.empty()) {deb(st.top());st.pop();}}
  168. Tpp void dqueue(queue<T> q) {while(!q.empty()){ deb(q.front());q.pop(); }}
  169.  
  170. void dgraph(vector<ll> adj[],ll node){rep(i,0,node+1){deb(i);rep(j,0,adj[i].size()) {cout<<adj[i][j]<<" ";}cout<<"\n";}cout<<"\n";}
  171.  
  172. Tpp void d1d(vector<T> v){for(ll i=0;i<v.size();i++){ cout<<v[i]<<" "; }cout<<"\n";}
  173. Tpp void d2d(vector<vector<T> >&v,ll n,ll m) {cout<<"2d: "<<"\n";for(ll i=0;i<n;i++){for(ll j=0;j<m;j++){cout<<v[i][j]<<" ";}cout<<"\n";}}
  174. Tpp void d3d(vector<vector<vector<T> > > &v,ll p,ll q,ll r){cout<<"3d: "<<"\n";for(ll i=0; i<p; i++){for(ll j=0; j<q; j++){for(ll k=0; k<r; k++){cout<<"v[i="<<i<<"][j="<<j<<"][k="<<k<<"]=";cout<<v[i][j][k]<<"\n";}}}}
  175.  
  176.  
  177.  
  178. //for debugging debfun1,fun2 etc
  179.  
  180.  
  181.  
  182.  
  183. //Input Output
  184.  
  185. Tpp void Rvec(vector<T> &v,ll n){rep(i,0,n){T d;cin>>d;v.pb(d);}}
  186. Tppp void Rvpll(vector<pair<T1,T2> > &v,ll n){rep(i,0,n){T1 a;T2 b;cin>>a>>b;v.pb(mp(a,b));} }
  187. void Rgraph(vector<ll> adj[],ll edge ,ll indexbase ,bool directed ){rep(i,0,edge){ll a,b;cin>>a>>b;if(indexbase==0){a--;b--;}adj[a].pb(b);if(directed==0){adj[b].pb(a);}}}
  188.  
  189.  
  190.  
  191. //Graph
  192.  
  193. //DFS
  194.  
  195. //vll adj[1000001];bool vis[1000001];void init(ll n){rep(i,0,n+1){adj[i].clear();vis[i]=false;}}
  196. //stack<ll> st;void DFS(ll val){vis[val]=1;st.push(val);for(auto child:adj[val]){if(!vis[child]) DFS(child);}}
  197.  
  198. //BFS
  199.  
  200. //vll adj[1000001];bool vis[1000001];
  201. //ll level[1000001];ll parent[1000001];
  202. //void BFS(ll source){ queue<ll> q; q.push(source);level[source]=0;vis[source]=1;while(!q.empty()){ll par=q.front();q.pop();for(auto child:adj[val]){if(!vis[child]){vis[child]=1;level[child]=level[val]+1;parent[child]=par;q.push(child);}}}}
  203.  
  204.  
  205.  
  206. //set/multiset.insert() map/vector/list.push_back()/queue/stack.push()/list.push_front()
  207. //vec/list.pop_back()/stack/queue/pqueue.pop()
  208. //pq.top()/queue.front()/stack.top()
  209. //cout<<fixed<<setprecision(decimal)<<value<<"\n";
  210. /*
  211. NCR dp
  212.  
  213. ll NCR[1010][1010];
  214. const ll MM=10056;ll funNCR(ll n){NCR[1][1]=1;NCR[1][0]=1;for(ll i=2;i<=n;i++){NCR[i][0]=1;NCR[i][i]=1;for(ll j=1;j<=i-1;j++){NCR[i][j]=(NCR[i-1][j-1]%MM+NCR[i-1][j]%MM)%MM;NCR[i][j]%=MM;}}}
  215.  
  216.  
  217. */
  218. //const int dx[]={1,0,-1,0};const int dy[]={0,1,0,-1}; //4 direction
  219. //const int dx[] = {1, -1, 0, 0, -1, -1, 1, 1}; const int dy[] = {0, 0, 1, -1, -1, 1, -1, 1};// 8 direction
  220. //const int dx[]={2,1,-1,-2,-2,-1,1,2};const int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
  221. //const int dx[]={2,1,-1,-2,-1,1};const int dy[]={0,1,1,0,-1,-1}; //Hexagonal Direction
  222. //-----four slopes->vertical x,horizontal y, diag1 x-y,diag2 x+y
  223. //-------------------------------------------------------------------------------------------------------------------
  224. //adj matrix cant be done dynamically adj[tot+1] cant be done
  225. //vector<vector<int>> grid(n, vector<int>(n, 0)); 2D Array
  226. //s.erase(remove(s.begin(),s.end(),' '),s.end());//INF=LONG_LONG_MAX;
  227. //vector<vector<int> > adj(maxx+2) //adjacency matrix
  228. //adj set vector<vector<int> > adj(maxx) //adjacency set
  229. //adj queue adj priority queue etc
  230. // to flip bit do 1 xor
  231. /*
  232. V<ll> v1;
  233.   v1.pb(7);v1.pb(1);v1.pb(18);
  234.   d1d(v1);
  235.   deb(MAX(v1));
  236.   deb(MIN(v1));
  237.   asort(v1);
  238.   d1d(v1);
  239.   deb(LB(v1,18));
  240.   deb(UB(v1,18));
  241.   deb3(v1[0],v1[1],v1[2]);
  242.   deb(v1[0]);
  243.  
  244.   heap h1;h1.push(1);h1.push(2);
  245.   deb(h1.top());h1.pop();
  246.   revheap h2;h2.push(1);h2.push(2);
  247.   deb(h2.top());h2.pop();
  248.   deb(SUM(v1));
  249. */
  250.  
  251. /*
  252. template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  253. template <class T> using multi_ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
  254. template <class T> using r_ordered_set = tree<T, null_type, greater<T>, rb_tree_tag, tree_order_statistics_node_update>;
  255. template <class T> using r_multi_ordered_set = tree<T, null_type, greater_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
  256. */
  257.  
  258. // ordered_set<ll> s;
  259. // s.order_of_key(k); --> number of items strictly smaller than k
  260. // s.find_by_order(k); --> k-th item in set (0-indexing) (returns iterator)
  261.  
  262. void S()
  263. {
  264.  
  265. }
  266.  
  267. int main()
  268. {
  269. FF;
  270. cout<<"123";
  271. return 0;
  272. }
  273.  
  274.  
  275.  
  276.