code_file1 stringlengths 87 4k | code_file2 stringlengths 85 4k |
|---|---|
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
int main(){
string n;
cin >> n;
int size = n.size();
int ans = INF;
for(int bit = 1; bit < (1<<size); bit++){
int sum = 0;
int cnt = 0;
for(int i = 0; i < size; i++){
if(bit&(1<<i)){
sum ... | #include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;
int main() {
string S; cin >> S;
deque<char> dq; bool flipped = false;
for (auto &c : S) {
if (c == 'R') {
... |
#include<algorithm>
#include<iostream>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<bitset>
#include<cstdio>
#include<string>
#include<time.h>
#include<vector>
#include<cmath>
#include<deque>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int N... | #include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long ... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define q_io ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
typedef vector<ll> vll;
const long long val = 1000000007;
const long long v = 100001;
map<ll, ll> mymap;
int main(){
#ifndef ONLINE_JUDGE
freope... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#def... |
// UTF−8
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
using lc = complex<double>;
template <class T>
bool complex_comparator(const complex<T> &a, const complex<T> &b) {
return real(a) == real(b) ? imag(a) < imag(b) : real(a) < real(b);
}
/* #include<atcoder/all> */
/* using namespace atcod... | #include <bits/stdc++.h>
#define fi first
#define se second
#define DB double
#define U unsigned
#define LL long long
#define LD long double
#define pb emplace_back
#define MP std::make_pair
#define SZ(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int... |
#include <bits/stdc++.h>
using namespace std;
void sort2vectors(vector<__int64_t> &av, vector<__int64_t> &bv){
int n = av.size();
vector<__int64_t> p(n), av2(n), bv2(n);
iota(p.begin(), p.end(), 0);
sort(p.begin(), p.end(), [&](__int64_t a, __int64_t b) { return av[a] < av[b]; });
for (int i = 0; i < n;... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }
template<typename A, typename B> inline bool ch... |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a[200010], s[200010] = {0}, ans[200010] = {0}, vis[200010] = {0}, n;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
vis[i] = max(vis[i-1], a[i]);
s[i] = s[i-1] + a[i];
}
for (int i = 1; i <= n; i++) {
ans[... | #include <algorithm>
#include <bitset>
//#include <cmath>
//#include <complex>
#include <cctype>
#include <cstdio>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <climits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include ... |
#include<iostream>
#include<algorithm>
#define int long long
using namespace std;
const int maxm = 3e3 + 5;
const int mod = 1e9 + 7;
int ms[maxm][maxm];
int d[maxm][maxm]; //d[i][j]表示前i个数分成j段的方案数
int sum[maxm];
int a[maxm];
int n;
void solve() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i... | #include<bits/stdc++.h>
#define int long long
using namespace std;
int get() {
int x = 0, f = 1; char c = getchar();
while(!isdigit(c)) { if(c == '-') f = -1; c = getchar(); }
while(isdigit(c)) { x = x * 10 + c - '0'; c = getchar(); }
return x * f;
}
const int N = 3e5 + 5;
int n, a[N], b[N], sum[N], top;
map<int,... |
#include <bits/stdc++.h>
using namespace std;
const int LGN = 15;
const int MAXN = 5005;
const long long int MOD = 998244353;
long long int fact[MAXN], inv_fact[MAXN], dp[LGN][MAXN];
long long int power(long long int a, int b)
{
if (b == 0)
{
return 1;
}
long long int ans = power(a, b/2);
ans = (ans * ans) % MOD... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0;i < (int)(n);++i)
#define MS(x) memset((x), -1, sizeof((x)))
#define ALL(x) x.begin(), x.end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, ... |
#include <iostream>
#include <vector>
#include <string>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
pair<int, int> divmod(int a, int b) { return make_pair(a / b, a % b); }
class Solver {
private:
const int n = 30;
double score = 0.0;
pair<int, int> input_query() {
int si, ... | #include<bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int n , x [103] , y [103] , vis [103];
vector < int > gr [103];
void dfs ( int x )
{
vis [x] = 1;
for ( int i = 0 ; i < gr [x] . size () ; i ++ )
{
int u = gr [x][i];
if ( vis [u] ) continue;
dfs ( u );
}... |
#include <bits/stdc++.h>
using namespace std;
int n;
const int dydis = 1e5 + 100;
vector<pair<int, int> > mas[dydis], gr[dydis];
bool vis[dydis] = {0};
int ans[dydis] = {0};
int neut[dydis] = {0};
void dfs(int v){
vis[v] = 1;
for(auto x : mas[v]){
if(vis[x.first]) continue;
gr[x.first].push_back... | #include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
#include <cstdint>
#include <string>
#include <sstream>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if ... |
#include <bits/stdc++.h>
#define LOCAL
#define mkp make_pair
#define ft first
#define sd second
using namespace std;
typedef long long ll;
typedef long double lld;
typedef pair<ll,ll> pll;
const lld pi = 3.14159265358979323846;
const ll maxn=1e5+10;
const ll mod=998244353;
void init(void);
ll pow_mod(ll a,ll k);
void ... | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define X first
#define Y second
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define mp make... |
#include <iostream>
#include <vector>
#include<math.h>
#include<algorithm>
#include <float.h>
#include <iomanip>
#include<string>
using namespace std;
int main()
{
unsigned long long N, a, c,bmax,bmin,I,Iking,a_,b_,c_;
N = 0;
cin >> N;
Iking = 100000000000000;
bmax = floor(log2(N));
bmin = 0;
if (N == 1) {... | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
typedef long long ll;
typedef pair<int, int>... |
//================code===================//
//#define TLE
#ifdef TLE
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#endif
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <ctime>
#define ci(t) cin>>t
#define co(t)... | #include "bits/stdc++.h"
#define int long long
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = (1LL << 61);
ll mod = 998244353;
template <typename T>
struct BIT {
int n; // 配列の要素数(数列の要素数+1)
vector<T> bit; // データの格納先
BIT(int n_) : n(n_ + 1), bit(n, 0) {}
void add(int i, T ... |
#include <bits/stdc++.h>
#define f(i,j,k) for(long long i=j;i<k;i++)
#define f2(i,j,k) for(long long i=j;i>=k;i--)
#define ll long long
using namespace std;
const long long mod=1e9+7;
void chmin(int& a, int b){ if(a > b) a = b; }
void chmax(int& a, int b){ if(a < b) a = b; }
void answer(ll a){
if(a==0){
co... | #include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
using ll = long long;
using namespace std;
int main(int argc, char *argv[]) {
ll N;
cin >> N;
cout << N - 1 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main() {
int N;
set<int> A;
cin >> N;
for(int i = 0; i < N; i++){
int a;
cin >> a;
A.insert(a);
}
while(A.size() > 1){
int x = *A.begin();
int X = *A.rbegin();
A.erase(X);
A.insert(X-x);
}
co... |
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> A(n), G(1001);
for (int i = 0; i < n; i++) {
cin >> A[i];
}
int ans = -1, best = 0;
for(int i = 0; i < n; i++) {
for(int j = 0... |
#include <iostream>
#include <string>
#define mod 3
using namespace std;
int n;
string s;
int dp[400000] = { 0 };
int f[400000] = { 0 };
int g[400000] = { 0 };
void compute()
{
dp[0] = 1;
f[0] = 0;
g[0] = 1;
for (int i = 1; i < n; ++i) {
f[i] += f[i - 1];
int j = i;
while (j % mo... | #include <bits/stdc++.h>
#define LL long long
using namespace std;
LL n, k;
int main() {
cin.tie(0), cout.tie(0);
ios::sync_with_stdio(false);
cin >> n >> k;
while (k--) {
if (n % 200) {
n = n * 1000 + 200;
} else {
n /= 200;
}
}
cout << n;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
typedef int_fast32_t int32;
typedef int_fast64_t int64;
typedef uint_fast64_t uint64;
const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;
#define YES(n) cout << ((n) ? "YES\n" : "NO\n" )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n" )
#def... | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define STRINGIFY(n) #n
#define TOSTRING(n) STRINGIFY(n)
#define PREFIX "#" TOSTRING(__LINE__) "| "
#define debug(x) \
{ \
std::cout << PREFIX << #x << " = " << x... |
#include <bits/stdc++.h>
//#define rep(i,a,n) for (int i=a;i<n;i++)
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0; i < (n); ++i)
#define rep2(i, n) for(ll i = 0; i < (n); ++i)
#define rep3(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep4(i, a, b, c) for(ll i = (a); i < (b); i += (c))... | #include <bits/stdc++.h>
using namespace std;
void dfs(vector<vector<tuple<int, int, int>>> &E, vector<string> &ans, int v){
for (auto e : E[v]){
int w = get<0>(e);
int id = get<1>(e);
int t = get<2>(e);
if (ans[id] == ""){
if (t == 0){
ans[id] = "->";
} else {
ans[id] = "<... |
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
ll N; cin >> N;
vector<ll> a(N), b(N), c(N);
rep(i,N) cin >> a[i];
rep(i,N) cin >> b[i];
ll ma = a[0];
c[0] = a[0] * b[0];
... | // //
// Radmanシ //
// //
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<stack>
using namespace std;
//#define int long long
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
#define F first
#define ... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<long long, long long>;
constexpr char ln = '\n';
constexpr long long MOD = 1000000007;
constexpr long long INF = 1000000000 + 100;
constexpr long long LINF = 1000000000000000000 + 100;
#define all(v) v.begin( ), v.end()
#define rep(i,... | #include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define pb(n) push_back(n);
#define m... |
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI 3.141592653589793238462
#define set_bits __builtin_popcountl... | #include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define rf(i,a,b) for(ll i=a; i>=b; i--)
#define pb push_back
#define mp make_pair
#define show(a) for(auto el:a)cout<<el<<" "
#define ff first
#defi... |
#include<bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define ll long long
#define ull unsigned long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define ti3 tuple<int,int,int>
#define mat vector<vector<int>>
const int inf = 1 <... | #include <bits/stdc++.h>
int main (){
int H, W, CNT=0, min=101;
std::cin >> H >> W;
int A[H][W];
for (int i=0; i<H; i++) {for (int j=0; j<W; j++) std::cin >> A[i][j];}
for (int i=0; i<H; i++) {for (int j=0; j<W; j++) if(min>A[i][j]) min=A[i][j];}
for (int i=0; i<H; i++) {for (int j=0; j<W; j++) ... |
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll... | #ifdef _DEBUG
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define all(v) v.begin(), v.end()
#define rep(i, begin, end) for(int i = begin; i < (int)(end); i++)
#define contains(v, x) (find(all(v), x) != v.end())
template<class T> bool chmin(T& a, T b){ if (a > b){ a = b;... |
#include<bits/stdc++.h>
#define PI 3.141592653589793238462
#define eps 1e-20
#define fi first
#define se second
using namespace std;
using cd = complex<double>;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll c[2000006],p1[2000005],p2[2000006],mod=1e9+7;
ll C(ll a,ll... | #pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x)... |
#include <iostream>
using namespace std;
int a,b;
int main()
{
cin>>a>>b;
cout<<a/b;
return 0;
}
| /*First,solve the problem then write the code:);)*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test ll t;cin>>t;while(t--)
#define vll vector<ll>
#define mll map<ll,ll>
#define vvll vector<vector<ll>>
#define v... |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#includ... | #include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define pb(a) push_back(a)
#define vll vector<ll>
#define loop(i, n) for(ll i=1;i<=n;i++)
#define loop0(i, n) for(ll i=0;i<n;i++)
#define in(i) scanf("%lld", &i);
#define out(i) printf("%lld", i)
#define pll pair<ll, ll>
#define vpll vector<pair<l... |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
vector<int> va(a), vb(b);
iota(begin(va), end(va), 1);
iota(begin(vb), end(vb), -b);
int sa = a * (a + 1) / 2;
int sb = b * (b + 1) / 2;
if (sa < sb) {
va[a - 1] += sb - sa;
} else if (sa > sb) {
vb[0] -= sa -... | #ifdef __LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b) {if(a<b) {a=b; return true;} return false;}
template<typename T> bool chmin(T &a,T b) {if(a>b) {a=b; return true;} return false;}
#define itn int
#define fi first
#define se second
#def... |
#include<bits/stdc++.h>
using namespace std;
#define deb(x) cout<<#x<< " = "<< x<<"\n";
//#include<ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define tr(x, it) for(auto (it) ... | #ifdef LOGX
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
/*---------macro---------*/
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define unless(x) if(!(x))
#define until(... |
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>;
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=998244353;
//const ll mod=1000000007;
const vector<int> dy={-1... | #include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
#include <cstdint>
#include <string>
#include <sstream>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if ... |
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define fill0(a) memset(a,0,sizeof(a))
#define fill1(a) memset(a,-1,sizeof(a))
#define fillbig(a) memset(a,63,sizeof(a))
#define pb push_back
#define ppb pop_back
#define mp make_pair
template<typename T1,typename T2> void chkmin(T1 &x,T2 ... |
#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(20) << (x)
#define all(v) (v).begin(), (v).end()
using namespace std;
#define forn(i,n) for (int i = 0; i < (n); ++i)
#define rforn(i, n) for(int i = (n) - 1;i >= 0;--i)
using ll = long long;
int mod = (ll)1e9 + 7;
#define PI ... |
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 998244353
using Graph=vector<vector<pair<int,int>>>;
int main(){
int N;
cin>>N;
vector<int> a(N),b(N),p(N);
for(int i=0;i<N;i++){
cin>>a[i];
}
set<pair<int,int>> s;
for(int i=0;i<N;i++){
cin>>b[i];
s.insert(make_pa... | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define ull unsigned long long
#define ll long long
#define M 998244353
#define pb push_back
#define p_q priority_queue
#define pii pair<ll,ll>
#define vi vector<ll>
#define vii ... |
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
#define MP make_pair
#define MT make_tuple
typedef long long ll;
#define PA pair<ll,ll>
#define TU tuple<ll,ll,ll>
#define vi vector<ll>
#define vii vector<vector<ll> >
#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define rep2(i,m,n) f... | #include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,x,y;
cin>>a>>b>>x>>y;
if(a>b){
cout<<x+min(y,2*x)*(a-b-1);
}else{
cout<<min(y,2*x)*(b-a)+x;
}
return 0;
} |
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <tuple>
using namespace std;
void yes(){ cout << "yes" << endl; }
void Yes(){ cout << "Yes" << endl; }
void YES(){ cout << "YES" << endl; }
void no(){ cout << "no" << endl; }
void No(){ cout << "No" << endl; }
void NO()... | #include <iostream>
using namespace std;
const int inf = (1 << 30);
int main()
{
int minA1 = inf, ind_minA1, minA2 = inf, ind_minA2,
minB1 = inf, ind_minB1, minB2 = inf, ind_minB2,
n, x, y;
cin >> n;
for(int i = 1 ; i <= n ; i++)
{
cin >> x >> y;
if(x < minA1)
... |
#include<bits/stdc++.h>
using namespace std;
int n;
long long X,cur;
long long a[55],b[55];
long long dp[55][2];
int main(){
scanf("%d%lld",&n,&X);
cur=X;
for(int i=1;i<=n;i++) scanf("%lld",a+i);
for(int i=1;i<n;i++){
b[i]=cur%(a[i+1])/a[i];
cur-=a[i]*b[i];
}
dp[0][0]=1ll;
for(int i=1;i<n;i++){
dp[i][0]+... | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin(... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pii pair<int,int>
#define gap " "
#define ok cout<<"ok"<<endl
#define DBG(a) cerr<< "Line "<<__LINE__ <<" : "<< #a <<" = "<<(a)<<endl
#define fastio {ios_base::sync... | #include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functi... |
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <... | #include <bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//#include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a; i >-1; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define... |
#include<bits/stdc++.h>
#define mem(a,x) memset(a,x,sizeof(a))
#define rep(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i <= _##i; ++i)
#define repd(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i >= _##i; --i)
#ifndef ONLINE_JUDGE
#define debug(x...) printf("["#x"]="),print(x);
#else
#defi... | #include<bits/stdc++.h>
using namespace std;
/// Defining variable types.
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<p... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int H,W;
cin >> H >> W;
vector<vector<char>> S(H, vector<char>(W));
for(int i=0; i<H; i++){
for(int j=0; j<W; j++)
cin >> S.at(i).at(j);
}
int count=0;
for(int i=0; i<H; i++){
for(int j=0; j<W-1; j++){
if(S.at(i).at(j)=='... | #include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplac... |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define M 1000000007
int n;
string s,x;
// bool rec(int a, int r){
// if(a==n){
// if(r==0)
// return 1;
// else
// return 0;
// }
// else if(x[a]=='T'){
// ret... | #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef pair<string,int> psi;
typedef pair<int,string> pis;
typedef array<int,2> aii;
typedef array<int,3> aiii;
typedef array<int,4> aiiii;
typedef unsigned long long ull;
typedef long long int ll;
typedef array<ll,2> all;
typedef array<ll,3> all... |
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
#define ll long long int
#define ld long double
#define ba boolalpha
#define F first
#define S second
#define pb push... | #include <bits/stdc++.h>
using namespace std;
#define Fi first
#define Se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<(n);i++)
typedef tuple<int, int, int> t3... |
//
// main.cpp
// abc194c
//
// Created by Hsiu-Fen Chou on 2021/4/8.
//
#include <iostream>
using namespace std;
int A[300005];
long long solve(int L, int R) {
if (L == R) return 0;
int M = (L + R) / 2;
long long sum1 = 0, sum2 = 0;
for (int i = L; i <= M; i++) {
sum1 += A[i];
}
fo... | #include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<int,int>;
using mp = map<string,int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
int main(){
int n;
cin >> n;
map<ll, ll> mp;
for(int i = 0; i < n; i++){
int ... |
#include<bits/stdc++.h>
using namespace std;
void f(int,int,int,int);
int h,w,a,b,ans;
int mp[20][20];
int main(void)
{
scanf("%d %d %d %d",&h,&w,&a,&b);
f(0,0,a,b);
printf("%d\n",ans);
return 0;
}
void f(int y,int x,int aa,int bb)
{
/* for(int i=0;i<w;i++){
for(int j=0;j<h;j++){
printf(".%d.",mp[i][j]);
}
... | #include <iostream>
#include <vector>
#include <set>
#include <bitset>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <list>
#include <cmath>
#include <algorithm>
#include <cassert>
using namespace std;
template <typename input_type>
input_type input() {
input_type inp;
cin >> inp;
... |
#include <bits/stdc++.h>
using namespace std;
int h, w, a, b, ans;
void dfs(int i, int mask, int a, int b) {
if (i == h * w) {
return (void)ans++;
}
if (mask & (1 << i)) return dfs(i + 1, mask, a, b);
if (b) {
dfs(i + 1, mask | (1 << i), a, b - 1);
}
if (a) {
if (i % w != (w - 1) && ~mask & (1 << (i + 1))... | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
constexpr int INF = 1e9, MOD = 1e9 + 7;
constexpr int64_t LINF = 5e18, LMOD = 998244353;
// #include <atcoder/all>
// using namespace atcoder;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[... |
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using C = complex<double>;
int main() {
ll N;
cin >> N;
v... | #include<bits/stdc++.h>
#define ll long long
using namespace std;
void readFile(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
int sol(vector<int> arr, int n){
int sum = 0;
for(int i = 0 ; i < n ; ++i){
sum += arr[i];
}
... |
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <sstream>
#include <stack>
#include <set>
#include <bitset>
#include <deque>
#include <vector>
using namespace std;
... | #include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
using namespace std;
using ll = long long;
usi... |
#include <bits/stdc++.h>
using namespace std;
int main(){
long long L;
cin >> L;
long long ans = 1;
for(int i=1;i<=11;i++){
ans *= L - i;
ans /= i;
}
cout << ans << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define int long long
#define forn(i,n) for(int i=0;i<n;i++)
int dp[13][205];
int ways(int id, int sum){
// cout<<id<<" "<<sum<<" ";
if(id==0 and sum==0) return 1;
if(id==0 or sum<=0) return 0;
if(dp[id][sum]==-1){
dp[id][sum]=0;
for(int i=1... |
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define mp make_pair
#define pb push_back
#define ll long long
//#define debug(x) ;
#define debug(x) cerr << #x << " = " << x << "\n";
ostream& operator<<(ostream& cerr, vector<ll> a... | /*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=10,M=1e5+10;
int n,m;
int wei[N],id[N];
ll f[N];
pair<int,int> bri[M]; //(limit,length)
inline int Read(int &r){
int b=1,c=getchar();r=0;
while(c<'0' || '9'<c) b=c=='-'? ... |
#include<bits/stdc++.h>
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
const int maxn = 110;
int dp[maxn][maxn*maxn*maxn], n, k, M;
void add(int &a, int b) {
a = a+b>=M?a+b-M:a+b;
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> n >> k >> M;
dp[0][0] = 1;
for(int i = 1; i <... | //#pragma GCC optimize ("O2")
//#pragma GCC target ("avx2")
#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cos... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned int;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define all(c) c.begin(),c.end()
#define si(x) ... | #include<bits/stdc++.h>
using namespace std;
#define il inline
#define rg register
il int read()
{
int re=0,k=1;char ch=getchar();
while(ch>'9'||ch<'0'){if(ch=='-')k=-1;ch=getchar();}
while(ch<='9'&&ch>='0'){re=re*10+ch-48;ch=getchar();}
return re*k;
}
il void write(int x)
{
if(x<0) return putchar('-'),write(-x),v... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mtv(kit) cout<<#kit<<" - "<<kit<<"\n";
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map
void doit(){... | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define int ll
#define ld long double
#define reps(i,s,n) for(int i=(s);i<(int)(n);i++)
#define rep(i,n) reps(i,0,n)
#define rreps(i,s,n) for(int i=(int)(s-1);i>=n;i--)
#define rrep(i,n) rreps(i,n,0)
#defin... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
typedef long long LL;
typedef pair <int, int> P;
const int N = 2e5 + 5;
int n, a[N], b[N], c[N];
LL ans, res;
int main(... | /*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).be... |
//I'll always miss you like a darling.
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define LD long double
#define ull unsigned long long
#define x first
#define y second
#define pb push_back
#define pf push_front
#define mp make_pair
#define Pair pair<int,int>
#define pLL pair<LL,LL>
#define pii... | #include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <tuple>
#include <utility>
#include <functional>
#include <set>
#include <map>
#include <bitset>
#include <list>
#include<iomanip>
using namespace std;
using ll = long long;
using UL... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define T int time; scanf("%d", &time); while(time--)
int main(){
ll sum = 0;
T{
ll a , b ;
cin >> a >> b ;
sum+=(b*(b+1)/2 - (a*(a-1))/2) ;
}
cout << sum <<... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#define mkp make_pair
#define mkt make_tuple
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace... |
/***Bismillahhirrahmannirrahim***/
/***coding is fun if u enjoy it***/
#include<bits/stdc++.h>
using namespace std;
/*** Input-Output ***/
#define pf printf
#define sfi(t) scanf("%d",&t)
#define sfi2(a,b) scanf("%d %d",&a,&b)
#define sfl(t) scanf("%lld",&t)
#define sfl2(a,b) scanf("%lld %lld",&a,&b)
... | #include "bits/stdc++.h"
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) ... |
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn=110,maxm=0,mod=998244353;
int n;
int w[maxn],cnt[maxn];
int f[2][maxn][maxn*max... | #include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int n;
int a[110];
int dp[110][10010];
void ADD(int &x, int y) {
x += y;
if (x >= mod) x -= mod;
}
int main() {
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
dp[0][0] = 1;
int sum = 0;
for (int i = 0; i < n; i++) {
int x = a[i]; ... |
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;*/
#include<algorithm>
#include <bits/stdc++.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define S second
#define F f... |
/**
* author: akifpathan
* created: Saturday 10.10.2020 06:06:06 PM
**/
/*
#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/
#ifdef LOCAL
#include "debug.h"
#else
#include<bits/stdc++.h>
using namespace std;
#... |
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 17;
const int mod = 1e9+ 7;
int dp[(1<<N)][N];
int fx(vector<array<int,3>>&v, int mask , int last ){
if(dp[mask][last] != -1){
return dp[mask][last];
}
int n = v.size();
if(mask == ((1<<n) -1)){
... | #include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#def... |
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <math.h>
#include <random>
#include <chrono>
#include <assert.h>
using namespace std ;
using... | #include <bits/stdc++.h>
#define ln '\n'
#define all(dat) dat.begin(), dat.end()
#define loop(i, to) for (__typeof(to) i = 0; i < to; ++i)
#define cont(i, to) for (__typeof(to) i = 1; i <= to; ++i)
#define circ(i, fm, to) for (__typeof(to) i = fm; i <= to; ++i)
#define foreac... |
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)
#define rep(i,n) for(ll i=0;i<n;i++)
int main(){
vector<pair<ll,string>> v;
ll N;
cin>>N;
rep(i,N){
string s... | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <sys/time.h>
using namespace std;
class XorShift128 {
private:
uint32_t x, y, z, w;
public:
XorShift128() : x(123456789), y(362436069), z(521288629), w(88675123) { }
uint32_t rnd() {
uint32_t t = x ^ (x << 11);
x = y;
y = z;
z = w;
return w = (... |
#include <algorithm>
#include <iostream>
using namespace std;
using Pair = pair<double, double>;
Pair dp[200010], dpsum[200010], holesum, anssum;
int n, m, k, x;
bool hole[200010];
int main() {
cin >> n >> m >> k;
for (int i = 0; i < k; i++) {
cin >> x;
hole[x] = true;
}
dpsum[0] = dp[0] = {1, 0};
f... | /*#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_s... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<double> x(n),y(n);
rep(i,n)cin >> x[i] >> y[i];
for (int i = 0; i < n-2; i++)
{
for (int j = i+1; j < n-1;... | #include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> index_set;
//typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tre... |
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
#define rep(i,n) for(int i=0;i<n;i++)
using P=pair<int,int>;
int main(){
int n;
cin >> n;
vector<int> a(n);
rep(i,n) scanf("%d",&a[i]);
vector<ll> e(n);
vector<ll> o(n);
rep(i,n){
if(i%2) o[i]=a[i];
else e[... | #include <bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;
map <int, int> d;
main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int n; cin >> n;
vector <int> a(n + 1);
int ans = 0;
d[0] = 1;
for (int i = 1; i <= n; ++ i){
cin >> a[i];
... |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
if (((a * a) + (b * b)) < (c * c))
cout
<< "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | #include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test() int t; cin>>t; while(t--)
#define all(v) v.begin(),v.end()
#define st(v) sort(all(v))
#define stA(arr,n) sort(arr,arr+n)
#define findInVec(v,key) (find(all(v),key)!=v.end())
#define findInSet(v,key) (v.find(key)... |
#include<iostream>
#include<cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
ll N;
cin >> N;
int p=0;
while(pow(10, p) <= N){
p++;
}
ll ans=0;
rep(i,p){
if(i==p-1){
ans += i/3*(N-pow(10,i)+1);
... | #include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define pb push_back
#define mp make_pair
#define clr(v,d) memset( v, d ,sizeof(v))
#define lcm(a,b) ((a*b)/(__gcd(a,b)))
... |
#include <bits/stdc++.h>
#define int long long
#define IOS; ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb emplace_back
#define pi pair<int, int>
#define fi first
#define se second
#define INF 2147483647
#define mkp make_pair
using namespace std;
int min(int a, int b){return a < b ? a : b;}
int max(int ... | #include "bits/stdc++.h"
typedef long long ll;
#define all(x) (x).begin(), (x).end() // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))
#define min3(x, y, z) min(x, min(y, z))
#ifdef _MSC_FULL_VER //デバッグ出力
#define dout cout
#define debug() if (true)
#define c... |
//~ author : Sumit Prajapati
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define int long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb ... | #define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
usi... |
#include <bits/stdc++.h>
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) x.begin(),x.end()
using namespace std;
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
int n,w;
cin >> n >> w;
int ans = 0;
while (n >= 0) {
n -=w;
if (... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll n,w;
cin>>n>>w;
cout<<(n/w);
// your code goes here
return 0;
} |
#include <bits/stdc++.h>
using namespace std;
long long n;
string t;
int main() {
cin>>n>>t;
int p=3;
long long q=1e10,u=200000;
string s;
for(int i=0;i<u;i++) {
s+="110";
}
long long tmpans=0,ans=0;
if(n==1) {
if(t=="1") {
ans=2*q;
} else {
ans=q;
}
}else if (n==2) {
if(t=="11"||t=="10") {
... | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
string s;
cin>>s;
long long ans=0;
string tt = "110";
if(s.size() == 1)
{
if(s[0]=='1')
ans = 2e10;
else
ans = 1e10;
}
else if(s.size()==2)
{
if(s=="11")
{
ans = 1e10;
}
else if(s=="10")
{
ans = 1e10;... |
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
using vll = vector<ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);... | #include<bits/stdc++.h>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(register int i=(a);i>=(b);--i)
#define int long long
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int N;
const int M = 10000;
const int m = 100;
int A[M], B[m];
void init() {
int min_v = 1000000;
for (int i = 0; i < m; i++) {
min_v = 1000000;
for (int j = i * m; j < (i + 1) * m; j++) {
min_v = min(min_v, A[j]);... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fast \
ios::sync_with_stdio(false); \
cin.tie(0);
void solve(int, int, vector<ll> &, vector<int> &, ll, int);
int main()
{
int ans = 0;
int n;
cin >> n;
vector<int> heights(n);
for (auto &i : h... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0,endrep=(n); i<endrep; ++i)
#define rep1(i,n) for(ll i=1,endrep=(n); i<=endrep; ++i)
#define revrep(i,n) for(ll i=(n)-1; i>=0; --i)
inline constexpr ll Inf = (1ULL << 60) -123456789;
#define fastio cin.tie(nullptr); ios_base:... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 10;
long long n, x;
void mx(long long &a, long long b){
if(b <= x) a = max(a, b);
}
long long a[maxn];
long long dp[2][maxn][maxn][maxn];
// mod tot res
int main(){
memset(dp, -1, sizeof dp);
cin >> n >> x;
for(int i = 1; i <= n; i++) cin >> a[i];... |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
int A,B; cin >> A >> B;
int limit = 2*A + 100;
cout << limit - B << endl;
} | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define INF 1000000000000
typedef long long ll;
int main()
{
int a, b, ans = 0;
cin >> a >> b;
cout << 2 * a... |
#line 2 "/home/defineprogram/Desktop/Library/template/template.cpp"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, n) for (int i = 1; i < n; i++)
#define rev(i, n) for (int i = n - 1; i >= 0; i--)
#define REV(i, n) for (int i = n - 1; i > ... | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(false);
int N; cin>>N;
long long sum = 0;
while(N--){
long long A; long long B;
cin>>A>>B;
sum += (B - A + 1)*(B+A)/2;
}
cout<<sum<<"\n";
return 0;
}... |
#include "bits/stdc++.h"
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A.at(i);
}
sort(A.begin(), A.end());
int max = 0,maxk = 2;
for (int k = 2; k <= A.at(N - 1); k++) {
int cnt = 0;
for (int i = 0; i < N; i++) {
if (A.at(i) % k == 0) cnt++;... | #include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include... |
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
#define rep(i, n) for(int i = 0, i##_len=(n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((int)(x).size())
void _cin() {} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... ... | #include <bits/stdc++.h>
using namespace std;
const int N=2e5+5,M=7;
int dp[N][M],n;
string s,x;
void solve(){
cin>>n>>s>>x;
dp[n][0]=1;
for(int i=n-1,p10=1;i>=0;i--,p10=(p10*10)%7){
int dig = ((s[i]-'0')*p10)%7;
for(int j=0;j<M;j++){
if(x[i]=='T'){
dp[i][j] = ( dp[i+1][j] | dp[i+1][(j+dig)%7] );
}else... |
#include <bits/stdc++.h>
using namespace std;
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::valu... | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define int long long int
#define pii pair<int,int>
const int INF= 1e12;
const int MAX=5e6+5;
const int MAXK=105;
const int mod = 1e9+7;
int gcd(int a, int b)
{
while(b!=0)
{
a=a%b;
swap(a,b);
... |
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int maxN = 1e6 + 5;
ll arr[maxN] = { 0 };
void init()
{
cin.tie(0);
ios_base::sync_with_stdio(false);
}
/*
* 1) First filter out the pairs which have gcd > 1. To compute this, we
* we need to know (1/2 + 1/3 + ... + 1/n) *... |
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
int main(){
int L,R; cin >> L >> R;
int N = R;
vector<ll> T(N+1,0);
T[1] = 1;
for(int a=1; a<=N; a++) for(int b=a*2; b<=N; b+=a) T[b] -= T[a];
ll ans... |
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define MOD 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define vvi vector<vector<int>>
#define INF (int)1e9
#define fora(i,a,b) for(ll i=a;i<b;i++)
#define forn(n) for(ll i=0;... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
int answer;
if (x == y) answer = x;
else if (x == 0 && y == 1) answer = 2;
else if (x == 1 && y == 0) answer = 2;
else if (x == 1 && y == 2) answer = 0;
else if (x == 2 && y == 1) answer = 0;
else if (x == 0 && y == 2... |
#include<bits/stdc++.h>
using namespace std ;
long long solve(long long x){
long long ans = 0 ; // 指数の数+1を数える
if(x == 1) return 1; // 1は1の0乗なので0 + 1 = 1
for(long long p = 2 ; p * p <=x ; p++){
while( x % p == 0){
ans++ ;
x /= p ;
}
}
if( x > 1 ) ans++ ; //... | //#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define DB double
#define LD long double
#define ST string
#define BS bitset
#define PA pair<LL... |
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include<string.h>
#include<iomanip>
#include<stack>
#include<queue>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define ll long long
... | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 100005;
double dp[N];
signed main() {
int n;
cin >> n;
for (int i = n-1; i >= 1; i--) {
dp[i] = dp[i+1]+(1.0)*n/(n-i);
}
cout << fixed << setprecision(10) << dp[1] << '\n';
} |
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
#include<functional>
using namespace std;
#define rep(i,a... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int N;
cin >> N;
vector<int> A(N);
rep(i, N) cin >> A[i];
int ans = A[0];
rep(i, N) ans = __gcd(ans, A[i]);
cout << ans << endl;
} |
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 6;
const int mod = 1e9 + 7;
int a[N], dif[N];
signed main() {
int n;
cin >> n;
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
sort(a + 1, a + 1 + n);
a[0] = 0;
for(int i = 1; i <= n; i++) {
dif[i - 1] = a[i] - a[i - 1] + 1;... | /***************************************************************
File name: B.cpp
Author: ljfcnyali
Create time: 2021年04月18日 星期日 20时03分40秒
***************************************************************/
#include<bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for ( int i = (a), _end_ = (b); i <= _end_; +... |
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve(){
int n;cin>>n;
map<int,int> cnt;
set<int> s;
for(int i=0;i<n;i++){
int x;cin>>x;
s.insert(x);cnt[x]++;
}
int ans=0;
for(int x:s) ans+=(n-cnt[x])*cnt[x];
cout<<ans/2<<"\n";
}
signed main(){
ios_ba... | #include <bits/stdc++.h>
using namespace std;
#define int long long
//#define float double
#define IOS std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int v=1000000007;
//fflush(stdout) write after cout or printf
// * understand question thoroughly (constraints, neg numbers or only positive numbers )..... |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define D(a) cerr << #a << " = " << a << endl
#else
#define D(a) 8
#endif
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define dforsn(i,s,n) for(int i=int(n-1);i>=int(s);i--)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define all(... | #include <bits/stdc++.h>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
vector<int> X(M), Y(M), Z(M);
for(int i = 0; i < M; i++) {
cin >> X[i] >> Y[i] >> Z[i];
}
vector<long long> dp((1 << N));
for(int i = 0; i < (1 << N); i++){
int cnt = __builtin_popcount(i);
... |
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <queue>
#include <deque>
#include <iomanip>
#include <cmath>
// 最大公約数
template<typename T> T gcd(T a, T b)
{
if (a < b) {
return gcd(b, a);
}
else {
const T mod = a % b;
if (mod == 0) {
retu... | #include <bits/stdc++.h>
#define Fast cin.tie(0), ios::sync_with_stdio(0)
#define All(x) x.begin(), x.end()
#define louisfghbvc int t; cin >> t; while(t--)
#define sz(x) (int)(x).size()
using namespace std;
typedef long long LL;
typedef pair<LL, LL> ii;
typedef vector<LL> vi;
template<typename T> istream& operator>>(... |
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll mod = 1000000007;
int main(){
int n;
cin >> n;
int judge = 0;
vector<P>vec(n);
rep(i,n){
P pp;
int a,b;
cin >> a >> b;
... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<ll, ll>;
using tp = tuple<ll, ll, ll>;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
#define all(hoge) (hoge).begin(), (hoge).end()
#... |
#include <bits/stdc++.h>
#include <bitset>
#include <fstream>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 2147483647;
// 9,223,372,036,854,775,807
const ll INFL = 9223372036854775807;
/*!
* @struct UnionFind
* @brief ランク(木の高さ)を用いたUnion Find木
*
*/
template<class T>
struct UnionF... | #include <bits/stdc++.h>
#include<cmath>
#include<string>
#define pb push_back
#define x first
#define y second
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define all(x) x.begin(),x.end()
#define int long long
#define ll long long
using namespace std;
void __print(int x) {cerr << x;}
void __print(lo... |
#include<bits/stdc++.h>
using namespace std;
#define M 998244353
#define N 200000
typedef long long int LL;
LL fact[301],invfact[301],sum[301],sum2[301];
LL ap[N][301],p2[301];
LL mult(LL a, LL b){
return a*b%M;
}
LL add(LL a, LL b){
return (a+b+M)%M;
}
LL c(LL n, LL k){
return mult(fact[n],mult(invfact[k],... | #include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
#include <cstdint>
#include <string>
#include <sstream>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if ... |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
const int INF = 1e9;
const ll LINF = 1e18;
template <class T>
bool chmax(T... | #include <bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'
using namespace std;
using LL = long long;
using... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_... | #include <iostream>
#include <iterator>
#include <list>
#include <cmath>
constexpr int GRID_SIZE = 50;
struct Pos{
int i;
int j;
};
enum MOVE
{
Up,
Left,
Dwon,
Right,
LAST
};
char move_char(MOVE move){
if (move == Up)
{
return 'U';
}
else if (move == Dwon)
{
... |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int n, m, x, y;
cin >> n >> m >> x >> y;
x--, y--;
vector<string> g(n);
for (int i = 0; i < n; i++) cin >> g[i];
int ans = 0;
for (int i = x; i < n && g[i][y] != '... | #include<bits/stdc++.h>
#define ll long long
#define pb emplace_back
#define INF 0x3f3f3f3f
#define f first
#define s second
#define FOR(i, n) for(int i = 1; i <= n; i ++)
#define FFOR(i, a, b) for(int i = a; i <= b; i ++)
#define pii pair<int, int>
#define mod 1000000007
#define all(x) x.begin(), x.end()
#define mem(x... |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator... | #include <bits/stdc++.h>
#include <chrono>
using namespace std;
using namespace std::chrono;
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
// #pragma optimization_level 3
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
/... |
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#i... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<vector<vector<int> > > vvvi;
typedef vector<vector<int> > vvi;
int main(){
int n,m;
cin>>n>>m;
vector<int> wid;
int pre = 0;
vector<int> a(m);
for(int i =0; i<m; i++){
cin>>a.at(i);
}
sort(a.begin(), a.end());
for(... |
// UTF−8
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
using lc = complex<ll>;
/* #include<atcoder/all> */
/* using namespace atcoder; */
template<class T>bool chmax(T &a, const T &b) { return (a<b ? (a=b,1) : 0); }
template<class T>bool chmin(T &a, const T &b) { return (a>b ? (a=b,1) : 0);... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pl = pair<ll, ll>;
const ll INF = ll(1e18);
const ll mod = ll(998244353);
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0... |
/*Allah Vorosha*/
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define in insert
#define rev reverse
#define all(x) (x).begin(),(x).end()
#define all2(x) (x).rbegin(),(x).rend()
#define sz(v) (int)v.size()
#define yes cout << "YES\n"
#define no cout << "NO\n";
#define take fo... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define maxINF 1e18
#define minINF 1e-18
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define pri(a,s,n) for(int i = s; i < n; i++) cout<<a[i]<<" "; cout << endl
int main()
{
FASTIO;
int t = 1; //cin >> t;
... |
#include <bits/stdc++.h>
using namespace std;
long long N; string arr[101]; long long memo[101][2];
long long dp(long long idx, long long state){
if(idx == N){
if(state == 1)return 1;
else return 0;
}
if(memo[idx][state] != -1)return memo[idx][state];
if(arr[idx] == "AND"){
return memo[idx][state] = dp(idx ... |
// Problem: A - Slot
// Contest: AtCoder - AtCoder Beginner Contest 189
// URL: https://atcoder.jp/contests/abc189/tasks/abc189_a
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pr... |
#include<bits/stdc++.h>
using namespace std;
long long arr[300010];
long long arr2[300010];
int main()
{
long long a,b,c,d,e,i,j;
cin >> a >> b;
long long k=0,chk=0;
for(i=0;i<a;i++)
{
cin >> d;
arr[d]++;
chk=max(d,chk);
k=max(arr[d],k);
}
for(i=0;i<=chk;i+... | #include <bits/stdc++.h>
using namespace std;
int main(){
int N, X;
cin >> N >> X;
int tmp = 0;
for (int i = 0; i < N; i++) {
int A;
cin >> A;
if (A != X){
if (tmp != 0){
cout << " ";
}
cout << A;
tmp++;
}
}
cout << endl;
} |
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cst... | #include <bits/stdc++.h>
#define TYPE 5
using namespace std;
typedef long long LL;
#define rep(i,n) for(LL i=0;i<(n);i++)
int main()
{
vector<pair<int,string>> data;
int n;
cin >> n;
for(int i=0; i<n; i++){
string name;
int h;
cin >> name >> h;
data.push_back(make_pair(h,name... |
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
... | #pragma GCC optimize ("O2")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); ... |
#include<iostream>
using namespace std;
int main()
{
string s;
cin>>s;
s[3] = s[0];
s[0] = s[1];
s[1] = s[2];
s[2] = s[3];
cout<<s<<"\n";
} | #include <bits/stdc++.h>
using namespace std;
vector<long long> divisor(long long N) {
//dが約数ならN/dも約数で、計算量は√N
vector<long long> ret1, ret2;
for (long long i=1; i*i<=N; i++)
{
if (N%i==0) {
ret1.push_back(i);
if (i*i != N) ret2.push_back(N/i);
}
}
reverse(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.