code_file1
stringlengths
87
4k
code_file2
stringlengths
85
4k
#include<bits/stdc++.h> using namespace std; using ll=long long; using uint=unsigned int; using ull=unsigned long long; const ll LL_MAX=LLONG_MAX; class union_find{ private: vector<ll> par; vector<ll> siz; public: union_find(ll n) : par(n),siz(n,1LL){ for (ll i=0;i<n;i++) par[i]=i; } ll root(ll x)...
#include <bits/stdc++.h> using namespace std; using ll = long long; void solve() { int n; cin>>n; cout<<(n+99)/100<<endl; return; } int main() { #ifdef bipinpathak (void)!freopen("input.txt", "r", stdin); (void)!freopen("output.txt", "w", stdout); #endif ios::sync_with_stdio(false); ci...
#pragma GCC optimize ("O2") #pragma GCC target ("avx2") #include<bits/stdc++.h> //#include<atcoder/all> //using namespace atcoder; using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) #define rep1(i, n) for(int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x)...
#include <bits/stdc++.h> using namespace std; typedef long long ll; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; } #define all(x) (x).begin(),(x).end() #define fi first #define ...
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vi> vvi; typedef set<int> si; typedef set<ll> sl; typedef queue<int> qi; typedef queue<ll> ql; typedef stack<int> sti; typedef deque<int> dqi; typedef priority_queue<int> pq...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long llp; #define mod 1000000007 #define deb(x) cerr << '\t' << "[" << #x << ": "<< x << "]\n"; #define f first #define s second #define pb push_back /* numeric_limits<llp>::max(); */ void solution(/*ll tc = 0*/); int main() {...
// Problem : D - Multiset Mean // Contest : AtCoder - AtCoder Regular Contest 104 // URL : https://atcoder.jp/contests/arc104/tasks/arc104_d // Memory Limit : 1024 MB // Time Limit : 4000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; int N, K; long l...
#include<bits/stdc++.h> using namespace std; #define inf 0x3f3f3f3f #define eps 1e-30 #define rep(i,l,r) for(int i=l;i<r;i++) #define rrep(i,r,l) for(int i=r-1;i>=l;i--) #define vi vector<int> #define vvi vector<vector<int> > #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define mod 1000000007 typedef ...
#include<bits/stdc++.h> #define ll long long #define ull unsigned long long #define ln "\n" using namespace std; //#define dbg(x) cout<<#x<<" = "<<x<<" " #define rep(i,s,n) for(ll i = (s);i<(n);++i) #define pc(x) __builtin_popcount(x) void DBG() { cerr << "]" << endl; } template<class H, class... T> void DBG(H h, T......
#include<bits/stdc++.h> #define mxn 100005 #define inf 1e9 using namespace std; int n, mem[mxn][26]; char str[mxn]; int dp(int pos, int ch) { if(pos==n)return inf; if(pos==n-1 && (str[n-1]-'a')!=ch)return 1; int &ret= mem[pos][ch]; if(ret!=-1)return ret; ret= dp(pos+1, ch); if((str[pos]-'a')!=c...
/* Author: Zcus Blog: https://cnblogs.com/zcus */ #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define pii pair<int, int> #define mp make_pair #define debug(x) cout << #x << " = " << x << endl #define For(i, x, y) for (int i = x; i <= y; i++) #define Rep(i, x,...
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define ll long long int #define sd(x) scanf("%lld",&x) #define sdi(x) scanf("%d",&x) #define sdc(c) scanf("%c",&c) #define inf 1000000000000000000ll #define pll pair<ll,ll> #define pii pair<int,int> #define fastio ios_base::sync_w...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) long long mod = 998244353; int main(){ int h, w; cin >> h >> w; vector<vector<int>> T(h + w - 1, vector<int>(3)); rep(i,h){ rep(j,w){ char c; cin >> c; if(c == 'R') T[i + j][0] =...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; typedef long long ll; int N, MAX_N = 2000001, idx = 0, MAX_LOG_V = 20; vector<vector<int>> edge(MAX_N), parent(MAX_LOG_V, vector<int>(MAX_N, -1)); vector<int> tp(MAX_N), l(MAX_N), r(MAX_N), par(MAX_N, -1), depth(MAX_N, 0); vec...
#include <map> #include <set> #include <stack> #include <queue> #include <deque> #include <cmath> #include <ctime> #include <bitset> #include <vector> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <algorithm> #define fi first #define se second #define il inline #define Ld double ...
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); int N, M; cin >> N >> M; vector<int> A(M), B(M); for(int i = 0; i < M; i++){ cin >> A[i] >> B[i]; A[i]--, B[i]--; } int K; cin >> K; vector<int> C(K), D(K); ...
#include<iostream> #include<string> #include<cstdio> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<ciso646> #include<random> #include<map> #include<set> #include<bitset> #include<stack> #include<unordered_map> #include<utility> #include<cassert> #in...
#include <iostream> #include <bits/stdc++.h> using namespace std; #define ll long long int #define ld long double #define MAX 205 #define MOD 998244353 #define INF 1e15 #define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define pi 3.14159265358979323846 #define Q ll MAXTEST; cin >> MAXTEST; for(ll TEST=1;TE...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll a, b; cin >> b >> a; ll m = 2*b+100; ll d = m-a; cout << d << endl; return 0; }
#include <bits/stdc++.h> using namespace std; /* 提出前に確認! - 配列は+10ぐらい余分にとっておく - setとmultisetを間違えない */ /* デバッグ時にチェック! - RE 配列の取りうる最大値、最小値を**すべて**チェックする */ int main(void) { long long n, k; cin >> n >> k; long long ans = 0; for (int B = 2; B <= 2 * n; B++) { if (2 <= B + k && B + k <= 2 * n) { long long A =...
#include<iostream> #include<string> #include<vector> #include<algorithm>//sort,reverse #include<utility>//pair #include<queue>//queue,priority_queue #include<deque>//double_ended queue #include<map>//map using namespace std; typedef long long LL; typedef pair<LL,LL> P;//Pでpair<-,->を表す。 const LL MAX=2000010; const LL M...
#include <bits/stdc++.h> #define arr array #define pb push_back #define fs first #define sc second #define eb emplace_back #define vt vector #define all(x) (x).begin(), (x).end() #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end...
#include<bits/stdc++.h> using namespace std; int main(){ int n,w,c=0; cin>>n>>w; int ans=0; while(ans<=n){ ans+=w; c++; } cout<<c-1; }
#include<bits/stdc++.h> using namespace std; int main() { int n, w; cin >> n >> w; cout << n / w; return 0; }
// AtCoder Templete #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 rrep(i, n) for (int i = (n) - 1; i >= 0; i--) #define loop(i, r, n) for (int i = (r); i < (n); i++) #define lloop(i, r, n) for (int i = (r) - ...
#include <bits/stdc++.h> using namespace std; const int O = 2e5 + 1; int t = 1; vector <int> c, dp, g[O], Max; int dfs(int u, int par = 0){ Max[u] = 1; for (int v : g[u]){ if (v == par) continue; dp[v] = dp[u] + 1; Max[u] = max(Max[u], dfs(v, u) + 1); } return Max[u]; } voi...
#pragma GCC optimize ("O3") #pragma GCC target ("sse4") #include<stdio.h> #include<iostream> #include<vector> #include<algorithm> #include<string> #include<string.h> #ifdef LOCAL #define eprintf(...) fprintf(stderr, __VA_ARGS__) #else #define NDEBUG #define eprintf(...) do {} while (0) #endif #include<cassert> using ...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> 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 co(x) cout << x << endl #define cosp(x) cout << x << " " using ll = long long; using ull = unsigned long long; int sub(int N){ vector<char>n; s...
/* これを入れて実行 g++ code.cpp ./a.out */ #include <iostream> #include <cstdio> #include <stdio.h> #include <vector> #include <string> #include <cstring> #include <queue> #include <deque> #include <stack> #include <algorithm> #include <utility> #include <set> #include <map> #include <unordered_map> #include <unordered_set...
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0; i < (n); i++) #define all(v) (v).begin(), (v).end() using ll = long long; using P = pair<ll,ll>; using vi = vector<int>; const ll INF = 1009009009009009009; int n; double PI = acos(-1); int main(){ cin >> n; double x,y; cin >...
#include <bits/stdc++.h> /* // using ASL (use make) #include <atcoder/all> using namespace atcoder; */ #define ALL(obj) begin(obj), end(obj) #define debug(x) cerr << #x << ": " << x << '\n' using namespace std; // 1次元 vector print template <class T> ostream &operator<<(ostream &s, vector<T> vec) { for (int i = 0; i...
//Author : Prakhar Asaiya #include<bits/stdc++.h> using namespace std; #define REP(i,a,b) for(ll i = a; i < b; ++i) #define REPN(i,a,b) for(ll i = a; i <= b; ++i) #define REPV(i,a,b) for(ll i = a; i >= b; --i) #define db1(x) cout<<#x<<"="<<x<<'\n' #define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n' #define db3(x,y...
/* "An anomaly, I'm Muhammad Ali Cause I know one day I'm gonna be the" - Greatest, Eminem */ #pragma GCC optimize ("O3") #pragma GCC target ("sse4") #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; typ...
// Problem: A - Long Common Subsequence // Contest: AtCoder - AtCoder Grand Contest 052 // URL: https://atcoder.jp/contests/agc052/tasks/agc052_a // Memory Limit: 1024 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) #include<bits/stdc++.h> using namespace std; #define int long long int mod...
#include <bits/stdc++.h> #define rep(i,n) for (int i=0; i<n; i++) #define ll long long #define VV(t) vector<vector<t>> using namespace std; using Graph = VV(int); const int INF = 1<<29; int factorial(int n) { if (n<=1) return 1; else return n*factorial(n-1); } int main() { int N; cin >> N; Graph G(N, vect...
#include <bits/stdc++.h> using namespace std; #pragma optimize("-O3") #define int long long int #define f first #define s second #define pb push_back #define endl '\n' #define T long double vector<vector<int>>adj; bool vis[105]; int cnt[105]; void dfs(int v){ vis[v]=1; cnt[v]++; for(auto u:adj[v]){ if(vis[u]){ ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; ll a[n]; for(int i=0; i<n; i++) cin >> a[i]; sort(a, a+n); ll ans=0, fs=0; for(int i=1; i<n; i++) { fs += abs(a[0] - a[i]); } ans = fs; for(int i=1; i < n...
#include <bits/stdc++.h> using u32 = uint32_t; using i64 = int64_t; using u64 = uint64_t; constexpr int P = 998244353; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int N; std::cin >> N; std::vector<int> a(N); for (int i = 0; i < N; i++) std::cin >> a[i]; std::sort(a.begin(), a.end()); ...
#pragma warning(disable:4996) #pragma comment(linker, "/STACK:336777216") #pragma GCC optimize("Ofast") #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <functional> using namespace std; using namespace __gnu_pbds; typedef long long ll; #define int long l...
#include <bits/stdc++.h> using namespace std; int main() { string s, ans = "No"; int slen; int num[10] = {}, dig[10] = {}, tem; bool flg; cin >> s; slen = s.size(); for ( int i = 0; i < slen; i++ ) { num[s[i] - '0'] ++; } for ( int i = 0; i < 1000; i+=8 ) { tem = i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef pair<int,int> pi; typedef pair<ll,ll> pl; #define F first #define S second #define endl '\n' #define all(x) (x).begin(),(x).end() #define sz(x) (int)(x).size() #ifdef dremix #define p(...
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int> A(N); for(int i = 0; i < N; i++){ cin >> A.at(i); } int ans = 0, rres = 0; for(int i = 2; i < 1001; i++){ int res = 0; for(int j = 0; j < N; j++){ if(A.at(j) % i == 0){ ...
#include<bits/stdc++.h> using namespace std; const int mod = 998244353; //const long long inf = 1e15; //const double Pi = acos(-1.0); typedef long long ll; typedef vector<int> vi; typedef vector<long long> vll; #define pb push_back #define mp make_pair #define F first #define S second #define all(x) x.begin(), x.end() ...
#include <bits/stdc++.h> #include <cmath> #include <algorithm> #include <vector> #include <string> using namespace std; #define rep(i, n) for (long long int i = 0; i < (n); i++) #define MOD 1000000007 typedef long long ll; typedef pair<ll, ll> P; int INF = 100000000; ll x[1000], y[1000], p[1000]; int main() { ll n, ...
#include <bits/stdc++.h> using namespace std; long long modpow(long long a, long long n, long long mod) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } // a= modpow(10, n, k) ; // 10^nのmod k を出す int main() { long b...
//================code===================// //#define TLE #ifdef TLE #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #endif #include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> #include <random> #include <ctime> #define ci(t) cin>>t #define co(t) ...
#include<bits/stdc++.h> #define ll long long using namespace std; map<long long, long long> mp; ll solve(ll x, ll y){ if(x == y)return 0; if(y < x){ return abs(x - y); } if(mp[y] != 0){ //cout << y << " " << dp[y] << endl; return mp[y]; } //cout << y << endl; ll...
/* 少加头文件,爆零两行泪 DP后效性,爆零两行泪 文件读入错,爆零两行泪 文件名写错,爆零两行泪 调完不编译,爆零两行泪 结论不证明,爆零两行泪 数组没开够,爆零两行泪 ll开 int,爆零两行泪 dp 没初值,爆零两行泪 深搜没边界,爆零两行泪 广搜忘出队,爆零两行泪 模数没看清,爆零两行泪 越界不特判,爆零两行泪 多测不清空,爆零两行泪 空间胡乱开,爆零两行泪 无向变有向,爆零两行泪 调试忘删除,爆零两行泪 文件不保存,爆零两行泪 题目提交错,爆零两行泪 */ #pragma GCC optimize("Ofast") #include<bits/stdc++.h> #define int long long #defin...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = (int)(a); (i) < (int)(b); (i)++) #define rrep(i, a, b) for (int i = (int)(b) - 1; (i) >= (int)(a); (i)--) #define all(v) v.begin(), v.end() typedef long long ll; template <class T> using V = vector<T>; template <class T> using VV = vector...
#include <bits/stdc++.h> #define var auto #define ll long long using namespace std; int n; int k; int mod; const int N_MAX = 100; const int M_MAX = 100; const int DAT_LEN = 100 * 100 * 100 / 2; const int TMP_LEN = 7; int tmp[TMP_LEN][DAT_LEN]; void multiple(int arr[DAT_LEN], int width, int k, int res[DAT_LEN]) {...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; N *= 2; vector<pair<int64_t, char>> P(N); bool ro = false, go = false, bo = false; for (int i = 0; i < N; i++) { cin >> P[i].first >> P[i].second; if (P[i].second == 'R') ro ^= true; if (P[i].sec...
// #pragma comment(linker, "/stack:200000000") // #pragma GCC optimize("Ofast") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include <bits/stdc++.h> using namespace std; using i128 = __int128_t; using u128 = __uint128_t; using u64 = uint64_t; //define #define int long long #defi...
#include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <vector> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <queue> #include <ctime> #include <cassert> #include <complex> #include <string> #include <cstring> #include <chrono> ...
#include <bits/stdc++.h> using namespace std; using ll=long long; using vin=vector<int>; using vll=vector<long long>; using vvin=vector<vector<int>>; using vvll=vector<vector<long long>>; using vstr=vector<string>; using vvstr=vector<vector<string>>; using vch=vector<char>; using vvch=vector<vector<char>>; using vbo=ve...
#include<iostream> #include<string> #include<iomanip> #include<cmath> #include<vector> #include<algorithm> #include<utility> using namespace std; #define int long long #define endl "\n" constexpr long long INF = (long long)1e18; constexpr long long MOD = 1'000'000'007; struct fast_io { fast_io(){ std::cin.tie(n...
#include <iostream> #include <cmath> #include <memory.h> using namespace std; typedef long long LL; int main() { int n; cin >> n; string s; LL ans = 1, p = 1; while (n--) { p <<= 1; cin >> s; if (s == "OR") { ans += p; } } cout << ans << endl; }
#include<iostream> #include<cstring> #include<algorithm> #include<cstdio> #define ll long long using namespace std; int main(){ double x1,x2,y1,y2; cin>>x1>>y1>>x2>>y2; double ans=(y1/(y1+y2))*(x2-x1)+x1; printf("%.8lf",ans); }
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vl = vector<ll>; using _lint = int; #define REP(i, n) for (_lint i = 0; i < (_lint)(n); i++) #define FOR(i, a, b) for (_lint i = (_lint)(a); i < (_lint)(b); i++) #def...
#include <bits/stdc++.h> using namespace std; typedef long long ll; void solve(){ ll n ; cin>>n; ll x = ((1.08)*(n)); if(x == 206){ cout<<"so-so"<<endl; } else{ if(x > 206){ cout<<":("<<endl; } else{ cout<<"Yay!"<<endl; } } } int main(){ solve(...
#include <bits/stdc++.h> #define loop(s, e, i) for (int i = s; i < e; ++i) #define print(s) cout << s << endl; #define DIV 1000000007 using namespace std; typedef long long ll; typedef unsigned long long ull; const ll INF = 1e18+7; ll ceildiv(ll a, ll b) { return (a+b-1)/b; } // 切り上げ ll floordiv(ll a, ll b) { retu...
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define mod 1000000007 void solve(){ int arr[4]; for(int i = 0;i<4;i++)cin>>arr[i]; sort(arr,arr+4); if(arr[0] + arr[1] + arr[2] == arr[3]){ cout<<"Yes"; }else if(arr[0] + arr[1] == arr[2] + arr[3]){ ...
#include<bits/stdc++.h> using namespace std; #define ll long long int int main(){ ll t,b,c,n,k; vector<int> a(4); for(int i=0;i<4;i++) cin>>a[i]; int flag=0; for(int i=1;i<15;i++){ int sum1=0,sum2=0; for(int j=0;j<4;j++){ if(i&(1<<j)) sum1+=a[j]; else sum2+=a[j]; } if(sum1==sum2){ flag=1; brea...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #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) #define all(obj) begin(obj), end(obj) #define allr(ob...
#include <bits/stdc++.h> #define int long long using namespace std; int32_t main(){ ios::sync_with_stdio(0); cin.tie(0); int n; cin>>n; string s; cin>>s; string t; while((int)t.size() < n+2) t+="110"; int ans=0; for(int i=0;i<3;i++){ if(s!=t.substr(i, n)) continue; ans+=...
#include <bits/stdc++.h> #define foreach(i,v) for(auto&& i: v) #define all(x) (x).begin(), (x).end() typedef std::vector< std::string > VS; typedef std::vector<int> VI; typedef long long ll; typedef std::pair<int, int> ii; template <class C> C& mini(C& a, C b) { if (b < a) a = b; return a; } template <class C> C& ma...
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; typedef unsigned long long ull; typedef long long ll; typedef long double ld; typedef vector <int> vi; typedef vector <ll> vll; typedef vector <string> vs; typedef vector <vector <int>> vvi; typedef vector <vll> vvll; typede...
#include<iostream> #include<algorithm> #include<vector> #include<queue> #include<stack> #include<string> #include<map> #include<set> #include<tuple> #include<cmath> #include<iomanip> using namespace std; typedef long long ll; typedef vector<ll> v; typedef vector<vector<ll>> vv; #define MOD 1000000007 #define INF 10...
#include <bits/stdc++.h> #define REP_(i, a_, b_, a, b, ...) \ for (int i = (a), END_##i = (b); i < END_##i; ++i) #define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__) #define ALL(x) std::begin(x), std::end(x) using i64 = long long; template<typename T, typename U> inline bool chmax(T &a, U b) { ret...
#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...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pdd; #define lc u << 1 #define rc u << 1 | 1 #define mid (t[u].l + t[u].r) / 2 #define INF 0x3f3f3f3f #define lowbit(x) x & (-x) #define mem(a, b) memset(a , b , sizeof(a)) #define FOR(i, x, n) for(int...
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <queue> #include <stack> #include <tuple> #include <cmath> #include <iomanip> #include <map> #include <cstring> #include <functional> #include <cctype> #include <locale> #include <complex> #define ll long long #define r...
#include <bits/stdc++.h> #define REP(i, s, n) for (int i = s; i < (int)(n); i++) #define ALL(a) a.begin(), a.end() #define MOD 1000000007 using namespace std; using ll = long long; int main() { int N, M; cin >> N >> M; vector<pair<int, int>> P(M); for (auto &[x, y] : P) cin >> x >> y; vector<int> X, Y...
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) #define rep2(i,x,n) for(int i=x; i<(n); i++) #define all(x) x.begin(),x.end() typedef long long ll; ll mod = 1000000007; ll inf = 1e18; int main(){ vector<int> a(4); rep(i,4) cin >> a[i]; for(int bit=0; bit<(1<<4); bi...
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0; i < n; ++i) using ll = long long; using P = pair<int,int>; int main() { int a,b,c,d;cin>>a>>b>>c>>d; int sum=a+b+c+d; if(sum%2==1){ cout<<"No"<<endl; } else{ int half=sum/2; if(half==a||half==b||half==c||half...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = int64_t; using pii = pair<int, int>; int main() { int n, x; cin >> n >> x; string s; cin >> s; for (int i = 0; i < n; i++) { x += s[i] == 'o' ? 1 : -1; x = max(x, 0); } cout << x << endl; }
#include<bits/stdc++.h> #define cases long long test;cin>>test;while(test--) #define f_io ios::sync_with_stdio(false); cin.tie(0) #define foi(a,n) for(long long i=a;i<n;i++) #define foj(a,n) for(long long j=a;j<n;j++) #define fok(a,n) for(long long k=a;k<n;k++) #define ll long long #define MOD 1000000007 #define INF 10...
// 問題の URL を書いておく // #include <bits/stdc++.h> using namespace std; //#define ENABLE_PRINT #if defined(ENABLE_PRINT) #define Print(v) \ do {\ cout << #v << ": " << v << endl; \ }while(0) #define PrintVec(v) \ do {\ for(int __i = 0; __i < v.size(); ++__i) \ { \ cout << #v << "[" << __i << "]: "...
#include <bits/stdc++.h> using namespace std; const int N = 4e5 + 7; int n, m; map<int,vector<int> > plcs; map<int,vector<int> > yplcs ; int xs[N], ys[N]; map<pair<int,int> ,int> gid; map<int,int> dp ; set<int> ans ; void solve(int i) { if(dp[i])return ; dp[i] =1 ; if(xs[i] == yplcs[y...
#include <stdio.h> long long power(long long a, long long b) { long long result = 1, i; for (i = 0; i < b; i++) { result *= a; } return result; } int main() { long long i = 1, j = 1, n, turn = 1;; scanf("%lld", &n); getchar(); while (1) { if (power(5, i) >= n) break; long long x = n - power(5, i); turn...
#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 = 20; const ll mod = 1e9 + 7; const ll inf = 1e18; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n; cin >> n; for (ll i = 3, x = 1; i <= n; i *...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, int> pli; typedef pair<int, ll> pil; typedef pair<ll, ll> pll; #define mp make_pair #define fr first #define sc second void solve() { int N; cin >> N; vector<int> A(N), B(N), P(N); for (i...
/* author : sgupta_2001 */ #include<bits/stdc++.h> using namespace std; using db = double; using ll = long long; using ld = long double; using ull = unsigned long long; //containers #define sz(x) int((x).size()) #define bg(x) begin(x) #define all(x) bg(x), end(x) #define rall(x) x.rbegin(), x.rend() #define sor(...
#include <bits/stdc++.h> using namespace std; #define ll long long #define FOR(i,a,b) for(int i=(a);i<(b);++i) #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 Graph vector<vector<int>>; #define iterG(next_v, G, v) for(auto next_v : G[v] #define ALL(...
#include <bits/stdc++.h> using namespace std; int ri() { int n; cin >> n; return n; } int main() { int h = ri(); int w = ri(); int x = ri() - 1; int y = ri() - 1; string s[h]; for (auto &i : s) cin >> i; int cnt = -3; for (int i = x; i < h && s[i][y] != '#'; i++) cnt++; for (int i = x; i >= 0 && s[i][y]...
//Author: stdout #pragma GCC optimize("O2") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; #define debug(x) cerr<<#x<<" = "<<x<<"\n"; #define lowbit(x) ((x)&-(x)) const int inf=0x3f3f3f3f; const double eps=1e-9; //const double pi=acos(-1.0...
#include "bits/stdc++.h" using namespace std; #define int long long #define pb push_back #define ppb pop_back #define pf push_front #define ppf pop_front #define all(x) (x).begin(),(x).end() #define uniq(v) (v).erase(unique(all...
#include<bits/stdc++.h> using namespace std; #define rep(i, a, n) for(int i = a; i < n; i++) #define all(A) A.begin(),A.end() #define an(A, n) A,A+n #define sz(a) int(a.size()) #define pu push #define pb push_back #define pob pop_back #define mp(a, b) make_pair(a, b) #define fi first #define se second #define is inse...
#include<bits/stdc++.h> using namespace std; #define FAST ios_base::sync_with_stdio(false);cin.tie(NULL); #define endl '\n' typedef long long ll; typedef pair<int,int> pii; /* #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> using namespac...
#include<bits/stdc++.h> #define int long long #define zmrl(x) signed((x).size()) #define ahen(x) (x).begin(),(x).end() #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; using pii = pair<int,int>; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); in...
/* ID: Trump TASK: LANG: C++ */ /* LANG can be C++11 or C++14 for those more recent releases */ #include <iostream> #include <fstream> #include <cstring> #include <algorithm> #include <cmath> #define sll(n) scanf("%lld",&n); #define sll2(a,b) scanf("%lld",&n); #define sll3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c); #defin...
#include <bits/stdc++.h> int main(){ char S, T; std::cin >> S >> T; if(S == 'Y'){ std::cout << (char)(T + 'A' - 'a') << std::endl; }else{ std::cout << T << std::endl; } return 0; }
#include <algorithm> #include <array> #include <cmath> #include <cstdint> #include <deque> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> using namespace std; using ll ...
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #incl...
#include<bits/stdc++.h> using namespace std; using ll=long long; using P=pair<ll,ll>; ll N,M; ll c[324]; ll dp[(1<<18)]; int main(){ cin>>N>>M; for(ll i=0;i<M;i++){ ll a,b;cin>>a>>b;a--;b--; if(a<b){c[N*a+b]=1;}else{c[N*b+a]=1;} }for(ll i=1;i<(1<<N);i++)dp[i]=N+1;dp[0]=0; vector<P>A((1<<N)); for(ll i=0;i<...
#include "bits/stdc++.h" using namespace std; #define max(a, b) (a < b ? b : a) #define min(a, b) ((a > b) ? b : a) #define mem(a,b) memset(a,(b),sizeof(a)) #define for0(a, c) for (int(a) = 0; (a) < (c); (a)++) #define forc(a, b, c) for (int(a) = (b); (a) <= (c); (a)++) #define forr(a, b, c) for (int(a) = (b); (...
#include <bits/stdc++.h> using namespace std; double n, x0, y00, x2, y2; int main(){ cin >> n >> x0 >> y00 >> x2 >> y2; double zx = (x0+x2)/2, zy = (y00+y2)/2; x0 -= zx; y00 -= zy; x2 -= zx; y2 -= zy; double theta = 180 - ((n-2)*180)/n; //theta = 360 - theta; double alpha = M_PI*theta/180; double x1 = x0*cos...
#include<bits/stdc++.h> using namespace std; int main(){ string S; cin >> S; int len = S.size(); if(len == 1){ int n = S.at(0) - '0'; if(n % 8 == 0){ cout << "Yes" << endl; }else{ cout << "No" << endl; } return 0; } if(len == 2){ int a = S.at(0) - '0'; int b = S.a...
#include<bits/stdc++.h> #define pb push_back #define mk make_pair #define ll long long #define ss second #define ff first #define mod 1000000007 #define w(x) ll x; cin>>x; while(x--) #define ps(x,y) fixed<<setprecision(y)<<x; #define fo(i, j, k, in) for (ll i=j ; i<k ; i+=in) #define re(i, j) fo(i, 0, j, 1) #define pi ...
#include <bits/stdc++.h> using namespace std; // Compile with "(g++) -std=c++11 -Wall -Wextra -Wconversion -Wshadow -Dcychien" #ifdef cychien #define debug(...) do {\ fprintf(stderr, "%s - %d : (%s) = ", __PRETTY_FUNCTION__, __LINE__, #__VA_ARGS__);\ _DO(__VA_ARGS__);\ }while(0) template<typename I> void _DO(I&&x...
#include "bits/stdc++.h" using namespace std; #define ll long long int int main(int argc, char const *argv[]) { ios::sync_with_stdio(false); cin.tie(nullptr); ll t, n, k; cin >> n; vector <ll> a, b; for (ll i = 1; i <= n; i++) { cin >> k; a.push_back(k); } for (ll i = 1; i <= n; i+...
/** * Author : Ujjawal Pabreja [cuber_coder] * Email : ujjawalpabreja99@gmail.com */ #include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" void Solve() { int l, r; cin >> l >> r; int n = r - l + 1; cout << (2 * l <= r ? n * (n - l) - n * (n - 1) / 2 + l * (l - 1) / 2 ...
#include<iostream> #include<algorithm> #include<string> #include<vector> #include<cmath> #include<map> #include<random> #include<iomanip> #include<queue> #include<stack> #include<assert.h> #include<time.h> #define int long long #define double long double #define rep(i,n) for(int i=0;i<n;i++) #define REP(i,n) for(int i=...
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <set> using namespace std; int main(){ long long n; cin >> n; vector<long long> a(n); set<long long> dup; multiset<long long> dupnum; for (long long i = 0; i < n; i++) { cin >> a[i]; dup.insert...
#include<bits/stdc++.h> #define int long long #define MOD 1000000007 #define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL) #define ll long long #define rep(i,a,b) for(int i=a;i< b;i++) #define endl "\n" #define all(a) a.begin(),a.end() #define pii pair<int,int> #define fr first #define sc second #define INF (i...
#include <bits/stdc++.h> #define rep3(i, s, n, a) for (long long i = (s); i < (long long)(n); i += a) #define rep2(i, s, n) rep3(i, s, n, 1) #define rep(i, n) rep2(i, 0, n) using namespace std; using ll = long long; using ull = unsigned long long; using P = pair<int, int>; using Pll = pair<ll, ll>; int main() { ...
#include <bits/stdc++.h> #define rep(i,n) for(ll i=0;i<n;++i) #define rrep(i, n) for(ll i=n-1;i>=0;--i) #define rep1(i, n) for(ll i=1; i<=n; ++i) #define repitr(itr,mp) for(auto itr=mp.begin();itr!=mp.end();++itr) #define ALL(a) (a).begin(),(a).end() template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}} ...
using namespace std; #include<iostream> int main(){ float a, b; cin >> a >> b; cout << a * (b / 100) << endl; return 0; }
#include "bits/stdc++.h" #include<algorithm> using namespace std; #define int long long #define pb push_back #define ppb pop_back #define pf push_front #define ppf pop_front #define all(x) (x).begin(),(x).end() #define uniq(v) (v).erase(uniq...
#include<bits/stdc++.h> #include <iomanip> using namespace std; #define pb push_back #define ll long long int #define pll pair<ll,ll> vector <int> g[102], gr[102]; int comp_size[102]; vector<bool> used; int num = 0; void dfs1 (int v) { used[v] = true; ++num; for (size_t i=0; i<...
#pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,mmx,avx") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define PB push_back #define MP make_pair #define endl "\n" #define fst first #define snd second const int UNDEF = -1; co...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A.at(i); A.at(i) %= 200; } int64_t count, ans = 0; for (int i = 0; i < 200; i++) { count = 0; for (int j : A) { if (i == j) count++; } a...
///* ***Bismillahir Rahmanir Rahim*** */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double dl; typedef unsigned long long ull; #define pb push_back #define PB pop_back #define nn "\n" #define O_O \ ios_base::sync_with_stdio(false); \ cin.tie(...
#include<bits/stdc++.h> using namespace std; int main(){int a,b,x,y;cin>>a>>b>>x>>y;if(a>b)a--; int p=min(2*x,y);p*=abs(a-b);p+=x;cout<<p<<endl;}
#pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx") #pragma GCC target ("avx2,fma") #pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> //#include <atcoder/all> #define F first #define S second #define int long ...
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <queue> #include <set> /* MACROS START */ #define input std::cin #define for2(i,n) for(int i=0; i<n; i++) #define for3(i,a,n) for(int i=a; i<n; i++) #define for4(i,a,n,s) for(int i=a; i<n; i+=s) using lint = long long int; using nam...
#pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define pi 3.141592653589793238 #define int long long #define ll long long #define ld long double using namespace __gnu_pbds; using namespace std; template...
#include <bits/stdc++.h> using namespace std; int main(){ long long N; cin >> N; long long Sa=0; vector<long long> V(N); for(int i=0;i<N;i++){ long long a,b; cin >> a >> b; Sa += a; V[i] = a*2+b; } sort(V.rbegin(),V.rend()); for(int i=0;i<=N;i++){ if(Sa<0){ cout << i << ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pll = pair<ll,ll>; using pld = pair<ld,ld>; using vll = vector<ll>; using vld = vector<ld>; #define _GLIBCXX_DEBUG #define rep(j, m) for (ll j = 0; j < (ll)(m); j++) #define rep2(i, l, n) for (ll i = l; i < (ll)(n); i++) #...
#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<algorithm> #include<cstdio> #define ll long long #define MaxN 200500 using namespace std; const ll INF=1ll<<60; struct Data{ll x;char c;}a[MaxN]; bool cmp(const Data &A,const Data &B) {return A.x<B.x;} int n,o[255];ll sav[255]; int main() { scanf("%d",&n);n*=2; for (int i=1;i<=n;i++){ scanf("%lld%s",&a...
#include<bits/stdc++.h> using namespace std; #define gc getchar_unlocked #define fo(i,n) for(i=0;i<n;i++) #define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1) #define ll long long #define si(x) scanf("%d",&x) #define sl(x) scanf("%lld",&x) #define ss(s) scanf("%s",s) #define pi(x) printf("%d\n",x) #define pl(x) printf(...
#include <bits/stdc++.h> using namespace std; const double pi = 3.14159265358979; #define setup\ cin.tie(0);\ ios::sync_with_stdio(false);\ cout << setprecision(20) << fixed; #define int long long int #define db double #define P pair<int,int> #define F first #define S second #define endl "\n" #define dtor(d...
#include <iostream> #include <vector> //#include <string> #include <algorithm> //#include <math.h> //#include <queue> //#include <stack> //#include <iomanip> // sometimes used //#include <set> //#include <map> //#include <numeric> //#include <list> //#include <deque> //#include <unordered_map> typedef long long LL; /...
// ----- In the name of ALLAH, the Most Gracious, the Most Merciful ----- #include<bits/stdc++.h> using namespace std; #define sim template < class c #define ris return * this #define dor > debug & operator << #define eni(x) sim > typename \ enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) { sim > stru...
#include <bits/stdc++.h> //#include <atcoder/all> //using namespace atcoder; using namespace std; #pragma region Macros using ll = long long; #define int ll using pii = pair<int, int>; using tiii = tuple<int, int, int>; template<class T = int> using V = vector<T>; template<class T = int> using VV = V<V<T>>; #define IO...
#include "bits/stdc++.h" using namespace std; #define int long long #define pb push_back #define ppb pop_back #define pf push_front #define ppf pop_front #define all(x) (x).begin(),(x).end() #define uniq(v) (v).erase(unique(all...
#include <bits/stdc++.h> #include <algorithm> #include <iostream> #include <stdlib.h> using namespace std; #define INF 1e9 #define PI 3.141592653589793238 #define N 1000000010 #define mod 1000000007 #define REP(inc, bgn, end) for(int inc=bgn; inc<end; inc++) typedef long long ll; int main() { ll n; cin>>n; ...
#include<bits/stdc++.h> using namespace std; int main() { int x,n; cin>>x; for(int i=1;i<=100000;i++) { if((x+i)%100==0) { cout<<i; return 0; } if(x%100==0) { break; } } cout<<"100"; return 0; }
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, s, n) for (int i = (s); i < (n); i++) using namespace std; using ll = long long; 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 > ...
#include <bits/stdc++.h> using namespace std; // ModIntR::set_mod() struct ModIntR { int x; ModIntR() : x(0) {} ModIntR(int64_t y) : x(y >= 0 ? y % mod() : (mod() - (-y) % mod()) % mod()) {} static int &mod() { static int mod = 0; return mod; } static void set_mod(int md) { mod() = md; } ModIntR ...
#include <bits/stdc++.h> const int MAXN = 200; int A[MAXN + 5], B[MAXN + 5]; int P[MAXN + 5], D[MAXN + 5]; bool Dp[MAXN + 5][MAXN + 5]; bool Check(int l, int r) { int mid = (l + r) >> 1, len = mid - l + 1; for (int i = l; i <= r; i++) { if (P[i]) { if (P[i] != -1) { if (P[i] < l || P[i] > r) return ...
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define gc getchar() #define pc(x) putchar(x) template<typename T> void scan(T &x){x = 0;bool _=0;T c=gc;_=c==45;c=_?gc:c;while(c<48||c>57)c=gc;for(;c<48||c>57;c=gc);for(;c>47&&c<58;c=gc)x=(x<<3)+(x<<1)+(c&15);x=_?-x:x;} template<typename T> void printn(T n...
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll inf=1000000000000000000,mod=1000000007; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif ll arr[4]; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<bool> vb; typedef map<int, int> mii; typedef pair<int, int> ii; #define INF 0x3f3f3f3f #define INFLL 0x3f3f3f3f3f3f3f3...
#include<bits/stdc++.h> //#include<atcoder/all> //using namespace atcoder; using namespace std; typedef long long ll; typedef long double ld; typedef pair< ll, ll > Pi; using vl = vector<ll>; using vs = vector<string>; using vvl = vector<vector<ll>>; #define rep(i,n) for(int i=0;i<(n);i++) #define rep2(i,n) for(int i=1...
#include <bits/stdc++.h> #include <iostream> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define speed \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define ll long long #d...
#include<bits/stdc++.h> using namespace std; using ll=long long; #define rep(i,n) for(int i=0;i<(int)n;i++) #define Rep(i,n) for(int i=0;i<=(int)n;i++) int main(){ ll n; int m; cin>>n>>m; if(m==0){ cout<<1<<endl; return 0; } vector<ll> a(m); for(int i=0;i<m;i++){ cin>>a.at(i); } sort(a.b...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int INFint = 1e9+1; const ll INFll = (ll)1e18+1; const int MOD=998244353; const ll MODD = 1000000007; #define rep(i,n) for(int i=0;i<n;i++) int main(){ ll t,p; cin>>t>>p; ll cnt=0; ll idt=0; vector<ll>ans; while(idt<=100)...
/* Author : Aditya Gupta Team : TechTurtle Date : 29-08-2020 Time : 20:05:54 */ #include<bits/stdc++.h> #define ll long long int #define ld long double #define vll vector<ll> #define vvll vector< vll > #define vld vector< ld > #define vvld vector< vld > #define pll pair<ll ,ll > #define vpll vector< pll > #define mp ...
#include <bits/stdc++.h> #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,j) for(int i=hd[j];i;i=nxt[i]) inline int read(){ int x=0,f=1;char c=getchar(); while(c<48||c>57){if(c=='-')f=-1;c=getchar();} while(c>=48&&c<=57)x=(x<<1)+(x<<3)+(c^4...
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; //using namespace atcoder; #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 mydeb(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__) //#define mydeb(fmt, ...) int main() { int64_t...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) //一次元配列に入力する関数 vin(n); vector<string> vin(int n) { vector<string> vec(n); for (int i = 0; i < n; i++) cin >> vec.at(i); return vec; } //一次元配列から順番に出力する関数 cout<<"a:";vout(a,n);cout<<endl; void vout(vector<long long>...
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long int ull; #define endl "\n" #define pb push_back #define sq(a) (a)*(a) #define all(x) (x).begin(), (x).end() #define debug(x) cerr<<#x<<'='<<(x)<<endl; #define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl; ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define int long long const int mod2 = 998244353; const int mod = 1e9+7; const int maxi = 4e3 + 2; int power(int a,int b){ int res = 1; while(b){ if(b&1LL)res = (res*a)%mod; a = (a*a)%mod; b/=2LL; } return res; }...
#include <bits/stdc++.h> #define int long long using namespace std; const int maxm=2e6+5; double d[maxm]; int n; void solve(){ cin>>n; d[n]=0; for(int i=n-1;i>=1;i--){ d[i]=d[i+1]+n*1.0/(n-i); } printf("%.10f\n",d[1]); } signed main(){ solve(); return 0; }
/** * author: Apiram * created: 06.03.2021 18:23:08 **/ #pragma GCC target ("avx2") #pragma GCC optimization ("O2") #pragma GCC optimization ("unroll-loops") #include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); double n; cin>>n; cout<<setprecision(15)<...
#include <bits/stdc++.h> using ld = long double; using vld = std::vector<ld>; using vvld = std::vector<vld>; using vvvld = std::vector<vvld>; using ll = long long; using vll = std::vector<ll>; using vvll = std::vector<vll>; using vvvll = std::vector<vvll>; using str = std::string; using vstr = std::vector<str>; templ...
#include <bits/stdc++.h> using namespace std; #define rep(i,a,n) for(int i=(a); i<(n); i++) #define rrep(i,a,n) for(int i=(a); i>=(n); i--) #define all(n) begin(n),end(n) #define rall(n) rbegin(n),rend(n) //#define yn(bool) if(bool){cout<<Yes<<endl;}else{cout<<No<<endl;} #define fore(i,a) for(auto &i:a) using ll = long...
#include<bits/stdc++.h> #define rep(i, n) for (int i = 0, length = n; i < length; i++) #define fi first #define se second #define lb lower_bound #define ub upper_bound #define ep emplace #define epb emplace_back #define scll static_cast<long long> #define sz(x) static_cast<int>((x).size()) #define pfll(x) printf("%lld...
#include<bits/stdc++.h> using namespace std; using Graph=vector<vector<int>>; void dfs(int v,vector<bool> &flag,Graph &g){ if(!flag[v]){return;} flag[v]=false; for(auto &nx : g[v]){dfs(nx,flag,g);} } int main(){ int n,res=0; cin >> n; vector<int> a(n); vector<bool> flag(200005,false); Graph g(200005)...
#include <string> #include <vector> #include<iostream> #include<cstdio> #include<cstdlib> #include<stack> #include<queue> #include<cmath> #include<algorithm> #include<functional> #include<list> #include<deque> #include<bitset> #include<set> #include<map> #include<unordered_map> #include<unordered_set> #include<cstring>...
#define MOD_TYPE 2 #pragma region Macros #include <bits/stdc++.h> using namespace std; #if 0 #include <boost/multiprecision/cpp_int.hpp> #include <boost/multiprecision/cpp_dec_float.hpp> using Int = boost::multiprecision::cpp_int; using lld = boost::multiprecision::cpp_dec_float_100; #endif #if 1 #pragma GCC target(...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; #define mp(a, b) make_pair(a, b) const int maxn = 2e5 + 10; pii a[maxn]; int main() { int n, k; scanf("%d%d", &n, &k); for(int i = 1; i <= k; ++i) scanf("%d%d", &a[i].first, &a[i].second); sort(a + 1, a + k + 1); unordered_set<int> s; s.ins...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <climits> #include <cstdlib> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> #define DEBUG 1 using namespace std; constexpr int kMod = 1000000007; typedef long lo...
#include <vector> #include <array> #include <stack> #include <queue> #include <list> #include <bitset> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <algorithm> #include <numeric> #include <iostream> #include <iomanip> #include <string> #include <chrono> #include <random> #inc...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define sz(v) ((int)(v).size()) #define all(v) ((v).begin()),((v).end()) #define allr(v) ((v).rbegin()),((v).rend()) #define pb push_back #define mp make_pair #define clr(v,d) mem...
#include <bits/stdc++.h> #define fi first #define se second #define rep(i,n) for(int i = 0; i < (n); ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) #define srep(i,s,t) for (int i = s; i < t; ++i) #define rng(a) a.begin(),a.end() #define sz(x) (int)(x).size() #define uni(x) x.erase(unique(rng(x)),x.end()) #defin...
#include <cstdio> #include <algorithm> const int N = 3e5 + 5; long long n, k, ans, d[N]; int x; int main(){ scanf("%lld%lld", &n, &k); for(int i = 1; i <= n; i++) { scanf("%d", &x); d[x] ++; } long long last = k; for(long long i = 0; i <= n; i++){ long long nl = std::min(last...
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main(void){ int N,K; cin >> N >> K; int T[N][N]; for(int i=0;i<N;i++)for(int j=0;j<N;j++){ cin >> T[i][j]; } vector<int> p; for(int i=0;i<N;i++){ p.push_back(i); } p.push_back(0);...
#include<bits/stdc++.h> #define For(a,b,c) for(int a=b;a<=c;++a) #define Dor(a,b,c) for(int a=b;a>=c;--a) using namespace std; typedef long long LL; int n,k; int S(int t) { int l=max(1,t-n),r=min(n,t-1); return max(r-l+1,0); } int main() { cin>>n>>k; LL s=0; For(i,1,n+n) { s+=1LL*S(i)*S(i+k); } cout<<s; retur...
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; //using namespace atcoder; int64_t synthesis(int num,int64_t x,vector<int> &a); const int64_t _infinity=(int64_t)1000000000000000000+1; int main() { int n; int64_t x; cin >> n >> x; vector<int> a(n); for (int i=0;i<n;++i) { cin >> a[i]; ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> pll; #define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i)) #define REP(i, n) FOR(i,n,0) #define OF64 std::setprecision(40) const ll MOD = 1000000007; const ll INF = (ll) 1e18 + 10; ll N, X; ll A[105]; ll S[105][105][105][105]...
#include <bits/stdc++.h> using namespace std; #define flush cout.flush using ll = long long; using ull = unsigned long long; using ld = long double; using pl = pair<ll, ll>; const ll INF = 1e9 + 7; const ll mod = 1e9 + 7; const ll mod2 = 998244353; const ld eps = 1e-9; const ld PI = acos(-1); void solve() { ll ...
#include<bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> PII; #define x first #define y second const int N = 2e5 + 10; int a[N], res[N], pos[N]; void Swap(int p, int &idx) { swap(pos[a[p]], pos[a[p + 1]]); swap(a[p], a[p + 1]); res[idx++] = p; } void solve() { int n; scanf("%d"...
#include <bits/stdc++.h> int main() { int N; std::cin >> N; std::vector<long long int> a(N), b(N); for (int i = 0; i < N; i++) { std::cin >> a[i]; } for (int i = 0; i < N; i++) { std::cin >> b[i]; } long long int max_a = 1, max_b = 1; long long int max = 1; // l...
#include<bits/stdc++.h> using namespace std; void __print(int x) {cout << x;}void __print(long x) {cout << x;}void __print(long long x) {cout << x;}void __print(unsigned x) {cout << x;}void __print(unsigned long x) {cout << x;}void __print(unsigned long long x) {cout << x;}void __print(float x) {cout << x;}void __print...
#include "bits/stdc++.h" using namespace std; // 定義 typedef long long ll; typedef pair<ll, ll> P; #define ALL(x) (x).begin(),(x).end() #define REP(i, n) for(ll i = 0 ; i < (ll)n ; ++i) #define REPN(i, m, n) for(ll i = m ; i < (ll)n ; ++i) #define VL vector<ll> #define...
#include<bits/stdc++.h> #define all(v) v.begin(), v.end() #define sz(x) (int)x.size() #define ini(x, y) memset(x, y, sizeof(x)); #define pb push_back #define fi first #define se second using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; const int MOD = (int)1e9 + 7; const in...
#include<bits/stdc++.h> using namespace std; using ll = long long int; using ld = long double; #define pow(n,m) powl(n,m); #define sqrt(n) sqrtl(n); const ll MAX = 5000000000000000000; const ll MOD = 1000000007; //998244353; void randinit(){srand((unsigned)time(NULL));} int main(){ ll A,B; cin >> A >> B; ve...
#include "bits/stdc++.h" using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); long long a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, m = 0, n = 0, p = 0, q = 0, mod = 1000000007, pi = 3.1415926535; string s1, s2; char moji; cin >> a; vector<long long> v(a); vector<vec...
//This Code was made by Chinese_zjc_. #include <iostream> #include <iomanip> #include <algorithm> #include <vector> #include <bitset> #include <cmath> #include <queue> #include <stack> #include <string> #include <cstring> #include <cstdio> #include <cstdlib> #include <map> #include <set> #include <time.h> // #include<w...
#include <bits/stdc++.h> #define rep(i,a) for (int i = 0; i < (a); i++ ) #define Rep(i,start,a) for (int i = start; i < (a); i++ ) #define ALL(vec) (vec).begin(), (vec).end() #define Sort(vec) sort((vec).begin(), (vec).end()) // 小さい順 #define SORT(vec) sort((vec).begin(), (vec).end(), [](int a, int b){return a>b;}) // 大...
#define _USE_MATH_DEFINES #include <iostream> #include <string> #include <vector> #include <math.h> #include <functional> #include <array> #include <algorithm> #include <iomanip> using namespace std; int main() { int a, b, c; int total = 0; cin >> a >> b >> c; if (a == b) { cout << c; } else if (a == c) ...
#include<bits/stdc++.h> #define llu unsigned long long int #define ll long long #define l1 int #define u_m unordered_map #define M map #define sort1(s) sort(s.begin(),s.end()) #define pb(x) push_back(x) #define yes cout<<"YES"<<endl; #define no cout<<"NO"<<endl; #define answer cout<<ans<<endl; #define Sum cout<<sum<<...
#include<bits/stdc++.h> using namespace std; #define int long long // typedef long long int; int const N = 4e6 + 10, mod = 1e9 + 7; int fact[N], infact[N]; int n, m, k; int qmi(int a, int k, int p) { int res = 1; while (k) { if (k & 1) res = res * a % p; k >>= 1; a = a * a % p; } ...
#include <bits/stdc++.h> using namespace std; const long long MOD = 998244353; long long fact[400005]; long long inv[400005]; long long invFact[400005]; long long powmod(long long a, long long b){ long long ans = 1%MOD; a %= MOD; while(b){ if(b&1){ans = (ans*a)%MOD;} b >>= 1; a = ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> iint; typedef pair<ll,ll> llll; #define ALL(x) (x).begin(),(x).end() const ll zero = 0; const ll one = 1; const ll INF = 9223372036854775807; //10^18 const int inINF = 2147483647; //10^9 const ll MO...
#include<iostream> #include<bits/stdc++.h> #include <vector> //#include <string> using namespace std; int main(){ vector <int> number; int a; cin>>a; number.push_back(a); cin>>a; number.push_back(a); cin>>a; number.push_back(a); sort(number.begin(),number.end()); if(abs(number[0]-number[1])==abs(num...
#include<bits/stdc++.h> #define p 998244353 using namespace std; int n; long long a[200005],ans,sum; int main() { scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%lld",&a[i]); sort(a+1,a+n+1);sum=0; for(int i=1;i<=n;i++) { sum=(sum*2+a[i-1])%p; ans=(ans+a[i]*sum%p+a[i]*a[i]%p)%p; } printf("%lld",ans); }
#include <bits/stdc++.h> #include <bits/extc++.h> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef double db; typedef string str; typedef pair<int,int> pi; typedef pair<ll,ll> pl; typedef pair<db,db> pd; typedef vector<int> vi; typedef vector<ll> vl; typ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define MOD int(1e9+7) #define INF int(1e9) #define LINF ll(1e18) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define P pair<ll,ll> ll gcd(ll m, ll n) {//最大公約数 if (n == 0)return m; return gcd(n, m % n); }//gcd long long modinv(long l...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author houghstc */ #include <iostream> #include <fstream> #include <iostream> #include <vector> #include <deque> #include <unordered_map> #include <unordered_set> #include <map> #include <set> #include <queue> #include <stac...
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<n; i++) typedef pair<int,int> P; typedef long long ll; const int INF = 1001001001; const ll INFL = 1e17; const int MOD = 1e+9+7; int main(){ int n; string s; cin >> n >> s; string ss=""; int ans = 0; for(int i=0; i<n; i++){ if(s[i]=...
#include <cstdio> #include <cstring> #include <iostream> #define int long long typedef long long ll; typedef unsigned long long ull; using namespace std; template <class T> T read(T &num) { T x = 0, f = 1; char ch = getchar(); while (ch > '9' || ch < '0') { if (ch == '-') { f = -1...
#include <math.h> #include <algorithm> #include <array> #include <bitset> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <sstream> #include <vector> using namespace std; using Graph = vector<vector<int>>; using ll = long long; typedef pair<ll, ll> P_ll; typedef pair<int, int> P; con...
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < n; ++i) #define rep_up(i, a, n) for (ll i = a; i < n; ++i) #define rep_down(i, a, n) for (ll i = a; i >= n; --i) #define P pair<ll, ll> #define all(v) v.begin(), v.end() #define fi first #define se second #define v...
#include <bits/stdc++.h> #include <fstream> using namespace std; typedef long long int64; typedef vector<int> vec; typedef vector<int64> vec64; // string __fname = ""; // ifstream in (__fname + ".in"); // ofstream out (__fname + ".out"); // #define cin in // #define cout out #define ss cout << " "; ...
#include<stdio.h> int main(void) { int n; scanf("%d",&n); printf("%d\n",(n-1)/100+1); return 0; }
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <queue> #include <map> #include <sstream> #include <cstdio> #include <cstring> #include <numeric> #include <cmath> #include <iomanip> #include <deque> #include <bitset> #include <cassert> #include <unordered_set> #inclu...
#include <bits/stdc++.h> using namespace std; int main(){ int n,w; cin >> n >> w; int ans = n / w; cout << ans << endl; return 0; }
#include<bits/stdc++.h> #define int long long using namespace std; const int N=200005; int n,m,a[N],b[N],s[N],t[N],ans=1e18; signed main() { ios::sync_with_stdio(false); cin>>n>>m; for(int i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+n+1); for(int i=1;i<=m;i++) cin>>b[i]; sort(b+1,b+m+1); for(int i=2;i<=n-1;i+=2) s...
#include <bits/stdc++.h> #define yala ios::sync_with_stdio(0); cin.tie(0); ios_base::sync_with_stdio(0); #define RW freopen("input.txt","r",stdin), freopen("output.txt","w",stdout); #define ll long long #define ld long double using namespace std; const ll N = 4e5 + 5; const ll INF = 1e18; const int mod = 1e9 + 5; const...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #ifndef aa #define trace(...) #define endl '\n' #endif #define pb push_back #de...
#include <bits/stdc++.h> using namespace std; template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } #define rep(i, n) for (int i = 0; i < (int)(n); i++) const long long LINF = 1LL << 60; struct Edge { int to; long long w; Edge(int arg_to, long long arg_w) : to(arg_to), w(a...
#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() #define fi first #define se sec...
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(ll i=0;i<(ll)n;i++) #define dump(x) cerr << "Line " << __LINE__ << ": " << #x << " = " << (x) << "\n"; #define spa << " " << #define fi first #define se second #define ALL(a) (a).begin(),(a).end() #define ALLR(a) (a).rbegin(),(a).rend() using ld =...
#include <bits/stdc++.h> using namespace std; int main(){ int k,l,m; long long n; cin>>n>>k; string s=""; for(int i=1; i<=k; i++){ if(n%200==0) n=n/200; else { n=n*1000+200; } } cout<<n; }
#include<bits/stdc++.h> #define lol long long using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); float ans,a,b; cin>>a>>b; ans=a*b/100; cout<<ans<<endl; return 0; }
// C++(GCC 9.2.1) #include <bits/stdc++.h> using namespace std; using LL = long long; #define repex(i, a, b, c) for(int i = a; i < b; i += c) #define repx(i, a, b) repex(i, a, b, 1) #define rep(i, n) repx(i, 0, n) #define repr(i, a, b) for(int i = a; i >= b; i--) const LL MOD = 998244353; int board[1010][1010]; // マスの色...
/** * author: shu8Cream * created: 26.04.2021 20:04:07 **/ #include <bits/stdc++.h> #include <chrono> using namespace std; #define rep(i,n) for (int i=0; i<(n); i++) #define all(x) (x).begin(), (x).end() using ll = long long; using P = pair<int,int>; using vi = vector<int>; using vvi = vector<vi>; using namespa...