Skip to content

Instantly share code, notes, and snippets.

@Yash089610
Last active August 28, 2022 11:33
Show Gist options
  • Select an option

  • Save Yash089610/3aa4c0f563d3a079bd0fb8961b9b0fe7 to your computer and use it in GitHub Desktop.

Select an option

Save Yash089610/3aa4c0f563d3a079bd0fb8961b9b0fe7 to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
/* TYPES */
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<int>::iterator vit;
typedef set<int> si;
typedef set<char> sc;
typedef set<string> ss;
typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
/* FUNCTIONS */
#define il(i, n) for (int i = 0; i < n; i++)
#define il2(i, a, n) for (int i = a; i < n; i++)
#define dl(i, a) for (int i = a; i > 0; i--)
#define dl2(i, a, b) for (int i = a; i > b; i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define MP make_pair
#define sort_all(v) sort(all(v));
#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
#define INF LONG_LONG_MAX
#define sp << " " <<
#define gcd(a, b) __gcd(a, b);
#define all(x) x.begin(), x.end()
#define in(x) cin >> x;
#define in2(x, y) cin >> x >> y;
#define in3(x, y, z) cin >> x >> y >> z;
#define out(x) cout << x;
#define out2(x, y) cout << x sp y;
#define out3(x, y, z) cout << x sp y sp z;
#define line cout << endl;
#define string_in(x) getline(cin, x)
#define f first
#define s second
#define read(type) readInt<type>()
#define fora(a) for (auto u : a)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define fraction(a) \
cout.unsetf(ios::floatfield); \
cout.precision(a); \
cout.setf(ios::fixed, ios::floatfield);
/* PRINTS */
void print(int a) { cout << a; }
void print(long long a) { cout << a; }
void print(bool a) { cout << a; }
void print(char a) { cout << a; }
template <class T>
void print(vector<T> v1)
{
cout << "[";
for (T i : v1)
{
print(i);
cout << " ";
cout << "]" << endl;
}
}
template <class T>
void print(set<T> s1)
{
cout << "[";
for (T i : s1)
{
print(i);
cout << " ";
cout << "]" << endl;
}
}
/* UTILS */
ll min(auto a, auto b)
{
if (a < b)
return a;
return b;
}
ll max(auto a, auto b)
{
if (a > b)
return a;
return b;
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
bool isPrime(ll n)
{
if (n <= 1)
return false;
if (n <= 3)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
for (int i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0)
return false;
return true;
}
bool isPowerOfTwo(ll n)
{
if (n == 0)
return false;
return (ceil(log2(n)) == floor(log2(n)));
}
bool isPerfectSquare(ll x)
{
if (x >= 0)
{
ll sr = sqrt(x);
return (sr * sr == x);
}
return false;
}
string to_upper(string a)
{
for (int i = 0; i < (int)a.size(); ++i)
if (a[i] >= 'a' && a[i] <= 'z')
a[i] -= 'a' - 'A';
return a;
}
string to_lower(string a)
{
for (int i = 0; i < (int)a.size(); ++i)
if (a[i] >= 'A' && a[i] <= 'Z')
a[i] += 'a' - 'A';
return a;
}
template <class T>
ll sumvec(vector<T> v)
{
ll n = v.size();
ll s = 0;
il(i, n) s += v[i];
return s;
}
void yes() { cout << "YES\n"; }
void no() { cout << "NO\n"; }
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
int tt = 1;
in(tt);
while (tt--)
{
int i, j, n, m, n1 = 0, element, a, b, flag = 0;
// Write solution here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment