https://github.com/archismankarmakar/c-_template_ak
C++ template & snippet by Archisman Karmakar for CP.
https://github.com/archismankarmakar/c-_template_ak
codechef codeforces competitive-programming computer-programming cpp cpp-all cpp17 cpp20 leetcode programming programming-language snippets technology template
Last synced: 4 months ago
JSON representation
C++ template & snippet by Archisman Karmakar for CP.
- Host: GitHub
- URL: https://github.com/archismankarmakar/c-_template_ak
- Owner: ArchismanKarmakar
- License: apache-2.0
- Created: 2023-07-07T06:55:15.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-07T09:12:45.000Z (almost 2 years ago)
- Last Synced: 2025-01-17T22:42:23.092Z (5 months ago)
- Topics: codechef, codeforces, competitive-programming, computer-programming, cpp, cpp-all, cpp17, cpp20, leetcode, programming, programming-language, snippets, technology, template
- Language: C++
- Homepage: https://www.archisman.org
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# C-_template_AK
## C++ template & snippet by Archisman Karmakar for CP.
#
#
```cpp
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#includeusing namespace std;
#define ll long long
#define gc getchar_unlocked
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair pii;
typedef pair pl;
typedef vector vi;
typedef vector vl;
typedef vector vpii;
typedef vector vpl;
typedef vector vvi;
typedef vector vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim)
{
uniform_int_distribution uid(0, lim - 1);
return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================vi g[N];
int a[N];int mpow(int base, int exp)
{
base %= mod;
int result = 1;
while (exp > 0)
{
if (exp & 1)
result = ((ll)result * base) % mod;
base = ((ll)base * base) % mod;
exp >>= 1;
}
return result;
}void ipgraph(int n, int m)
{
int i, u, v;
while (m--)
{
cin >> u >> v;
u--, v--;
g[u].pb(v);
g[v].pb(u);
}
}void dfs(int u, int par)
{
for (int v : g[u])
{
if (v == par)
continue;
dfs(v, u);
}
}void selfDestruct(char *argv)
{
char *process_name = argv;
char command[256] = "rm ";
strcat(command, process_name);
system(command);
}int main(int argc, char *argv[])
{
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin); // input.txt
freopen("output.txt", "w", stdout); // output.txt
#endif// Your Code Goes Here.
selfDestruct(argv[0]);
return 0;
}
```#
#
#### Without Online Sync and IO in text file:
```cpp
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#includeusing namespace std;
#define ll long long
#define gc getchar_unlocked
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair pii;
typedef pair pl;
typedef vector vi;
typedef vector vl;
typedef vector vpii;
typedef vector vpl;
typedef vector vvi;
typedef vector vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim)
{
uniform_int_distribution uid(0, lim - 1);
return uid(rang);
}
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================vi g[N];
int a[N];int mpow(int base, int exp)
{
base %= mod;
int result = 1;
while (exp > 0)
{
if (exp & 1)
result = ((ll)result * base) % mod;
base = ((ll)base * base) % mod;
exp >>= 1;
}
return result;
}void ipgraph(int n, int m)
{
int i, u, v;
while (m--)
{
cin >> u >> v;
u--, v--;
g[u].pb(v);
g[v].pb(u);
}
}void dfs(int u, int par)
{
for (int v : g[u])
{
if (v == par)
continue;
dfs(v, u);
}
}void selfDestruct(char *argv)
{
char *process_name = argv;
char command[256] = "rm ";
strcat(command, process_name);
system(command);
}int main(int argc, char *argv[])
{// Your Code Goes Here.
selfDestruct(argv[0]);
return 0;
}
```#
#
#### Credit: [Archisman Karmakar](https://github.com/ArchismanKarmakar/)