Skip to content

Instantly share code, notes, and snippets.

View StarOrpheus's full-sized avatar

Zahar Koval StarOrpheus

  • Limassol, Cyprus
View GitHub Profile
const int P = max(rand(), 239017) | 1;
const int N = 500020;
const int MOD1 = 1000000007;
const int MOD2 = 1000000009;
array<pair<int, int>, N> p;
bool initp()
{
ll gcd(ll x, ll y)
{
while(x > 0 && y > 0)
{
if (x > y)
x = x % y;
else
y = y % x;
}
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define INF (1<<30)
import java.io.*;
import java.util.*;
import static java.lang.Integer.min;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
class segtree
{
private:
int sz;
vector<map<ll, int > > tr;
inline void add(map<ll, int >& d, const map<ll, int>& from)
{
for(auto& p: from)
d[p.F] += p.S;
class fenwick
{
public:
fenwick();
fenwick(fenwick& x);
const fenwick& operator=(const fenwick& t);
const fenwick& operator=(const fenwick& t) const;
fenwick(int sz) : tr(sz, 0), sz(sz) {}
template<typename T>
const char32_t * const __get_byte_array(const T& data)
{
void * __void_ptr = (void *) &data;
const char32_t * const __char_ptr = (const char32_t * const) __void_ptr;
return __char_ptr;
}
template<typename T>
This file has been truncated, but you can view the full file.
50000 150000
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
var a,r:array of array of array of longint;k,r1,r2:array [1..50000] of longint;
p:array [1..5000] of boolean;
n,m,i,j,x,y,s,f,k1:longint;
procedure dfs(v:longint);
begin
p[v]:=false;
for j:=1 to k[v] do
if (p[j]=true) and (r[v,j]=0) then
begin
dfs(a[v,j]);
@StarOrpheus
StarOrpheus / C.cpp
Last active December 15, 2016 10:52
ll memeficate(ll r)
{
ll x = 0;
for(int i = 1; i < 62; i += 2)
x |= bool((r & (1ll << i))) << (i >> 1);
return x;
}
ll cnt(ll r)