code_file1
stringlengths
87
4k
code_file2
stringlengths
82
4k
/* || Shree Ganeshay Namah || || Jai Shree Ram || || Nabh Sparsham Diptam || */ #include<bits/stdc++.h> using namespace std; typedef long long int ll; #define mod 1000000007 #define block 180 #define ff first.first #define fs first.second #define sf second.first #define ss second.second #define f1 first #def...
#include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <vector> #include <set> #include <map> #include <cmath> #include <list> #include <ctime> #include <sstream> #include <queue> #include <stack> #include <random> #include <bitset> #include <numeric> #include <cassert> using namespace s...
#include <algorithm> #include <iostream> #include <vector> #include <string> #include <climits> // FOO_MAX, FOO_MIN #include <cmath> #include <cstdlib> // abs(int) #include <numeric> #include <iomanip> #include <map> using namespace std; #define roundup(n,d) ( ((n) + ((d)-1)) / (d) ) #define assign_max(into, compare...
#include <iostream> #include <vector> #include <algorithm> using namespace std; vector<long long> enum_divisors(long long N) { vector<long long> res; for (long long i = 1; i * i <= N; ++i) { if (N % i == 0) { res.push_back(i); // 重複しないならば i の相方である N/i も push if (N/i ...
#include <cmath> #include <iostream> #include <string> #include <algorithm> #include <vector> #include <queue> #include <vector> #include <map> #include<cstdio> #include<functional> #include <bitset> #include <iomanip> #include <cctype> #define rep(i, n) for (int i = 0; i < (n); i++) #define repi(i,a,b) for(int i=int(a...
#include <bits/stdc++.h> using namespace std; #define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define endl "\n" # define int long long # define ll long long #define pb push_back const int N = 300005,mod = 1e9 + 7; ll help(ll n,ll m) { ll ans=1; for(ll a=m+1;a<=n;a++) { ans*=a; ...
#include <array> #include <cstddef> #include <cstdint> constexpr std::size_t bsr64(std::uint64_t c) noexcept { #ifdef __GNUC__ return 63 - __builtin_clzll(c); #else constexpr std::array<std::size_t, 64> table = { 0, 1, 2, 7, 3, 13, 8, 27, 4, 33, 14, 36, 9, 49, 28, 19, 5, 25, 34, 17, 15, 53, 37...
#include <bits/stdc++.h> using namespace std; typedef long long int lld; typedef pair<int,int> pi; typedef pair<lld,lld> pl; typedef pair<int,lld> pil; typedef pair<lld,int> pli; typedef vector<int> vit; typedef vector<vit> vitt; typedef vector<lld> vlt; typedef vector<vlt> vltt; typedef vector<pi> vpit; typedef vector...
#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; #define rep(i, n) for (int i = 0; i < (n); ++i...
#include <bits/stdc++.h> // #include <atcoder/all> // #include "icld.cpp" using namespace std; using ll = long long int; using vi = vector<int>; using si = set<int>; using vll = vector<ll>; using vvi = vector<vector<int>>; using ss = string; using db = double; template<typename T> using minpq = priority_queue <T,vector...
#include "bits/stdc++.h" using namespace std; using ll = long long; int main(){ ll t; cin>>t; ll a; for(int i = 0; i<t; i++){ cin>>a; if(a%4==0){ cout<<"Even"<<endl; } else if(a%2==0){ cout<<"Same"<<endl; } if(a%2!=0){ cout<...
/** Created by: Humberto Yusta Codeforces User: humbertoyusta Country: Cuba */ #include<bits/stdc++.h> using namespace std; /// Pragmas #pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline","03") // Optimization flags //#pragma GCC option("arch=native","t...
#include <bits/stdc++.h> #define INF 1000000007 #define F first #define S second #define PB push_back #define MP make_pair #define REP(i,a,b) for (int i = a; i < b; i++) using namespace std; typedef long long ll; typedef long double ld; typedef long long int lli; typedef vector<int> vi; typedef unordered_map<int,i...
#include <bits/stdc++.h> const long long INF = 1e9; const long long MOD = 1e9 + 7; //const long long MOD = 998244353; const long long LINF = 1e18; using namespace std; #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define POSSIBLE(n) cout << ((n) ? "POSSIB...
#include<iostream> using namespace std; int main(){ int n,w; cin>>n>>w; cout<<n/w; }
#include<bits/stdc++.h> using namespace std; #define mod 1000000007 typedef long long ll; // DP o Trees::http://cfrp.azurewebsites.net/blog/entry/20935 //********************TRIE****************** struct TrieNode{ struct TrieNode*child[26]; int end=0; }; struct TrieNode* getnode(){ struct TrieNode* temp...
#include<iostream> #include<cstdio> #include<algorithm> #define N 5010 #define mod 998244353 #define LL long long const int w=15; int n,m,fac[N],ifac[N],f[20][N]; inline int quick_pow(int x,int b) { int ret=1; while(b) { if(b&1) ret=(LL)ret*x%mod; x=(LL)x*x%mod,b>>=1; } return ret; } inline int inv(int x) {ret...
#include <bits/stdc++.h> #define int long long #define debug(x) cout << #x << " = " << x << endl; using namespace std; inline 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 * 10 + ch - '0', ch =...
#include<bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define i128 __int128 #define mp make_pair #define ld long double typedef pair<int, int> pii; typedef priority_queue<int, vector<int>, greater<int> > small_heap; typedef priority_queue<int> big_heap; const int N = 1e6 + 10...
#include <iostream> using namespace std; int A,B; int main(){ cin>>A>>B; cout<<2*A+100-B; return 0; }
#include<bits/stdc++.h> using namespace std; #define int long long int #define vi vector<int> #define ii pair<int,int> #define pb push_back #define ff first #define ss second #define fast_io ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL); # define PI 3.14159265358979323846 #define trace1(x) ...
#include<bits/stdc++.h> using namespace std; #define endl "\n" #define int long long #define mod 1000000007 #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define trace(x) cerr<<#x<<" : "<<x<<endl; void solve() { int a, b; cin >> a >> b; if(a==b) { cout << a; ...
#include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cstring> #include <string> #include <iomanip> #include <iostream> #include <map> #include <unordered_map> #include <queue> #include <random> #include <set> #include <stack> #include <vector> using namespace std; typedef long long ll...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for (int i = 0; i < (n); ++i) int main(){ int n; std::cin >> n; ll ans=0; rep(i,n){ ll a,b; std::cin >> a>>b; ll add=(a+b)*(b-a+1)/2; ans+=add; } std::cout << ans << '\n'; return 0; }
#include<bits/stdc++.h> #include<vector> #include <iostream> using namespace std; using ll = long long; int main() { int x, y; cin >> x >> y; if (x != y){ cout << 3 - x - y << endl; }else{ cout << x << endl; } return 0; }
// #include <iostream> #include <string> using namespace std; int main() { int x, y; cin >> x >> y; if (x == y) cout << x << "\n"; else { if ((x + 1) % 3 != y) { cout << ((x+1) % 3) << "\n"; } else { cout << ((y+1) % 3) << "\n"; } } return 0; }
#include <bits/stdc++.h> #define REP(i,n) for (int i = 0; i < (n); ++i) template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;} template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;} using namespace std; using ll = long long; using P = pair<in...
#include <iostream> #include <vector> using namespace std; using ll = long long; const ll MOD = 1e9+7; int main(){ ll i,j,H,W,r_yoko;; cin >> H >> W; vector<vector<ll>> dp(H,vector<ll>(W)); vector<vector<char>> mp(H,vector<char>(W)); dp.at(0).at(0) = 1; for(i=0;i<H;++i){...
#include <iostream> #include <algorithm> #include <vector> #define flush fflush(stdout) #define endl '\n' using namespace std; typedef long long ll; typedef pair<int, int> P; typedef pair<ll, ll> Pl; const int mod1 = (int)1e9 + 7, mod2 = (int)998244353; const int INF = (int)1e9; const int di[8] = {1, 0, -1, 0, 1, 1, -1...
#include<bits/stdc++.h> using namespace std; // 素因数分解 template <typename T> map<T, T> prime_factor(T n) { map<T, T> ret; for (T i = 2; i * i <= n; i++) { T tmp = 0; while (n % i == 0) { tmp++; n /= i; } ret[i] = tmp; } if (n != 1) ret[n] = 1; r...
#include <iostream> #include <stdio.h> #include <cstring> #include <cstdio> #include <math.h> #include <algorithm> #include <vector> #include <string> #include <stdlib.h> #include <queue> #include <stack> #include <utility> #include <fstream> //#include <random> #include <map> #include <unordered_map> #include <cstdlib...
#include <algorithm> #include <iostream> #include <iomanip> #include <cassert> #include <cstring> #include <string> #include <vector> #include <random> #include <bitset> #include <queue> #include <cmath> #include <unordered_map> #include <set> #include <map> #define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(...
#include <bits/stdc++.h> using namespace std; void yes(){ cout << "yes" << endl; } void Yes(){ cout << "Yes" << endl; } void YES(){ cout << "YES" << endl; } void no(){ cout << "no" << endl; } void No(){ cout << "No" << endl; } void NO(){ cout << "NO" << endl; } void print(string str){ cout << str << endl;} #define re...
#include <bits/stdc++.h> using namespace std; int main() { int n,x,count = 0; cin >> n >> x; x *= 100; int v[n], p[n]; for (int i = 0; i < n; i++) cin >> v[i] >> p[i]; for (int i = 0; i < n; i++) { v[i] *= p[i]; x -= v[i]; count++; if (x < 0) { cout << count << 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<bits/stdc++.h> typedef long long int ll; using namespace std; #define sz 200008 #define mod 1000000007 #define f first #define s second ll arr[sz+10],brr[sz+10]; char c[sz]; int main() { int t=1; //scanf("%d",&t); while(t--) { int n; scanf("%s",&c); n=strlen(c); int cnt=0; for(int i=0;i<...
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<bitset> #include<set> #include<map> #include<stack> #include<queue> #include<deque> #include<list> #include<iomanip> #include<cmath> #include<cstring> #include<functional> #include<cstdio> #include<cstdlib> #include<numeric> //#include<at...
#include <algorithm> #include <cctype> #include <cmath> #include <cstring> #include <iostream> #include <sstream> #include <numeric> #include <map> #include <set> #include <queue> #include <vector> using namespace std; typedef pair<int, int> II; void solve(long long N, long long M, std::vector<int> &u, std::vector<i...
#include <iostream> #include <fstream> #include <math.h> #include <algorithm> #include <string> #include <map> #include <vector> #include <stack> #include <queue> #include <deque> #include <tuple> #include <stdlib.h> #include <stdio.h> #include <set> #include <limits> #include <iomanip> #include <cstring> //memset usin...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #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 all(v) v.begin(), v.end() int main() { ios::sync_with_stdio(false); cin.tie(0); int n,x; ...
#include<bits/stdc++.h> #define int long long #define uc getchar() #define ph putchar #define R register #define CN const #define rint register int #define cint const int #define pe ph('\n') #define ps ph(' ') using namespace std; cint inf=998244353; cint mix=1e6+5; inline int in(); inline void out(rint x); int n=in(),...
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<vector> #include<functional> #include<algorithm> #include<stdlib.h> #include<string> #include<string.h> #define _USE_MATH_DEFINES #include<math.h> #include<deque> #include<set> #include<map> #include<queue> #include<list> #include<iostream> #include <bitset> us...
#pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #include <iostream> #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double db; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template <typename T> using ord...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define endl "\n" template <class T> bool chmin(T& a, T b){ if(a > b){ a = b; return 1; } return 0; } template <class T> bool chmax(T& a, T b){ if(a < b){ a = b; return 1; } return 0; } #define MAX_LL 1000000000000000000 #define MAX_INT 1000000000 #...
#include<bits/stdc++.h> #include<iostream> #include<set> #include<queue> #include<vector> #include<list> #include<stack> #define me(a,b) memset(a,b,sizeof(a)); #define ios ios::sync_with_stdio(0); cin.tie(0),cout.tie(0); using namespace std; typedef long long ll; const int N = 1e7+7; const double eps = 1e-7; const d...
#include <bits/stdc++.h> #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; using ll = long long; int main() { int n, m; cin >> n >> m; int a[n], b[m]; rep(i, n) cin >> a[i]; rep(i, m) cin >> b[i]; set<int> ans; rep(i, n){ bool flag = true; rep(j, m){ ...
#include <bits/stdc++.h> using namespace std; struct StDish { StDish() : m_nDish1(0), m_nDish2(0) { } int m_nDish1; int m_nDish2; }; void input(int& rnDishSiz, vector<StDish>& rvoCond, vector<StDish>& rvoPutDish) { int nCondSiz; cin >> rnDishSiz >> nCondSiz; rvoCond.resize(nCo...
#include<bits/stdc++.h> using namespace std; #define ll long long #define ps(x,y) fixed<<setprecision(y)<<x #define w(t) int x;cin>>x;while(x--) #define pi 2*acos(0.0) #define bg begin() #define ed end() #define all(x) x.begin(),x.end() #define sortarr(x) sort(x,x+arrsize(x)) #define arrsize(x) sizeof(x)/sizeof(x[0]) #...
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.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 f first #define s second #define pb push_back #def...
#include <iostream> #include <string> #include <algorithm> #include <iostream> #include <string> #include <algorithm> #include <vector> #include <iomanip> #include <cmath> #include <stdio.h> #include <queue> #include <deque> #include <cstdio> #include <set> #include <map> #include <bitset> #include <stack> #include <cc...
#include <bits/stdc++.h> using namespace std; // #include <atcoder/all> // using namespace atcoder; // using mint = modint1000000007; // using mint2 = modint998244353; typedef int64_t Int; #define all(x) (x).begin(), (x).end() const double EPS = 1e-10; const Int INF = 1e18; const int inf = 1e9; const Int mod = 1e9+...
#include "bits/stdc++.h" using namespace std; int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL); int64_t t;cin>>t; int64_t N;cin>>N; int64_t ans=N*100+t-1; ans/=t; cout<<(ans+N-1)<<"\n"; return 0; }
#include <iostream> #include <stdio.h> #include <climits> #include <vector> #include <queue> #include <array> //martin02 using namespace std; int main() { long long int k, n, m; scanf("%lld %lld %lld", &k, &n, &m); vector<long long int> a(k); vector<long long int> b(k); priority_queue<array<long double, 2>> pq;...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <chrono> #define pb push_back #define INF 0x3f3f3f3f #define LINF 0x3f3f3f3f3f3f3f3f #define endl '\n' #define ll long long #define f first #define int long long #define fin cin #define fout cout #define s second #define FAST cin.tie(0), cout.ti...
//@formatter:off #include<bits/stdc++.h> #define overload4(_1,_2,_3,_4,name,...) name #define rep1(i,n) for (ll i = 0; i < ll(n); ++i) #define rep2(i,s,n) for (ll i = ll(s); i < ll(n); ++i) #define rep3(i,s,n,d) for(ll i = ll(s); i < ll(n); i+=d) #define rep(...) overload4(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__) #defi...
#include <bits/stdc++.h> #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; typedef long long ll; #define REP(i,n) for(ll i=0; i<ll(n); i++) #define FOR(i,m,n) for(ll i=ll(m); i<ll(n); i++) #define ALL(obj) (obj).begin(),(obj).end() #define VI vector<int> #d...
#include<iostream> #include<cstdio> using namespace std; struct Edge{ int to,nxt; }e[400005]; int n,k,h[200005],num,f[200005],g[200005],cnt; void add(int u,int v){ e[++num].to=v; e[num].nxt=h[u]; h[u]=num; } void dfs(int u,int fa,int lim){ int i,v; f[u]=1e9; g[u]=0; for(i=h[u];i;i=e[i].nxt){ v=e[i].to; if(v...
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define FORR2(x,y,arr) for(auto& [x,y]:arr) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define ...
#include<bits/stdc++.h> using namespace std; #define LL long long int main() { ios::sync_with_stdio(0), cin.tie(0); char c, d; cin >> c >> d; if(c == 'Y') if(d >= 97) d -= 32; cout << d; }
#include<bits/stdc++.h> #define FastRead \ ios_base::sync_with_stdio(false); \ cin.tie(0); #define ll long long #define endl "\n" #define f for #define ml ll t,g; cin>>t; f(g=0;g<t;g++) #define pi acos(-1) using namespace std; ...
#include <bits/stdc++.h> typedef long long ll; const int N = 100; const int S = N * N; const int P = 998244353; inline int norm(int x) {if (x >= P) x -= P; return x;} inline int reduce(int x) {if (x < 0) x += P; return x;} inline void add(int &x, int y) {if ((x += y) >= P) x -= P;} inline void sub(int &x, int y) {if...
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<sstream> #include<cstdio> #include<cstdlib> #include<cstring> #include<climits> #include<cmath> #include<string> #include<vector> #include<set> #include<map> #include<queue> #include<numeric> #include<functional> #include<algorithm> #include<bitset> #include<t...
#include<bits/stdc++.h> #define eps 1e-9 #define MOD1 998244353 #define MOD2 1000000007 #define INV_2 499122177 #define INF 1000000000 #define PI 3.14159265358979323846 using namespace std; int main() { ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int a, b, w; cin >> a >> b >> w; w*=1000; if(w < a || ((b-a)*(w...
// 2021-03-14 18:10:57 // clang-format off #include <bits/stdc++.h> #ifdef LOCAL #include "lib/debug.hpp" #else #define debug(...) 1 #endif #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define rep(i, n) REP(i, 0, (n)) #define repc(i, n) REPC(i, 0, (n)) #define REP(i, n, m) for (int i =...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; int N, M; int a[MAXN][2]; vector <pair <int, int>> adj[MAXN]; int bio[MAXN], ans[MAXN]; int c[MAXN]; void load() { scanf("%d%d", &N, &M); for (int i = 0; i < M; i++) for (int j = 0; j < 2; j++) scanf("%d", a[i] + j); for (int i =...
#include<bits/stdc++.h> using namespace std; int n,m; vector<vector<int>>a; vector<pair<int,int>>ds; int b[104][104]; const int nmax=1e6; int c[nmax+4]; int mau[105]; int cha[105]; int hang[105]; vector<pair<int,int>>kq; void dfs(int u) { mau[u]=1; for(int i=0; i<a[u].size(); ++i) { int v=a[u][i]; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using pii = pair<int,int>; #define pb push_back #define fi first #define se second #define rep(i,a,b) for(int i=int(a);i<=(int)(b);i++) #define per(i,a,b) for(int i=int(a);i>=(int)(b);i--) const int mod = 1e9+7; const int max...
// Jai Shree Ram #include<bits/stdc++.h> typedef long long int ll; #define pb push_back #define max2(a,b) (a>b)?a:b #define mi2(a,b) (a<=b)?a:b #define fori(i,n) for(ll i=0;i<(ll)n;i++) #define ford(i,n) for(ll i=n;i>=0;i--) #define pll pair<ll,ll> #define mod 1000000007 #define ff first #define ss second using namesp...
#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 = 1; i <= (n); i++) #define FOR(i,a,b) for(int i=(a);i<(b);++i) template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;} template<class T> inline bool chmax(T& a...
#include<bits/stdc++.h> using namespace std; #define fastt ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define debug printf("\n<<CameHere>>\n") #define mem(x,y) memset(x, y, sizeof(x)) #define all(qz) qz.begin(),qz.end() #define rall(qz) qz.rbegin(),qz.rend() #define inf ...
#include <bits/stdc++.h> using namespace std; namespace SimpleModInt { constexpr int md = (int)1e9 + 7; inline int norm(long long a) { return (a % md + md) % md; } inline int add(int a, int b) { a += b; if (a >= md) a -= md; return a; } inline int sub(int a, int b...
#include<bits/stdc++.h> #define db double #define reg register #define LL long long #define pb push_back #define lb lower_bound #define ub upper_bound #define ull unsigned long long #define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;++i) #define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;--i) #define erep(i,a) for(int i...
//BY: YASH JAIN, CF: yashjain0333 #include <bits/stdc++.h> using namespace std; #define May_the_fork_be_with_you ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define all(x) (x).begin(), (x).end() #define rall(v) v.rbegin(),v.rend() #define forn(i, n) for (int i = 0; i < (int)(n); ++i) #define for1(i, n) for (int i...
#include <bits/stdc++.h> using namespace std; int N, Q; const int maxn = 2e5 + 5; typedef long long ll; inline ll read() { ll x = 0; int s = 1; char c = getchar(); while (c < 48 || c > 57) { if (c == '-') s = -1; c = getchar(); } while (c >= 48 && c <= 57) { ...
#include<bits/stdc++.h> using namespace std; using lint = long long; #define fi first #define se second const int N = 2e5 + 5; const int INF = 2e9; const lint LINF = 9e18; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; cout << ((n + 99) / 100) << "\n"; }
#define ll long long #define pub push_back #define pob pop_back #define puf push_front #define pof pop_front #define mp make_pair #define fo(i , n) for(ll i = 0 ; i < n ; i++) #define tll tuple<ll ,ll ,ll , ll> #define tri tuple<ll ,ll ,ll> #define pll pair<ll ,ll> //#include<bits/stdc++.h> #include<iomanip> #inclu...
#include <bits/stdc++.h> using namespace std; int main() { int N; bool ans=true; cin>>N; vector<int> a(N); for(int i=0;i<N;i++) cin>>a.at(i); sort(a.begin(),a.end()); for(int i=1;i<=N;i++) if(a[i-1]!=i) ans=false; if(ans) cout<<"Yes"<<endl; else cout<<"No"<<endl; }
#include<bits/stdc++.h> using namespace std; #define ull unsigned long long #define pb push_back #define ll long long #define mk make_pair #define endl '\n' #define M 1000000007 ull dp[101][101]; ull nCr(ull n,ull r) { if(n==r)return dp[n][r]=1; if(r==1)return dp[n][r]=n; if(r==0)return dp[n][r]=1; if(...
#include <iostream> using namespace std; int main() { int a,b,c; cin>>a>>b>>c; if (a==b) cout<<c; else if (b==c) cout<<a; else if (a==c) cout<<b; else cout<<0; return 0; }
// #define ONLINE_JUDGE // _ // (_) // _ __ ___ __ _ _ ___ _ __ _ __ ___ //| '_ ` _ \ / _` | |/ _ \| '__| '__/ _ \ //| | | | | | (_| | | (_) | | | | | (_) | //|_| |_| |_|\__,_| |\___/|_| |_| \___/ // _/ | ...
#include <bits/stdc++.h> using namespace std; #define stp(var, init, end) for (auto var = init; var < end; ++var) #define stpe(var, init, end) for (auto var = init; var <= end; ++var) #define ll long long int main(void) { int n, rnum = 0, gnum = 0, bnum = 0; cin >> n; vector<ll> rdogs; vector<ll> gdo...
#include <bits/stdc++.h> #define rei register int using namespace std; int K; int cnt[11],qpow[11]; string S,T; double ans; int score(string A){ memset(cnt,0,sizeof(cnt)); int res = 0; for(rei i = 0;i < A.size();++i) ++cnt[A[i] - '0']; for(rei i = 1;i <= 9;++i) res += i * qpow[cnt[i]]; return res; } void solve(stri...
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for (long long i = 0; i < (n); ++i) #define INF LONG_MAX/3 //#define DIV 1000000007 //#define DIV 998244353 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, con...
#include <algorithm> #include <bitset> #include <cmath> #include <complex> #include <cstdio> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <sys/types.h> #include <unistd.h> #include <vector> #pragma region macros #define _overload(_1, ...
// CTRL+ALT+M #include <bits/stdc++.h> using namespace std; #define M 1000000007 #define int long long int #define vi vector<int> #define vb vector<bool> #define vc vector<char> #define vpi vector<pair<int,int>> #define pii pair<int,int> #define pb push_back #define inf 1e18 #define ff first #define ss second #defin...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned ll int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t=1; //cin>>t; while(t--) { string s; cin>>s; int n = s.length(),sum=0; vector<int> c(3,0); if(n==...
//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> using namespace std; //#include <atcoder/all> //using namespace atcoder; #define rep(i,n) for (int i = 0; i < (n); ++i) #define rep1(i,n) for (int i = 1; i <= (n); ++i) #define bit(n,k) ((n>>k)&1) //nのk bit目 #define vec(T) vector<T> #define vvec(T) vector<vector<T>> using ll = long long; using ...
#include<bits/stdc++.h> #define pii pair<int,int> #define eps 1e-7 #define equals(a,b) (fabs(a - b) < eps) #define fi first #define se second using namespace std; typedef long long ll; const int maxn = 1e6 + 5; const ll MOD = 1e9 + 7; ll rd(){ ll x = 0; int f = 1; char ch = getchar(); while(ch < '0' || ch > '9'){...
#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; #define int long long #define pb push_back #define S second #define F first #define f(i,n) for(int i=0;i<n;i++) #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define vi vector<int> #define pii pair<int,int> const int N = 105; int n; pair<double,doub...
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math") #include <bits/stdc++.h> using namespace std; template<class t> inline t read(t &x){ char c=getchar();bool f=0;x=0; while(!isdigit(c)) f|=c=='-',c=getchar(); while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar(); if(f) x=-x;return x; } template<...
#include "bits/stdc++.h" using namespace std; int main() { int N; cin >> N; string S, T; cin >> S >> T; vector<int>s; for (int i = 0; i < N; ++i) { if ('1' == S[i]) { s.push_back(i); } } vector<int>t; int tcount = 0; for (int i = 0; i < N; ++i) { if ('1' == T[i]) { t.push_back(i); } } if (t.s...
#include<bits/stdc++.h> typedef long long LL; typedef double dl; #define opt operator #define pb push_back const LL maxn=1e6+9,mod=998244353,inf=0x3f3f3f3f; LL Read(){ LL x(0),f(1); char c=getchar(); while(c<'0' || c>'9'){ if(c=='-') f=-1; c=getchar(); } while(c>='0' && c<='9'){ x=(x<<3ll)+(x<<1ll)+c-'0'; c=get...
#include <math.h> #include <bits/stdc++.h> using namespace std; #define rep(i, l, n) for (int i = (l); i < (n); i++) #define max(p, q) ((p) > (q) ? (p) : (q)) #define min(p, q) ((p) < (q) ? (p) : (q)) #define mod using ll = long long; using P = pair<int, int>; template <class T> using V = vector<T>; template <class T> ...
#include <stack> #include <iostream> #include <vector> #include <algorithm> #include <string> #include <cstring> #include <cmath> #include <unordered_map> /*#define cin(a) scanf("%d",&a) #define llcin(a) scanf("%lld",&a) #define fcin(a) scanf("%lf",&a) #define cout(a) printf("%d",a) #define cout_n(a) printf("%d\n",a) #...
#include <bits/stdc++.h> using namespace std; #define int long long #define pi pair<int,int> #define f first #define s second void find(int N,vector<int>& a) { int n=(N<<1); vector<bool> vis(n,1); vector<pi> val(n); for(int i=0;i<n;i++) val[i]=make_pair(a[i],i); sort(val.begin(),val.end()); ...
#include<set> #include<queue> #include<cmath> #include<vector> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; #define MAXN 10005 #define ENDL putchar('\n') #define LL long long #define DB double #define lowbit(x) ((-x) & (x)) LL read() { LL f = 1,x = 0;char s = getchar()...
// Problem: // E - Magical Ornament // // // Contest: AtCoder - AtCoder Beginner Contest 190 // URL: https://atcoder.jp/contests/abc190/tasks/abc190_e // Memory Limit: 1024 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> u...
#include <cstdio> #include <cctype> #include <cstring> #define rr register using namespace std; const int N=100011; struct node{int y,next;}e[N<<1]; int as[N],q[N],a[18],et=1,head,ans,tail,k,dis[18][N],n,m,dp[N<<1][18],two[18]; inline signed iut(){ rr int ans=0; rr char c=getchar(); while (!isdigit(c)) c=getchar(); ...
#include <iostream> #include <vector> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <cmath> using namespace std; using ll = long long; using P = pair<ll, ll>; #define rep(i, n) for (ll i = 0; i < (n); i++) #define rep2(i, s, n) for (ll i = s; i < (n); i++) int main(){ ...
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p); template <typename A, typename B, typename C, typename D> string to_string(tuple<A, B, C, D> p); string to_string(const...
#include<bits/stdc++.h> using namespace std; template<typename T>inline T read(){ T f=0,x=0;char c=getchar(); while(!isdigit(c)) f=c=='-',c=getchar(); while(isdigit(c)) x=x*10+c-48,c=getchar(); return f?-x:x; } #define int long long namespace run{ const int MAX=1LL<<62; int X,Y,ans,num[109+9]; int main(){ X=re...
#include "bits/stdc++.h" using namespace std; #define int long long int x, y; map<int, int> dp; int recurse(int n) { if (n <= x) { return abs(x - n); } if (n % 2 == 0) { if (dp[n / 2] == 0) dp[n] = recurse(n / 2) + 1; else dp[n] = dp[n / 2] + 1; dp[n] = min(dp[n], abs(x - n)); return dp[n]; } els...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; #define fi first #define se second #define N 5114514 #define all(x) (x).begin(), (x).end() const ll mod = 1000000007; // const ll mod = 998244353; const ll inf = 1000000000000000000; void solve() { ll n; string s; c...
#include <bits/stdc++.h> //#include <atcoder/all> #pragma GCC target("arch=skylake-avx512") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; static const double EPS = 1e-12; static const double PI = aco...
#include <bits/stdc++.h> #define ll long long #define md 1000000007 using namespace std; int main(){ ll n,i,j,a[201],dp[201][201],flg,rm,id[2]={-1,-1},bigval=md,k,num; vector<ll> v[2]; bigval-=7; bigval*=400; cin>>n; memset(dp,0,sizeof(dp)); for(i=0;i<n;i++) cin>>a[i]; dp[a[0]%200][0]=1; for(i=1;i<n;i++){ for(j=0...
#include <bits/stdc++.h> #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; typedef long long ll; const int INF = 1 << 30; const ll LLINF = 1LL << 60; int mod = 1000000007; bool issame(int x, int y){ if(x > y) swap(x, y); bool ret = true; while(x){ if((x&1)^(y&1)) ret = false; ...
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<bitset> #include<set> #include<map> #include<stack> #include<queue> #include<deque> #include<list> #include<iomanip> #include<cmath> #include<cstring> #include<functional> #include<cstdio> #include<cstdlib> #include<numeric> using namesp...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define M 1000000007 #define pii pair<ll, ll> #define prdb(pranay) cout << fixed << setprecision(10) << pranay; #define speed1 ios_base ::sync_with_stdio(false); #define speed2 cin.tie(NULL); #define speed3 cout.tie(NULL); int main() { #ifndef ONLI...
#include <bits/stdc++.h> /* #include <atcoder/all> */ #define rng(i, a, b) for (int i = int(a); i < int(b); i++) #define rep(i, b) rng(i, 0, b) #define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--) #define per(i, b) gnr(i, 0, b) using namespace std; /* using namespace atcoder; */ using ll = long long; usin...
#include<bits/stdc++.h> using namespace std; #define ll long long #define n_l '\n' #define pb push_back #define all(x) (x).begin(),(x).end() #define fi first #define se second #define sz(x) ((int)(x).size()) #define forn(i,n) for(int i=0;i<n;i++) #define for1(i,n) for(int i=1;i<=n;i++) typedef vector<int> vi; typedef v...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<string> s(n); for (int i = 0; i < n; i++) cin >> s.at(i); vector<vector<ll>> dp(n + 1, vector<ll>(2)); // T, F dp[0][0] = dp[0][1] = 1; for (int ...
#include<bits/stdc++.h> #pragma GCC optimize("Ofast") 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> indexed_set; #define forn(i,x1,n) for(int i=x1;...
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; int it = *min_element(a.begin(), a.end()); unordered_map<int, int> mp; auto add = [&](int x, int val) { if (x >= it) return; ...
#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; #define rep(i, n) for (int i = 0; i < (n); +...
#define DEBUG 0 #include <bits/stdc++.h> using namespace std; #if DEBUG // basic debugging macros int __i__,__j__; #define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl #define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl #define printVar(n) cout<<#n<<": "<<n<<endl #define printA...
#pragma GCC optimize("O3") // #include <atcoder/all> // using namespace atcoder; #include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // using namespace __gnu_pbds; // gp_hash_table<int, int> mapka; using namespace std; #define PB push_back #define MP make_pair #define LL long long #define int LL #defi...
#include <bits/stdc++.h> #define ll long long #define mod 1000000007 using namespace std; ll power(ll a, ll b) { ll ans = 1; if(b==0) return ans; while(b>0) { if(b%2==0) { a = (a*a)%mod; b/=2; } else { ans = (ans * a)%mod; b-=1; } } return ans; } int main() { int n; cin>>n; char a...
#include<bits/stdc++.h> //#include<atcoder/all> using namespace std; using ll = long long; ll MOD = 1e9+7; ll g(ll x){ int ret = 1; for(int i = 0;i<x;i++){ (ret*=2)%=MOD; } return ret; } ll f(ll x){ ll ret; ll ret_1 = 1; ll ret_2 = 1; for(int i = 0;i<x-1;i++){ (ret = ret_1 + ret_2)%=MOD; ret_2 = ret_1; ...
#include <bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define FOR(i, a, b) for (ll i = (a); i <= (b); i++) #define FORX(i, a, b, x) for (ll i = (a); i <= (b); i+=x) #define debug(x) cout <<" || "<< #x << " is= " << x <<endl; //use for debug #define read(a) ll a; cin >> a; ...
#include<iostream> #include<algorithm> #include<cstring> using namespace std; typedef pair<int, int> PII; const int N = 4e5 + 10; PII a[N]; int b[N]; int stk[N], top; int main(){ int n; scanf("%d", &n); for(int i = 1; i <= 2 * n; i ++){ scanf("%d", &a[i].first); a[i].second = i; } ...
// 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> #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimization("unroll-loops") // #define TEST_CASES // #define ONLINE_JUDGE #define test \ long long t; \ cin >> t; \ while (t--) #ifndef ONLINE_JUDGE #define reach(x) cout << "\n\t\t" << x << "\n\n"; #defin...
#include<bits/stdc++.h> #define ll long long #define mod 1000000007 ll read(){ char C=getchar(); ll N=0 , F=1; while(('0' > C || C > '9') && (C != '-')) C=getchar(); if(C == '-') F=-1 , C=getchar(); while('0' <= C && C <= '9') N=(N << 1)+(N << 3)+(C - 48) , C=getchar(); return F*N; } ll n,p; ll pow...
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> ii; #define pb push_back #define T ll testx; cin>>testx; while(testx--) #define print(name) for(auto t:name){cout<<t<<" ";}cout<<endl; #define printii(name) for(auto t:name){cout<<t.first...
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; //using namespace atcoder; using ll=long long; using ld=long double; using pll=pair<ll, ll>; //using mint = modint1000000007; #define rep(i,n) for (ll i=0; i<n; ++i) #define all(c) begin(c),end(c) #define PI acos(-1) #define oo 2e18 template<typenam...
#include<bits/stdc++.h> using namespace std; using ll=long long; using P=pair<ll,ll>; ll N,M,Q; map<ll,ll>mp; map<ll,ll>mp1; P dat[2][800005]; ll n; void init(ll n_){ n=1; while(n<=n_)n*=2; for(ll i=0;i<2*n-1;i++){ dat[0][i]=P(0,0); dat[1][i]=P(0,0); } } void update(ll j,ll k,ll a){ ll m=mp1.at(k); k+=n-1;...
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> using namespace __gnu_pbds; using namespace std; #define LETS_GET_SCHWIFTY ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ff first #de...
#include<bits/stdc++.h> using namespace std; #define DONTSYNC ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) //dont use stdio with iostream functions //input and output are out of order now! #define TEST unsigned long long T; cin>>T; while(T--) //loop over each testcase #define endl "\n" #define for...
#include <bits/stdc++.h> using namespace std; #define ar array #define ll long long const int MAX_N = 2e5 + 1; const int MOD = 1e9 + 7; const int INF = 1e9; const ll LINF = 1e18; void solve() { int v, t, s, d; cin >> v >> t >> s >> d; if (d >= v * t && d <= v * s)cout << "No" << endl; else cout << "Yes...
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<(n); i++) using namespace std; typedef long long ll; typedef pair<int,int> P; int main(){ ll r,x,y; cin >> r >> x >> y; ll ans = 1; if(r*r == x*x+y*y) { cout << 1 << endl; return 0; } if(r*r > x*x+y*y) { cout <...
#include<bits/stdc++.h> #define ll long long #define mll map<ll,ll> #define u_mll unordered_map<ll,ll> #define pll pair<ll,ll> #define sll set<ll> #define msll multiset<ll> #define usll unordered_set<ll> #define vll vector<ll> #define vv vector #define pqll priority_queue<ll, vll, greater<ll> ()> #define pql priority_q...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; #define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i) #define ALL(x) ((x).begin()), ((x).end()) #define READ(x) (cin >> (x)) #define WRITE_N(x) (cout << (x) << endl) #define WRITE(...
#include <bits/stdc++.h> using namespace std; #define ull unsigned long long #define MOD (int)(1e9+7) #define MOD1 998244353 #define ceil(x, y) ((x)%(y))==0? ((x)/(y)) : ((x)/(y)+1) #define FOR(i, N) for(int i = 0; i < N; ++i) #define FOR1(i, N) for(int i = 1; i <= N; ++i) #define vi vector <int> #define pii pair <int,...
#include<cstdio> using namespace std; int main(){ int n,a,sum=0; scanf("%d",&n); while(n--){ scanf("%d",&a); a>10 ? sum+=a-10:0; } printf("%d\n",sum); return 0; }
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define rt return 0 #define endln "\n" #define all(v) v.begin(), v.end() #define for1(i, a, b) for (long long int i = a; i < b; i++) #define for2(i, a, b) for (long long int i = a; i > b; i--) // cout << fixed << setprecision(0) <<...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (n); ++i) int main() { int N; cin >> N; vector<long long> A(N); for(auto &e : A) cin >> e; long long m = 0; for(auto &e : A) m += abs(e); cout << m << '\n'; double y = 0; for(auto &e : A) y += double(e)...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll typedef long double ld; typedef pair<int,int> pii; #define x first #define y second int ppow(int x,int y,int mod) { int res=1; while(y) { if(y&1) res=res*x%mod; y>>=1; x=x*x%mod; } ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; constexpr ll MOD = 1e9 + 7; //constexpr ll MOD = 998244353; //constexpr ll MOD = ; ll mod(ll A, ll M) {return (A % M + M) % M;} constexpr ll INF = 1LL << 60; template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return tru...
#pragma region shig_templates #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> pairI2; typedef pair<LL, LL> pairLL2; typedef vector<int> VI; typedef vector<LL> VLL; typedef vector<VI> VVI; typedef vector<VVI> VVVI; typedef vector<string> VS; #define shig_for(i, a, b) for(int i...
#include<bits/stdc++.h> #define ll long long using namespace std; template <typename T, typename TT> void print(T c, TT a,int n){ vector<int> r; for(int i=0;i<n;i++) r.push_back(a[i][0] - c[0]); int mi = *min_element(r.begin(), r.end()); if(mi<0){ for(auto &x:r) x+=abs(mi); for(auto &x:c) x-=abs(mi)...
/* /^--^\ \____/ / \ _____ _ __ __ ____ _ ____ ____ _____ | || ()_)| |\ \/ /| ===|| |__ / (__` / () \|_ _| \__ __/ |_| |_|/_/\_\|____...
#pragma GCC optimize("Ofast") #include<bits/stdc++.h> using namespace std; #define pb push_back #define fi first #define se second #define sz(a) (int)(a.size()) #define all(a) a.begin(),a.end() #define lb lower_bound #define ub upper_bound #define owo ios_base::sync_with_stdio(0);cin.tie(0); #define MOD (ll)(1e9+7) #d...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define ll long long #define pb emplace_back #define mp make_pair #define mt make_tuple #...
/* Description @authors Magneto @date 2020-10-12 10:59:53 @version 1.2.3 */ #include <bits/stdc++.h> #define FAST ios_base::sync_with_stdio(false);cin.tie(nullptr); #define ll long long #define l long int #define f(i, a, b) for(int i=a; i<b; i++) #define fr(i, a, b) for(int i=a; i>=b; i--) #define endl '\n' #define ...
#include <iostream> #include <vector> #include <limits> #include <cstring> #include <time.h> #include <math.h> #include <algorithm> #include <random> #include <list> #include <stack> #include <queue> #include <set> #include <unordered_set> #include <map> #include <unordered_map> #include <chrono> using namespace std; ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double vector<vector<int>> edge; vector<int> v; vector<int> d; int dfs(ll now, ll pre, ll target) { int res = 0; int ma = -1, mi = 1000000; int dma = -1, dmi = 1000000; int cnt = 0; for (int nxt : edge[now]) { ...
#include <iostream> using namespace std; string a; bool Pal(int i , int j) { while(i < j) { if(a[i] != a[j]) return false; i++; j--; } return true; } int main() { cin >> a; int i , j; i = 0; while(a[i] == '0'&& i < a.size()) i++; j = a....
#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; int main() { int64_t N; int64_t count=0; cin>>N; vector<int>data(200); for(int i=0;i<N;i++){ int64_t a,z; cin>>a; z=a%200; data.at(z)++; } for(int i=0;i<200;i++){ int64_t b,c; b=data.at(i); c=(b*(b-1))/2; count+=c; } cout<<co...
#include "bits/stdc++.h" #pragma region header using i32 = int; using i64 = long long int; using u32 = unsigned int; using u64 = unsigned long long int; using isize = ptrdiff_t; using usize = size_t; inline u64 popcount(const u64 v) { #ifdef _MSC_VER return u64(__popcnt64(v)); #else return u64(__builtin_popcount(v...
/*ver 6*/ #include <cstdio> #include <cstdlib> #include <cmath> #include <iostream> #include <iomanip> #include <vector> #include <string> #include <utility> #include <algorithm> #include <queue> #include <tuple> #include <map> #include <list> #include <set> using namespace std; void init() {cin.tie(0);ios::sync_with_s...
#include <bits/stdc++.h> using namespace std; /* Fix k. For this k, we will: Compute the maximum possible sum of k items that is equal to X modulo k. We will do this by using a DP approach. We go through the items one by one and decide IN ORDER whether we use them. Our DP state is (# items used, current sum % k, it...
#include <bits/stdc++.h> #include <algorithm> #include <unordered_set> using namespace std; int main(){ long long int l,C; cin >> l; C = 1; for(int j=1; j<12; j++){ C = C*(l-j)/j; } cout << C << endl; return 0; }
#pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #include <complex> #include <queue> #include <set> #include <unordered_set> #include <list> #include <chrono> #include <random> #include <iostream> #inc...
#include<cstdio> #include<algorithm> #include<cstring> using namespace std; int main(void) { int a,b,c; scanf("%d %d %d",&a,&b,&c); if(c%2==0){ a=abs(a); b=abs(b); } if(a<b) printf("<\n"); else if(a>b) printf(">\n"); else printf("=\n"); return 0; }
#include <cmath> #include <string> #include <vector> #include <iostream> #include <algorithm> #include <functional> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; cout << 21 - a - b - c << endl; return 0; }
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <vector> #include <queue> #include <algorithm> using namespace std; typedef long long ll; inline int read() { int a=0,f=1; char ch=getchar(); for(;!isdigit(ch);ch=getchar()) if(ch=='-')f=-1; for(;isdigit(ch);ch=getchar()) a=(a<<...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define _GLIBCXX_DEBUG #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, c, n) for (ll i = c; i < (n); ++i) //以下debug用 #define d(x) cout << #x << "; " << x << endl; #define p(x) cout << x << endl; #define f(x) for (long unsigned int i = 0;...
#include<bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int i=0;i<n;i++) int n,m; vector<int> G[20]; vector<bool> used(20,false); vector<int> col(20,-1); vector<int> vs; void dfs(int v) { if(used[v])return; used[v]=true; vs.push_back(v); for(int u:G[v])dfs(u); } ll now...
#include <bits/stdc++.h> using namespace std; #define int long long const int MAXN = 2e1 + 5; int fa[MAXN]; int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); } void merge(int x, int y) { fa[find(y)] = find(x); } vector<int> vec; int res, col[MAXN]; int n, m, g[MAXN][MAXN]; void dfs(int k) { if (...
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #define N 100005 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<<3)+(x<<1)+(ch^48);ch=getchar();} return x*f; } int n,a[N]; inline...
#include <stdio.h> #include <cstring> #include <algorithm> #include <vector> #include <stack> #include <queue> #include <iostream> #include <map> #define go(i, l, r) for(int i = (l), i##end = (int)(r); i <= i##end; ++i) #define god(i, r, l) for(int i = (r), i##end = (int)(l); i >= i##end; --i) #define ios ios_base::sy...
#include <cstdio> #define ll long long #define mem(x, a) memset(x, a, sizeof x) #define mpy(x, y) memcpy(x, y, sizeof y) #define fo(x, a, b) for (int x = (a); x <= (b); x++) #define fd(x, a, b) for (int x = (a); x >= (b); x--) #define go(x) for (int p = tail[x], v; p; p = e[p].fr) using namespace std; ll n, m; int mai...
#include<bits/stdc++.h> using namespace std; #define int long long int #define ff first #define ss second #define pb push_back #define print(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] " std::random_device dev; std::mt19937 rng(dev()); std::uniform_int_distribution<std::mt19937::result_type> dist(1,10000000...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPR(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(array) array.begin(), array.end() #define print(x) cout << x << endl; #define pb push_back using namespace std; typedef long long ll; typede...
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; int a[200001], visited[200001] = {0}; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i]; int cnt = 0, ans = 0; for (int i = 1; i <= n; ++i) ...
#include <bits/stdc++.h> using namespace std; #define int long long #define F(i,a,b) for(int i=(int)(a);i<=(int)(b);i++) #define R(i,b,a) for(int i=(int)(b);i>=(int)(a);i--) #define endl "\n" #define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define pii pair<int,int> #define pb push_back #define all(v) v.begin...
//#pragma once #include <stdio.h> #include <stdlib.h> #include <string> #include <iostream> #include <queue> #include <algorithm> #include <sstream> #include <vector> #include <math.h> #include <set> #include <map> #include <unordered_map> #include <numeric> #include <bitset> #include <iomanip> #include <cctype> #inclu...
#include <iostream> #include <algorithm> using namespace std; int main(){ int h,w,sum=0,mx=998244353; cin>>h>>w; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ int in; cin>>in; sum+=in; mx=min(mx,in); } } cout<<sum-mx*h*w<<endl; }
/* Author: $%U%$ * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$ **/ #include <bits/stdc++.h> using namespace std; #define fore(i, a, b) for (int i = a, to = b; i < to; i++) #define foref(i, a, b) for (int i = b - 1, to = a; i >= to; i--) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define SZ(v)...
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n,m,ans; char a[105][105]; int main() { scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++)cin>>a[i][j]; for(int i=1;i<=n;i++) for(int j=2;j<=m;j++)if(a[i][j]=='.'&&a[i][j-1]=='.')ans++; for(int j=1;j<=...
#include <bits/stdc++.h> using namespace std; //#define int long long typedef long long ll; typedef unsigned long long ul; typedef unsigned int ui; const ll mod = 1000000007; const ll INF = mod * mod; const int INF_N = 1e+9; typedef pair<int, int> P; #define rep(i,n) for(int i=0;i<n;i++) #define per(i,n) for(int i=n...
#include <iostream> #include <string> using namespace std; using ll = long long; int main(void){ string X; cin >> X; if (X == "0") { cout << 0 << endl; return 0; } string ans; for (auto x : X) { if (x != '.') { ans += x; } else { break; } } cout << ans << endl; r...
#include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> #define ordered_set tree<int, null_type, less<int >,rb_tree_tag, tree_order_statistics_node_update> using namespace __gnu_pbds; #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("u...
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG #define rep(i, from, to) for (ll i = from; i < (to); ++i) #define mp(x,y) make_pair(x,y) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define sz(x) (int)(x).size() #define pb push_back using ll = long long; using ld=lon...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <sstream> #include <stack> #include <vector> //#include <ext/pb_ds/assoc_container.hpp> //using namespace _...
#include<bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //using namespace __gnu_pbds; #define DBG(a) cout<< "line "<<__LINE__ <<" : "<< #a <<" --> "<<(a)<<endl #define eps 1e-8 #define eq(x,y) (fabs((x)-(y)) < eps) using namespace std; typedef long long ll; typedef long...
#include<iostream> #include<algorithm> #include<cstring> #include<vector> using namespace std; typedef long long LL; const int N = 810, inf = 1e9; int n, m; int a[N][N]; int s[N][N]; int vis; bool check(int x){ for(int i = 1; i <= n; i ++) for(int j = 1; j <= n; j ++) s[i][j] = s[i - 1][j] +...
#include "bits/stdc++.h" using namespace std; #define ll long long #define all(v) v.begin(),v.end() #define sortall(v) sort(all(v)) #define deb(x) cout<<#x<<" = "<<x<<'\n' #define deb2(x, y) cout<<#x<<" = "<<x<<" , "<<#y<<" = "<<y<<'\n'; #define si(x) scanf("%d", &x) #define sii(x,y) scanf("%d%d", &x, &y) #define sll(...
//デバッグ用オプション:-fsanitize=undefined,address //コンパイラ最適化 #pragma GCC optimize("Ofast") //インクルードなど #include<bits/stdc++.h> using namespace std; typedef long long ll; //マクロ //forループ //引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか //Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる //FORAは範囲for文(使いにくかったら消す) #define re...
#include <bits/stdc++.h> using namespace std; struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast; using ull = unsigned long long; using ll = long long; using vi = vector<int>; using vl = vector<long>; using vll = vector<long long>; using vvi = vector<vi>; using vvl = vector<vl>; using vvll = ve...
#include <iostream> #include <algorithm> #include <list> #include <string> int h, w; int f (int a, int b, std::list<int> r) { int s = 0; if (a == 0 || r.empty()) { s = 1; } else { int m = r.front(); r.pop_front(); if (b > 0) { s += f(a, b-1, r); } if ((m+1) % w != 0 && m+1 == r....
#include "bits/stdc++.h" using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; long long a[n]; long long mx = 0; long long sum = 0; long long mospos = 0; for (int i = 0; i < n; i++) { cin >> a[i]; if (i) a[i] += a[i - 1]; m...
/* ID: Λινδα LANG: C++ TASK: abc196c */ #include <stdio.h> long long ppct(long long x) { long long i=0,s=1; do { x=x/10; i++; } while(x!=0); while(i--) { s=s*10; } return s; } int read(){char c=getchar();int t=0,f=1;while(c<'0'||c>'9'){if(c=='-'){f=-1;}c=getchar();}while(c>='0'&&c<='9'){t=(t<<1)+(t<<3)+(...
#include <bits/stdc++.h> #define fi first #define se second using namespace std; typedef long long ll; typedef pair<ll, ll> pll; const int N = 2e5 + 5; const ll inf = 1e18; const ll mod = 998244353; ll n, k, a[100][100], s, visr[100], visc[100], fact[100]; vector<ll> r[100], c[100]; bool check_col(int x, int y){ fo...
/* * @author : ashnove */ #include <bits/stdc++.h> using namespace std; #define ll long long int #define F first #define S second #define endl "\n" #define nl cout<<endl; #define pb push_back #define f(i,a,b) for(ll i=a;i<b;i++) #define Knucklehead ios_base::sync_with_stdio(false);cin.tie(NULL); //#define mod 100000007...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; #define REP(NAME, NUM) for (int NAME = 0; NAME < int(NUM); ++NAME) #define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME) #define ALL(NAME) (NAME).begin(), (NAME).end() #define cMOD...
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define REP(i, n) for (int i = 0; i < (n); ++i) #define REPR(i, n) for (int i = n - 1; i >= 0; --i) #define FOR(i, m, n) for (int i = m; i < n; ++i) #define FORR(i, m, n) for (int i = m; i >= n; --i) #define ALL(v) (v).begin(),(v...
//ABHISHEK AGRAWAL,BIT mesra// //Author: Abhishekagrawal //Date: 09/05/2021 //Time: 18:34:50 #include<bits/stdc++.h> using namespace std; #define booga cout << "booga" << endl #define int long long int #define pb push_back #define f first #define s second #define mod (...
#include<bits/stdc++.h> #include<string.h> #include<cstdio> #include<algorithm> #include<iostream> #include<queue> #include<vector> #include<cstring> #include<map> #include<set> #include<cstdlib> #include<bitset> using namespace std; typedef long long ll; char s[2003][2003]; ll mod=1e9+7; ll ma[2003][2003]={0}; ll maxx...
#include <bits/stdc++.h> using namespace std; struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); } } fast; template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); ...
// 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 #include<bits/stdc++.h> using namespace std; #define _rep(i, x, y) for(int i = (int)x; i < (int)y; ++i) #define _dep(i,x,y) for(int i = (int...
//ABHISHEK AGRAWAL,BIT mesra// //Newbie......You have to be odd to be no. ONE :)// //Author: Abhishekagrawal //Date: 15/03/2021 //Time: 04:36:03 #include<bits/stdc++.h> using namespace std; #define ll long long int #define ld long double #define ...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <chrono> #include <cstdint> #include <cstdio> #include <cstring> #include <deque> #include <iomanip> #include <ios> #include <iostream> #include <limits> #include <map> #include <queue> #include <random> #include <set> #include <stack> ...
#include <bits/stdc++.h> #define endl '\n' #define modulo 1000000007 #define int long long #pragma GCC optimize("-Ofast") //#pragma GCC optimize("trapv") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native") #pragma GCC optimize("-ffast-math") #pragma GCC optimize("-funroll-loops") #prag...
#include <bits/stdc++.h> using namespace std; using i64 = long long; const i64 N = 1000, G = 30; struct Node { //0:up 1:right 2:down 3:left double cost[4] = {4500, 4500, 4500, 4500}; }; i64 dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; Node node[G][G]; int main() { for (i64 turn = 1; turn <= N; turn++...
#pragma GCC optimize ("O2") #pragma GCC target ("avx") #include<bits/stdc++.h> //#include<atcoder/all> //using namespace atcoder; using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) #define rep1(i, n) for(int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x)...
#include<bits/stdc++.h> using namespace std; #define vi vector<int> #define vvi vector<vi> #define rep(i,l,r) for(int i=l;i<r;i++) #define inf 0x3f3f3f3f #define PI 3.1415926 typedef long long ll; const int maxn=25; int n; void solve() { cin>>n; int x0,x1,y0,y1; cin>>x0>>y0>>x1>>y1; x1-=x0,y1-=y0; double ang=(n-2)...