code_file1 stringlengths 87 4k | code_file2 stringlengths 82 4k |
|---|---|
#include<bits/stdc++.h>
//#include <boost/math/common_factor.hpp>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define os_find(k) find... | #include<cstdio>
#include<algorithm>
#define int long long
const int Q=100005;
const int INF=(1<<30);
using namespace std;
typedef long long ll;
#define rg register int
char buf[1<<21],*p1=buf,*p2=buf;
#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
inline bool ig(char c){return c>=48&&c<... |
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VVI vector<VI>
#define VL vector<LL>
#define VVL vector<VL>
#define VPII vector<PII>
#defi... | #include "bits/stdc++.h"
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define all(X) begin(X), end(X)
#define size(X) (int)std::size(X)
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3... |
#include <bits/stdc++.h>
using namespace std;
class factor{
int size;
vector<int> primes;
vector<int> lp;
public:
explicit factor(int n): size(n){
lp.assign(n+1,-1);
for(int i=2;i<=n;i++){
if(lp[i]==-1){
primes.push_back(i);
lp[i]=i;
... | #include<bits/stdc++.h>
using namespace std;
#define rint register int
#define int long long
inline int read(){
int x=0,f=1;
char c=getchar();
while(!isdigit(c)){
if(c=='-')
f=-1;
c=getchar();
}
while(isdigit(c)){
x=(x<<3)+(x<<1)+(c^48);
c=getchar();
}... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (long long i = 0; i < (n); i++)
using ll = long long;
using P = pair<ll, ll>;
template<class T>
bool chmax(T &a, T b) {if (a < b) {a = b;return true;}else return false;}
template<class T>
bool chmin(T &a, T b) {if (a > b) {a = b;return true;}else retu... |
// '-.-'
// () __.'.__
// .-:--:-. |_______|
// () \____/ \=====/
// /\ {====} )___(
... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define deb(x) cout << #x << " " << x << endl;
#define mod 1000000007
#define fast std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define endl "\n"
const ll INF = 1e18;
const ll NEGINF = -1 * INF;
/*NOTES: Take care of ll vs int
... | #include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace std;
#pragma GCC optimize("O3","unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target("avx2")
using namespace __gnu_pbds;
template <typename... |
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) v.begin(), v.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, const T& b) { if (b<a)... |
// Problem: F - Range Xor Query
// Contest: AtCoder - AtCoder Beginner Contest 185
// URL: https://atcoder.jp/contests/abc185/tasks/abc185_f
// Memory Limit: 1024 MB
// Time Limit: 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include<bits/stdc++.h>
using namespace std;
#define int l... |
#include <bits/stdc++.h>
using namespace std;
#define fr(i,n) for(int i = 0; i<n; i++)
#define sz(v) (int)(v.size())
#define prin(a) cout << #a << " = " << a << endl
#define prinv(v) cout << #v << " = "; for(auto it : v) cout << it << ", "; cout << endl
#define all(v) (v).begin(),(v).end()
typedef long long ll;
#def... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll z = 0, mod = 1000000007, MAX = 60;
int main(){
ll N;
cin >> N;
vector<vector<pair<ll, ll>>> G(N + 1, vector<pair<ll, ll>>(0));
for (ll i = 0; i < N - 1; i++){
ll u, v, w;
cin >> u >> v >> w;
G[u].push_back({v, w});
... |
#include <bits/stdc++.h>
int main(){
int n, l;
std::cin >> n >> l;
std::vector<std::pair<int, int>> vec(n + 2);
vec[0] = std::make_pair(0, 0);
vec[n + 1] = std::make_pair(l - n, l - n);
for(int i = 1; i <= n; i++) std::cin >> vec[i].first, vec[i].first -= i;
for(int i = 1; i <= n; i++) std:... | #include<bits/stdc++.h>
using namespace std;
#define author "Sihare0riginals"
#define ss string
#define lli long long int
#define ld long double
#define f first
#define s second
#define all(v) v.begin(),v.en... |
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
const ld eps = 1e-14;
int main() {
long double x, y, r;
cin >> x >> y >> r;
r += eps;
ll ans = 0;
for (ll i = (ll)(y-r-1); i <= (ll)(... | #include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;
struct Point
{
ldouble x, y;
ldouble dist(Point &other) { return sqrt((x - other.x)*(x - other.x) + (y - other.y)*(y - other.y)); }
ldouble dist2(Point &other) { return (x - other.x)*(x - other... |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#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 repa(i,a,n) for(int i=(a); i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
#define COUT(x) cout<<(x)<<endl
#define YES(x) cout<<(x?"YES":"NO")<<e... | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100];
int main(){
ll n;
scanf("%lld",&n);
a[0]=1;a[1]=1;
int i=1;
while(a[i]+a[i-1]<=n)
i++,a[i]=a[i-1]+a[i-2]; //a[i]<=n i的最小值
//cout<<i<<endl;
ll res=i,k=n;
for(int j=i;j>=1;j--){
if(k>=a[j])
k-=a[j],res++; //是否可以插... |
#include <bits/stdc++.h>
using namespace std;
//#define int long long
const int N = 2e5 + 7;
int p[N], r[N], t[N];
vector <int> ans;
int apply(int x) {
if(r[x] == x) return 0;
if(t[r[x] - 1]) return -1;
int ax = p[r[x]], ay = p[r[x] - 1];
t[r[x] - 1] = true;
ans.push_back(r[x] - 1);
swa... | #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;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(lon... |
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef pair<int,int> Pair;
typedef tuple<int,int,int> tpl;
#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< "... |
/* In the name of Anton */
/*
* Motto :)
*
*
*
*
*
*/
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,a,n) for(int i=a;i<=n;i++)
#define repb(i,a,n) for(int i=a;i>=n;i--)
#define trav(x,a) for(auto &x: a)
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for (int i = 0; i < (int)(a); i++)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
typedef long long ll;
template<typename T>istream& operator>>(istream&i,vector<T>&v){rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vec... |
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i=0; i<(n); ++i)
#define RREP(i, n) for (int i=(int)(n)-1; i>=0; --i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, n) for (int i=(int)(n)-1; i>=(a); --i)
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end(... | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stack>
#include <cassert>
#include <map>
#include <numeric>
#include <cstring>
#include <set>
#include <ctime>
#include <queue>
#include <cmath>
#include <iomanip>
#include <iterator>
using namespace std;
clock_t timeStart, timeFi... |
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#include <cmath>
using namespace std;
int main(){
int X;
cin >> X;
if( X%100 == 0) cout << 100 << endl;
else cout << 100 - X%100 << endl;
} | //#define _GLIBCXX_DEB // Iterator safety; out-of-bounds access for Containers, etc.
//#pragma GCC optimize "trapv" // abort() on (signed) integer overflow.
#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 ... |
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#define N 111
#define NN 131000
template <typename T> inline void read(T &x) {
x = 0; char c = getchar(); bool flag = false;
while (!isdigit(c)) { if (c == '-') flag = true; c = getchar(); }
while (isdigit(c)) { x = (x << 1) + (x << 3) + (... | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll dp[101][127501],n,k,m;
void pls(ll &a,ll b){
a+=b;if(a>=m)a-=m;
}
int main(){
dp[0][0]=1;
cin>>n>>k>>m;
for(int j=0;j<n;j++)
for(int l=0;l<=((j+1)*(j+2)/2)*k;l++)
for(int i=0;i<=k&&l+(j+1)*i<127501;i++)
pls(dp[j+1][l+(j+1)*... |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define F first
#define S second
#define PB push_back
#define forn(i,a,b) for(i=a;i<=b;i++)
#define nfor(i,a,b) for(i=a;i>=b;i--)
#define all(x) x... | #include<bits/stdc++.h>
using namespace std;
int main(){
long long N;
cin >> N;
set<long long> S;
for(long long i = 1; i*i<=N; i++){
if(N%i==0){
S.insert(i);
S.insert(N/i);
}
}
for(auto c:S){
cout << c << endl;
}
} |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair <int, int> pin;
const int N = 1e5 + 5;
const ll P = 1e9 + 7;
int n;
ll a[N], ans;
vector <ll> vec;
template <typename T>
inline void read(T &X) {
char ch = 0; T op = 1;
for (X = 0; ch > '9' || ch < '0'; ch = ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAXN = 1e5 + 10;
const int MAXM = 1e5 + 10;
struct edge {
int u,v;
int next;
}e[MAXM * 2];
int first[MAXN];
int idx;
int n;
void add(int a, int b) {
e[idx].u = a;
e[idx].v = b;
e[idx].next ... |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i, n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define miele(v) min_element(v.begin(), v.end())
#define maele(v) max_element(v.begin(), v.end())
#define SUM(v) accumulate(v.begin(),... |
// Problem: F - +1-1x2
// Contest: AtCoder - AtCoder Beginner Contest 188
// URL: https://atcoder.jp/contests/abc188/tasks/abc188_f
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ... |
#include <algorithm>
#include <iostream>
#include <string>
#include <functional>
#include <vector>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cmath>
#include <climits>
#include <queue>
#include <bitset>
#include <set>
#include <assert.h>
#include <map>
using namespace std;
typedef vector<vector<... | #include<bits/stdc++.h>
using namespace std;
int main() {
long long int n,i,j,x,y,z,k,z1,c1=0,sum=0,c=0,d,m,x1,y1,x2,y2;
string o,p;
cin>>o>>p;
for(i=0;i<o.size();i++)
{
sum=sum+(o[i]-'0');
}
for(i=0;i<p.size();i++)
{
c=c+(p[i]-'0');
}
cout<<max(c,sum);
return 0;
}
|
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll Max=3*1e10;
int main()
{
int n;cin>>n;int i;ll m=9999999999;
string s;cin>>s;
string s1="";
for(int i=1;i<=2*1e5;i++)
{
if(i%3==0)
s1+='0';
else
s1+='1';
}
//cout<<s1<<endl;
if(n=... | #include<bits/stdc++.h>
#define ll long long int
using namespace std;
const ll COPIES = 1e10;
int cnt;
int main () {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n, i, flag = 0;
string t;
cin >> n >> t;
string a = "", ... |
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define pb push_back
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define pi pair<int,int>
#define vi vector<int>
#define mii map<int,... | #line 1 "/workspaces/compro/lib/template.hpp"
#line 1 "/workspaces/compro/lib/io/vector.hpp"
#include <iostream>
#include <vector>
#ifndef IO_VECTOR
#define IO_VECTOR
template <class T> std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
int size = v.size();
for (int i = 0; i < size; i++) {
... |
#include <bits/stdc++.h>
#define FOR(i, n) for(int i = 0; i < (n); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define TRAV(i, a) for(auto &i : (a))
#define SZ(x) ((int)(x).size())
#define X first
#define Y second
#define MP std::make_pair
#define PR std::pair
typedef long long ll;
typedef std::pair<int, i... | #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 <bits/stdc++.h>
#define fi first
#define se second
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define reset(a,v) memset((a), v, sizeof(a))
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
co... | #define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define ... |
#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair<ll,ll>; const ll INF=4e18;
void print0(){}; template<typename H,typename... T> void print0(H h,T... t){cout<<h;print0(t...);}
void print(){print0("\n");}; template<typename H,typename... T>... | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
static int IN(void)
{
int x=0,f=1,c;while(c=getchar(),c<48||c>57){if(c==45)f=-f;}
while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f*x;
}
static void OUT(long x){if(x<0){putchar('-'),x=-x;}if(x>=10){OUT(x/10);}putchar(... |
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)x.size()
#define rep(i, a, b) for(int i = a; i <= b; ++i)
#define per(i, a, b) for(int i = b; i >= a; --i)
using ll = long long;
using namespace std;
const int N = 5005;
const int P = 998244353;
int n, m;
ll ans, dp[... | #include<bits/stdc++.h>
#define pi 3.141592653589793238
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999
#define pb push_back
#define ff first
#define ss second
#define mt make_tuple
#define ll long long
#defin... |
#include <bits/stdc++.h>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long int t;
cin >> t;
long long int sum = 0, a, b;
for (long long int i = 0; i < t; i++)
{
cin >> ... | #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;
set<P> s;
for(int i = 0; i < N; i++){
int x, y;
cin >> x >> y;
P p;
p.first = x, p.second = y;
... |
#include <bits/stdc++.h>
#pragma GCC optimize(2)
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#include<bitset>
#include<stack>
#include<time.h>
#define X first
#define Y second
#define PB push_b... | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using vi = vector<int>;
using vv = vector<vi>;
//editorial
int main(){
int n;
string t, x;
cin >> n >> t >> x;
vi s(n);
rep(i,n)s[i] = t[i] - '0';
vv dp(n+1, vi (7, 0));//dp[i][j]: iターン目にjがあれば高橋君が... |
#include <bits/stdc++.h>
#include <cmath>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<long long,long long>;
//ll INF = 1e18;
//int INF = 1e9;
//printf("%.10f\n",ans);
int main() {
int n;
cin >> n;
int a = 0;
rep(i,n){
int x;
cin >... | #include <bits/stdc++.h>
using namespace std;
int main (){
int n;
cin >> n;
set<int> a;
set<int> b;
for(int i=0;i<n;i++){
int x;
cin >>x;
a.insert(x);
}
for(int i=0;i<n;i++){
int x;
cin >>x;
b.insert(x);
}
int ans=*begin(b)-*rbegin(a)+1;
if(ans<=0){
cout << 0... |
#include <cstdio>
#define int long long
const int N = 3005, P = 1000000007;
int n, a[N], ans, f[N], tub[N], b[N], t[N];
signed main() {
scanf("%lld", &n);
for(int i = 1; i <= n; i++) scanf("%lld", &a[i]), a[i] += a[i-1];
for(int i = 1; i <= n; i++) f[i] = 1;
ans = (ans + f[n]) % P;
for(int i = 2; i... | #include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)... |
using namespace std;
#include <iostream>
int main() {
int n, a, b; cin >> n >> a >> b;
cout << n - a + b << endl;
return 0;
} | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define pll pair<ll,ll>
#define pii pair<int,int>
#define vll vector<ll>
#define vi vector<int>
#define sz(v) (ll)v.size()
#define all(v) v.begin(),v.end()
#define pq_max priority_queue<ll... |
#include <bits/stdc++.h>
using namespace std;
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define forn(i,n) for(ll i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi... | #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long
#define double long double
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define endl '\n'
#define pii pair<int,int>
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(x) x.beg... |
#include<bits/stdc++.h>
using namespace std ;
const int N = 5e3+5 ,mod = 998244353;
long long fac[N]={1} ,inv[N]={1} ;
long long fast_power(long long b,long long p){
long long res=1;
while(p){
if(p%2) res=(res*b)%mod;
b=(b*b)%mod;
p/=2;
}
return res;
}
void prep(){
for(int ... | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pp=pair<ll,ll>;
const ll INF=1e18;
const ll mod=1e9+7;
const double pi=3.14159265358979323846;
ll modpow(ll a, ll b) { // aのb乗
ll ans=1;
for (ll i=0; i<63; i++) {
if (b & ((ll)1<<i)) {
ans*=a;
ans%=mod;
}
a*=a;
... |
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;
typedef long long ll;
inline LL quick_mul(LL a,LL b,LL m) //快速乘
{
ll ans = 0;
a %= m;
b %= m;
while (b) {
if (b & 1) {
ans = (ans + a) % m;
}
a = (... | #include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
for(int i=0;i<t;i++){
long long num ;
cin >> num;
if (num%4==0){
cout<<"Even"<<endl;
continue;
}
if(num % 2==1){
cout<<"Odd"<<endl;
continue;
}
else{
cout<<"Same"<<endl;
continue;... |
#include<bits/stdc++.h>
#define N 101
int a,b,c,vis[N][N][N];
double f[N][N][N];
inline double F(int x,int y,int z){
if(x>99||y>99||z>99)return 0;
if(vis[x][y][z])return f[x][y][z];vis[x][y][z]=1;
return f[x][y][z]=(F(x+1,y,z)*x+F(x,y+1,z)*y+F(x,y,z+1)*z)/(x+y+z)+1;
}
signed main(void){
int a,b,c;scanf("%d%d%d",&a,... | #include<bits/stdc++.h>
using namespace std;
int main(){
int a, b, x, y;
cin >> a >> b >> x >> y;
int y_ = min(2*x, y);
cout << abs(2*a-1-2*b) / 2 * y_ + (abs(2*a-1-2*b)%2 == 0 ? 0 : x) << endl;
return 0;
} |
#include <bits/stdc++.h>
#define ll long long
#define V vector<long long>
#define VV vector<vector<long long>>
#define VVV vector<vector<vector<long long>>>
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0;(i)<(n);++(i))
#define per(i,n) for(ll (i)=(n)-1;(i)>=0;--(i))
#define gg 9223372036854775807
#ifdef LOCAL
#def... | #include <bits/stdc++.h>
using namespace std;
const int N = 100 + 1;
const int K = 1'000'000;
int mod;
int add(int &a, int b) {
a += b;
if (a >= mod) {
a -= mod;
}
return a;
}
int sub(int &a, int b) {
a -= b;
if (a < 0) {
a += mod;
}
return a;
}
int mul(int a, int b) {
return (long long) ... |
// {{{ by unolight
#pragma region
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i+... | /**
* author: souravrax
* created: 19.06.2021 17:50:09
**/
#include <bits/stdc++.h>
using namespace std;
#define all(x) begin(x), end(x)
#define len(x) int((x).size())
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
... |
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
constexpr int MOD = 1000000007;
constexpr int INF = 100100100... | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long int ll;
typedef pair<ll,ll> pll;
#define MOD 1000000007
bool visited[10];
ll cities[10][10];
ll n,k,ret = 0;
void go(int c,ll total,int visCount)
{
if(visCount >= n-1)
{
if(total+cities[c][0] =... |
#include <bits/stdc++.h>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#define loop(i,a,b) for (int i = (a); i <= (b); i++)
#define loopr(i, a, b) for(int i = (a); i >= (b); i--)
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define mp(a,b)... | #include <bits/stdc++.h>
#include <random>
#include <time.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const ll Lmax=ll(1e18);
const int Nmax=2e... |
#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 M 1000000007
#define pii 3.14159265359
#define pb push_back
#define pob pop_back
#define forr(i,n) for(i=0;i<n;i++)
#define fors(i,j,n) for(i=j;i<n;i++)
#define pi pair<int,int>
#define ff first
#define ss second
#define tcase 0
#define all(v) v.begin(),v.end()
typedef long long int l... |
/*
飲んだ魔剤で家が建つ。
created at: 2020-12-11 15:15:32
*/
#include <bits/stdc++.h>
using namespace std;
map<vector<int>, long double> memo;
long double cnt (int a, int b, int c)
{
long double x, y, z;
x = y = z = 0.0l;
if (a < 100 && b < 100 && c < 100) {
vector<int> p, q, r;
p = {a+1, b... | #include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
#define rep(i, s, n) for (int i = (int)s; i < (int)n; i++)
#define repr(i, n, s) for (int i = (int)n... |
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using PP = std::pair<ll,P>;
#define REP(i,b,e) for(ll i=b; i<e; i++)
#define PRINT(vec) {printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");}
#define fi first
#define se second
const int MOD = 1e9+7;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -... | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
vector<tuple<int,int,int>> v;
for(int i=0;i<n;i++)
{
int p,q,r;
cin>>p>>q>>r;
v.push_back({q,r,p});
}
int c=0;
so... |
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <tuple>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <random>
#include <chrono>
#include <numeric... | #include <bits/stdc++.h>
using namespace std;
void solve() {
int m;
cin >> m;
vector<pair<int, int>> edges(m);
int n = 0;
for (auto& edge: edges) {
int u, v;
cin >> u >> v;
--u;
--v;
edge = {u, v};
n = max(n, u + 1);
n = max(n, v + 1);
}
... |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<vector<int>> mod(1 << 8);
for (int i = 1; i < (1 << min(8, n)); i++) {
int ... | // abc190_e
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_RE... |
//https://oeis.org/search?q=0%2C0%2C1%2C2%2C4%2C6&language=english&go=Search
//https://smallpdf.com/result#r=dc43c99933feaa1c7f3a2f2e2036bc6a&t=pdf-to-word
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <string.h>
using namespace std;
#define ll long long
#define INF 1000007
#define MAX 500007
#... | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int main()
{
ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
int n;
cin >> n;
int arr[n];
int ans = 2000000000;
for(int i = 0; i < n; i++)
{
cin >> arr[i];
}
for(int mask = 0; mask < (1 << (n-1)); mask++)
... |
#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 pb push_back
#define ll long long
#define ld long double
#define sz(x) (ll)x.size()
#... | #include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
template <class T>
inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
... |
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
using namespace std;
using ll = long long;
int main(){
ll n,w; cin>>n>>w;
ll size = 200000,s,t,p,fin=0;
vector<ll> time(size,0);
rep(i,n){
cin>>s>>t>>p;
time[s] += p;
time[t] += -p;
if(t>fin) fin=t;
}
rep(i,fin){
tim... | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
string res;
cin>>n>>m;
if(n > m)
res = m+3 > n ? "Yes" : "No";
else
res = n+3 > m ? "Yes" : "No";
cout<<res;
} |
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll a,b,c,d,chk=0;
cin>>a>>b>>c>>d;
if((a==(b+c+d))|| (b==(a+c+d))|| (c==(a+b+d))|| (d==(a+c+b))|| ((a+b)==(c+d))||((a+c)==(b+d))||((a+d)==(c+b)) )chk=1;
if(chk)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
| #include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> p(4);
int B=0;
for(int i=0;i<4;i++){
cin>>p[i];
B+=p[i];
}
for(int i=0;i<16;i++){
int q=i,A=0;
for(int j=0;j<4;j++){
if(q%2==1){
A+=p[j];
}
q/=2;
}
if(A*2==B){
cout<<"Yes"<<endl;
... |
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);
ll test_case;
test_case=1;
//cin>>test_case;
while(test_case--)
{
ll n;
cin>>n;
ll s=0;
ll i=111;
i=i*9;
while(i<n)
{
s+=n-i;
... | #include <bits/stdc++.h>
using namespace std;
bool is_ok_10(int x)
{
while (0 < x) {
if (x % 10 == 7) {
return false;
}
x = x / 10;
}
return true;
}
bool is_ok_7(int x)
{
while (0 < x) {
if (x % 8 == 7) {
return false;
}
x = x / 8;
}
return true;
}
int main()
{
int n... |
#include<bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
#define mod2 998244353
void fast(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
}
const int mx=1e5+5;
vector<int> adj[mx];
int vis[mx];
int good[mx];
int... | // g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<random>
#... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
#define rep(i, j, n) for (ll i = j; i < (n); i++)
#define repr(i, j, n) for (ll i = j; i >= (n); i--)
#define each(i, mp) for (auto &i : mp)
#define all(x) (x).begin(), (x).end()
#define CLR(mat, f) memset(mat, f, sizeof(mat))
... | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define int long long
pair<int,int>point[1010];
bool online(int i,int j,int k)
{
int x1=point[i].first;
int y1=point[i].second;
int x2=point[j].first;
int y2=point[j].second;
int x3=point[k].first;
int y3=point[k].second;
return (y3-y1)... |
#include <bits/stdc++.h>
#define N 400005
#define ll long long
using namespace std;
inline int read()
{
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
int T;
int n;
int a[N];
int main()
{
n = rea... | //In The Name Of Allah
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define F first
#define S second
//#pragma GCC optimize("Ofast")
const int maxn = 1e4 + 5;
int n, a[maxn], ans = maxn, b[maxn][105];
string s;
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
... |
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#defin... | #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() {
int N; cin >> N;
bool nums[(int)2e5 + 2] = {}; int cur = 0;
REP(i, 0, N) {
int p; cin >> p;
nums... |
#include <bits/stdc++.h>
using namespace std ;
const int MAX = 3000 + 10 ;
int arr[MAX][5] ;
int freq[40] ;
int n ;
bool check(int x)
{
memset(freq , 0 , sizeof(freq)) ;
for(int i = 0 ; i < n ; ++i)
{
int mask = 0 ;
for(int j = 0 ; j < 5 ; ++j)
{
if(arr[i][j] >= x)
mask += (1 << j) ;
}
freq[mas... | #include <bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
using ll = long long;
int main(){
ll N;
cin>>N;
vector<ll> A(N+1,0),B(N+1,0),MB(N+1,0),C(N,0);
ll ans=0;
for(ll i=1; i<=N; i++){
cin >> A.at(i);
}
for(ll i=1; ... |
#include <bits/stdc++.h>
using namespace std;
//using namespace atcoder;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=... | #include"bits/stdc++.h"
using namespace std;
typedef long long ll;
int main(){
ll n,count,p;
count=0;
cin>>n;
p=1;
ll q=0;
while(true){
if(p*1000>n){
count+=q*(n-p+1);
cout<<count<<endl;
return 0;
break;
}
count+=q*(p*10... |
// Problem: B - Insurance
// Contest: AtCoder - Tokio Marine & Nichido Fire Insurance Programming Contest 2021(AtCoder Regular Contest 122)
// URL: https://atcoder.jp/contests/arc122/tasks/arc122_b
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <bits/stdc++.... | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>
using ... |
#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>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
const ll MODA=998244353;
ll vx[4]={0,1,0,-1};
ll vy[4]={1,0,-1,0};
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
long long gcd(long long a,long long b){
ll gcdmax=max(a,b);
ll gcdmin=min(a,b);
whi... |
#include<bits/stdc++.h>
#include<chrono>
using namespace std;
#define FASTio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define all(v) (v).begin(), (v).end()
#define getunique(v) {sort(all(v)); v.erase(unique(all(v)), v.end());}
#define printarr(v) {for(auto x : v) cout<<x<<" "... | #include <bits/stdc++.h>
using namespace std;
#define int long long
template <typename T>
void print_vec(const vector<T>& v, bool newline = true) {
for (int i = 0; i < v.size(); ++i) {
cout << v[i] << " ";
}
if (newline) {
cout << "\n";
}
}
mt19937 rng((uint32_t)chrono::steady... |
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,mmx,avx")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
#define endl "\n"
#define fst first
#define snd second
const int UNDEF = -1;
co... | /*@author Vipen Loka*/
#include <bits/stdc++.h>
#define endl '\n'
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#defi... |
#include<iostream>
using namespace std;
int main(){
int n,ans;
ans=0;
cin>>n;
for(int i=0;i<n;i++){
int a,p,x,t;
cin>>a>>p>>x;
t=ans;
if(a<=0.5+x-1){
if(ans==0){
ans=p;
}else if(ans!=0&&t<=p){
... | #include <bits/stdc++.h>
using namespace std;
const int N = 100000+10;
int main(){
int n;
int a[N][3];
int k=0;
int min=1e9+10;
int b[N];
cin>>n;
for(int i=0;i<n;i++){
for(int j=0;j<3;j++){
cin>>a[i][j];
}
}
for(int i=0;i<n;i++){
if(a[i][2]-a[i][0]>0){
b[k]=a[i][1];
k++;
}
else{
continue;... |
#include <iostream>
using namespace std;
int main ()
{
int a,b,c;
cin>>a>>b>>c;
if(a-b==(b-c) || a-c==c-b || c-a==a-b)
cout<<"Yes";
else
cout<<"No";
return 0;
} | #include <vector>
#include <iostream>
#include <set>
#include <map>
#include <unordered_set>
#include <queue>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stack>
using namespace std;
typedef long long ll;
typedef pair<ll... |
/*
© 2021-03-28 06:53:10 Franco1010 All Rights Reserved
*/
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
// #pragma GCC target("avx,avx2,fma")
#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
#... | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
long long n;
cin >> n;
vector<int>a(n);
for(int i=0; i<n; i++){
cin >> a[i];
}
sort(a.begin(),a.end());
long long ans = n*(n-1);
long long cnt=0;
for(int i=1; i<n; i++){
if(... |
#include<iostream>
#include<cstdio>
using namespace std;
#define fo(i,a,b) for(int i=a;i<=b;++i)
#define fod(i,a,b) for(int i=a;i>=b;--i)
#define LL long long
#define p 998244353
int n,m,er[21];
int jc[10001],ny[10001];
int f[20][5001];
int ksm(int x,int y){
if(x==1)return y;
LL u=ksm(x/2,y);
u=(LL)u*u%p;
if(x&1)u=... | #include <bits/stdc++.h>
using namespace std;
#define inf 1e15
#define mod 1000000007
#define N 100001
#define ll long long int
#define vint vector<int>
#define vll vector<ll>
#define vstr vector<string>
#define vvint vector<vector<int> >
#define ... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll k, n, m;
cin >> k >> n >> m;
vector<pair<ll,ll>> S(k);
vector<ll> A(k);
vector<ll> B(k);
for(ll i=0; i<k; i++) cin >> A[i];
ll count = 0;
for(ll i=0; i<k; i++){
ll b = m*A[i]/n;
if(m*A[i]%n >= n/2) b++;
... | //#pragma GCC optimize ("O2")
//#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#include<cstdio>
#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); i++)
#define... |
/*
* Author : Andrew J
*/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define vz(x) x.size()
using ll = long long;
using ii = pair <int , int>;
void in(int &x);
const ... | #include <bits/stdc++.h>
using namespace std;
string s,t;
int main()
{
long long n;
cin>>n;
cin>>s>>t;
vector<int> ss,tt;
for(int i=0;i<n;i++)
{
if(s[i]=='0')
{
ss.push_back(i);
}
if(t[i]=='0')
{
tt.push_back(i);
}
}
if(ss.size()!=tt.size())
{
cout<<-1<<endl;
}
else{
long long ans=0;
... |
#include <bits/stdc++.h> /*Fuck ratings Feel the magic in the code...*/
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
// template<typename T>
// using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statisti... | #include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <stdlib.h>
#include <fstream>
#include <random>
using na... |
#define G 3
#include<map>
#define AK goto
#include<cmath>
#include<queue>
#include<bitset>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ll long long
#define md ((l+r)>>1)
#define cht 1000000007
#define inf 1145141919810
#define mem(i,j)memset(i,j,sizeof(i))
#define ... | #include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
typedef long long ll;
struct node{
ll a,b,c,d,e,f;
}op[N];
ll x[N],y[N];
int main(){
int n;
cin>>n;
for (int i=1;i<=n;i++){
cin>>x[i]>>y[i];
}
int m,t;
ll p;
node now;
cin>>m;
op[0]={1,0,0,0,1,0};
for (int i=1;i<=m;i++){
cin>>t;
now=op[i-... |
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &x){
x = 0; int f = 1; char ch = getchar();
while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
while (isdigit(ch)) {x = x * 10 + ch - '0'; ch = getchar();}
x *= f;
}
inline void write(int x){if (x > 9) write(x/10); putchar(x%... | #include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random... |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for(int i = 0; i < n; i++)
int main()
{
ll n;
cin >> n;
ll m = n;
ll b2 = 1;
ll ans = 1e18+1;
for(int b = 0;b2<=n;b++){
ll a = n/b2;
ll c = n%b2;
ans = min(ans,a... | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
long long n;
cin >> n;
long long sum=n;
long long a=n,b=0,c=0;
long long count2=1;
while(a>1) {
if(a%2==0) {
b++;
a/=2;
count2*=2;
}
else {
c=c+count... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define sz(x) (int)(x.size())
#define all(x) x.begin(), x.end()
#define rep(x) for (int ii = 0; ii < x; ii++)
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
map<int, vector<int>> M;
rep(n) {
int x, id;
... | #include <cstdio>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <iostream>
#include <sstream>
#include <ostream>
#include <cstring>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <iomanip>
#include <set>
#include <bitset>
//#include<unordered_map>
#defi... |
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int,int>;
using PL = pair<ll,ll>;
using PPL = pair<pair<ll,ll>,ll>;
#define INF 1000000000
#define INFLL 1000000000000000000
#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
... | #include <bits/stdc++.h>
using namespace std;
int main() {
int a,b;
cin>>a>>b;
double c=(a-b)*100.0/a;
cout<<fixed<<setprecision(3)<<c<<endl;
} |
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)
typedef long long int ll;
typedef unsigned long long int ull;
typedef vecto... | #include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define pf push_front
#define sz(x) (int)(x).size()
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x)... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
vector<vector<int>> cyancheck(51, vector<int>(51));
cyancheck.at(x).at(y) = 1;
int k = 2;
vector<vector<int>> cyanmond(51, vector<int>(51));
for (int i = 0; i < 50; i++) {
for (int j = 0; j < 50; j++) {
cin >> c... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=1000000007;
constexpr ll INF=2e18;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1... |
#include<bits/stdc++.h>
using namespace std;
#define pb emplace_back
#define pf first
#define ps second
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define Endl '\n'
#define codejam cout<<"Case #"<<t<<": ";
#define PI 3.141592653589793238462
#define sz(x) ((int)(x).size())
#define mod 100000000... | #include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cinttypes>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<string>
#include<stack>
#define FSCNd64 "%" SCNd64
#define FPRId64 "%" PRId64
using namespace std;
using ll=long long;... |
// Enjoy your stay. Code by evima
#include <bits/stdc++.h>
using namespace std;
using ld = long double;
using ll = long long;
using lll = __int128;
using vl = vector<ll>;
using LOOPVAR_TYPE = ll;
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define sz(x) ll((x).size())
#define GET_MACRO(_1, _2, _3... | #include <random>
#include "bits/stdc++.h"
//#include <atcoder/all>
using namespace std;
// using namespace atcoder;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld eps = 1e-12;
constexpr int inf = numeric_limits<int>::max() / 2;
constexpr ll mod = 1e9 + 7;
mt19937_64 rnd{random_d... |
//Har Har Mahadev
using namespace std;
#include <bits/stdc++.h>
#define booga cerr << "booga" << endl
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define safai(...) Clearing_out(__VA_ARGS__)
temp... | #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma,avx512f,avx512bw,avx512bitalg")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//雪花飄飄北風嘯嘯
//天地一片蒼茫
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
usi... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 ... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
vector <vector <int> > a(n, vector <int> (n));
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
cin >> a[i][j];
int left = -1, right = 100000000... |
#include <bits/stdc++.h>
using i32 = std::int32_t;
using u32 = std::uint32_t;
using i64 = std::int64_t;
using u64 = std::uint64_t;
using i128 = __int128_t;
using u128 = __uint128_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;
class rep {
struct Iter {
usize itr;
constexpr Iter(const u... | #include<bits/stdc++.h>
#define LL long long
#define DB double
#define pb push_back
#define mkp make_pair
#define LB lower_bound
#define UB upper_bound
#define rint register int
#define MS(x,y) memset(x,y,sizeof(x))
#define rep(i,a,b) for(rint i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(rint i=a,i##end=b;i>=i##... |
/*
Author : Ritesh Singh
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define ff first
#define ss second
#define f(i,n) for (int i=0;i<n;i++)
#define fa(i,a,b) for (int i=a;i<b;i++)
#define pb push_back
#define fast ios_base::s... | #include <bits/stdc++.h>
#define N 200005
using namespace std;
void solve(){
int n;
cin >> n;
int arr[n];
for(int i=0;i<n;i++){
cin >> arr[i];
}
int ans = 0;
for(int i=0;i<n;i++){
int now = 0;
for(int j=i;j>=0;j--){
if(arr[j]>=arr[i])
now+... |
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
const int maxn=1e2+10;
int arr[maxn];
string s;
int n;
bool judge(int x){
for(int i=0;i<n;i++){
int a=arr[i]/x,b=arr[i+1]/x;
int aa=arr[i]%x,bb=arr[i+1]%x;
if(s[i]=='<'){
if(a>=b) return false;
... | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,... |
/*Author-Nilesh Chandra(isocyanide7)*/
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
const ll Mod=1000000007;
const ll INF=9999999999... | //https://atcoder.jp/contests/zone2021/tasks/zone2021_c
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool chk(vector<vector<int>> &arr, int mid)
{
int n=arr.size();
set<int> st;
for (int i = 0; i < n; i++)
{
int c=0;
for (int j = 0; j < 5; j++)
{
... |
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0... | #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>;
// vector<vector<bool>> used;
int h, w, a, b;
vector<vector<bool>> used;
int rec(int i, int j, vector<vector<bool>> &used, int a, int b) {
if (j == w) return rec(i+1, 0, used... |
#include <bits/stdc++.h>
using namespace std;
#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second
using int32 = int_fast32_t;
using uint32 = uint_fast32_... | #include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define mxn 1005
#define mxm 105
#define f first
#define s second
#define pb push_back
#define es " "
#define endl '\n'
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define ll long long
#define fastio ios_base::sync_with_stdio(0), cin.tie(... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll mod = 1000000007;
const double pi = 3.14159265358979;
const ll INF = 1e18;
int main() {
string s; cin >> s;
int a, b, c; a = b = c = 0;
rep(i, ... | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
string s;
long long n=10,a[11],b[11],c[5],ans,p;
int main(){
long long i,j,u,v;
cin>>s;
for(i=0;i<n;i++){
if(s[i]=='o') a[i]=1;
if(s[i]=='x') a[i]=-1;
}
for(i=0;i<=9999;i++){
u=i;
memset(b,0,sizeof(b));
c[1]=... |
// #include<bits/stdc++.h>
// using namespace std;
// #define ll long long int
// #define ft first
// #define sd second
// #define pb push_back
// #define pob pop_back
// #define str string
// #define map map<ll, ll>
// #define mmap multimap<ll, ll>
// #define FIO ios_base::sync_with_stdio(false);cin.tie(NULL); cout.ti... | #include <bits/stdc++.h>
using ll =long long;
using namespace std;
using Graph =vector<vector<ll> >;
int main(){
int A,B;
cin>>A>>B;
vector<int>vb(B+1);
for(int i=A;i<=B;i++){
for(int j=1;j*j<=i;j++){
if(i%j==0){
vb[j]++;
if(i/j!=j)vb[i/j]++;
... |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (... | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using P = pair<i64, i64>;
#define overload3(_1, _2, _3, name, ...) name
#define rep1(i, n) for(i64 i = 0LL; i < (n); ++i)
#define rep2(i, a, b) for(i64 i = (a); i < (b); ++i)
#define rep(...) overload3(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
#define... |
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define V vector
template <typename T> bool chmin(T &a, const ... | #include <bits/stdc++.h>
#include <iostream>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <list>
#include <algorithm>
#define eps 10e-14
//cout<<fixed<<setprecision(15)<<
//s=to_string(100);
//vector<vector<char>>c(h,vector<char>(w));
//next_permutation(orig.begin(),orig.end());
using namespace st... |
//wtrl,everybody hangbeat me
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctim... | #include<bits/stdc++.h>
#define ll long long
#define ld long double
#define MOD 998244353
#define f first
#define s second
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const ll inf=1e18+5;
const int maxN=1e6+1;
ll power(ll a,int n){
if(n==0){
return 1ll... |
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
using ld = long double;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_nod... | #include <bits/stdc++.h>
using namespace std;
int main(){
long long N;
cin >> N;
vector<int> ans;
long long INF = 1000000000000000000;
vector<long long> fib(87, INF);
fib[0] = 1;
fib[1] = 1;
for(int i = 2; i < 87; i++){
fib[i] = fib[i - 1] + fib[i - 2];
}
vector<int> ind;... |
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <time.h>
#include <set>
using namespace std;
int64_t mod = 998244353 ;
int64_t min(int64_t a,int64_t b) {
if (a > b)
{
return b ;... | #include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define ui unsigned int
#define us unsigned short
#define inf_int 1e9
#define inf_ll 1e18
#define mod 1000000007
#define smod 998244353
vector<pair<ll, ll>> v[5];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(... |
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << '=' << x << endl
#define rep(i, b, e) for (int i = b; i <= e; i++)
char s1[512345], s2[512345];
vector<int> a(512345);
vector<int> b(512345);
signed main(void) {
int n, cnt = 0;
cin >> n;
scanf("%s%s", s1 + 1, s2 + 1);
rep (i... | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
/*
ll fac[100000+1];
ll power(ll x,ll y)
{
ll res = 1; // Initialize result
x = x % k; // Update x if it is more than or
// equal to p
while (y > 0)
{
// If y is odd, multiply x with result
if (y & 1)
... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpll vector<pll>
#define vpii vector<pii>
#... | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n,t=0,i=1,k=0;
cin>>n;
while(t<=n+1){
t=t+i;
i++;
k++;
}
printf("%lld\n",n-k+2);
return 0;
} |
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#i... | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll=long long;
using P=pair<int,int>;
int n;
vector<int> x(210),y(210),r(210);
vector<int> a(210,-1),b(210,-1),c(210,-1),d(210,-1);
void input(){
cin>>n;
for(int i=0;i<n;i++){
cin>>x[i]>>y[i]>>r[i];
}
}
v... |
#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <vector>
#include <list>
#include <cmath>
#include <map>
#include <deque>
#include <utility>
#include <climits>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <string>
#include <stack>
#include <set>
#inclu... | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<int, int> pi;
const int maxn = 4e5 + 5;
int n;
int f[maxn], g[maxn];
string a;
int C(int i, int j){
if(f[i] == f[j] + f[i-j])
... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define T() long long t;cin>>t;for(long long o=1;o<=t;o++)
#define INF INT_MAX
#define INFS INT_MIN
#define mod 1000000007
#define FOR(a, b, n) for(int a = b; a < n; a++)
#define REP(a,c, b) for(int a = c; a < b; a++)
#define FORD(a, b, c) for(int a = b;... | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chro... |
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define rep(i,n) repi(i,0,n)
#define repi(i,a,n) for(ll i=a;i<(ll)n;++i)
#define repe(i,n) repie(i,0,n)
#define repie(i,a,n) for(ll i=a;i<=(ll)n;++i)
#define ALL(a) (a).begin(),(a).end()
#define RAL... | // Artur Kraska, II UWr
#include <bits/stdc++.h>
#define forr(i, n) for(int i=0; i<n; i++)
#define FOREACH(iter, coll) for(auto iter = coll.begin(); iter != coll.end(); ++iter)
#define FOREACHR(iter, coll) for(auto iter = coll.rbegin(); iter != coll.rend(); ++iter)
#define lbound(P,R,P... |
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#in... | #include <iostream>
using namespace std;
const int INF = 100000000;
int b[10005][102];
bool judge(int k, int n, int *a){
for(int i = 0; i < k; i++){
for(int j = 0; j <= n; j++){
b[i][j] = a[j] / k;
if(a[j] % k > i) b[i][j]++;
}
}
for(int i = 0; i < k; i++){
... |
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int arr[3];
for(int i=0;i<3;i++) cin>>arr[i];
sort(arr,arr+3);
cout<<arr[2]+arr[1];
return 0;
}
| #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,m,n) for (int i = (m); i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; --i)
#define RREP(i,m,n) for (int i = (n)-1; i >= (m); ++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespac... |
#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 int long long int
#define ld long double
#define pb push_back
#define MOD 10... | #include<bits/stdc++.h>
#define INF 1e9
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
int main(){
int n,m,q;
scanf("%d %d %d",&n,&m,&q);
vector<bool> caja,prod;
vector<pi> a(n),b(m);
for(int i = 0; i < n; i++)
scanf("%d %d",&a[i].second,&a[i].first);
sort(a.begin(), a.end());
for(int i =... |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
vector<int>a(n);
char c;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>c;
if(c=='1'){
a[i]|=1<<j;
}
}
}
int64_t even=0,odd=0;
for(int i=1;i<n;i++){
if(__builtin_popcount(a[0]^a[i])%2==0)... | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll> pql;
typedef set<ll> sl;
typedef pair<ll, ll> pl;
ty... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.