code_file1
stringlengths
87
4k
code_file2
stringlengths
82
4k
// #define LOCAL #define _USE_MATH_DEFINES #include <array> #include <cassert> #include <cstdio> #include <cstring> #include <iostream> #include <iomanip> #include <string> #include <sstream> #include <vector> #include <queue> #include <stack> #include <list> #include <set> #include <map> #include <unordered_set> #incl...
#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;...
#include <bits/stdc++.h> using namespace std; using ll = int64_t; const int MAX = 100010; ll A[110]; int main() { ll R, X, Y; cin >> R >> X >> Y; ll ans = 0; double dis = sqrt(X * X + Y * Y); if(dis < R){ ans = 2; } else{ while(dis > 0){ dis -= R; ...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for(int i = 0; i < (int)(n); ++i) #define FOR(i, a, b) for(int i = (int)(a); i <= (int)(b); ++i) #define FORR(i, a, b) for(int i = (int)(a); i >= (int)(b); --i) #define ALL(c) (c).begin(), (c).end() using ll = long long; using VI = vector<int>; using VL ...
#pragma GCC optimize ("Ofast") #pragma GCC target ("avx2") #include <bits/stdc++.h> using namespace std; using ll = long long; using str = string; using vi = vector<int>; using vl = vector<ll>; using vb = vector<bool>; using vs = vector<str>; using pi = pair<int,int>; using pl = pair<ll,ll>; using vpi = vector<pair<int...
#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> #include <ext/pb_ds/assoc_container.hpp> #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math") #pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") #pragma comment(linker, "/stack:200000000") using namespace std; using namespace __gnu_pbds; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define ff first #define ss second #define all(x) (x).begin(), (x).end() #define len(x) int((x).size()) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #define randint(n) uniform_int_distribution<int>(1, (n))(rng) ll mono[30...
/* Simplicity and Goodness */ #include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> using namespace std; // using namespace __gnu_pbds; // typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; void my_dbg() { cout <...
#include"bits/stdc++.h" using namespace std; using ll=long long; template<class T=long long>inline T in(istream&is=cin){T ret;is>>ret;return ret;} template<class T,class Size=typename vector<T>::size_type>inline auto vector_2d(Size h,Size w,T v){return vector<vector<T>>(h,vector<T>(w,v));} template<class T>auto comp_pa...
#include <bits/stdc++.h> using namespace std; int main(){ vector<string> S(3); for (auto &s: S) cin >> s; string C = ""; for (const auto &s: S) C += s; sort(C.begin(), C.end()); C.erase(unique(C.begin(), C.end()), C.end()); if (C.size() > 10){ puts("UNSOLVABL...
#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(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define PRINT(a) cout << (a) << endl #define pb push_back #define eb emplace_back #define mp make_pair #define ...
/* the vast starry sky, bright for those who chase the light. */ #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; #define mk make_pair const int inf=(int)1e9; const ll INF=(ll)5e18; const int MOD=1e9+7; int _abs(int x){return x<0 ? -x : x;} int add(int x,int y){x+=y; return ...
#include <bits/stdc++.h> using namespace std; using i128 = __int128_t; using u128 = __uint128_t; using u64 = uint64_t; //define #define int long long #define ll int #define trav(i,v) for(auto i: v) #define rep(i,n) for(int i=0;i<n;i++) #define repu(i,k,n) for(int i=k;i<=n;i++) #define repd(i,k,n) for(int i=k;i>...
#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; typedef long long ll; typedef pair<int,int> pii; const int MAXN = 1e6 + 5; bool isnp[MAXN]; int pri[MAXN], pcnt = 0, mu[MAXN]; void sieve(int n) { isnp[0] = isnp[1] = 1; mu[1] = 1; for(int i=2; i<=n; ++i) { if(!isnp[i]) pri[++pcnt] = i, mu[i] = -1; for(int j=1; j<=pc...
#include<bits/stdc++.h> #define PI 3.141592653589793238462 #define eps 1e-10 using namespace std; typedef long long ll; typedef long double db; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<db,db> pdd; int main(){ ll x,y,a,b;cin>>x>>y>>a>>b; ll now=0; while(x<(x+b)/a){ if(x>=y/a) ...
#include<cmath> #include<queue> #include<cstdio> #include<vector> #include<cstring> #include<iostream> #include<algorithm> using namespace std; #define ll long long //#define N int f(int x,int y,int m)// x^y%m { int ans=1; // int n=1; while(y) { if(y&1) { ans=ans*x%m; } x=x*x%m; y=y>>1; } return ans...
#include<bits/stdc++.h> using namespace std; #define mem(a,x) memset(a,x,sizeof(a)); #define ft ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define pi pair<int,int> #define pb push_back #define F first #define S second #define B begin() #define E end() const int N=2e5+...
#include <bits/stdc++.h> #include <unordered_set> #include <algorithm> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vll = vector<ll>; using vs = vector<string>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repll(i,n)...
#include <bits/stdc++.h> using namespace std; using ll=long long; int main(){ int x,y; cin >> x >> y; if(x==y){ cout << x <<endl; return 0; } if(x+y==1) cout << 2 << endl; if(x+y==3) cout << 0 << endl; if(x+y==2) cout << 1 << endl; }
#include <bits/stdc++.h> #include <unordered_set> using namespace std; using Graph = vector<vector<int> >; #define INF 1e9 #define LLINF 1e18 #define PI 3.14159265358979323 #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(),(x).end() typedef long long ll; typedef long double ld; template<...
#include<bits/stdc++.h> using namespace std; using ll = int64_t; using LL = uint64_t; typedef vector<ll>VI; typedef pair<ll,ll>P; #define VV(T) vector<vector<T>> #define sz(x) int(x.size()) #define rep(i, n) for (int i = 0; i < (int)n; i++) #define ALL(a) (a).begin(),(a).end() #define rALL(a) (a).rbegin(),(a).rend() #...
#include<bits/stdc++.h> using namespace std; #define reg register typedef long long ll; inline ll fpow(reg ll x,reg ll exp,reg ll mod){ reg ll res=1; x%=mod; while(exp){ if(exp&1) res=res*x%mod; x=x*x%mod; exp>>=1; } return res; } ll n; int m; int main(void){ scanf("%lld%d",&n,&m); printf("%lld\n",fp...
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(x,y) for(ll i=x;i<y;i++) #define vll vector<ll> #define sll set<ll> #define pb push_back #define in insert #define FAST ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define MOD 1000000007 #define all(x) x.begin(),x.end() #define tc ll t;ci...
#include<bits/stdc++.h> using namespace std; int main() { int a,b; cin>>a>>b; if(a+b>=15&&b>=8) cout<<"1"; else if(a+b>=10&&b>=3) cout<<"2"; else if(a+b>=3) cout<<"3"; else cout<<"4"; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector<ll> vl; typedef pair<ll, ll> PP; #define rep(i, n) for (ll i = 0; i < ll(n); i++) #define all(v) v.begin(), v.end() #define inputv(v, n) \ vl v; \ rep(i, n) \ { \ ll x;...
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<=b;i++) #define per(i,a,b) for(int i=a;i>=b;i--) #define Grep(u) for(int i=head[u];i;i=e[i].nxt) #define clear(a) memset(a,0,sizeof(a)) #define setinf(a) memset(a,0x3f,sizeof(a)) #define setninf(a) memset(a,0xcf,sizeof(a)) #define setneg1(a) memset(a,-1,sizeof(...
/* * Author: Moon-light */ #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define mp make_pair #define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define lowbit(x) ((x)&(-x)) #define sz(x) ((int)x.size()) #define fr(x) freopen(x,'r',stdin) #define fw(x)...
#include<bits/stdc++.h> //#include<ext/pb_ds/assoc_container.hpp> using namespace std; //using namespace __gnu_pbds; #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() #define tr(x, it) for(auto (it) = (x).begin();it != (x).end();it++) #define fo(i, k, n) ...
/* Author: rrrr_wys **/ #include <bits/stdc++.h> #define rep(i, a, b) for (int i = (a); i <= (b); ++i) #define per(i, a, b) for (int i = (a); i >= (b); --i) #define pb push_back #define pii pair<int, int> #define pll pair<ll, ll> #define fi first #define se second typedef double db; typedef long long ll; using namesp...
#include <iostream> #include <vector> #include <utility> #include<algorithm> #include <string> #include <map> #include <cmath> #include <random> #include <tuple> #include <set> #include <queue> #define ll long long #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; struct Edge { long long ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, M; cin >> N >> M; vector<pair<int, int>> P(M); for (int i = 0; i < M; i++) { cin >> P[i].first >> P[i].second; } sort(P.begin(), P.end()); set<int> st; st.insert(N); for (int l = ...
#define rep(i, n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include <bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n>>m; map<pair<int,int>,int> M; rep(i,m){ int x,y; cin>>x>>y; M[{x,y}]=1; } map<int,int> A; map<pair<int,int>,int> ...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; //template #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define ALL(v) (v).begin(),(v).end() using ll=long long int; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12; template<typename T>inline bool ch...
#include <bits/stdc++.h> using namespace std; typedef long long lint; #define rep(i,n) for(lint (i)=0;(i)<(n);(i)++) #define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++) #define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--) #define INF (1ll<<60) #define all(x) (x).begin(),(x).end() const lint MOD =1000000007; //const lint ...
#include <bits/stdc++.h> using namespace std; int main() { int a,b,c; cin>>a; cin>>b; cin>>c; if(a-(2*b)+c == 0){ cout << "Yes" << endl; } else if(a-(2*c)+b == 0){ cout << "Yes" << endl; } else if(a-(2*b)+c == 0){ cout << "Yes" << endl; } else ...
#include<bits/stdc++.h> #define pb push_back #define ppb pop_back #define pf push_front #define ppf pop_front #define all(x) (x).begin(),(x).end() #define sz(x) (int)((x).size()) #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define int long long typedef unsigned long long ull; typedef long double ld...
#include <bits/stdc++.h> #define int long long using namespace std; const int maxn = 2e5+8, inf = 1e18+9, mod = 998244353; int n, m; void solve() { int i, j, ans = 0, pre = 0; map<int, int> mp; mp[pre]++; cin >> n; for (i = 1; i <= n; i++) { int v; cin >> v; if (i & 1) pre -= v; ...
/* problem : algorithm : created : Programmer_juruo */ #include <bits/stdc++.h> using namespace std; #define int long long #define N 2000005 #define M 2005 #define lowbit(x) x & (-x) #define F1(i, n) for(int i = 1; i <= n; i++) #define F(i, a, n) for(int i = a; i <= n; i++) #define F0(i, n) for(int i = 0; i < n; i++)...
#include <bits/stdc++.h> using namespace std; int main() { double ans; double A; double B; cin >> A >> B; ans = A/100 * B; cout << ans << endl; }
#include <bits/stdc++.h> #ifndef ONLINE_JUDGE #define _GLIBCXX_DEBUG #endif using namespace std; #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 Clear(a) a = decltype(a)() #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define v...
/* I love the sound you make when you shut up. */ #include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update using namespace __gnu_pbds; /*-------typedefs------*/ template<class T> using order...
#include<iostream> #include<algorithm> using namespace std; int main(){ int a,b; cin>>a>>b; int c[a]; for(int i=0;i<a;i++){ cin>>c[i]; } for(int i=0;i<a;i++){ if(c[i]!=b){ cout<<c[i]<<' '; } } }
#include<bits/stdc++.h> using namespace std; #define li long long int #define rep(i,to) for(li i=0;i<((li)(to));i++) #define repp(i,start,to) for(li i=(li)(start);i<((li)(to));i++) #define pb push_back #define sz(v) ((li)(v).size()) #define bgn(v) ((v).begin()) #define eend(v) ((...
#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 p(x,y) pair<x,y> #define oset(x) tree<x, null_type, less<x>, rb_tree_tag, tree_order_statistics_node_update> #define all(x) (x).begin(),(x).end() #define ll ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll signed main() { int a,b,c,d,n; cin>>n; if(n%100>0) cout<<n/100+1; else cout<<n/100; return 0; }
#include <iostream> using namespace std; int main() { long lim; long wei; long total=0; cin>>lim; cin>>wei; for(long i=wei;i<=lim;i+=wei){ total++; } cout<<total; return 0; }
#include <iostream> #include <algorithm> using namespace std; int main(void){ // Your code here! long long int a, b, c, d; cin >> a >> b >> c >> d; if(c * d - b == 0){ cout << -1 << endl; } else{ long long int ans = a / (c * d - b); if(ans < 0){ cout << -1 << endl; } ...
#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> using namespace std; using ll = long long; using vec = vector<ll>; using mat = vector<vec>; using pll = pair<ll,ll>; #define INF (1LL << 60) #define MOD 1000000007 #define PI 3.14159265358979323846 #define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i)) #define FORR(i,v) for(auto (i...
#include<bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1e9; int N, Q; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); ll mi = INF, mx = -INF, a = 0; cin >> N; for(int i=0;i<N;++i) { ll x, t; cin >> x >> t; if(t == 1) { mi += x; ...
//include //------------------------------------------ #include <string> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <complex> #include <ss...
#include <bits/stdc++.h> #define X first #define Y second #define pb push_back #define pii pair<int, int> typedef long long ll; using namespace std; const int MOD = 1e9 + 7; const ll INF = 1e18; const int OFF = (1 << 20); int n; int a[600005]; int loga[300005]; int desno[600005]; int lijevo[600005]; void update(int ...
#include<bits/stdc++.h> using namespace std; const int N = 200+5; #define esp 1e-19 #define ll long long #define inf 0x3f3f3f3f int a[N][N],b[N]; struct node { int x,y; }c[N]; int n,m,k; int ret; int vis[N][N]; void DFS(int r) { if(r==k) { int cnt = 0; memset(vis,0,sizeof vis); for(int...
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") typedef long long int ll...
//g++ -std=c++11 -Wall test.cpp -o test -lm -g -O2 #include <bits/stdc++.h> #include <cstdio> #include <iterator> using namespace std; #define sws \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); #define vi vector<int> #define vll vector<lo...
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { int n; cin >> n; vector<int> div; for(int i=2; n > 1; ) { if(n%i == 0) { div.push_back(i); n /= i; continue; } i++; if(i*i > n) i = n; } se...
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,abm,mmx,avx,avx2,fma,tune=native") #include <bits/stdc++.h> using namespace std ; #define int int64_t //be careful about this #define endl "\n" #define f(i,a,b) for(int i=int(a);i<int...
#include <bits/stdc++.h> using namespace std; const int inf = 1 << 29; const int N = 1100; vector<int> edge[N][26]; vector<int> edge2[N * N]; int dist[N * N]; void bfs(int s) { queue<int> q; fill(dist, dist + N * N, inf); q.push(s); dist[s] = 0; while (q.size()) { int v = q.front(); ...
#include <iostream> #include <numeric> #include <unordered_map> #include <vector> using namespace std; #define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++) #define REP(i, n) FOR(i,0,n) // UnionFind Tree (0-indexed), based on size of each disjoint set struct UnionFind { std::vector<int> par; ...
#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 rep(i, n) for (int i = 0; i < (int)(n); i++) typedef long long ll; typedef pair<int, int> pii; struct Edge{ int to; ll weight; ll bias; Edge(int to, ll weight, ll bias):to(to), weight(weight), bias(bias){} }; using Graph = vector<vector<Edge>>; cons...
#include <bits/stdc++.h> #define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++) #define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--) #define pb push_back #define mp make_pair #define pll pair<ll,ll> #define endl "\n" using ll=long long; using ld=long double; using namespace std; ll mod= 1e9+7; ll GCD(ll a, ll b) { return b ? GCD(b...
#include <iostream> #include <string> #include <vector> #include <queue> #include <stack> #include <set> #include <cctype> #include <cmath> #include<deque> #include<map> #include<algorithm> #include<iomanip> using namespace std; #define rep(i,n) for(int i = 0; i < n; i++) #define rep1(i,begin,end) for(int i = begin; ...
//高知能系Vtuberの高井茅乃です。 //Twitter: https://twitter.com/takaichino //YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw #include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF INT_MAX #define LLINF LLONG_MAX #define REP(i,n) for(int i=0;i<n;i++) #define REP1(i,n) for(int i=1;i<=n;i+...
#include<iostream> #include<cstdio> using namespace std; #define int long long bool vis[101]; int c[101]; signed main() { int t,n;scanf("%lld%lld",&t,&n); for(int i=1;i<=100;i++)vis[(t+100)*i/100]=1; int cnt=0,r=100+t; for(int i=1;i<=100+t;i++)if(!vis[i])c[++cnt]=i; // for(int i=1;i<=cnt;i++)printf("%lld ",c[i]); /...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { double t,N; cin >>t>>N; // cout << "------------" << endl; //double ans = (((100+t)*N+1)/t-1); double ans = (N*100/t)*((100+t)/100); cout << std::fixed << std::setprecision(0) << ceil(((100+t)*N)/t-1) << endl; }
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <utility> #include <queue> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ldouble; const int LEN = 100000; struct fastio { int it, len; char s[LEN + 5]; fastio()...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define rep(i, n) rep2(i, 0, n) #define ...
#include <iostream> #include <algorithm> #include <vector> #include <string> typedef long long ll; int n, m, a[200005], b[200005]; int main() { std::cin >> n >> m; int w = 2100000000; for (int i = 1; i <= m; ++i) { std::cin >> a[i]; } std::sort(a, a + m + 1); a[m + 1] = n + 1; for (int i = 1; i <= m + 1; ++i) ...
#include<cstdio> #include<algorithm> int a[200000]; using namespace std; int main(void) { long long ans=0,x=0; int n,i; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&a[i]); sort(a,a+n); for(i=n-1;i>=1;i--){ ans+=x; x+=(long long)(a[i]-a[i-1])*(n-i); ans+=(long long)(a[i]-a[i-1])*(n-i); ...
/** * author: otera **/ #include<bits/stdc++.h> using namespace std; #define int long long typedef long long ll; typedef long double ld; const int inf=1e9+7; const ll INF=1LL<<60; #define rep(i, n) for(int i = 0; i < n; ++ i) #define per(i,n) for(int i=n-1;i>=0;i--) #define Rep(i,sta,n) for(int i=sta;i<n;i++)...
#include <bits/stdc++.h> using namespace std; 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(a > b) { a = b; return 1; } return 0; } #define DEBUG #ifdef DEBUG templ...
#include <iostream> #include <algorithm> #include <string.h> #include <vector> using namespace std; typedef long long ll; const int N=1e5+10; ll n; ll a[N],b[N]; ll res,sum; vector<int> v[2]; int main() { cin>>n; for(int i=1;i<=n;i++) cin>>a[i],sum+=a[i]; for(int i=1;i<=n;i++){ cin>>b[i]; b[i]=b[i]-a[i]; if(i%...
#include <bits/stdc++.h> #define rep(i, x, y) for (int i = x; i <= y; i++) using namespace std; typedef long long ll; const int N = 1e5 + 10; ll tot = 0; int n, a[N], b[N]; priority_queue<int> q[2]; int main() { cin >> n; rep(i, 1, n) scanf("%d", &a[i]), tot += a[i]; rep(i, 1, n) scanf("%d", &b[i]), q[i &...
#include <bits/stdc++.h> using namespace std; inline int re() { char c = getchar(); int x = 0, k = 1; while (c < '0' || c > '9') { if (c == '-') k = -1; c = getchar(); } while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + c - '0', c = getchar(); return ...
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T> using vec = vector<T>; template <class T> using vvec = vector<vec<T>>; template<class T> bool chmin(T& a,T b){if(a>b) {a = b; return true;} return false;} template<class T> bool chmax(T& a,T b){if(a<b) {a = b; return true;} return fa...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<ll,ll>; ll solve() { ll N; cin >> N; vector<ll> A(N), B(N), P(N); for ( int i = 0; i < N; i++ ) cin >> A[i]; for ( int i = 0; i < N; i++ ) cin >> B[i]; for ( int i = 0; i < N; i++ ) { cin >> P[i]; ...
#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 empla...
//Bismillahir Rahmanir Raheem #include<bits/stdc++.h> using namespace std; typedef pair<int,int>pii; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; #define sf(x) scanf("%d",&x) #define sfl(x) scanf("%...
#include <bits/stdc++.h> using namespace std; #define FOR(i,n1,n2) for(int i=(int)(n1); i<(int)(n2); ++i) #define REP(i,n) for(int i=0 ; i<(int)(n) ; ++i) using llint = long long int; const double EPS = 1e-9; // debug #ifdef _DEBUG #define _GLIBCXX_DEBUG #define DEBUG(x) cout << '(' << __LINE__ << ") " << #x...
#include <bits/stdc++.h> #define mem(arr, val) memset(arr, val, sizeof(arr)) #define all(v) v.begin(), v.end() #define endl '\n' #define decision (yes ? "YES" : "NO") using namespace std; // const double PI = acos(-1.0); // const double E = exp(1.0); const double EPS = 1e-9; const int INF = (int)2e9; const int MOD = (i...
// clang-format off /* #pragma GCC optimize("Ofast") */ /* #pragma GCC optimize("unroll-loops") */ #pragma GCC diagnostic ignored "-Wregister" #include <bits/stdc++.h> using namespace std; #define int ll typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vector<int>> vvi; type...
#include<bits/stdc++.h> using namespace std; #define ll long long #define fo(i,n) for(ll i=0;i<n;i++) #define foi(i,n) for(int i=0;i<n;i++) #define Fo(i,k,n) for(ll i=k;k<n?i<n:i>n;k<n?i+=1:i-=1) #define Foi(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1) #define pb push_back #define F first #define S second #define all...
#include<bits/stdc++.h> #define maxn 500010 using namespace std; int read() { int s=0,w=1; char ch=getchar(); while(ch<'0'||ch>'9') {if(ch=='-') w=-1;ch=getchar();} while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48),ch=getchar(); return s*w; } signed main() { int n=read(),m=read(),C=read(); if(C&1) { if(n>=m) co...
//khodaya khodet komak kon # include <bits/stdc++.h> /* // ordered_set # include <ext/pb_ds/assoc_container.hpp> # include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; # define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> */ using namespace std; typedef long ...
// #define _GLIBCXX_DEBUG #include <bits/stdc++.h> // #include<atcoder/all> using namespace std; // using namespace atcoder; using ll=long long; template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;} template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}retu...
#include<iostream> #include<vector> #include<algorithm> #include<string> #include<queue> #include<cmath> #include<cstdio> #include<tuple> #include<bitset> #include<map> using namespace std; #define rep(i,n) for(int i=0;i<n;++i) #define rep1(i,n) for(int i=1;i<=n;++i) #define ALL(x) x.begin(),x.end() #define ll long lo...
#pragma GCC target ("avx2") #pragma GCC optimize ("unroll-loops") #pragma GCC optimize ("O3") #include "bits/stdc++.h" #include <unordered_set> #include <unordered_map> #include <random> using namespace std; typedef long long ll; typedef unsigned long long ull; constexpr ll MOD = 1'000'000'007LL; /*998'244'353LL;*/ #de...
/*** author: yuji9511 ***/ #include <bits/stdc++.h> // #include <atcoder/all> // using namespace atcoder; using namespace std; using ll = long long; using lpair = pair<ll, 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);i>=(n);i--) #define prin...
#include <bits/stdc++.h> using namespace std; #define int long long #define yes cout << "YES\n" #define no cout << "NO\n" #define pb push_back() #define ff first #define ss second #define MOD 1000000007 int32_t main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ...
#include <bits/stdc++.h> using namespace std; #define ALL(x) (x).begin(),(x).end() #define COUT(x) cout<<(x)<<"\n" #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define REP(i,n) for(int i=0;i<n;i++) #define YES(x) cout<<(x?"YES":"NO")<<"\n" #define Yes(x) cout<<(x?"Yes":"No")<<"\n" #define dump(x) cout<...
#include<bits//stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define req(i,n) for(int i = 1;i <= n; i++) #define rrep(i,n) for(ll i = n-1;i >= 0;i--) #define ALL(obj) begin(obj), end(obj) #define RALL(a) rbegin(a),rend(a) typedef long long ll; typedef long do...
#pragma GCC optimize "trapv" #include<iostream> #include <bits/stdc++.h> using namespace std; #define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define ll long long #define ull unsigned long long #define ui unsigned int #define vi vector<int> #define vll vector<ll> #define pb push_back #define l...
#pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx,avx2,sse,sse2,sse3,sse4") #include <bits/stdc++.h> using namespace std; #define endl '\n' typedef long long ll; const ll INF=1e18+7; const int MAXN=1e6+7; //struct EDGE {int n,next;} edge[MAXN<<1]; int n,x; ...
#include <bits/stdc++.h> #include <math.h> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (int)(n); i ++) vector <int> dy = {0, 1, 0, -1}; vector <int> dx = {1, 0, -1, 0}; const int INF = 1000000000; const ll INFLL = 100000000000000000; int main(){ int n; cin >> n; vector <in...
#include <bits/stdc++.h> #define rep(i,n) for (int i=0; i<n; i++) #define rng(i,l,r) for (int i=l; i<r; i++) #define V(t) vector<t> #define VV(t) V(vector<t>) #define ALL(x) begin(x), end(x) using namespace std; using ll = long long; using P = pair<int,int>; const int INF = 1 << 30; const ll LINF = 1LL << 60; template<...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define Test(x) {static int testInt=1000;if((testInt--)>0) cout<<x<<"\t";} #define BIGint 1000000007 #define FASTio ios::sync_with_stdio(false);cin.tie(NULL); /****************************************************/ int ...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; //template #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define ALL(v) (v).begin(),(v).end() using ll=long long int; const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12; template<typename T>inline bool ch...
#include <iostream> #include<vector> #include<algorithm> #include<string> #include<map> #include<set> #include<stack> #include<queue> #include<math.h> using namespace std; typedef long long ll; #define int long long #define double long double typedef vector<int> VI; typedef pair<int, int> pii; typedef vector<pii> VP; t...
#include <bits/stdc++.h> #define f first #define s second using namespace std; typedef long long ll; const int maxk = 10 + 1; const int maxn = 2e5 + 17; int N; string S, X; int DP[maxk][maxn]; bool solve(int i, int rem) { int &ret = DP[rem][i]; if (ret != -1) return ret; if (i == N) return ret = !re...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FOR(var, begin, end) for (int var = (begin); var <= (end); var++) #define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--) #define REP(var, length) FOR(var, 0, length - 1) #define RREP(var, length) RFOR(var, length - 1, 0) #de...
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int t; long long N; cin >> t >> N; set<int> S; for (int i = 1; i <= 100; i++) { S.emplace(((100 + t) * i) / 100); } int M = 100 + t; vector<int> V; for (int i = 1; i <= ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n,m,cnt,MOD=1000000007,ans=1,bik[200001],dp[1001][2]; char AA,AB,BA,BB; map<ll,ll> mp; ll f(ll x,ll y){ if(y==0)return 1; if(y%2==0)return f(x,y/2)*f(x,y/2)%MOD; return x*f(x,y-1)%MOD; } ll comb(ll x,ll y){ return bik[x]*f(bik[x-y],M...
#include<bits/stdc++.h> #include<iostream> #include<string> #include<cmath> #include<cstdio> #include<cctype> #include<cstring> #include<iomanip> #include<cstdlib> #include<ctime> #include<set> #include<map> #include<utility> #include<queue> #include<vector> #include<stack> #include<sstream> #include<algorithm> #define...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #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 all(a) (a).begin(),(a).end() #define bit(k) (1LL<<(k)) #define SUM(v) accumulate(all(v), 0LL) typedef pair<int, int> i_i; typedef pair<ll, ll> l_l; template...
#include <bits/stdc++.h> #define Mashu cout << "UUZ ate it." << endl #define RE register int #define ll long long using namespace std; inline int read(){ char ch=getchar(); int x=0,cf=1; while(ch<'0'||ch>'9') { if(ch=='-') cf=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { x=(x<<3)+(x<<1)+(ch^48); ch=getcha...
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (int)(n); i++) #define REP(i,n) for (int i = 1; i < (int)(n); i++) #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define debug(var) do{cout << #var << " : "; view(var);}while(0) template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;ret...
#include <bits/stdc++.h> #define ff first #define ss second #define endl '\n' using namespace std; const long long INF = (long long) 1e18; const int mod = (int) 1e9+7; const int MAXN = (int) 3e5+5; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; typedef pair<ll,ll> pll; ll n; int a[MAX...
/* May the force be with you */ #include<bits/stdc++.h> using namespace std; #define ll long long #define vi vector<int> #define vl vector<ll> #define pb push_back #define FASTANDFURIOUS ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); #define rep(i,a,b) for(ll i=a;i<b;i++) #define For(i,n) for(ll i=0;i<n...
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin>>n; int a[n+1],b[n+1],c[n+1]; for(int i=1;i<=n;i++) { cin>>a[i]; } for(int i=1;i<=n;i++) { cin>>b[i]; } for(int i=1;i<=n;i++) { cin>>c...
#include <bits/stdc++.h> using namespace std; int main() { int64_t n,x; cin >> n >> x; string s; cin >> s; for(char c : s){ if(c=='o')x++; if(c=='x'&&x>0)x--; } cout<<x<<"\n"; }
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> #define pb push_back #define mpr make_pair #define pii pair<int, int> #define ll long long #define dl long double #define all(arr) arr.begin(), arr.end() #define fi first #define se second #define rep(i, n) for (int i = 0; i < (int)(n); i++) #de...
#include<bits/stdc++.h> #define ll long long #define ff first #define ss second #define pb push_back using namespace std; const int N = 1e6; ll a,b,c; ll binpow(ll a,ll b){ ll res = 1; while(b){ if(b & 1){ res *= a; res %= 4; } a *= a; a %= 4; b >>...
# include <bits/stdc++.h> using namespace std; #define ll long long #define int ll #define pb push_back #define ppb pop_back #define eb emplace_back #define endl '\n' #define max(a,b) ((a)>(b)?(a):(b)) #define min(a,b) ((a)<(b)?(a):(b)) #define vi vector<int> #define...
#include<bits/stdc++.h> //#include <atcoder/all> #define rep(i,n)for(int i=0;(i)<(int)(n);i++) #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++) #define ALL(a) (a).begin(),(a).end() #define pb push_back #define fi first #define se second #define sz(x) ((int)x.size()) using namespace std; //using namespace atc...
#include<bits/stdc++.h> #define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i) #define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i) #define foreach(i, n) for(auto &i:(n)) #define all(x) (x).begin(),...
#include<iostream> #include<string> #include<cstring> #include<cstdio> #include<stack> using namespace std; const int N = 2e5+10; int main(){ /*freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout);*/ char str[N]; char ans[N]; int n; cin>>n>>str; int res = 0; for(int i = 0,j = 0...
#include <iostream> #include <cmath> #include <iomanip> #include <vector> #include <stack> #include <queue> #include <list> #include <map> #include <set> #include <bitset> #include <string> #include <algorithm> #include <iterator> #include <unordered_map> #include <unordered_set> #include <sstream> #include <fstream> #...
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll ans=0,n; map<ll,ll>cnt; scanf("%lld",&n); for(ll i=1;i<=n;i++){ ll x; scanf("%lld",&x); cnt[x]++; if(i==1)continue; ans+=i-cnt[x]; } printf("%lld\n",ans); return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define vi vector<ll> #define mod 1000000007 #define pb push_back #define vs vector<string> #define pii pair<ll,ll> #define unm unordered_map #define mp make_pair #define pq_max priority_queue ll; #define pq_min priority_queue<ll,vi,greater<ll> > #de...
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") using namespace std; using std::cout; using std::cin; using std::endl; using ll=long long; using ld=long double; ll I=1167167167167167167; ll Q=1e9+7; #define rep(i,a) for (ll i=0;i<a;i++) template<class T> using _pq = priority_queue<T, vector<T>, greater<T>>; temp...
#include<iostream> #include<string> #include<algorithm> #include<cmath> #include<utility> #include<bitset> #include<vector> #include<iomanip> #include<map> #include<set> #include<queue> using namespace std; #define ll long long #define ssort(v) sort(v.begin(), v.end()) #define ssortr(v) ...
#include<bits/stdc++.h> using namespace std; int n; int main(){ cin>>n; float k = n; float actual = 1.08*k; int actuals = floor(actual); if(actuals>206){ cout<<":("<<endl; }else if(actuals == 206){ cout<<"so-so"<<endl; }else{ cout<<"Yay!"<<endl; } return 0; }
#pragma GCC optimize(2) #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll>PLL; typedef pair<int, int>PII; typedef pair<double, double>PDD; #define I_int ll inline ll read() { ll x = 0, f = 1; char ch = getchar(); while(ch < '0' || ch > '9'...
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); ios_base::sync_with_stdio(false); int n; cin >> n; vector<long long> a0(n/2); vector<long long> a1(n/2); vector<long long> b0(n/2); vector<long long> b1(n/2); for (int i = 0; i < n/2; i++) { cin >> a0[i...
#include <iostream> #include <vector> #include <queue> #include <algorithm> #include <map> #include <set> #include <unistd.h> #include <stdlib.h> #include <cassert> using namespace std; // using namespace atcoder; // using mint = long double; // using mint = modint998244353; // using mint = modint1000000007; typedef...
#include <bits/stdc++.h> /// TONI BO$$ was here /// #MLC using namespace std; long long v[100]; vector <int> supl; vector <int> op; int main() { int i, s, k, ct; long long n; scanf("%lld", &n); v[0] = v[1] = 1; for(i = 2; i <= 100; i++) v[i] = v[i - 1] + v[i - 2]; for(i = 1; v[i] <= n; ...
#include <bits/stdc++.h> #define repd(i, a, b) for (ll i = (a); i < (b); i++) #define repb(i, n) for (ll i = (n)-1; i >= 0; i--) #define rep(i, n) repd(i, 0, n) using namespace std; using ll = long long; using ul = unsigned long long; using ld = long double; const ul mod = 1000000007; int main() { ios_base::syn...
#include <iostream> #include<cmath> #include<vector> #include<set> #include <algorithm> #include<map> #include<string> #include <chrono> using namespace std;typedef long long ll; #define rep(i,n) for(i=0;i<n;i++) #define pb push_back #define INF32 2147483647 //2.147483647×10^{9}:32bit整数のinf #define INF64 92233720368547...
#include<bits/stdc++.h> using namespace std; int main() { long long n,i,j,max1=0,max2=0,l=-1,r=-1; cin>>n; long a[n],b[n]; for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<n;i++) cin>>b[i]; for(i=0;i<n;i++) { if(max2>r) r=max2; if(a[i]>max1) { l=i; max1=a[i]; } ...
#include<bits/stdc++.h> using namespace std; int main(void) { char S, T; cin >> S >> T; if (S == 'Y') { cout << (char) (T - 32) << endl; } else { cout << T << endl; } }
#include<bits/stdc++.h> using namespace std; #define ll long long #define rep(i,a,n) for(ll i=a;i<n;i++) #define rev(i,n,a) for(ll i=n-1;i>=a;i--) #define f first #define s second #define vll vector<ll> #define vvll vector<vector<ll>> #define vpii vector<pair<int,int>> #define vpll vector<pll> #define pll pair<ll,ll> ...
#include <iostream> using namespace std; char c[4]; typedef long long ll; ll mod = 1000000007; ll pw(ll a, ll x){ if(x<0) return 1; ll ret = 1; while(x){ if(x&1) (ret *= a) %= mod; (a *= a) %= mod; x /= 2; } return ret; } ll dp1[2010][2],dp2[2010][2]; void solve(){ dp1[0][0] = ...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #define FOR(i, a, b) for(ll i = a; i < b; i++) #define rep(i, n) FOR(i, 0, n) #define rFOR(i, a, b) for(ll i = a - 1; i >= b; i--) #define rrep(i, a) rFOR(i, a, 0) #define pb push_back using namespace std; using ll = long long; using ld = long double; typedef pair<ll,ll...
//g++ 7.4.0 #include <iostream> #include <bits/stdc++.h> using namespace std; typedef long long ll; #define MAXN 100005 ll C[MAXN]; ll D[MAXN]; vector<pair<ll,ll>> adj[MAXN]; ll dis[MAXN]; ll getDis(ll t, ll c, ll d) { return(t + c + d/(t + 1LL)); } void dijkstra(ll source) { set<pair<ll,ll>> s; s.inser...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define pb push_back #define nl cout<<"\n" #define all(x) x.begin(),x.end() template<class C> void min_self( C &a, C b ){ a = min(a,b); } template<class C> void max_self( C &a, C b...
#include <bits/stdc++.h> #include <ext/pb_ds/hash_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; typedef long long LL; typedef unsigned long long uLL; LL z = 1; int ksm(int a, int b, int p){ int s = 1; while(b){ if(b & 1) s = z * s * a % p; a = z * a * a % ...
/* Stay motivated and keep working hard */ #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 #define pb push_back #define cntbit __builtin_popcount #define fr first #define mem(arr, val) m...
#include <bits/stdc++.h> #define int long long #define menhera_chan_is_mine ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define pb push_back #define pi pair<int, int> #define BE(i) i.begin(),i.end() #define fi first #define se second #define INF 2147483647 #define mkp make_pair #define ist insert #define mod 10...
#include<iostream> #include<climits> #include<bits/stdc++.h> using namespace std; #define LL long long int #define mod 998244353 LL r(vector<LL> &kabza,vector<LL> &nonKabza,LL i,LL j,vector<vector<LL> > &dp){ if( i>=kabza.size() ){ return 0; } if (j>=nonKabza.size()){ return INT_MAX; } ...
#include<iostream> #include<cstring> #include<vector> using namespace std; const int N = 1500005; int n, m, a[N], cnt[N], ans[N]; int main() { scanf("%d%d", &n, &m); for(int i = 1; i <= m; ++i) { scanf("%d", &a[i]); ++cnt[a[i]]; } int l = -1; while(cnt[++l]); ans[l] = true; for(int i = m + 1; i <= n; ++...
#include <bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(false); cin.tie(0); #define FOR(i,s,n) for(int i = (s); i < (n); i++) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) for(int i = (n); i >= 0; i--) #define ALL(n) (n).begin(), (n).end() #define RALL(n) (n).rbegin(), (n).rend() #define ATYN(n) ...
/* { ###################### # Author # # Gary # # 2021 # ###################### */ #include<bits/stdc++.h> #define rb(a,b,c) for(int a=b;a<=c;++a) #define rl(a,b,c) for(int a=b;a>=c;--a) #define LL long long #define IT iterator #define PB push_back #define II(a,b) make_pair(a,b) ...
#include<bits/stdc++.h> using namespace std; typedef long long int ll; const int maxn = 2e5+5; #define mod 1000000009 void solve(){ int n,m; cin >> n>> m; vector<int> a(m); for(int i=0;i<m;i++){ cin >> a[i]; } if( m==0){ cout << 1 << endl; return; } sort(a.begin(),a.end()); vector...
//红太阳zhouakngyang txdy! #include<bits/stdc++.h> using namespace std; #define int long long inline int read() { int sum=0,nega=1;char ch=getchar(); while(ch>'9'||ch<'0'){if(ch=='-')nega=-1;ch=getchar();} while(ch<='9'&&ch>='0')sum=sum*10+ch-'0',ch=getchar(); return sum*nega; } const int N=5009,mod=998244353; int n,m...
#include<bits/stdc++.h> using namespace std; using ll = long long; constexpr int Inf = 2000000030; constexpr long long INF= 2000000000000000000; template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b;...
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <utility> #include <cmath> #include <vector> #include <stack> #include <queue> #include <deque> #include <set> #include <unordered_set> #include <map> #include <tuple> #include <numeric> #include <functional> using namespace std; type...
#include <bits/stdc++.h> //#include <atcoder/string> //using namespace atcoder; //#pragma GCC optimize("Ofast") using namespace std; #define reps(i,s,n) for(int i = s; i < n; i++) #define rep(i,n) reps(i,0,n) #define Rreps(i,n,e) for(int i = n - 1; i >= e; --i) #define Rrep(i,n) Rreps(i,n,0) #define ALL(a) a.begin(), a...
#include<bits/stdc++.h> using namespace std; #define ll long long const int maxn = 4e5 + 5; int n; int a[maxn]; int main() { scanf("%d",&n); for(int i=1;i<=2*n;i++) scanf("%d",&a[i]); priority_queue<int> heap; ll sum = 0, aoki = 0; for(int i=1;i<=n;i++) { heap.push(-a[n-i+1]); heap.push(-a[n+i]); sum += ...
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) (x).begin(),(x).end() template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;} template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;} int dx[4]={0,1,0,-1}, dy[4]={1,0,...
#include <bits/stdc++.h> using namespace std; //-(smallstar))---- :] #define int long long #define ll long long #define mp make_pair #define vi vector<ll> #define pb push_back #define all(o) (o).begin(), (o).end() #define rall(o) (o).rbegin(), (o).rend() #define nl cout << "\n" //debug start #define debug(a) \...
//created by pyoxiao on 2021/05/08 #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mp make_pair #define pb push_back #define CL(a, b) memset(a, b, sizeof(a)) using namespace std; const int mod = 1e9 + 7; LL fpow(LL a, LL b, LL p = mod){LL ans = 1; a %= p; while(b) {if(b & 1) ans ...
#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <functional> #include<bits/stdc++.h> using namespace std; using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #define pf ...
#include "bits/stdc++.h" //#include "atcoder/all" using namespace std; //using namespace atcoder; //using mint = modint1000000007; //const int mod = 1000000007; //using mint = modint998244353; //const int mod = 998244353; //const int INF = 1e9; const long long LINF = 1e18; //const bool debug = false; #define rep(i, n) ...
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); ++i) using namespace std; template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } using ll = long long; usi...
#include<bits/stdc++.h> using namespace std; int main(){ int x; cin >> x; if(x<0) cout << 0 << endl; else cout << x << endl; return 0; }
#include <bits/stdc++.h> #define ll long long int #define pb push_back #define umap unordered_map #define mod 1000000007 #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define MN(a,b,c) min(a,min(b,c)) #define MX(a,b,c) max(a,max(b,c)) #define pr1 ...
#include<bits/stdc++.h> #include<vector> #include<map> #include<set> #include<list> using namespace std; #define ll signed long long #define D double #define LD long double #define ff first #define ss second #define PII pair<int, int> #define PLL pair<ll,ll> #define SPLL pair<sll, sll> #define pb(x) push_back(x) #defi...
#include <bits/stdc++.h> #define ll long long #define pb push_back #define f(i, b) for (int i = 0; i < b; i++) #define fr(i, a, b) for (int i = a; i >= b; i--) #define vt vector #define all(v) v.begin(), v.end() const ll M = 998244353; using namespace std; ll num(string t) { ll r = 0; for (ll i = 0; i < t.lengt...
#include <bits/stdc++.h> #include <math.h> using namespace std; int main() { unsigned long long N ; unsigned long long ans=0; unsigned long long V[100]; int i=1; cin>>N; unsigned long long M=N; while(M>0){ V[i]=M%10; M=M/10; i++; } if(0<N && N<11){ ans=ans; } else if(11<=N && ...
// Problem: C - Tricolor Pyramid // Contest: AtCoder - AtCoder Regular Contest 117 // URL: https://atcoder.jp/contests/arc117/tasks/arc117_c // Memory Limit: 1024 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) #include <stdio.h> #include <string.h> #include <algorithm> #include <queue> //...
#pragma GCC optimize ("Ofast") #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; struct _ { ios_base::Init i; _() { cin.sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(10); } } ___; #define trace(....
#include<iostream> #include<cstdio> #include<algorithm> namespace do_while_true { #define ld double #define ll long long #define re register #define pb push_back #define fir first #define sec second #define pp std::pair #define mp std::make_pair const ll mod = 998244353; template <typename T> inline T Max(T ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define print(a) \ for (auto x : a) \ cout << x << " "; \ cout << endl #define print_upto(a, n) \ for (ll i = 1; i <= n; i++) \ cout << a[i] << " "; \ cout << endl #define take(a, n) ...
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; int q[50][50];int u[50][50];int v[2501];vector<int> s;vector<int> ms;int mt=-1;int tt=0; time_point<high_resolution_clock> start; #pragma GCC optimize("O2") char h(int c){ if(c==0)return 'D'; if(c==1)return 'R'; if(c==2)return 'U'; return 'L...
#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 <bitset> #inc...
#include <bits/stdc++.h> #define int long long #define Mid ((l + r) >> 1) #define lson (rt << 1) #define rson (rt << 1 | 1) using namespace std; int read(){ char c; int num, f = 1; while(c = getchar(),!isdigit(c)) if(c == '-') f = -1; num = c - '0'; while(c = getchar(), isdigit(c)) num = num * 10 + c - '0'; return ...
#include<cstdio> #include<set> #define fo(x,a,b) for(int x=(a),e_=(b);x<=e_;x++) #define fd(x,a,b) for(int x=(a),e_=(b);x>=e_;x--) #define fi first #define se second #define mp make_pair #define ww printf using namespace std; typedef long long ll; set<pair<int,int>> s; int n; int main(){ int u,v; scanf("%d",&n); f...
//#pragma GCC optimize("O3") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define FIO ios_base::sync_with_stdio(false); cin.tie(0); #define trav(x,a) for (auto& x: a) #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() #define mem(a,v) memset((a)...
#include<bits/stdc++.h> using namespace std; const int N = 100; typedef long long ll; int a[N], n, isnot[N]; vector<int>G[N]; int vis[N]; int b[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 }; ll ans = LLONG_MAX; void dfs(int p, ll sum) { if (p >= 15) { for (int i = 1; i <= n; i++) { ...
#include <iostream> #include <algorithm> #include <map> #include <set> #include <queue> #include <bitset> #include <climits> #include <string> #include <cmath> #include <bitset> #include <complex> #include <functional> #include <ctime> #include <cassert> #include <fstream> #include <stack> #include <random> #include <i...
#include <cstdio> #include <cctype> #define rr register using namespace std; const int N=100011,mod=1000000007; int dp[N][2],f[N][2],n; inline signed iut(){ rr int ans=0; rr char c=getchar(); while (!isdigit(c)) c=getchar(); while (isdigit(c)) ans=(ans<<3)+(ans<<1)+(c^48),c=getchar(); return ans; } inline void prin...
#include <bits/stdc++.h> using namespace std; template<class T> void ckmin(T &a, T b) { a = min(a, b); } template<class T> void ckmax(T &a, T b) { a = max(a, b); } #define pb push_back #define mp make_pair #define cotu cout #define itn int #define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #def...
#include<bits/stdc++.h> using namespace std; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/detail/standard_policies.hpp> // using namespace __gnu_pbds; #pragma GCC optimize("O3") #ifdef LOCAL #include "/Users/lbjlc/Desktop/coding/debug_utils.h" #else #define print(...) ; #define printn(...) ; #de...
#include <bits/stdc++.h> //#include <chrono> //#pragma GCC optimize("O3") using namespace std; #define reps(i,s,n) for(int i = s; i < n; i++) #define rep(i,n) reps(i,0,n) #define Rreps(i,n,e) for(int i = n - 1; i >= e; --i) #define Rrep(i,n) Rreps(i,n,0) #define ALL(a) a.begin(), a.end() using ll = long long; using ve...
#include<bits/stdc++.h> #include<stdio.h> using namespace std; #define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define MAX 100050 #define ll long long #define ld long double #define lli long long int #define pb push_back #define INF 100000000000000 #define mod 998244353 // trignometric funct...
#include <stdio.h> #include <stdint.h> #include <inttypes.h> int main() { int64_t n; scanf("%" SCNd64, &n); int cnt[3] = { 0 }; while (n) { cnt[n % 10 % 3]++; n /= 10; } int cur = (cnt[1] + 2 * cnt[2]) % 3; int k = cnt[0] + cnt[1] + cnt[2]; int res; if (!cur) res = 0; else if (cur == 1) { if (cnt[1])...
#include <bits/stdc++.h> // #include <atcoder/all> #include <cmath> using namespace std; using ll = long long; using Graph = vector<vector<int>>; const ll INFI = 1001001001; const ll INFL = 1001001001001001001; const ll MOD = (int)1e9 + 7; const double EPS = 1e-9; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, ...
#include <bits/stdc++.h> using namespace std; using LL = long long; using ULL = unsigned long long; using VI = vector<int>; using VL = vector<LL>; using PII = pair<int, int>; using PLL = pair<LL, LL>; #define SZ(a) (int)a.size() #define ALL(a) a.begin(), a.end() #define MP make_pair #define PB push_back #define EB emp...
#include <bits/stdc++.h> #define M_PI 3.14159265358979323846 /* pi */ using namespace std; using ll = long long; int main() { ll mod = 998244353; ll A, B, C; cin >> A >> B >> C; ll a = (((A % mod) * (A % mod + 1)) / 2) % mod; ll b = (((B % mod) * (B % mod + 1)) / 2) % mod; ll c = (((C % mod) * (C % ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define REP(i, n) for(int i=0; i<n; i++) #define REPi(i, a, b) for(int i=int(a); i<int(b); i++) #define MEMS(a,b) memset(a,b,sizeof(a)) #define mp make_pair #define MOD(a, m) ((a % m + m) % m) template<class T>bool chm...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #ifndef aa #define trace(...) #define endl '\n' #endif #define pb push_back #define u...
#include<bits/stdc++.h> int main(){ using namespace std; unsigned long N; cin >> N; vector<bitset<100>> edge(N); for(unsigned long i{0}; i < N; ++i){ string S; cin >> S; for(unsigned long j{0}; j < N; ++j)edge[j][i] = (S[j] == '1'); edge[i][i] = true; } for(u...
#include<bits/stdc++.h> using namespace std; const int N=101; int n,g[N][N],C[N][N],vis[N],to[N]; char s[N][N]; void dfs(int x) { if(vis[x]) return; vis[x]=1; for(int i=1;i<=n;i++) if(g[x][i]) dfs(i); } int main() { scanf("%d",&n); for(int i=1;i<=n;i++) scanf...
#include<bits/stdc++.h> using namespace std; #define lli long long int #define pb push_back #define mp make_pair #define pll pair<lli,lli> int main(){ int n, s, d; cin >> n >> s >> d; while(n--){ int x, y; cin >> x >> y; if(x < s && y > d){ cout << "Yes" ; return 0; } } cout << "No"; return 0; }
#include<bits/stdc++.h> #include <iostream> //#include <boost/math/common_factor.hpp> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<ll> vl; typedef vector<pair<int, int> > vpii; typedef vector<pair<ll, ll> > vpll; #define all(x) x.begin(), x.end() #define reg(i,x) for(ll i=0;i<x;i++...
//#include <atcoder/all> #include <bits/stdc++.h> //using namespace atcoder; using namespace std; typedef long long ll; #define MOD (long long)(1e9+7) #define INF (1LL<<60) #define rep(i,n) for(ll i = 0; i < (n); i++) #define rep1(i,n) for(ll i = 1; i <= (n); i++) template<class T> inline bool chmin(T& a, T b) { if...
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { int n; cin >> n; cout << (n + 99) / 100 << endl; return 0; }
#include <math.h> #include <time.h> #include <ctype.h> #include <stdio.h> #include <assert.h> #include <stdlib.h> #include <string.h> #include <map> #include <set> #include <deque> #include <queue> #include <stack> #include <bitset> #include <string> #include <vector> #include <iostream> #include <algorithm> #include<i...
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long #define ld long double #define rep(i,n) for (ll i = 0;i<(n);++i) #define all(v) v.begin(),v.end() template <typename T>bool chmax(T &a, const T& b) {if (a < b) {a = b;return true;}return false;} template <typename T>bool chmin(T &a, c...
#include<bits/stdc++.h> using namespace std; #define endl "\n" typedef long long ll; const int MOD=1e9+7; void solve() { int h,w; cin>>h>>w; char a[1+h][1+w]; for(int i=1;i<=h;i++) { for(int j=1;j<=w;j++) cin>>a[i][j]; } in...
#include <stdio.h> #define M 5000 #include <bits/stdc++.h> using namespace std; #define ll int64_t #include <cstdlib> #include <math.h> #include<cstdio> #include<cstring> #include <math.h> #define vi v(n) vector<ll> v(n); #define FOR(I, A, B) for (ll I = (A); I <= (B); I++) #define fo(i,n) for(ll i=0;i<n;i++) #define...
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } using ll = long long; using...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for(int i = 0; i < (n); i++) #define ALL(a) (a).begin(),(a).end() #define SORT(a) sort((a).begin(),(a).end()) #define RSORT(a) sort((a).rbegin(),(a).rend()) #define ll long long #define pb(a) push_back(a) #define PRINTV(v) {for(ll deB=0; deB<(v).size(); ...
#include <bits/stdc++.h> #define endl '\n' #define fi first #define se second #define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k)) #define forn(i,n) for (int i = 0; i < int(n); i++) #define forr(i,a,b) for (int i = a; i <= b; i++) #define all(v) v.begin(), v.end() #define pb push_back using namespace std; typedef long lo...
#include <bits/stdc++.h> using namespace std; // clang-format off #define forn(i, x, y) for (int i = x; i < y; i++) #define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(NULL) #define all(v) v.begin(), v.end() // clang-format on using VI = vector<int>; class UF { vector<int> root; public: UF(in...
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ll X, Y, ans = 0; ll A, B; cin >> X >> Y >> A >> B; while ((double)X*A<=2e18 && X*A<Y && X*A<= X+B) { X *= A; ans++; } ans += (Y - X - 1) / B; cout << ans << endl; return 0; }
#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; template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define pb push_back #define N 200001 #define ll long long #def...