code_file1
stringlengths
87
4k
code_file2
stringlengths
85
4k
#include <iostream> #include <string.h> #include <algorithm> #include <iomanip> #include <cmath> #include <map> using namespace std; #include <vector> #include <queue> #include <numeric> #define MM (1000000000 + 7) typedef unsigned long long ull; int N, Q; string S; int T, A, B; string ans; int main() { ios::sync_w...
#include <cassert> #include <cctype> #include <cerrno> #include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #inc...
#include<bits/stdc++.h> #define ll long long int #define pll pair<ll,ll> #define vpll vector< pll > #define mpll map<ll,ll> #define MOD 1000000007 #define all(v) v.begin(),v.end() #define s(v) v.size() #define test ll t;cin>>t;while(t--) #define vec vector<ll> #define read0(v,n) for(int i=0;i<n;i++)cin>>v[i]; #define r...
#include<bits/stdc++.h> #define ll long long #define pb push_back #define e "\n" #define fl(x,n) for(ll i=x;i<=n;i++) #define fl2(x,n) for(ll i=x;i>=n;i--) using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int a,b; cin >> a >> b; if(a>b) {...
#include <bits/stdc++.h> #define fi first #define se second #define sz(a) (int)(a).size() #define all(a) (a).begin(), (a).end() #define reset(a,v) memset((a), v, sizeof(a)) using namespace std; typedef long long ll; typedef pair<int,int> ii; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<ii> vii; co...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t=1; // cin>>t; while(t--){ int n,k; cin>>n>>k; int a[n]; int count[n]={0}; for(int i=0;i<n;i++){ cin>>a[i]; count[a[i]]++; } priority_queue<int, vector<int>, ...
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;++i) #define all(x) (x).begin(),(x).end() using namespace std; constexpr int INF = 1e9, MOD = 1e9 + 7; constexpr int64_t LINF = 5e18, LMOD = 998244353; // #include <atcoder/all> // using namespace atcoder; // const int dy[]={0,-1,0,1,1,-1,-1,1}; // const int dx[...
#include<bits/stdc++.h> typedef long long int ll; typedef long double ld; typedef std::vector<ll> vi; typedef std::vector<std::vector<ll> > vv; typedef std::vector<std::pair<ll,ll> > pii; #define mod 1000000007 #define IO ios_base::sync_with_stdio(false);cin.tie(NULL); #define fo(i,a,b) for(i=a;i<b;i++) #define f...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author aajisaka */ #include<bits/stdc++.h> using namespace std; void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...
#include <bits/stdc++.h> using namespace std; #define m_p make_pair #define all(x) (x).begin(),(x).end() #define sz(x) ((int)(x).size()) #define fi first #define se second typedef long long ll; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); mt19937 rnf(2106); const int N = 100005; int n, d; int a...
#define _CRT_SECURE_NO_WARNINGS #include <fstream> #include <iostream> #include <vector> #include <algorithm> #include <string> #include <set> #include <math.h> #include <map> #include <deque> #include <iomanip> #define ll long long #define ld long double using namespace std; void solve() { ll L, R; cin >> L...
/* Description @authors Magneto @date 2021-02-13 17:36:16 @version */ #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 pb pu...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #pragma GCC optimize("Ofast") #pragma GCC target("avx2") using namespace std; using namespace __gnu_pbds; #define int long long #define real long double #define f first #define s second #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> b(N+1); vector<vector<int> > iap(N+1, vector<int>(3)); vector<int> who_has(N+1); vector<int> who_is(N+1); vector<pair<int, int> > ans; for (int i = 1; i < 3; i++) { for (int j = 1; j < N+1; j++) cin >> iap.at(...
#include <bits/stdc++.h> using namespace std; #define int long long #define M 998244353 int binary_expo(int a,int b) { int res=1; while(b>0) { if(b&1>0) { res=(((res%M)*(a%M))%M); } b=b>>1; a=(((a%M)*(a%M))%M); } return res; } int inv(int a,int b) ...
// // main.cpp // #include <algorithm> #include <array> #include <assert.h> #include <complex> #include <iomanip> #include <iostream> #include <limits> #include <inttypes.h> #include <map> #include <math.h> #include <memory> #include <memory> #include <queue> #include <random> #include <set> #include <stdio.h> #inclu...
// E - Lamps #include <bits/stdc++.h> using namespace std; using ll = int64_t; using vi = vector<int>; using vvi = vector<vi>; #define rep(i,n) for(int i=0;i<(int)(n);++i) #define irep(i,s) for(int i=(int)(s);i>=0;--i) int main(){ int h, w; cin>>h>>w; int k = h * w; vector<string> S(h); rep(i, h){ cin>>S[i]; r...
#include<bits/stdc++.h> using namespace std; #define GODSPEED ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15); #define f first #define s second #define newl cout<<"\n"; #define pb push_back #define mset(...
#include<bits/stdc++.h> using namespace::std; const int N = 2000 + 5; int gcd(int a, int b){ while(b){ a %= b; swap(a, b); } return a; } int n; int a[N]; int solve(){ map<int, int> G; for(int i = 1; i <= n; i++){ for(int j = 1; j * j <= a[i]; j++){ if(a[i] % j == 0){ if(G.count(j)) G[j] = gcd(G[j]...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; const ll MOD = 1e9+7; const ll INF = 1e18; #define rep(i,m,n) for(ll i = (m); i <= (n); i++) #define zep(i,m,n) for(ll i = (m); i < (n); i++) #define rrep(i,m,n) for(ll i = (m); i >= (n); i--) #define print(x) cout << (x) << end...
#include<bits/stdc++.h> using namespace std; using ll = long long; using vs = vector<string>; using vi = vector<int>; using vl = vector<ll>; using vb = vector<bool>; using pi = pair<int, int>; using pl = pair<ll, ll>; using vpi = vector<pair<int, int>>; using vpl = vector<pair<ll, ll>>; using ld = double; #define sz(...
//in dp prefix suffix sum helps.. #include<iostream> #include<vector> #include<string.h> #include<algorithm> #include<iomanip> #include<cmath> #include<stack> #include <iterator> #include <map> #include<list> #include <fstream> #include<unordered_map> #include<set> #include<queue> #define int long long #define double ...
#include <iostream> #include <algorithm> using namespace std; const int kMaxN = 1e5 + 1; struct E { int y, n; } e[2 * kMaxN]; struct V { int c, et; } a[kMaxN]; int n, p, v[kMaxN]; bool s[kMaxN]; void A(int i, int x, int y) { e[i] = {y, a[x].et}; a[x].et = i; } void D(int x, int f) { s[x] = !v[a[x].c]++...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define f(i,a,b) for(ll i=a;i<b;i++) #define F first #define S second #define pb push_back #define endl '\n' #define ce(ele) cout<<ele<<' ' #define CASE(t) int t; cin>>t; while(t--) #define sor(v) sort(v.begin(),v.end()) #define rev(v) reverse(v.be...
#include<bits/stdc++.h> using namespace std; const int inf = 1e9; bool mini(int &a, int b) { if (a > b) { a = b; return 1; } return 0; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); //freopen("input.txt","r",stdin); int n, m; cin >> n >> m; vector<vector<int> > adj(n); for (...
#include <bits/stdc++.h> // #include <atcoder/all> // #include "icld.cpp" using namespace std; using ll = long long int; using pii = pair<int,int>; using vi = vector<int>; using vll = vector<ll>; using vvi = vector<vector<int>>; using ss = string; using db = double; const int dx[4] = {1,0,-1,0}; const int dy[4] = {0,1,...
/************************************************************************* > File Name: 2.cpp > Author: Knowledge_llz > Mail: 925538513@qq.com > Blog: https://blog.csdn.net/Pig_cfbsl > Created Time: 2020/10/24 21:01:12 ************************************************************************/ #include<iostream>...
#include <iostream> #include <vector> #include <map> #include <set> #include <queue> #include <algorithm> #include <string> #include <cmath> #include <cstdio> #include <iomanip> #include <fstream> #include <cassert> #include <cstring> #include <unordered_set> #include <unordered_map> #include <numeric> #include <ctime>...
#include<bits/stdc++.h> using namespace std; using ll=long long; ll mod=1000000007; int main(){ ll N; cin >> N; set<ll> P; for(ll a=2;a*a<=N;a++){ ll j=a*a; while(j<=N){ P.insert(j); j*=a; } } cout << N-P.size() << endl; }
#include "bits/stdc++.h" using namespace std; #define int long long #define pb push_back #define f(i,a,n) for(int i=a ; i<n ; i++) #define rf(i,n,a) for(int i=n ; i>=a ; i--) #define F first #define S second #define all(c) (c).begin(),(c).end() #define sz(v) (int)(v).size() #define fast ios::sync_with_stdio(0); cin.ti...
#include <bits/stdc++.h> #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; #define ll long long #define INF 9999999999999999 #define rep(i,m,n) for(ll i = m;i < n;i++) #define rrep(i,m,n) for(ll i=m-1;i>=n;i--) #define pb(n) push_back(n) #define UE(N) N.e...
#include<bits/stdc++.h> using namespace std; #define gc c=getchar() #define r(x) read(x) #define ll long long #define db double template<typename T> inline void read(T&x){ x=0;T k=1;char gc; while(!isdigit(c)){if(c=='-')k=-1;gc;} while(isdigit(c)){x=x*10+c-'0';gc;}x*=k; } ll n,k; inline ll calc(ll x){ ...
#include<bits/stdc++.h> using namespace std; void solve() { int a,b; cin >> a >> b; int mx=0; for (int k=1; k<=b; k++) { int z = (a+k-1)/k; int first = z*k; int second = (z+1)*k; if (first>=a && second<=b) mx = k; } cout << mx; } int main() { int t=1; //cin >> t; wh...
#if _local #define _GLIBCXX_DEBUG #endif #include<bits/stdc++.h> using namespace std; struct fastio{fastio(){cin.tie(nullptr);ios_base::sync_with_stdio(false);std::cout<<std::fixed<<setprecision(10);}}oitsaf; #define rep(i,n) for(int i=0;i<int(n);++i) using i64 = int64_t; using pll = std::pair<int64_t,int64_t>; const...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second typedef long long ll; typedef pair<int,int> ii; const int N = 3e5; const int INF = 1e9; int n, k; int st[4*N], lz[4*N]; void prop(int idx, int l, int r) { if (lz[idx] == 0) return; st[idx] += lz[idx]; if (l < r) { l...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using ll = long long; using ld = long double; #define FOR(i, a, b) for(ll i = (ll)(a); i < (ll)(b); i++) #define rep(i, n) FOR(i, 0, n) #define rFOR(i, a, b) for(ll i = (ll)(a - 1); i >= (ll)(b); i--) #define rrep(i, a) rFOR(i, a, 0) #define pb push_back using namespace s...
/* _/_/_/_/ _/_/_/_/_/ _/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/_/_/_/ _/_/ _/_/_/_/_/ _/_/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/_/ _/ _/ _/_/ ...
# include <bits/stdc++.h> # define ll long long # define db double # define ld long double # define pb push_back # define fir first # define sec second # define rep(i, l, r) for (int i = l; i <= r; i++) # define per(i, r, l) for (int i = r; i >= l; i--) using namespace std; const int N = 200010; typedef pair <int, int>...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<long long> v(n); for (auto &x : v) cin >> x; long long ans = 0; sort(v.begin(), v.end()); for (long long i = 0; i < n; ++i) { ans += i * v[i] - (n - i - 1) * v[i]; }...
#include<bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> #define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0...
#include <bits/stdc++.h> #define int long long #define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0) using namespace std; const unsigned int M = 1e9 + 7; int32_t main() { fastio; int x; cin >> x; if(x <= 0) cout << 0; else cout << x; return 0; }
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <cstring> #include <math.h> #include <bitset> #include <queue> #include <set> #include <iomanip> #include <assert.h> #include <cstdio> // #include<bits/stdc++.h> using namespace std; typedef long long ll; constexpr long long int INFLL =...
#include<bits/stdc++.h> using namespace std; inline int read(){ int x=0,f=1;char ch=getchar(); while(!isdigit(ch)){if(ch=='-')f=-f;ch=getchar();} while(isdigit(ch)){x=x*10+ch-48;ch=getchar();} return x*f; } int n,k; char c[110]; signed main(){ n=read(),k=read(); cin>>(c+1); for(int i=1;i<=k;i++...
#include <bits/stdc++.h> using namespace std; int main() { int n,k; string s; bool winner[4][4] = {{true,false,true,false},{false,false,false,false},{false,false,true,true},{true,false,false,true}}; string win; cin >> n >> k >> s; while(k--) { int len = s.size(); if(len & 1) ...
#include <bits/stdc++.h> #include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){//main_program int H,W,X,Y; int count = 1; cin >> H >> W >> X >> Y; vector<vector<char>> data(H, vector<char>(W)); for(int i = 1;i<=H;i++){ for(int l = 1;l<=W;l++){ cin >> data.at...
#include<bits/stdc++.h> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define HUGE_NUM 4000000000000000000 //オーバーフローに注意 #define MOD 1000000007 #define EPS 0.000000001 using namespace std; #define SIZE 200005 struct Info{ Info(){ kei = value = 0; } Info(double arg_kei...
#include <bits/stdc++.h> using namespace std; long long rev(long long num) { int digit, rev = 0; do { digit = num % 10; rev = (rev * 10) + digit; num = num / 10; } while (num != 0); return rev; } long long deleteTrail(long long num) { num = rev(num); num = rev(num)...
#include<bits/stdc++.h> using namespace std; int main () { int i,f=0,p=0; string s,s1; cin>>s; for(i=s.size()-1; i>=0; i--) { if(s[i]!='0') break; else if(s[i]=='0') p++; } for(i=1; i<=p; i++) { s1+='0'; } //cout<<s1<<endl; for...
#include<bits/stdc++.h> using namespace std; int main(){ long long L,S=1;cin>>L; for(int X=1;X<12;X++){ S*=L-X;S/=X; } cout<<S<<endl; }
#pragma GCC optimize("Ofast") #include<bits/stdc++.h> #include<iostream> #include<cmath> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define mod 1000000007 #define one(x) __builtin_popcountll(x) #define zero(x) __builtin_ctzll(x) #d...
#include <bits/stdc++.h> using namespace std; // #include <atcoder/all> // using namespace atcoder; // #define int long long #define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i) #define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps...
#include<bits/stdc++.h> using namespace std; const int maxn = 1e6+1; long long st[maxn], tot; long long ts[maxn], cnt; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; string s, t; cin >> s >> t; for(int i = 1; i <= n; ++ i) { if (s[i-1] == '0') st[++to...
#include <bits/stdc++.h> using namespace std; #include <math.h> #include <iomanip> #include <cstdint> #include <string> #include <sstream> template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if ...
#include <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; typedef long long ll; const int maxn=2e3+9; const int MAX=6e5+9; const int MAX1=5e6+9; const int INF=0x3f3f3f3f; const double ep=1e-8; const double ep1=1e-4; const int mod=998244353; const double inf=1e20; const double pi=acos(-1); #define debug1 puts("?"); #define debug(x) ...
#include <iostream> #include <math.h> #include <numeric> #include <vector> #include <utility> #include <algorithm> #include <map> #include <queue> #include <queue> #include <stack> #include <sstream> #include <set> typedef long long ll; const int dx[8]={1,0,-1,0,1,-1,-1,1}; const int dy[8]={0,1,0,-1,1,1,-1,-1}; cons...
#include<bits/stdc++.h> using namespace std; const int N = 2e5 + 7; typedef long long ll; const ll mod = 1e9 + 7; string s; int k, a[N], n; int work(int x) { int ans = 0; while (x) { if (x & 1) ans++; x = x / 2; } return ans; } ll dp[N][20]; ll dfs(int p, int stat, int limit) { in...
#include <cstdio> #include <cstring> #define ll long long using namespace std; const ll mod=1e9+7; ll f[200010][17][2][2],ans;int k,n,a[200010]; char s[200010]; int num(int x) { if(s[x]<='9'&&s[x]>='0') return s[x]-'0'; return s[x]-'A'+10; } ll dfs(int pos,int st,int maxx,bool zero) { int cnt=__builtin_popc...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define al(a) a.begin(), a.end() #define ral(a) a.rbegin(), a.rend() #define sz(a) (int)a.size() using C = complex<double>; C inC() { double x, y; cin >> x >> y; return C(x, y); } int main() { int n; cin >> n; C s...
#define rep(i, n) for(int i = 0; i < (int)(n); i++) #define repr(i, n) for(int i = ((int)(n) - 1); i >= 0; i--) #define repn(i, n) for(int i = 1; i <= (int)(n); i++) #define reprn(i, n) for(int i = ((int)(n)); i > 0; i--) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define LARGE_PRIME...
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; #define ll long long ll pwmd(ll a, ll n) { if(n == 0) return 1; ll tmp = pwmd(a, n / 2); tmp = (tmp * tmp) % MOD; return (n % 2 == 0 ? tmp : tmp * a % MOD); } int main() { ll n, m, k; cin >> n >> m >> k; vector<ll> fact(n...
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define Pr pair<ll,ll> #define Tp tuple<ll,ll,ll> using Graph = vector<vector<int>>; ll mod = 1000000007; template< typename flow_t > struct Dinic { const flow_t INF; struct edge { int to; flo...
#include <bits/stdc++.h> using namespace std; template<typename T> void out(T x) { cout << x << endl; exit(0); } #define watch(x) cout << (#x) << " is " << (x) << endl using ll = long long; const int maxn = 1e6 + 5; int n, k; vector<int> g[maxn]; int limit; int used; // farthest needs, town reach ...
/* ** ** ****** ****** ****** ** ****** *** ** ** ** ** ** ** ** ** ** ** ** ********* **\../** ****** ****** ** ** ****** ** ** *** ** ** ** ** ** ** ** ** ** ** ** ** ***** ** ** ** ** ** ** ** ****** ****** ****** ***** */ #include <bits/stdc+...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define MAXN (1000005) int main() { ios_base::sync_with_stdio(false);cin.tie(0); ll a,b,c,d; cin>>a>>b>>c>>d; ll minimum = min(a,b); minimum = min(minimum,c); minimum = min(minimum,d); cout<<minimum<<'\n'; }
#include <bits/stdc++.h> using namespace std; const long long mod1 = 1000000007; using ll = long long; long long pow(long long x,long long n){ long long ans = 1; while(n != 0){ long long a = x; long long z = 1; while(z*2 <= n){ a *=a; a=a%mod1; z*=2;...
#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> #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; using ll = long long; using P = pair<int,int>; const string a = "atcoder"; void solve(){ string s; cin >> s; if(s > a){ cout << 0 << endl; return; } string t = s; sort(t.rbegin(), t.rend...
#include <bits/stdc++.h> #define f first #define s second #define fore(i,a,b) for(int i = (a), ThxMK = (b); i < ThxMK; ++i) #define pb push_back #define all(s) begin(s), end(s) #define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define sz(s) int(s.size()) #define ENDL '\n' #define vv(type, name, h, ...) vec...
#include<bits/stdc++.h> using namespace std; int main() { int n, x; cin>>n>>x; string s; cin>>s; for(char c : s){ if(c == 'o'){ x++; } else{ x = max(0, x-1); } } cout<<x; return 0; }
#include <bits/stdc++.h> using namespace std; typedef long long i64; typedef unsigned long long ui64; typedef vector<i64> vi; typedef vector<vi> vvi; typedef pair<i64, i64> pi; #define pb push_back #define sz(a) i64((a).size()) #define all(c) (c).begin(), (c).end() #define REP(s, e, i) for(i=(s); i < (e); ++i) inlin...
#include <iostream> #include <vector> #include <map> #include <algorithm> #include <cmath> #include <string> #include <iomanip> #include <deque> #include <queue> #include <stack> #include <set> #include <complex> #include <ctime> #include <bitset> // #include <atcoder/all> #include <fstream> #include <random> #include ...
#include <cmath> #include <iostream> #include <list> #include <map> #include <set> #include <stack> #include <utility> #include <vector> #define DEBUG_PRINT(n) \ (cout << "L" << __LINE__ << " " << #n << " = " << n << endl) #define LOOP(n) for (int _i = 0; _i < (n); _i++) #define REP(i, n) for (int i = 0; i < (n);...
#include <bits/stdc++.h> #define int long long #define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0) using namespace std; const unsigned int M = 1e9 + 7; int32_t main() { fastio; int n, a, b; cin >> n >> a >> b; cout << (n - a) + b; return 0; }
#include <bits/stdc++.h> using namespace std; int a[100006]; int main () { int n,m,k; cin>>n>>m>>k; for (int i=1;i<=2*m;i++) cin>>a[i]; sort(a+1,a+2*m+1); a[0]=0,a[2*m+1]=k; int t=2*m+1; int ans=n; for (int i=1;i<=t;i++){ if(i%2) ans-=a[i]-a[i-1]; else ans=min(n,ans+a[i]-a[i-1]) ; if (ans<=0) { cout<...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { double N, D, H; //Nこ D離れてHの高さ cin >> N >> D >> H; vector<pair<int, int>> dh(N); for(int i = 0; i < N; i++) cin >> dh.at(i).first >> dh.at(i).second; //fin double ans=0; for(int i = 0;i < N; i++) { double k; k = ...
#include<bits/stdc++.h> #include<cstring> using namespace std; #define PMax 100000000 #define GNode 100 using ll= long long; map<string ,int> chk; int main() { ll tc; cin>>tc; int flg=0; string s,ans; while(tc--){ cin>>s; if(s[0]=='!'){ s.erase(0, 1); if(chk[s]==1){ ...
#include <bits/stdc++.h> using namespace std; #define rep(i,n)for(int i=0;i<(n);i++) #define ALL(a) (a).begin(), (a).end() #define RALL(a) (a).rbegin(), (a).rend() #define pb push_back using ll = long long; using P = pair<int, int>; int main(){ int n; cin >> n; set<int> a; rep(i,n) { int p; ...
/*/ Author: _Math.man "Everything in this world is magic, except to the magician" /*/ #include<bits/stdc++.h> using namespace std; /*/---------------------------Defines-----------------------------------------/*/ #pragma GCC optimize("Ofast") #define int long long #define IOS ios_base::sync_with_stdi...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define sorts(s) sort(s.begin(), s.end()) #define sortu(s) sort(s.begin(), s.end(), greater<>()) typedef long long int ll; using Graph = vector<vector<int>>; int main(void) { int i, j, k; int N; cin >> N; ...
#include <bits/stdc++.h> using namespace std; #ifndef ONLINE_JUDGE #define _GLIBCXX_DEBUG #endif #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = s; i < (int)(n); i++) #define Clear(a) a = decltype(a)() #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define v...
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i < (int)(b); i++) #define rrep(i, a, b) for (int i = a; i >= b; i--) #define all(vec) vec.begin(), vec.end() #define allr(vec) vec.rbegin(), vec.rend() #define CST(x) cout << fixed << setprecision(x) using namespace std; void _main(); int main() { cin.ti...
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0;i < (n);i++) using namespace std; using ll = long long; using pii = pair<int,int>; const int INF = 2e9; int main(){ ll n,x; cin >> n >> x; vector<pair<ll,ll>> events; rep(i,n){ ll a,b,c; cin >> a >> b >> c; events.emplace_...
#include<bits/stdc++.h> #define con(typ) const typ typedef long long ll; template<typename T>void sf(T &x){x=0;T f=0;char c=getchar();for(;c<'0'||c>'9';c=getchar())if(c=='-')f=1;for(;c>='0'&&c<='9';c=getchar())x=(x<<3)+(x<<1)+(c^'0');if(f)x=-x;} template<typename T>void pf(T x,char l='\n'){static int s[100],t;if(x<0)pu...
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; constexpr ll MOD = 998244353; #ifndef ONLINE_JUDGE template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " (" << x.first << " : " ...
#include<bits/stdc++.h> using namespace std; const int mod=1000000007; #define int long long #define Fastio ios_base::sync_with_stdio(false); cin.tie(NULL); #define pb push_back #define pii pair<int,int> #define F first #define S second #define endl "\n" #define vmin *min_element #define vmax *max_element #define max3...
#include <algorithm> #include<iostream> #include<vector> #include<deque> #include<queue> #include<stack> #include<list> #include<map> #include<set> #include<string> #include <sstream> #include<bitset> #include<stdlib.h> #include<string.h> #include<math.h> #include<limits.h> const int TIME = 2*100000+10; const int INF ...
//#include <atcoder/all> #include <bits/stdc++.h> using namespace std; #define rep2(x,fr,to) for(int x=(fr);x<(to);x++) #define rep(x,to) for(int x=0;x<(to);x++) #define repr(x,fr,to) for(int x=(fr);x>=(to);x--) #define all(c) c.begin(),c.end() #define sz(v) (int)v.size() typedef long long ll; typedef vector<int> ...
#include <bits/stdc++.h> using namespace std; #define REP(i, a, b) for(int i = (a); i <= (b); i++) #define PER(i, a, b) for(int i = (a); i >= (b); i--) #define rep(i, a, b) for(int i = (a); i < (b); i++) #define all(S) (S).begin(), (S).end() #define pb push_back #define mk make_pair #define S second #define F first t...
#include<bits/stdc++.h> #include<bits/extc++.h> #pragma GCC optimize("Ofast") using namespace std; using namespace __gnu_pbds; template<typename TH> void _dbg(const char* sdbg, TH h) { cerr<<sdbg<<"="<<h<<"\n"; } template<typename TH, typename... TA> void _dbg(const char* sdbg, TH h, TA... t){ while(*sdbg != ',') { ce...
#include<cstdio> #include<algorithm> #include<vector> #include<set> #include<cstring> using namespace std; typedef long long ll; const int N = 1e6 + 50; char s[N]; int main(){ scanf("%s", s + 1); int len = strlen(s + 1); bool ok = 1; for(int i = 1; i <= len; i += 2) if(!(s[i] >= 'a' && s[i] <= 'z'...
#include <bits/stdc++.h> #include <math.h> using namespace std; typedef long long ll; typedef unsigned long long ull; # define M_PI 3.14159265358979323846 const int M=998244353; long long mod(long long x){ return ((x%M + M)%M); ...
#include <bits/stdc++.h> using namespace std; int h, w; bool field[16][16]; long long dfs(int x, int y, int a, int b) { //畳が足りない時。 if(a < 0 || b < 0)return 0; //端まで行きついたら if(y == h) y = 0, x++;//左上に移動 if(x == w)return 1;//右下端まで来たのでこれが一つ //もう使われてたら if(field[x][y] == true)return dfs(x, y +...
// I SELL YOU...! #include<iostream> #include<vector> #include<algorithm> #include<functional> #include<queue> #include<chrono> #include<iomanip> #include<map> #include<set> using namespace std; using ll = long long; using P = pair<ll,ll>; using TP = tuple<ll,ll,ll>; void init_io(){ cin.tie(0); ios::sync_with_stdi...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const int mod = 998244353; #define int __int128 const int inf = (1LL << 60); const int INF = inf * inf; template< typename T > inline void get_min(T &x, T y) {if(y < x) x = y;} template< typename T > inline void get_max(T &x, T y) {if(x < y) x = y;...
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < n; i++) #define Rep(i,n) for(int i = 1; i <= n; i++) #define sz(a) int(a.size()) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define debug(a) { cerr << #a << ':' << a << endl; } #define endl '\n' #define fi first...
// Problem: D - Powers // Contest: AtCoder - AtCoder Regular Contest 106 // URL: https://atcoder.jp/contests/arc106/tasks/arc106_d // Memory Limit: 1024 MB // Time Limit: 3000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std;...
#include<bits/stdc++.h> using namespace std; const long long mod = 998244353; long long n , k , a [200005] , fact [303] , sum [303] , mn [303] , pww [200005][303] , pwww [200005][303]; long long pw ( long long x , long long y ) { if ( y == 0 ) return 1; long long ans = pw ( x , y / 2 ); ans = ( ans * ans ) ...
#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; #define endl '\n' #define fi first #define se second #define For(i, l, r) for (int i = l; i < r; i++) #define ForE(i, l, r) for (int i = l; i <= r; i++) #define FordE(...
#include<bits/stdc++.h> #define ll long long int #define pii pair<int,int> #define pll pair<ll,ll> #define vpii vector< pii > #define vpll vector< pll > #define mpii map<int,int> #define mpll map<ll,ll> #define MOD 1000000007 #define all(v) v.begin(),v.end() #define s(v) v.size() #define test ll t;cin>>t;while(t--) #de...
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = a; i < (int)(b); ++i) #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define REPR(i, n) for (int i = n - 1; i >= 0; --i) using namespace std; #define int long long int //------------ATCODER TEMPLATE------------- signed main() { int N, M; cin >>...
#include <bits/stdc++.h> // ==================================================================== // clang-format off namespace std { template <class Fun> class y_combinator_result { Fun fun_; public: template <class T> explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {} template <class ......
#include<bits/stdc++.h> using namespace std; #define int long long #define rep(i,n) for(int i=0;i<n;i++) #define pii pair<int,int> #define que pair<pii,int> int N, M, Q; int X[200010][3]; int O[200010], P[200010]; vector<que> V; int ans[200010][2]; int A[3][3]; int now = 0; void calc(int a[3][3], int b[3][3]) { ...
#include <bits/stdc++.h> using namespace std; #define int long long #define pi (3.141592653589) #define mod 1000000007 #define float double #define pb push_back // #define mp make_pair #define ff first #define ss second #define rrep(i, n) for(int i=n-1;i>=0;i--) #define rep(i,n) for(int i=0;i<n;i++) const int N = 1e6+...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using pii = pair<int, int>; int main() { int n; cin >> n; double ans = 0.0; for (int i = n - 1; i > 0; i--) { double p = (double)n / i; ans += p; } printf("%.10f\n", ans); retur...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) // 最大公約数 ll gcd(ll a, ll b) { return (a % b)? gcd(b, a % b): b; } ll gcd(ll a, ll b, ll c){ return gcd(a, gcd(b,c)); } int main(){ int N;cin >> N; ll result = 0; rep(i,N){ int t...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long int; template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } } template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } } int main() { int N; cin >> N; unordered_map<string, int...
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 2e5 + 10; const int N = 105; const ll mod = 998244353; int n; string str[maxn], res; unordered_map<string, int>o; int main() { #ifndef ONLINE_JUDGE freopen("1.txt", "r", stdin); #endif ios::sync_with_stdio(false); cin.tie(0); cin ...
#include <bits/stdc++.h> #define int long long using namespace std; const int Mod=998244353; int n,m,k,ans; inline int qpow(int a,int b,int m=Mod) { if (!a) return 0; int r=1; while (b) { if (b&1) r=1ll*r*a%m; a=1ll*a*a%m,b>>=1; } return r; } signed main() { cin>>n>>m>>k; if (n==1||m==1) cout<<qpow(k,n+m-1)...
#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 rep3(i, x, n) for(int i = x; i >= n; i--) #define each(e, v) for(auto &e: v) #define pb push_back #define eb emplace_back #define all(x) x.begin(), x.end() #define rall(x)...
#pragma GCC optimize("Ofast") #pragma GCC target ("sse4") #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> #inc...
/* Konnichiwaa!!!! */ #include<bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define REP(i, k, n) for(ll i = k; i < n; ++i) #define REPI(i, k, n) for(ll i = k; i >= n; --i) #define vi vector<int> #define vch vector<char> #define vstr vector<string> #define vll vector<ll> #d...
// #pragma GCC optimize("Ofast") // #pragma GCC target("avx,avx2,fma") // #pragma GCC optimization ("unroll-loops") #include <algorithm> #include<bits/stdc++.h> #include <cstdarg> #include <cstdint> #include <cstring> #include <iomanip> #include <math.h> #include <vector> // @author : sam000013 #define int long long ...
#include<bits/stdc++.h> using namespace std; #define NeedForSpeed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define int long long int #define fi first #define se second #define pub push_back #define pi pair<int,int> #define all(x) ...
#include <bits/stdc++.h> using namespace std; using Graph = vector<vector<int>>; #define rep(i,n) for(int i=0; i<(n); i++) #define INF ((1LL<<62)-(1LL<<31)) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() typedef long long ll; typedef pair<ll,ll> pl; typedef tuple<ll,ll,ll> tupl; int mai...
#include <bits/stdc++.h> using namespace std; #define LSOne(S) ((S) & -(S)) typedef vector<long double> vld; using ld = long double; class FenwickTree { private: vld ft; public: FenwickTree(int m) { ft.assign(m+1, 0); } ld rsq(int j) { ld sum = 0; for (; j; j -= LSOne(j)) sum += ft[j]; re...
//#pragma GCC optimize("Ofast") //#pragma GCC target("avx,avx2,fma") //#pragma GCC optimization ("unroll-loops") #include<bits/stdc++.h> #include<string.h> using namespace std; #define pb push_back #define all(v) v.begin(),v.end() #define ya cout<<"Yes"<<endl; #define no cout<<"No"<<...
#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() { int n; ci...
#include <bits/stdc++.h> using namespace std; const char nl = '\n'; const double eps = 1e-6; const int N = 110; int n, D, H; int d[N], h[N]; int main() { ios::sync_with_stdio(false); //cin.tie(nullptr); priority_queue<double, vector<double>, greater<double>> q; cin >> n >> D >> H; for (int i =...
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main() { cout << fixed << setprecision(20); int n,D,H; cin >> n >> D >> H; vector<int> d(n); vector<int> h(n); rep(i,n){ cin >> d[i] >> h[i]; } double ans = 0; rep(i,n){ doub...
#include <iostream> #include <algorithm> #include <vector> #include <numeric> #include <random> #include <chrono> #include <queue> #include <utility> #include <string> #include <set> #include <map> #include <cmath> #include <limits> #define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define showv(v)...
#include "iostream" #include <cmath> #include <algorithm> #include <vector> #include <stack> using namespace:: std; long long int pow (long long int n, long int k, long int m) { if (k == 1) return n; else if (k % 2 == 0) return ((pow (n, k / 2, m) % m * pow (n, k / 2, m) % m) % m); e...
// Artur Kraska, II UWr #include <bits/stdc++.h> #define forr(i, n) for(int i=0; i<n; i++) #define FOREACH(iter, coll) for(auto iter = coll.begin(); iter != coll.end(); ++iter) #define FOREACHR(iter, coll) for(auto iter = coll.rbegin(); iter != coll.rend(); ++iter) #define lbound(P,R,P...
#include <unordered_map> #include <numeric> #include <vector> #include <iostream> using namespace std; constexpr int M = 998244353; int main() { int h, w, k; cin >> h >> w >> k; long long dp[2][w][3]; int cur = 0, prev = 1; unordered_map<int, unordered_map<int, char> > f; auto get = [&f](int i, in...
#include<cstdio> #define MOD 1000000007 #define MAX_X 2000000 int f[2000006]; int inv_f[2000006]; int pow(int x, int y) { if (y == 0) { return 1; } if (y % 2 == 0) { return pow(1ll * x * x % MOD, y / 2); } else { return 1ll * x * pow(x, y - 1) % MOD; } } int inv(int x) { return pow(x, MOD - 2...
#include <bits/stdc++.h> using namespace std; // #include <atcoder/all> // using namespace atcoder; // #define int long long #define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i) #define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps...
//kapi kapi spaghetti #include <iostream> #include <iomanip> //setprecision(12) #include <algorithm> #include <functional> #include <map> #include <vector> #include <queue> #include <cmath> #include <set> typedef long long ll; typedef unsigned long long ull; using namespace std; using pll=pair<ll,ll>; int main() {...
#include <bits/stdc++.h> using namespace std; //#include <atcoder/all> //using namespace atcoder; #define rep(i, n) for(int i = 0, i##_len=(n); i < i##_len; ++i) #define all(x) (x).begin(), (x).end() #define len(x) ((int)(x).size()) void _cin() {} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... ...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for(int i=0; i<(int)(n); i++) int main(){ int N, p, b=0; cin >> N; int A[200001]={}; REP(i, N){ cin >> p; A[p]=1; for(int j=b; j<=200000; j++){ if(A[j]==0){ cout << j << "\n"; b=j; break; } } } }
#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 std; using namespace __gnu_pbds; #define endl "\n" //interactive #define fi first #define se second #defin...
#include <iostream> #include <vector> #include<string> #include <algorithm> #include <cmath> #include <map> #include <utility> #define ll long long using namespace std; int mul(int n){ int ans = 1; for(int i = 0;i < n;i ++)ans *= 2; return ans; } int main(){ int num,mem; cin >> num; cin >> mem; vector<v...
#include <bits/stdc++.h> using namespace std; #define int int64_t #define itn int #define fi first #define se second signed main(){ cin.tie(0); ios::sync_with_stdio(false); int h,w; int a[105][105],sum=0,m; cin>>h>>w; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ cin>>a[i][j]; if(i==0&&j==0) ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define yes "Yes" #define no "No" #define rep(i, n) for( int i=0; i<(n); i++) const long long INF = 1LL << 60; template<class T> inline bool chmin(T& a, T b) {if(a>b){a=b; return 1;} return 0; } template<class T> inline bool chmax(...
#include<bits/stdc++.h> using namespace std; const int N=3000; int n,k; int a[N][N],sum[N][N]; bool check(int x) { memset(sum,0,sizeof sum); for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]; if(a[i][j]<=x) sum[i][j]--; else sum[i][j]++; } } for(...
// Why Stop Now... #include "bits/stdc++.h" using ll = long long; using namespace std; #define el "\n" #define n_l "\n" #define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const...
#include <bits/stdc++.h> using namespace std; int dp[1<<18]; int n,m; int edge[20]; void init(){ for(int i=0;i<n;i++) edge[i] = edge[i] | (1<<i); } int main(){ cin>>n>>m; init(); while(m--){ int a,b,a1,b1; cin>>a>>b; a1=a-1 ,b1=b-1; //二进制从 0 开始 ,点的序列号改为:0~n-1 edge[a1] = edge[a1] | (1<<b1); //将...
#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; #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #endif #define int long long #define mp make_pair #define mt make_tuple #define pb push_back #define ppb pop_back...
#include<bits/stdc++.h> #define LL long long #define ull unsigned long long #define pii pair<int, int> #define lson (o << 1) #define rson (o << 1 | 1) #define mp make_pair #define fi first #define se second using namespace std; template <class T> T gi() { T x = 0; bool f = 0; char c = getchar(); while (c != '-'...
#include<cstdio> #include<cmath> #include<cstring> #include<algorithm> #define maxn 505 #define ll long long #define mo 998244353 using namespace std; int n,m,i,j,k,a[maxn][maxn],c[3]; int main(){ scanf("%d%d",&n,&m); for(i=1;i<=n;i++){ char ch=getchar(); while (ch!='R'&&ch!='B'&&ch!='.') ch=getchar(); for(j=...
//デバッグ用オプション:-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 <iostream> #define ll long long int #define MN (int)200100 using namespace std; ll md = 998244353; ll ncr[MN+2][55]; ll minP[MN+2]; ll sol[MN+2]; int main(){ minP[1] = 1; //eratosten; for(int i=2; i<MN; i++) if(!minP[i]) for(int j=1; j*i<MN; j++) if(!minP[i*j]) minP[i*j]=i; //ncr for(int i=1; i<MN; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, int> pli; typedef pair<ll, ll> pll; #define mp make_pair #define fr first #define sc second int lg(ll n) { assert(n > 0); int ans = -1; while (n) { ans++; n >>= 1; } r...
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); double A, B; cin >> A >> B; cout.precision(10); cout << A * B * 0.01 << "\n"; }
#include <iostream> #include <stdio.h> #include <algorithm> using namespace std; typedef long long ll; int A, B; int main(int argc, const char * argv[]) { // insert code here... scanf("%d %d", &A, &B); double ans = (double)(A * B) / 100; printf("%f", ans); return 0; }
#include <iostream> #include <vector> #include <algorithm> #include <iomanip> #include <string> #include <stack> #include <queue> #include <map> #include <set> #include <tuple> #include <cstdio> #include <cstdlib> #include <cmath> #include <cassert> #include <cstdint> #include <cctype> #include <numeric> #include <bits...
// First of all Naste "_" // Always check the fast IO is there or not // always write functions for little things coz u repeat the variables #include<bits/stdc++.h> #include <algorithm> using namespace std; typedef long long int ll; #define endline '\n' #define vll vector<ll> #define vi vector<int> #define pll pai...
/************************************************************************* > File Name: 1.cpp > Author: Knowledge_llz > Mail: 925538513@qq.com > Blog: https://blog.csdn.net/Pig_cfbsl > Created Time: 2020/10/11 22:45:26 ************************************************************************/ #include<bits/stdc+...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> P; const ll MOD = 1e9+7; const ll INF = 1e18; #define rep(i,m,n) for(ll i = (m); i <= (n); i++) #define zep(i,m,n) for(ll i = (m); i < (n); i++) #define rrep(i,m,n) for(ll i = (m); i >= (n); i--) #define print(x) cout << (x) << end...
//Author: Fuadul Hasan(fuadul202@gmail.com) //BSMRSTU,Gopalganj //#include<bits/stdc++.h> #define _USE_MATH_DEFINES #include <set> #include <map> #include <list> #include <queue> #include <stack> #include <cmath> #include <ctime> #include <cstdio> #include <string> #include <vector> #include <bitset> #include <random> ...
#include <bits/stdc++.h> #define ll long long #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define powr(x,n,p) for(int axy=0 ; axy<p ; axy++){x=x*n;} #define YES printf("YES\n") #define Yes printf("Yes\n") #define yes printf("yes\n") #define NO printf("NO\n") #define No printf("...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define P pair<ll,ll> #define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I) #define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I) #define TO(x,t,f) ((x)?(t):(f)) #define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9 #define POSL(x,v) (lower_...
#include <bits/stdc++.h> using namespace std; template<int M> struct static_mint { static_assert(0 < M, "Module must be positive"); int val; static_mint() : val() {} static_mint(long long x) : val(x % M) { if (val < 0) val += M; } static_mint pow(long long n) const { static_mint ans = 1, x(*this); for (; ...
#include <bits/stdc++.h> #include <unordered_set> #include <algorithm> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vll = vector<ll>; using vs = vector<string>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repll(i,n)...
#include <bits/stdc++.h> using namespace std; #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 #define deb(x) cout<<#...
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T> using vec = vector<T>; template <class T> using vvec = vector<vec<T>>; template<class T> bool chmin(T& a,T b){if(a>b) {a = b; return true;} return false;} template<class T> bool chmax(T& a,T b){if(a<b) {a = b; return true;} return fa...
#define _USE_MATH_DEFIMES #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cctype> #include <climits> #include <clocale> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <ioman...
//{{{ #include <bits/stdc++.h> using namespace std; using LL = long long; using VLL = vector<LL>; using vi = vector<int>; using pii = pair<int, int>; #define sz(x) (int)((x).size()) #define all(x) (x).begin(), (x).end() #define clr(a, b) memset(a, b, sizeof(a)) #ifdef LOCAL #include "prettyprint.hpp" // clang-format of...
#include <bits/stdc++.h> using namespace std; typedef long long LL; #define IOS ios::sync_with_stdio(false); cin.tie(0);cout.tie(0) const int P = 1e9 + 7; const double PI = acos(-1.0); const int INF = 0x3f3f3f3f; const int N = 3e6 + 10; int main() { IOS; int n; string str; vector<int> v; cin >> str >> n; for(...
/* quid-pro-quo: LOGIC for AC written by: codercell07 LANG: C++ 11 Problem: random */ #include<bits/stdc++.h> #define fastio ios::sync_with_stdio(false); cin.tie(NULL) #define testcases freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout) #define ui unsigned int #define ll long long #def...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef int64_t i6; typedef std::vector<std::vector<int64_t> > Graph; #define rep(i, n) for (int64_t i = 0; i < n; ++i) #define rep2(i, n) for (int64_t i = 1; i <= n; ++i) #define repb(i, l, n) for (int64_t i = l; i < n; ++i) #define repb2(i, l, n) f...
#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; ...
#pragma comment (linker, "/STACK:256000000") #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <algorithm> #include <utility> #include <functional> #include <cstring> #include <queue> #include <stack> #include <math.h> #include <iterator> #include <vector> #include <string> #include <set> #include <math.h> #...
#include<iostream> #include<string> #include<cstdio> #include<algorithm> #include<cstdlib> #include<cmath> #include<vector> #include<utility> #include<queue> #include<stack> #include<set> #include<map> #include<bitset> #include<iomanip> #include<list> #include<deque> using namespace std; //#define MODE 1 #ifdef MODE #d...
#include <iostream> #include <vector> #include <cmath> using namespace std; typedef long long ll; int main() { ll N, a; cin >> N; ll sum = 0, mx = 0, add = 0; for (ll i = 1; i <= N; i++) { cin >> a; sum += a; mx = max(mx, a); cout << sum + i * mx + add << endl; add += sum; } }
#include <bits/stdc++.h> #define _overload3(_1,_2,_3,name,...)name #define _rep(i,n)repi(i,0,n) #define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i) #define MSVC_UNKO(x)x #define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__)) #define all(c)c.begin(),c.end() #define write(x)cout<<(x)<<'...
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__) #else #define DEBUG(...) 6 #endif template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";} template<typename C, typen...
#include "bits/stdc++.h" using namespace std; typedef long long ll; // #define int long long template <class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T...
#include<bits/stdc++.h> using namespace std; int main() { string s; cin >> s; reverse(s.begin(), s.end()); for(auto c : s) { if(c == '6') cout << '9'; else if(c == '9') cout << '6'; else cout << c; } cout << endl; return 0; }
#include<iostream> #include<sstream> #include<iomanip> #include<cstdlib> #include<algorithm> #include<vector> #include<map> #include<cmath> #include<string> #include<numeric> #include<queue> #define rep(i,p) for(long long int i=0;i<p;i++) #define reep(i,p) for(long long int i=1;i<=p;i++) #define ll long long #define ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define Pint pair<int,int> #define Pll pair<ll,ll> #define fi first #define se second #define rep(i,n) for(int i=0;i<n;i++) #define all(v) v.begin(),v.end() #define pb push_back #define eb emplace_back template<class T>void chmax(T &a,T b){if(a<b)a=b;} ...
#include<iostream> #include<vector> #include<string.h> #include<algorithm> #include<iomanip> #include<cmath> #include<stack> #include<chrono> #include<random> #include<iterator> #include<map> #include<list> #include<algorithm> #include<fstream> #include<unordered_map> #include<set> #include<queue> using namespace std; ...
#include <iostream> #include <map> using namespace std; long long N, Answer = 0; long long A[1 << 19], B[1 << 19], C[1 << 19]; map<long long, long long> D; int main() { // Step #1. 入力 cin >> N; for (int i = 1; i <= N; i++) cin >> A[i]; // Step #2. 累積和を取る for (int i = 1; i <= N; i++) { if (i % 2 == 1) B[i] = A...
#include <iostream> using namespace std; int main() { string s; cin >> s; bool flag = true; for(int i = 0; i < s.length(); i++){ if ( i % 2 == 0){ //奇数番目 if(isupper(s[i])){ //小文字 flag = false; } }else{ if(!isupper(s[i])){ ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; bool flag = false; char bool_ans(ll A, ll B){ if(A == B) return '='; else if(A < B) return '<'; else return '>'; } int main(){ ll A, B, C; char ans; cin >> A >> B >> C; if(A >= 0 && B >= 0){ ans = bool_ans(A, B);...
#include<cstdio> #include<queue> #include<utility> #include<vector> #include<cmath> using namespace std; int n, m; vector<pair<int, pair<int, int>>> v[100005]; long long dis[100005]; priority_queue<pair<long long, int>> pq; int main() { scanf("%d %d", &n, &m); for (int i = 0; i < m; i++) { int a, b, c, d; ...
#include<bits/stdc++.h> using namespace std; #define int long long #define vi vector<int> #define ff first #define ss second #define pb push_back #define mp make_pair #define pi 3.141592653589793238 #define rep(i,a,b) for (int i = a; i <= b; i++) #define zip(i,a,b) for(int i=a;i<b;i++) #define rzip(i,a,b) for(int i=a;i...
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll t,n; int main(){ cin>>t>>n; ll ans=(n*100+t-1)/t+n-1; cout<<ans; }
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; 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 true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } int m...
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <set> #include <queue> #include <iomanip> using namespace std; typedef long long ll; ll n, k; ll yama[800][800]; vector<ll> heights; ll centerNum; ll num[800][800]; int main() { cin >> n >> k; for (ll y = 0; y < n; y++) { for ...
#pragma GCC optimize ("Ofast") #include<bits/stdc++.h> using namespace std; void*wmem; char memarr[96000000]; inline int my_getchar(){ static char buf[1048576]; static int s = 1048576; static int e = 1048576; if(s == e && e == 1048576){ e = fread(buf, 1, 1048576, stdin); s = 0; } if(s == e){ ret...
#include <bits/stdc++.h> // 1. dp typedef long double ld; #define int long long #define gcd __gcd #define endl "\n" #define setbits(x) __builtin_popcountll(x) #define zrobits(x) __builtin_ctzll(x) #define mod 1000000007 #define mod2 998244353 #define maxe *m...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long ans = 1; for (int i = 1; i < 12; i++) { ans *= (n-i); ans /= i; } cout << ans << endl; return 0; }
#include<bits/stdc++.h> #define Rushia_mywife ios::sync_with_stdio(0);cin.tie(0); #define rep0(n) rep(i,0,n) #define rep1(n) rep(i,1,n+1) #define rep(i,head,n) for(int i=(head);i<n;i++) #define F first #define S second #define FF first.first #define FS first.second #define SF second.first #define SS second.second #def...
#include <bits/stdc++.h> using namespace std; // #include <atcoder/all> // using namespace atcoder; // #define int long long #define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i) #define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps...
#include <iostream> using namespace std; long long cnt[200001]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; n <<= 1; for(int i = 2; i <= n; i++) { cnt[i] = min(i - 1, n - i + 1); } k = abs(k); long long result = 0; for(int i = k; i <= n; i...
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <sstream> #include <queue> #include <deque> #include <bitset> #include <iterator> #include <list> #include <stack> #include <map> #include <set> #include <functional> #include <numeric> #include <utility> #include <iomanip> #include <...
#include <stdio.h> #include <math.h> #include <string> #include <string.h> #include <float.h> #include <iostream> #include <map> #include <vector> #include <algorithm> #include <climits> //#include "stdc++.h" using namespace std; // Q1 int main() { long lA, lB, lC; cin >> lA >> lB >> lC; if (0 == lC) { if (lA -...
#pragma GCC optimize("Ofast") #include <iostream> // cout, endl, cin #include <string> // string, to_string, stoi #include <vector> // vector #include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <utility> // pair, make_pair #include <tuple> // tuple, make_tuple #include <cstdint> // ...
#include <bits/stdc++.h> #define ll long long #define SZ(vvv) ((int)vvv.size()) #define all(vvv) (vvv.begin(), vvv.end()) #define fastIO cout << fixed << setprecision(6), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr) using namespace std; const int N = 5e5 + 9, M = 1e2 + 3, MOD = 1e9 + 7, B = 31; cons...
#include<bits/stdc++.h> #include <cstdio> #include <cstring> #include <cmath> #include <string> #include <chrono> #include <complex> using namespace std; #define ll long long #define ld long double #define ui unsigned int #define ull unsigned ll #define mp make_pair #define eb emplac...
#include<bits/stdc++.h> using namespace std; #define int long long const int N = 2e5 + 10,mod = 998244353; int a[N]; int s[N]; int n; int qpow(int a,int b){ int res = 1; while(b){ if(b & 1) res = res * a % mod; a = a * a % mod; b>>=1; } return res; } int inv(int a){return qpow(a,mod-2);} signed main(){ cin >...
#include<iostream> #include<string> #include<vector> #include<set> #include<iomanip> #include<algorithm> #include<cmath> #include<bitset> #include<queue> #include<stack> #include<utility> #include<cstdlib> #include<cstdio> #include<map> #include<unordered_set> #include<unordered_map> #include<list> #include<tuple> usin...
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <complex> #include <deque> #include <functional> #include <iostream> #include <list> #include <map> #include <set> #include <stack> #include <string> #include <tuple> #include <vector> #includ...
// Jai Shree Ram #include<bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define ook order_of_key #define fb...
#include<iostream> #include<algorithm> #include<string> #include<vector> #include<cstdlib> #include<queue> #include<set> #include<cstdio> #include<map> #include<cassert> using namespace std; #define ll long long #define reps(i, a, b) for(int i = a; i < b; i++) #define rreps(i, a, b) for(int i = a-1; i >= b; i--) #def...
#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<bits/stdc++.h> using namespace std; using ll=long long; vector<vector<ll>> Culc(vector<ll> x1, vector<ll> y1, vector<ll> z1, vector<ll> x2, vector<ll> y2, vector<ll> z2) { vector<vector<ll>> R(3, vector<ll>(3)); R[0][0] = x1[0] * x2[0] + x1[1] * y2[0] + x1[2] * z2[0]; R[0][1] = x1[0] * x2[1] + x1[...
#include <bits/stdc++.h> #define ALL(x) std::begin(x), std::end(x) using namespace std; // @title 行列 #include <cassert> #include <iostream> #include <vector> using namespace std; template< class T > struct Matrix { size_t H, W; vector< vector< T > > A; Matrix() {} Matrix(size_t n, size_t m) : H(n), W(m), A(H,...
#include<iostream> #include<math.h> #include<time.h> #include<algorithm> #include<random> #include<vector> #include<string> using namespace std; int num_cand = 3000; mt19937 engine(time(0)); vector<vector<double>> x_path(100, vector<double>(100, 5000.0)); //(30, 29) vector<vector<double>> y_path(100, vector<double>...
#include<bits/stdc++.h> using namespace std; int main(){ for(int i=0;i<1000;i++){ int si,sj,ti,tj; cin>>si>>sj>>ti>>tj; int difx=si-ti; int dify=sj-tj; if(difx>0){ for(int i=0;i<difx;i++){ cout<<'U'; } }else{ for(i...