fork download
  1. /*
  2. ==> Don't stop when you're tired, stop when you're done.
  3. ==> From the river to the sea, Palestine will be free.
  4. --> @author: MIDORIYA_
  5. */
  6. //*==============================================================
  7. #include <bits/stdc++.h>
  8. using namespace std;
  9. typedef long long ll;
  10. typedef double db;
  11. typedef long double ld;
  12. typedef pair<int, int> pii;
  13. typedef pair<ll, ll> pll;
  14. typedef vector<int> vi;
  15. typedef vector<ll> vll;
  16. typedef vector<db> vd;
  17. typedef vector<ld> vld;
  18. typedef vector<bool> vb;
  19. typedef vector<vector<ll>> vvl;
  20. typedef vector<vector<int>> vvi;
  21. typedef vector<pii> vii;
  22. typedef set<int> si;
  23. typedef set<ll> sl;
  24. #define pb push_back
  25. #define all(x) x.begin(), x.end()
  26. #define rall(x) x.rbegin(), x.rend()
  27. #define endl "\n"
  28. const int MOD = 998244353, mod = 1e9 + 7, maxA = 1e5 + 5;
  29. #define time cerr << "Time Taken: " << (float)clock() / CLOCKS_PER_SEC << " Secs";
  30. //*===================>>>Fast-IO-Functions<<<=================
  31. void fastIO()
  32. {
  33. ios_base::sync_with_stdio(false);
  34. cin.tie(nullptr);
  35. cout.tie(nullptr);
  36. }
  37. //*===================>>>File-IO-Functions<<<=================
  38. void fileIO()
  39. {
  40. #ifndef ONLINE_JUDGE
  41. freopen("in.txt", "r", stdin);
  42. freopen("out.txt", "w", stdout);
  43. #endif
  44. }
  45. //*===================>>>ONE-FOR-ALL-Function<<<==============
  46. void OneForAll()
  47. {
  48. int op;
  49. cin >> op;
  50.  
  51. static queue<ll> arr;
  52. if(op == 1)
  53. {
  54. ll n;
  55. cin >> n;
  56. arr.push(n);
  57. }
  58. else if(op == 2)
  59. {
  60. if(!arr.empty())
  61. {
  62. arr.pop();
  63. }
  64. }
  65. else
  66. {
  67. if(!arr.empty())
  68. {
  69. cout << arr.front() << endl;
  70. }
  71. else
  72. {
  73. cout << "Empty!" << endl;
  74. }
  75. }
  76. }
  77.  
  78. int main()
  79. {
  80. fastIO();
  81. fileIO();
  82.  
  83. ll tc = 1, t = 1;
  84. cin >> t;
  85. while (t--)
  86. {
  87. // cout << "Case " << tc++ << ": ";
  88. OneForAll();
  89. }
  90. time;
  91. return 0;
  92. }
Success #stdin #stdout #stderr 0s 5308KB
stdin
Standard input is empty
stdout
Empty!
stderr
Time Taken: 0.004336 Secs