This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from math import sqrt | |
def rec(state, v): | |
if state == (1 << N) - 1: | |
return cakes[v] | |
if dp[state][v] != -1: | |
return dp[state][v] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long int ll; | |
typedef pair<int, int> P; | |
typedef pair<ll, ll> Pll; | |
typedef vector<int> Vi; | |
typedef tuple<int, int, int> T; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long int ll; | |
typedef pair<int, int> P; | |
typedef pair<ll, ll> Pll; | |
typedef vector<int> Vi; | |
typedef tuple<int, int, int> T; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import math,string,itertools,fractions,heapq,collections,re,array,bisect | |
class Procrastination: | |
def findFinalAssignee(self, n): | |
def miller_rabin(n): | |
""" primality Test | |
if n < 3,825,123,056,546,413,051, it is enough to test | |
a = 2, 3, 5, 7, 11, 13, 17, 19, and 23. | |
Complexity: O(log^3 n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long int ll; | |
typedef pair<int, int> P; | |
typedef pair<ll, ll> Pll; | |
typedef vector<int> Vi; | |
typedef tuple<int, int, int> T; | |
#define FOR(i,s,x) for(int i=s;i<(x);i++) | |
#define REP(i,x) FOR(i,0,x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long int ll; | |
typedef pair<int, int> P; | |
typedef pair<ll, ll> Pll; | |
typedef vector<int> Vi; | |
typedef tuple<int, int, int> T; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long int ll; | |
typedef pair<int, int> P; | |
typedef vector<int> Vi; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) | |
/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) | |
int main() { | |
// use scanf in CodeForces! | |
cin.tie(0); | |
ios_base::sync_with_stdio(false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import math,string,itertools,fractions,heapq,collections,re,array,bisect | |
class TheKingsFactorization: | |
def getVector(self, N, primes): | |
ans = list(primes) | |
n = N | |
for p in primes: | |
n /= p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long int ll; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) | |
#define INF 1<<25 | |
#define MAX_V 100010 |