code_file1
stringlengths
87
4k
code_file2
stringlengths
85
4k
#include <stdio.h> typedef long long ll; int main(void) { ll i, j, n, ans = 0; scanf("%lld", &n); ll ca[n + 1], b[n], c; for(i = 0; i <= n; ++i) ca[i] = 0; for(i = 0; i < n; ++i) scanf("%lld", &c), ca[c]++; for(i = 0; i < n; ++i) scanf("%lld", &b[i]); for(i = 0; i < n; ++i) scanf("%lld", &c), ans += ca[b...
#pragma region Template // clang-format off #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; // #include <atcoder/all> // using namespace atcoder; #define rep(i, m, n) for (int i = m; i < (int)(n); i++) #define repe(i, m, n) for (int i = m; i <= (int)(n); i++) #define all(x) (x).begin(),(x).end() #...
#include <cassert> #include <iostream> #include <algorithm> #include <cstdio> #include <complex> #include <vector> #include <set> #include <map> #include <cmath> #include <queue> #include <string> #include <cstdlib> #include <memory.h> #include <ctime> #include <bitset> #include <fstream> #include <queue> #include <st...
/** * author: Dooloper * created: 11.10.2020 23:12:53 **/ #pragma region Macros #pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; using P = pair<int,int>; using ll = long long; #define rep(i,n) for(int i = 0; i < (n); i++) #define repn(i,n) for(int i = 1; i <= (n); i++) #define pb push_b...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 1000000007; int main() { ll b, c; cin >> b >> c; ll result = 0; if (c == 1) { if (b == 0) { cout << 1 << endl; } else { cout << 2 << endl; } return 0; } if ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; const ll mod=1e9+7; #define rep(i,n) for (int i = 0; i < (n); i++) ll b,c,ans; int main(){ cin >> b >> c; ll k=c/2; if(c==1){ if(b==0)ans=1; else ans=2; } else if(c%2==1) ans=(k*4+1)-max(0LL,...
#include <bits/stdc++.h> using namespace std; using lint = long long int; template<int64_t MOD> struct Mint { int64_t v; Mint() { v = 0; } Mint(int64_t x) { v = x % MOD; if(v < 0) v += MOD; } Mint operator-() { return Mint(-v); }; Mint operator+(Mint x) { return Mint(v + x.v); }; Mint operator-(Mint x) { ...
#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include <bits/stdc++.h> using namespace std; const int MOD=1e9+7; int D[2010][2010]; int E[2010][2010]; ll modpow(ll x,ll n){ ll ans=1; while(n){ if(n&1) ans=ans*x %MOD; x=x*x %MOD; n/=2; }...
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int mod=998244353; int n,m,ans; int Power(int x,int y){ int ret=1; while(y) { if(y&1)ret=1ll*ret*x%mod; x=1ll*x*x%mod,y>>=1; } return ret; } int main(){ cin>>n>>m; int w1=Power(m*m,mod-2); int w2=Power(m,mod-2); for(int i=2,l=Power(m,n...
#include<bits/stdc++.h> using namespace std; #define N 200005 #define mod 998244353 int n,k,ans,a[N],sum[N][305],fac[N],inv[N]; int c(int n,int m){ return 1LL*fac[n]*inv[m]%mod*inv[n-m]%mod; } int main(){ scanf("%d%d",&n,&k); for(int i=1;i<=n;i++)scanf("%d",&a[i]); for(int i=1;i<=n;i++){ int ss=1; for(int j=0;j...
#include<bits/stdc++.h> using namespace std; const long long MOD = 1e9+7; const long long N = 1e5+10; typedef long long ll; typedef long double ld; void test_case() { ld r, x, y; cin >> r >> x >> y; ld dis = sqrt(x * x + y * y); ld res = dis/r; ll ans = ceil(res); if(ans == 1 && ceil(res) != floor(res)) an...
#include <vector> #include <cstdlib> #include <math.h> #include <algorithm> #include <tuple> #include <set> #include <map> #include <iostream> #include <iomanip> #include <limits> using namespace std; # define rep(i, n) for (long long i = 0; i < (long long)(n); i++) int main() { long long r, x, y; cin >> r >> x >...
#include <bits/stdc++.h> using namespace std; /* ループ処理 0からnまで*/ #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { double A, B; cin >> A >> B; cout << A / 100.0 * B << endl; return 0; }
#include<bits/stdc++.h> using namespace std; int main() { int A, B; cin >> A >> B; cout << A * B / 100.0 << endl; }
//Let's join Kaede Takagaki Fan Club !! #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; //#define int long long typedef long long ll; typedef pair<int,int> P; typedef pair<int,P...
#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...
#include <iostream> using namespace std; int main(){ int x, y; cin >> x >> y; switch(x+y){ case 0: cout << 0 << endl; break; case 1: cout << 2 << endl; break; case 2: cout << 1 << endl; break; case 3: cout << 0 << endl; break; case 4: cout << 2 << endl; break; }...
#include <bits/stdc++.h> #include <string> typedef long long int ll; typedef long double ld; using namespace std; ll mod = 1e9 + 7; int solve() { return 0; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll x, y; cin >> x >> y; if (x == y) cout << x ...
#include<bits/stdc++.h> using namespace std; int a,b,c,l,r; int main(){ cin>>a>>b>>c; c*=1000; l=c/b; if(c%b!=0)l++; r=c/a; if(r<l)puts("UNSATISFIABLE"); else cout<<l<<" "<<r; }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pll; #define MottoHayaku ios::sync_with_stdio(0);cin.tie(0); #define rep(i,n) for(ll i=0;i<n;i++) #define rep1(i,n) for(ll i=1;i<=n;i++) #define F first #define S second #define pb push_back const ll INF=2e18; signed main() { ...
#include <cmath> #include <iostream> #include <string> #include <algorithm> #include <vector> #include <queue> #include <vector> #include <map> #include<cstdio> #include<functional> #include <bitset> #include <iomanip> #include <cctype> #define rep(i, n) for (int i = 0; i < (n); i++) #define repi(i,a,b) for(int i=int(a...
#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; //Replace each 0 with a 0, //each 1 with a 1, each 6 with a 9, each 8 with an 8, and each 9 with a 6. int main() { string s;cin>>s; for(int i=s.length()-1;i>=0;i--) {if(s[i]=='6') s[i]='9'; else if(s[i]=='9') s[i]='6'; cout<<s[i]; } // cout<<s; ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; const ll INF = 1LL << 30; using pll = pair<ll, ll>; using Graph = vector<vector<int>>; int main() { ll N; cin >> N; ll cut = 0, ans = 0; while(cut < N) { cut += ans+1; ans++; } cout << a...
#include <iostream> using namespace std; int main() { char c[3]; for(int i=0;i<3;i++) { cin>>c[i]; } for(int i=0;i<2;i++) { if(c[i]!=c[i+1]) { cout<<"Lost"; return 0; } } cout<<"Won"; return 0; }
#include <bits/stdc++.h> using namespace std; int a[2]; int main() { cin >> a[0] >> a[1]; if (a[0] == a[1]) { cout << a[0] << endl; } else { for (int i = 0; i < 3; ++i) { bool flag = 1; for (int j = 0; j < 2; ++j) { if (a[j] == i) { ...
#include<bits/stdc++.h> using namespace std; typedef long long int ll; int main(){ int x; cin >> x; cout << max(0, x) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int x; cin >> x; if (x < 0) { cout << 0 << endl; } else { cout << x << endl; } }
#include<bits/stdc++.h> using namespace std; #define reg register typedef long long ll; #define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++) static char buf[1<<21],*p1=buf,*p2=buf; #define flush() (fwrite(wbuf,1,wp1,stdout),wp1=0) #define putchar(c) (wp1==wp2&&(flush(),0),wbuf[wp1++]=c) s...
#include <algorithm> #include <climits> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <set> #include <stack> #include <string> #include <vector> #define REP(i, n) for(int i = 0; i < n; ++i) using namespace std; using LLONG = long long; const LLONG M...
#include <bits/stdc++.h> #define rep(i, n) for (long long i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; using V = vector<int>; int main() { int a, b; string ans; cin >> a >> b; ans = b % a == 0 ? "Yes" : "No"; cout << ans << endl; return 0; }
#include <iostream> #include <algorithm> #include <set> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll b, c; cin >> b >> c; if (b == 0) { ll l1 = c >> 1; ll l2 = (c - 1) >> 1; cout << l2 + l1 + 1 << '\n'; } else { if (c == 1) { cout << 2 << ...
#include <bits/stdc++.h> using namespace std; #define int long long #define REP(i, n) FOR(i, 0, n) #define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i) #define ALL(obj) (obj).begin(), (obj).end() #define ALLR(obj) (obj).rbegin(), (obj).rend() #define CEIL(a, b) ((a - 1) / b + 1) template <typename T...
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(int)(n);i++) using namespace std; using ll = long long; const int INF = 1001001001; const ll INF_LL = 1001001001001001001LL; const int MA = 200; int main(void){ int n; cin >> n; vector<ll> a(2*MA+1,0); rep(i,n){ int tmp; cin >> tmp; a[MA+tmp]++;...
#include <bits/stdc++.h> using namespace std; void fastStd() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); } const int MOD = 1e9+7; int n; vector<int> arr; vector<long long> minim; vector<pair<long long, long long>> dp; vector<pair<long long, long long>> dp2; long long generate(bool plus, int i...
#include <bits/stdc++.h> using namespace std; using ll=long long; #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 template<class T,class U> inline bool chmax(T &a,U b){ if(a<b){ a=b; return true; } return false; }...
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define repa(i,a,n) for(int i=(a);i<(n);i++) #define rrep(i,n) for(int i=n;i>=0;i--) #define rrepa(i,a,n) for(int i=n;i>=(a);i--) #define all(a) (a).begin(),(a).end() #define MOD 1000000007 #define cmax(a,b) a=max(a,b) #define cmin(...
#include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <bitset> #include <complex> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector>...
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <set> #include <cassert> using namespace std; vector<int> opos(const string& s) { int n = s.length(); vector<int> ps; for (int i = 0; i < n; ++i) { if (s[i] == '1') ps.push_back(i); } return ps; } void s...
#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() // s= 000101 // t= 110000 // ans=4 // s= 0101011 // t= 1111000 // ans=3 // s= 1111000 // t= 0101011 // ans=3 // s= 1101100 //...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for(ll i = 0; i < ll(n); i++) #define REPD(i, n) for(ll i = n-1; i >= 0; i--) #define FOR(i, a, b) for(ll i = a; i < ll(b); i++) #define FORD(i, a, b) for(ll i = a; i > ll(b); i--) #define START ios::sync_with_stdio(false);cin.tie(0);...
#include <bits/stdc++.h> using namespace std; int main(){ int x; cin>>x; if(x>=0){ cout<<x; } else{ cout<<0; } }
#include <bits/stdc++.h> using namespace std; /*#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> */ typedef long long ll; typedef long double ld; typedef unsigne...
#include <bits/stdc++.h> using namespace std; // clang-format off #define rep(i, n) for ( int i = 0; i < (int)(n); i += 1) #define rrep(i, n) for ( int i = (n) - 1; i >= 0; i -= 1) #define range(i, l, r) for ( int i = (int)(l); i < (int)(r); (i) += 1 ) #define rrange(i, l, r) for ( int i = (int)(r)-1; i >= (int)(l); (...
#include <bits/stdc++.h> using namespace std; using ll = long long; // -------------------------------------------------------- template<class T> bool chmax(T& a, const T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> bool chmin(T& a, const T b) { if (b < a) { a = b; return 1; } return 0; } #define ...
//#pragma GCC optimize("O3") #include<bits/stdc++.h> #define eps 1e-9 #define MOD1 998244353 #define MOD2 1000000007 #define INV_2 499122177 #define INF 1000000000 #define PI 3.14159265358979323846 using namespace std; int main() { ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); long long x, k, i; cin >> x >> k; ...
#include "bits/stdc++.h" using namespace std; using ll=long long; using vi=vector<int>; using vvi=vector<vi>; using vll=vector<ll>; using vvll=vector<vll>; using pii=pair<int,int>; #define rep(i,n) for(int i=0;i<(n);i++) #define sor(v) sort(v.begin(),v.end()) #define rev(v) reverse(v.begin(),v.end()) #define pb push_ba...
#include <bits/stdc++.h> #include <string> #include <cmath> #include <sstream> #include <unordered_map> #define FOR(i, a, b) for (ll i = (a); i < (b); i++) #define FORD(i, a, b) for(ll i = (a-1); i >= (b); i--) #define pb(a) push_back(a) #define mp(a,b) make_pair(a,b) #define ff first #define ss second #define spre cou...
#include <bits/stdc++.h> using namespace std; typedef long long ll; //int:2*10**9 typedef long double ld; typedef pair<ll,ll> P; #define REP(i,n) for(ll i = 0; i<(ll)(n); i++) #define FOR(i,a,b) for(ll i=(a);i<=(b);i++) #define FORD(i,a,b) for(ll i=(a);i>=(b);i--) #define vec2(name,i,j,k) vector<vector<ll>> name(i,vect...
#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; int POW[10]; char table[260]; //最大公約数 ll gcd(ll x,ll y){ x = abs(x); y = abs(y); ...
#include <stdlib.h> #include <cmath> #include <cstdio> #include <cstdint> #include <string> #include <iostream> #include <vector> #include <utility> #include <algorithm> #include <map> using namespace std; using ll = long long; int main(){ string X; cin >> X; ll index=-1; for(ll i=0;i<X.size();++i){ if(X[...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = int64_t; int main() { string s; cin >> s; string t; for(int i = 1; i < s.size(); i++) t += s[i]; t += s[0]; cout << t << endl; }
#include <algorithm> #include <iostream> #include <numeric> #include <string> #include <tuple> #include <utility> #include <vector> #define rep(i, a, b) for (int i = int(a); i < int(b); i++) using namespace std; using ll = long long int; // clang-format off #ifdef _DEBUG_ #define dump(...) do{ cerr << __LINE__ << ":\...
#include <algorithm> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstring> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <tuple> #include <vec...
#pragma region //#pragma optimize("Ofast") #include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <vector> using namespace std; typedef long long ll; #define tr t[root] #define lson t[root << 1] #define rson t[root << 1 | 1]...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<ll,ll> pll; typedef pair<ll,pll> plp; typedef pair<pll,ll> ppl; typedef pair<pll,pll> ppp; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<vvll> vvvll; typedef vecto...
#include<bits/stdc++.h> using namespace std; #define ll long long #define ull unsigned long long #define gcd __gcd #define INF LONG_LONG_MAX #define rep(i,n) for(int i=0;i<(int)(n);i++) int main(){ string str; cin >> str; int ans=0; rep(i,10000){ vector<bool> flag(10); //最初にフラグを立てる. ...
#include <iostream> using namespace std; int main() { char a,b,c; cin >> a >>b >> c ; cout << b<<c<<a; return 0; }
#include <iostream> #include <iomanip> #include <cmath> #include <cstdlib> #include <cstring> #include <climits> #include <algorithm> #include <numeric> #include <utility> #include <random> #include <chrono> #include <string> #include <vector> #include <stack> #include <queue> #include <set> #include <map> #include <un...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll K,N,M; class Node{ public: ll diff,b,pos; Node(ll _d = 0,ll _b = 0,ll _p = 0):diff(_d),b(_b),pos(_p){ } }; bool operator < (const Node &A,const Node &B){ return A.diff > B.diff; } void solve(){ vector<ll> vec; for(int i=0;...
#line 1 "main_d.cpp" #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cctype> #include <cstdint> #include <cstdlib> #include <cmath> #include <complex> #include <chrono> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <memory> #in...
#include<bits/stdc++.h> using namespace std; using namespace std::chrono; const int mod=1e9+7; const int mex=2002; #define ll long long #define test int t;cin>>t;while(t--) #define fast ios_base::sync_with_stdio(false);cin.tie(NULL); #define fo(i,a,n) for(int i=a;i<n;i++) #define rfo(i,a,b) for(int i=a;i>=b;i--) #de...
#include <bits/stdc++.h> #define ll long long using namespace std; const int maxn=100000; int n; int p[maxn+1],a[maxn+1]; int main(){ cin>>n; iota(p,p+n+1,0); for (int i=2;;++i){ int j=i*i; if (j>n) break; if (p[i]!=i) continue; while (j<=n) { p[j]=i; j+=i; } } a[1]=1; cout<<1; for (int i=2;i<=...
#include <iostream> #include <cstdio> #include <string> #include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <utility> #include <cmath> #include <vector> #include <queue> #include <deque> #include <set> #include <map> #include <numeric> #include <functional> using namespace std; typedef...
//#pragma GCC optimize "trapv" #pragma GCC optimize("Ofast") #pragma GCC optimize("O3", "unroll-loops") #pragma GCC target("avx,avx2,fma") #include<bits/stdc++.h> #define ll long long int #define fab(a,b,i) for(int i=a;i<b;i++) #define pb push_back #define db double #define mp make_pair #define endl "\n" #define f firs...
#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> #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...
#include<bits/stdc++.h> // 76 87 using namespace std; #define rep(x, k, n) for(int x = (k); x < (n); ++x) #define repr(x, k, n) for(int x = (k); x > (n); --x) #define tr(it,a) for(auto it = (a).begin(); it != (a).end(); ++it) #define ll long long #define siz(x) ((int)(x).size()) #defi...
#include<bits/stdc++.h> using namespace std; #define int long long #define MOD 1000000007 #define pd push_back #define sort(v) sort(v.begin(),v.end()) #define Sort(v) sort(v.begin(),v.end(),greater<int>()) #define display(s) for(auto val:s) cout<<val<<" "; cout<<endl; #define displayMap(mymap) for(auto val:mymap) cout<...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a,b,c,d;cin>>a>>b>>c>>d;ll e=0; ll ans=-1; for(ll x=0;x<=1e8;x++){ ll r=a+b*x; ll l=c*x; if(r<=l*d){ ans=x; break; } } cout<<ans<<endl; return 0; }
#include <bits/stdc++.h> using namespace std; bool delimiter, unof = 1; #define F first #define S second #define pb push_back #define ll long long #define all(x) x.begin() , x.end() #define rep(i,s,e) for (int i = s; i < e; ++i) #define rev(i,s,e) for (int i = s; i > e; --i) inline namespace IO{ template<class t> u...
#include<bits/stdc++.h> using namespace std; int main () { ios_base::sync_with_stdio(false); cin.tie(0); int a, b; cin >> a >> b; int sum = a * (a + 1) / 2 - b * (b + 1) / 2; for (int i = 1; i <= a; i++) { int x = i; if (sum < 0) x += abs(sum), sum = 0; cout << x << " "; }...
#include <bits/stdc++.h> // #include <atcoder/all> // using namespace atcoder; #define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) #define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++) #define repr(i, n) for (ll i = n; i >= 0; i--) #define pb push_back #define COUT(x) cout << (x) << "\n" #define COUTF(x) cout << setpre...
#include <iostream> #include <vector> #include <map> #include <set> #include <algorithm> using namespace std; int n; int64_t C; int minn(int64_t &a, int &b) { return (a < b) ? a : b; } int main(int argc, const char * argv[]) { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> C; ...
#include <iostream> using namespace std; int main(void){ double x,y,z; //take_g, taka_yen, su_g, su_yen cin >> x >> y >> z; // 高橋,すぬの1gあたりの値段 double taka_per_yen = y/x; double su_per_yen; // すぬの1gあたりの値段がより小さくなるまで回す int amp = z*taka_per_yen; while(true){ su_per_yen = amp/z...
#include<iostream> #include<algorithm> #include<cstring> #include<cstdio> #include<bitset> #include<cmath> #include<ctime> #include<queue> #include<map> #include<set> #define int long long #define lowbit(x) (x&(-x)) #define mid ((l+r)>>1) #define lc (x<<1) #define rc (x<<1|1) #define max Max #define min Min #define ab...
#include<bits/stdc++.h> using namespace std; int a,b; int main(){ cin>>a>>b; int t=1000000000; int tt=t; for(int i=1;i<a;i++){ cout<<i<<" "; tt-=i; } cout<<tt<<" "; int ttt=t; for(int i=1;i<b;i++){ cout<<-i<<" "; ttt-=i; } cout<<-ttt; }
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <queue> #include <bitset> #include <cmath> using namespace std; #include<stdio.h> #include <stdlib.h> int main() { double a, b; cin >> a >> b; double ans = 100-((b / a) * 100); cout << ans << endl; }
#include <iostream> #include <vector> #include <string> using namespace std; int main() { int n, s, d, xs, ys; cin >> n >> s >> d; bool dmg = false; for (int i = 0; i < n; ++i) { cin >> xs >> ys; if (xs < s && ys > d) dmg = true; } if (dmg) cout << "Yes\n"; else cout << "No\n"; return 0; }
// C - POW #include <bits/stdc++.h> using namespace std; int main(){ int a, b, c; cin>>a>>b>>c; if((a<0 || b<0) && c%2==0) a = abs(a), b = abs(b); puts(a<b? "<": a>b? ">":"="); }
#include <bits/stdc++.h> using namespace std; int main() { // long long int i,j,k,n,m,t,v,s,d; long double x,y,r; cin>>x>>y>>r; r+=1e-14; long long int sx=ceil(x-r),ex=floor(x+r); long long int c=0; for(long long int i=sx;i<=ex;i++) { if(i>=x-r && i<=x+r) { long double y...
// #define ONLINE_JUDGE #include <bits/stdc++.h> using namespace std; using ll = long long; #ifndef ONLINE_JUDGE # define dbg(x) cerr << '#' << #x << ' ' << x << endl # define TIME cerr << "RuningTime: " << clock() << "ms\n", 0 #else # define dbg(x) # define TIME 0 #endif #define mem(a,b) memset(a,b,sizeof(a)) ...
#include "algorithm" #include "iostream" #include "numeric" #include "iomanip" #include "cstring" #include "math.h" #include "bitset" #include "string" #include "vector" #include "random" #include "chrono" #include "ctime" #include ...
// clang-format off #include <bits/stdc++.h> using namespace std; #define int long long #define stoi stoll using pii = pair<int,int>; using vi = vector<int>; using vvi = vector<vi>; #define all(c) begin(c), end(c) #define rall(c) rbegin(c), rend(c) #define fore(x, c) for(auto &&x : c) #define rep(i, a, n) for(int i = a...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; typedef long long ll; #define fi first #define se second #define mp make_pair #define pb push_back #define range(i, a...
#include <iostream> #include <stdio.h> #include <cstring> #include <cstdio> #include <math.h> #include <algorithm> #include <vector> #include <string> #include <stdlib.h> #include <queue> #include <stack> #include <utility> #include <fstream> //#include <random> #include <map> //#include <unordered_map> #include <cstdl...
/* AUTHOR:SOURABH CREATED:13:12:20 */ #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ordered_set tree<ll , null_type, less< ll >, rb_tree_tag, tree_order_statistics_node_update> #define ll long long int #define ld long double #define fi first #define s...
#include <bits/stdc++.h> #define endl '\n' #define fi first #define se second #define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k)) #define forn(i,n) for (int i = 0; i < (n); i++) #define forr(i,a,b) for (int i = a; i <= b; i++) #define all(v) v.begin(), v.end() #define pb(x) push_back(x) using namespace std; typedef long...
#define _USE_MATH_DEFINES #include <iostream> //cin, cout #include <vector> //vector #include <algorithm> //sort,min,max,count #include <string> //string,getline, to_string #include <ios> //fixed #include <iomanip> //setprecision #include <utility> //swap, pair #include <cstdlib> //abs(int) #include <cmath> //sqrt,ce...
#include <bits/stdc++.h> using namespace std; int main(){ int a, b, x, y; cin >> a >> b >> x >> y; if (a<=b){ cout << min(x+(b-a)*y, (b-a)*2*x+x) << endl; return 0; } else{ cout << min(x+(a-b-1)*y, (a-b-1)*2*x+x) << endl; return 0; } }
#include <stdio.h> #include <math.h> #include <iostream> #include <algorithm> #include <vector> #include <numeric> #include <string> #include <map> #include <set> #include <bitset> #include <queue> #include <stack> #include <memory.h> #include <iomanip> //#include <atcoder/all> //#include <bits/stdc++.h> using namespac...
#include<bits/stdc++.h> using namespace std; #define int long long #define all(v) (v).begin(), (v).end() signed main(){ int x; cin>>x; cout<<(x<0?0:x); }
#include <climits> #include <iostream> #include <unordered_map> #include <map> #include <vector> #include <unordered_set> #include <iomanip> #include <queue> #include <algorithm> #include <set> #include <cmath> #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #includ...
#include <bits/stdc++.h> #define endl '\n' using namespace std; using ll = long long; const int MOD = 998244353; static const int MX = 200100; ll poww(ll a, ll b) { if (b == 0) { return 1; } if (b & 1) { return (a * poww(a, b - 1)) % MOD; } return poww((a * a) % MOD, b >> 1); } ll inv(ll a) { return poww(a...
#include <bits/stdc++.h> #include <vector> // #include <atcoder/all> // using namespace atcoder; using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); int N, M, T; cin >> N >> M >> T; vector<ll> A(M); vector<ll> B(M); for (int i = 0;...
#include <bits/stdc++.h> #define ll long long #define sz(x) (int)(x).size() using namespace std; //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //uniform_int_distribution<int>(1000,10000)(rng) ll binpow(ll a, ll b) { ll res = 1; while (b > 0) { if (b & 1) res = r...
#include<bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long int int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n; cin>>n; double D,H; cin>>D>>H; double ans=0.0; while(n--) { ...
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<long long> VL; typedef vector<vector<long long>> VVL; typedef pair<int,int> Pair; typedef tuple<int,int,int> tpl; #define ALL(a) (a).begin(),(a).end() #define SORT(c) sort((c).begin(),(c...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> P; #define eps 1e-9 #define INF 2000000000 // 2e9 #define LLINF 2000000000000000000ll // 2e18 (llmax:9e18) #define all(x) (x).begin(), (x).end() #define sq(x) ((x) * (x)) #ifndef LOCAL #define dmp(...) ; #else #d...
#include<iostream> #include<algorithm> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if(a == c && b == d) { cout << 0; return 0; } if(a + b == c + d || a - b == c - d || abs(a - c) + abs(b - d) <= 3) { cout << 1; return 0; } ...
#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,fma,abm,mmx,avx,avx2") #include <bits/stdc++.h> #define all(V) V.begin(),V.end() #define pi 3.1415926535897932384626 #define fi fixed<<setprecision(13) #define ll long long #define rep(i, n) for (int i = 0; ...
#include<bits/stdc++.h> using namespace std; #define dbg(x) cerr << #x << " = " << x << endl #define rep(i, a, b) for(int i = (a); i <= (b); ++ i) #define MP make_pair #define pb push_back #define fi first #define se second typedef long long LL; typedef unsigned long long u64; typedef unsigned int u32; template <typena...
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll mod; ll qpow(ll a, ll n)//计算a^n % mod { ll re = 1; while(n) { if(n & 1)//判断n的最后一位是否为1 re = (re * a) %mod; n >>= 1;//舍去n的最后一位 a = (a * a) %mod;//将a平方 } return re %mod; } int main() { ll n, m...
#include<bits/stdc++.h> #define pi 3.141592653589793238 #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #define MOD 1000000007 #define INF 999999999999999999 #define pb push_back #define ff first #define ss second #define mt make_tuple #define ll long long #defin...
#include <bits/stdc++.h> #include <cmath> #include <unordered_set> using namespace std; using ll = long long; using vi = vector<int>; int main() { double x, y, z; cin >> x >> y >> z; double ans = 10000000; while(y/x <= ans/z){ ans--; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; #define ll long long #define forin(in ,n) for(ll i=0; i<n; i++) cin>>in[i] #define forout(out) for(ll i=0; i<(ll)out.size(); i++) cout<<out[i]<<endl #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) fo...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> P; const ll mod=998244353; #define rep(i,n) for (int i = 0; i < (n); i++) int n,m; ll dp[10000]; ll fac[5100], finv[5100], inv[5100]; void COMinit(int n) { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for ...
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int mod=998244353; inline int addmod(int x) { return x>=mod?x-mod:x; } int n,m,c[5005][5005],f[105][5005],pn=5e3; int main() { for(int i=0;i<=pn;i++) c[i][0]=1; for(int i=1;i<=pn;i++) for(int j=1;j<=pn;j++) c[i][j]=addmod(c[i-1]...
/**Bismillahir Rahmanir Rahim.**/ /* Md.Fagun Molla 18ICTCSE006 BSMRSTU(SHIICT) */ #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; using ll=long long; using db=double; ///...
#include<bits/stdc++.h> using namespace std; #define db(a) cout<<#a<<"="<<(a)<<'\n'; #define DB(a) {cout<<#a<<"里的元素为 ";for(auto x:a)cout<<x<<' ';cout<<'\n';} #define DBB(a) {cout<<#a<<"里的元素为 ";for(auto x:a)cout<<x.first<<' '<<x.second<<" ";cout<<'\n';} #define bb begin() #define ee end() #define ss size() #define pb...
/* * Author: Kewth * Date: echo -n ' ' && date +%Y.%m.%d # Type "!!sh" in Vim. * Solution: To be updated after "Accept". * Digression: * CopyRight: __ __ __ __ | |/ |.-----.--.--.--.| |_| |--. | < | -__| | | || _| | |__|\__||_____|________||____|__|__| */ ...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cfloat> #include <chrono> #include <climits> #include <cmath> #include <cstdio> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstre...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using pii = pair<int, int>; using vi = vector<int>; using vii = vector<vi>; using ll = long long; int main() { ll r, x, y; cin >> r >> x >> y; ll di...
//Code Written by Pinaki Bhattacharjee #include<bits/stdc++.h> using namespace std; // typedef typedef long long ll; typedef long double ld; typedef unsigned int uint; typedef unsigned long long ull; // #define #define LOCAL #define INF 1e18 #define MAX 10000 #define PI 2*acos(0.0) #define endl "\n" #define pb push_b...
#include <bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n>>m; vector<int> g(n); for(int i=0;i<m;i++){ int a,b; cin>>a>>b; a--;b--; g[a]|=1<<b; g[b]|=1<<a; } if(m==0){ cout<<n<<endl; return 0; } vector<int> dp(1<<n,...
#include<bits/stdc++.h> using namespace std; #define ALL(x) begin(x),end(x) #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; #define mod 1000000007 using ll=long long; const int INF=1000000000; const ll LINF=1001002003004005006ll; int dx[]={1,0,-1,0},dy[]={0...
//@Author: KeinYukiyoshi // clang-format off #include <bits/stdc++.h> //#pragma GCC optimize("Ofast") //#pragma GCC target("avx") #define int long long using namespace std; #define stoi stoll #define fi first #define se second #define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++) #define rep2(i, a, b) for (int i...
#include <bits/stdc++.h> #define ll long long #define vi vector<int> #define vll vector<long long> #define pii pair<int,int> #define pll pair<ll,ll> #define sll set<long long> #define si set<int> #define sti stack<int> #define stkl stack<ll> #define qi queue<int> #define pb push_back #define ff first #define ss secon...
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; n *= 1.08; if(n < 206) { cout << "Yay!" << endl; } else if(n == 206) { cout << "so-so" << endl; } else { cout << ":(" << endl; } return 0; }
#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 int long long #define read(a) for(auto &z : a) cin >> z; #define write(a) {for(auto &z : a) cout << z << ' ';cout << '\n';} #define print(a) cout << a...
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <numeric> #include <utility> #include <tuple> #define REP(i, a, b) for (int i = int(a); i < int(b); i++) using namespace std; using ll = long long int; using P = pair<ll, ll>; // clang-format off #ifdef _DEBUG_ #define dump(...) do{...
#include "bits/stdc++.h" using namespace std; #include "string" #define int long long #define pi pair <int, int> #define ff first #define ss second #define boost ios::sync_with_stdio(false);cin.tie(nullptr) #define endl '\n' #define vi vector<int> const int M = 998244353; int mod(int m, int mod = M) { m %= mod; ...
#include <bits/stdc++.h> using namespace std; int n, m, a, b, db=1; string s[100]; int main() { cin >> n >> m >> a >> b; a--, b--; for (int i=0; i<n; i++) { cin >> s[i]; } for (int j=b-1; j>=0; j--) { if (s[a][j]=='.') { db++; } else { break; ...
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { int w,h,x,y,i,j,s=0,k; cin>>h>>w>>x>>y; char a[h][w]; for(i=0;i<h;i++){ for(j=0;j<w;j++){ cin>>a[i][j]; } } for(i=x-1;i<x;i++){ for(j=y-1;j<y;j++){ for(k=j+1;k<w;k++){ ...
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "/debug.h" #else #define db(...) #endif #define all(v) v.begin(), v.end() #define pb push_back using ll = long long; const int NAX = 2e5 + 5, MOD = 1000000007; const string FIRST = "First"; const string SECOND = "Second"; auto solveCase(int n, const...
#include<iostream> #include<algorithm> using namespace std; int solve(){ int n; scanf("%d",&n); int a[n]; for(int i=0;i<n;i++) scanf("%d",a+i); if(n%2){ puts("Second"); return 0; } sort(a,a+n); for(int i=0;i<n;){ int st=0; while(st+i<n and a[st+i]==a[i]) st++; if(st&1){ puts("First"); return 0; ...
#include<bits/stdc++.h> using namespace std ; #define long long ll #define mod 1000000007 int main () { string str ; cin >> str ; int count=0 ; for (int i=0;i<=(str.length()-4);i++) { if(str[i]=='Z') { if(str[i+1]=='O'&&str[i+2]=='N'&&str[i+3]=='e') count++; } } cout<<count<<"\n"; }
#include <bits/stdc++.h> #define ll long long int #define w(t) int t; cin>>t; while(t--) #define F first #define S second #define pb push_back #define mp make_pair #define pii pair<int,int> #define mii map<int,int> #defin...
#include <bits/stdc++.h> using namespace std ; typedef long long ll ; typedef pair<ll,int> P ; #define MAX_M (ll)100 #define MAX_N 100000 int n , m , X , Y ; struct edge { ll cost ; ll limit ; int to ; }; vector<edge> G[100000] ; ll d[100000] ; ll djikstra(int s , int t){ fill(d,d+n,LLONG_MAX) ; d[s] = 0...
#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <utility> #include <cmath> #include <vector> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <tuple> #include <numeric> #include <functional> using namespace std; typedef long long ll; typedef...
#include <bits/stdc++.h> using ll = long long; using namespace std; #define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++) #define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++) #define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--) #define rreps(i, n) for (int i = ((int)(n)); i ...
#include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0); #define ll long long int #define INFL 1e18L #define INF 2e9 #define nl '\n' #define ld long double #define precision(x) fixed << setprecision(x) const ll mod = 998244353; ll gcd(ll a, ll b) { if (b == 0) retur...
#include <iostream> using namespace std; int N; long long int A[1000006], B[1000006]; int main(void) { cin >> N; for (int i = 1; i <= N; i++) { cin >> A[i]; } for (int i = 1; i <= N; i++) { cin >> B[i]; } long long int ans = 0; for (int i = 1; i <= N; i++) { ans += A[i] * B[i]; } if (ans == 0) { co...
#include<bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> #define ll long long #define pb push_back #define mp make_pair #define endl "\n" #define int ll #define vi vec...
#include <bits/stdc++.h> using namespace std; #define forn(i, n) for (int i = 0; i < (n); i++) #define pb push_back #define mp make_pair #define MOD 1000000007 #define f first #define s second #define rand(i, j) uniform_int_distribution<ll>((ll)(i), (ll)(j))(rng) mt19937 rng(std::chrono::steady_clock::now().time_since...
#define _GLIBCXX_DEBUG #include <algorithm> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> // #include <atcoder/all> // using namespace atcoder; using namespace std; using l...
#include<cstdio> #include<vector> #include<algorithm> #include<iostream> #include<stack> #include<queue> #include<string> using namespace std; const int INF = 1000000001; typedef pair<int, int> P; typedef long long ll; int main(){ int a, b, c; cin >> a >> b >> c; if (a == b) cout << c << endl; else i...
#include <bits/stdc++.h> #define crap ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define db1(x) cout<<#x<<"="<<x<<'\n' #define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n' #define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n' #define rep(i,n) for(ll i=0;i<(n);++i) #define repA(i,a,n) for...
#include <iostream> using namespace std; int main() { int x,y; cin>>x>>y; int z=min(x,y); int g=max(x,y); if(z+3>g) cout<<"Yes"; else cout<<" No"; return 0; }
// include #include <algorithm> #include <complex> #include <iostream> #include <string> #include <vector> using namespace std; //型短縮 #define ll long long //マクロ定義 #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { ll N, K; cin >> N >> K; ll res = 0; string bigstr = to_string(N); string sma...
#include <iostream> using namespace std; int main() { int N; cin >> N; int x = N/100; if (!(N%100==0)) x++; cout << x; }
//#include <bits/stdc++.h> #include <iostream> #include <vector> #include <queue> #include <stack> #include <list> #include <string> #include <string.h> #include <assert.h> #include <math.h> #include <numeric> #include <cmath> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <lim...
#include <bits/stdc++.h> #include <limits> using namespace std; typedef unsigned long long int ull; typedef long long int ll; #define fi(i,n) for( ll i=0 ; i<n ; i++ ) #define f(i, a, b) for( ll i=a ; i<b ; i++ ) #define vi vector<int> #define pb push_back #define MOD 1000000007 ll digits(ll n) { return floor(log10...
#include <iostream> #include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5, OO = 1e9; long long a[N] , j = 0; long long n; void divisor(long long value){ long long i = 1; for( ; i * i < value; ++i){ if(value % i == 0){ a[j] = i; j++; a[j] = value / i; ...
#include <stdio.h> #include <bits/stdc++.h> using namespace std; typedef long long ll; #define SZ(a) int((a).size()) #define _REP(_1,_2,_3,_4,name,...) name #define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s)) #define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:...
#include <bits/stdc++.h> #define s second #define f first #define pb push_back #define endl '\n' #define all(x) (x).begin(), (x).end() #define _ ios_base::sync_with_stdio(0);cin.tie(0); #define read(x) for(auto& qw : (x)) cin >> qw; #define print(x) for(auto& qw : (x)) cout << qw << " "; cout << endl; using namespace s...
#include <bits/stdc++.h> int n, m; int main() { scanf("%d%d", &n, &m); if (m == 0) { for (int i = 1; i < 2 * n; i += 2) { printf("%d %d\n", i, i + 1); } } else if (m < 0 || m >= n - 1) { printf("-1\n"); } else { printf("1 1000000000\n"); printf("2 1000000\n"); int k1 = n - 2 - m...
#include <iostream> #include <map> #include <vector> using namespace std; int main() { ios_base::sync_with_stdio(false);cin.tie(0); int N,M,i,k=1; cin >> N >> M; if(N == 1 && M ==0){ cout << 1 <<" "<< 2 <<"\n"; return 0; } else if(M == 0 && N%2!=0){ cout << -1; ...
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int,int>; int main() { double sx, sy, gx, gy; cin >> sx >> sy >> gx >> gy; double ans = (gx - sx)*sy/(sy+gy) + sx; printf("%f06\n", ans); return 0; }
#include <iostream> #include <iomanip> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.precision(16); double sx, sy, gx, gy; cin >> sx >> sy >> gx >> gy; if (sx > gx) { swap(sx, gx); swap(sy, gy); } sy = -sy; double dy = gy - sy, dx = gx - sx; auto chec...
#include <iostream> #include <algorithm> #include <vector> #include <math.h> #include <set> #include <map> #define repi(i, s, e) for (int i = (s); i < (e); ++i) using namespace std; using ll = int64_t; int main() { int n; cin >> n; ll x[n]; repi(i, 0, n) cin >> x[i]; ll man = 0; repi(i, 0, n) ...
/** ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀ ⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀⠀⠀ ⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄⠀ ⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿⠀ ⠀⡇⠀⠀⠀⠀...
#include<bits/stdc++.h> #define DONTSYNC ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) //dont use stdio with iostream functions //input and output are out of order now! #define TEST unsigned long long T; cin>>T; while(T--) //loop over each testcase #define endl "\n" #define fori(a,start,end) for(i...
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; const int INF=1e9; const ll MOD=998244353; struct UnionFind{ vector<int> par; vector<int> sizes; UnionFind(int n):par(n),sizes(n,1){ for(int i=0;i<n;i++){ par[i]=i; } } i...
#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)...
#include <bits/stdc++.h> #define int long long #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; signed main(){ fastio //Equivalent to the problem which we need to collect from the top of the grid down int n; cin >> n; int l[n+1], r[n+1]; fill(l,l+n+1,...
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { double sx, sy, gx, gy; cin >> sx >> sy >> gx >> gy; double ty = sy + gy; double tx; if(sx >=0 && gx >= 0){ if(sx > gx){ tx = sx ...
/* Har Har Mahadev */ //cout<<fixed<<setprecision(11)<<ans<<"\n"; //cin.ignore();getline(cin,s,'\n'); #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef vector<ll> vll; typedef pair<ll,ll> pll; #define lab(i,a,b) for(i=a;i<=b;i++) #define bal(i,a,b) for(i=b;i>=a;...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); int n; cin>>n; int a[n]; for (int i=0;i<n;i++) cin>>a[i]; vector<int> sav(200007,0); int m=0;int nm=1; for (int i=0;i<n;i++) { sav[a[i]]=1; if (sav[m]!=0) { while (sav[m]...
#include <bits/stdc++.h> #define fi first #define se second #define pb push_back #define mp make_pair #define sz(x) ((int)(x).size()) #define endl "\n" #define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr); #define all(x) x.begin(),x.end() #define y1 omg #define INF 1000000010 #define FOR(x, n) for(int x=0;...
#include "bits/stdc++.h" #include <ext/pb_ds/assoc_container.hpp> //#include <boost/multiprecision/cpp_int.hpp> using namespace std; using namespace __gnu_pbds; //using namespace boost::multiprecision; typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; typedef l...
#include <bits/stdc++.h> using namespace std; #define all(hoge) (hoge).begin(), (hoge).end() #define en '\n' using ll = long long; using ull = unsigned long long; #define rep(i, m, n) for(ll i = (ll)(m); i < (ll)(n); ++i) #define rep2(i, m, n) for(ll i = (ll)(n)-1; i >= (ll)(m); --i) #define REP(i, n) rep(i, 0, n) #de...
#include <bits/stdc++.h> #define debug(x) cerr << #x << " = " << x << endl using namespace std; typedef long long LL; const int MAXN = 3005; const int MOD = 998244353; int n, k, dp[MAXN][MAXN]; template <class T> void read(T& x) { x = 0; T f = 1; char ch = getchar(); while (ch < '0' || ch > '9') f =...
#include<bits/stdc++.h> using namespace std; using ll = long long; using vl = vector<ll>; #define rep(i,n) for(int i=0;i<(n);i++) #define rrep(i,n) for(int i=(n)-1;i>=0;i--) #define rep1(i,n) for(int i=1;i<=(n);i++) #define rrep1(i,n) for(int i=(n);i>0;i--) #define fore(i_in,a) for (auto& i_in: a) #define all(x) x.begi...
#include <bits/stdc++.h> #define ll long long #define db long double #define x first #define y second #define mp make_pair #define pb push_back #define all(a) a.begin(), a.end() using namespace std; int main(){ #ifdef LOCAL freopen("E_input.txt", "r", stdin); //freopen("E_output.txt", "w", stdout); #endif ios_ba...
///****In the name of ALLAH, most Gracious, most Compassionate****// #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair <int, int> pii; #define ALL(a) a.begin(), a.end() #define FastIO...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define ud unsigned int #define ll long long #define ull unsigned long long #define MAX_INF 0x3f #define MAX_INF_VAL 0x3f3f3f3f #define MAX_INF_VAL_LL 0x3f3f3f3f3f3f3f3f //#define pi 3.141592653589 #define eps 1e-9 #define F(x) ((x)/3+((x)%3==1?0:tb)) #define G(x) ...
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; #define rep(i,n) for(ll i=0; i<n; i++) #define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++) #define rrep(i,n) for(ll i=n-1; i>=0; i--) #define fi first #define se second long long mo = 1000000007; typedef long long ll; typedef long double ld; typedef ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define light ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define vp(v) for(auto it = v.begin(); it != v.end(); it++) cout << *it << " "; cout<<endl; int main() { light ll tx; cin>>tx; ll h1, h2 , t; string s1 , s2 , ...
#include <iostream> #include <cstdio> #include <vector> #include <queue> #include <stack> #include <algorithm> #include <set> #include <map> #include <deque> #include <cmath> #include <string> #include <iomanip> #include <locale> #include <list> #include <bitset> #include <tuple> #include <fstream> using namespace std;...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int a[maxn]; int main() { int T; scanf("%d", &T); for(int cas = 1; cas <= T; ++cas) { int n; scanf("%d", &n); for(int i = 1; i <= n; ++i) scanf("%d", &a[i]); if(n & 1) puts("Second"); else { sort(a + 1, a + n + 1); bool flag ...
//Shinchan Loves Coding :)) #include<bits/stdc++.h> using namespace std; #define night_rider ios::sync_with_stdio(false);cin.tie(NULL); #define double long double #define int long long int #define en "\n" #define fi first #define se second #define PB push_back #define all(v) v.begin(),v.end() #define allr(v) v.rbegin...
#pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") #pragma GCC optimize("unroll-loops") // #include <atcoder/all> // #include <bits/stdc++.h> #include <complex> #include <queue> #include <set> #include <unordered_set> #include <list> #include <chrono> #include <rand...
#include<bits/stdc++.h> using namespace std; const int maxN = 1e6 + 100; int N, M, t[maxN], x[maxN], y[maxN], sz[maxN], vol[maxN]; int tata (int nod) { if (t[nod] == nod) return nod; return t[nod] = tata (t[nod]); } int main () { //freopen ("input", "r", stdin); //freopen ("output", "w", stdout); scanf ("%...
#include <iostream> #include <vector> #include <limits> #include <algorithm> #include <map> #include <math.h> using namespace std; using ll = long long; const int INT_INF = numeric_limits<int>::max(); const long long LL_INF = numeric_limits<long long>::max(); int main() { double A, B; cin >> A >> B; double C = 1...
#include <iostream> using namespace std; int main() { long s,p; cin>>s>>p; for(int i=1; i<=1000000; i++){ if(p%i==0&&i+p/i==s){ cout<<"Yes\n"; return 0; } } cout<<"No\n"; }
#include <algorithm> #include <iomanip> #include <iostream> using ld = long double; int main() { std::cout << std::fixed << std::setprecision(16); int N; ld D, H, res = -1.0; std::cin >> N >> D >> H; ld d, h, y; for (int i = 0; i < N; i++) { std::cin >> d >> h; y = ((h - H) * (-1 * D)) / (d - D); ...
#include<bits/stdc++.h> typedef long long int lli; typedef long double lld; typedef long long ll; //Fast Input I/O #define fio ios_base::sync_with_stdio(false), cin.tie(NULL); //Datatype #define vi vector<int> #define vlli vector<long long int> #define vvi vector<vector<int>> #define vvlli vector<vector<long long int...
#include<bits/stdc++.h> #define ll long long using namespace std; int main(){ int a,b,c,d; cin>>a>>b; cin>>c>>d; int maks = -999999; for(int i=a;i<=b;i++){ for(int j=c;j<=d;j++){ maks = max(maks,i-j); } }cout<<maks<<endl; }
#include<bits/stdc++.h> using namespace std; int main() { int a,b,c,d; cin>>a>>b>>c>>d; int result= b-c; cout<< result <<endl; return 0; }
#include <iostream> #include<vector> #include<algorithm> #include<string> #include<map> #include<set> #include<stack> #include<queue> #include<math.h> using namespace std; typedef long long ll; #define int long long #define double long double typedef vector<int> VI; typedef pair<int, int> pii; typedef vector<pii> VP; t...
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <functional> using namespace std; struct DataA { int a; char b; }; template<typename T> void vMap(vector<T>& dst, vector<T>& src, function<T(T)> callback) { transform(src.begin(), src.end(), dst.begin(), callback); } ...
#include <bits/stdc++.h> using namespace std; using lli = long long int; using ii = pair<int, lli>; const int MAXN = 2e5; const lli MOD = 1e9+7; int n; vector<ii> adj[MAXN+1]; lli rootXor[MAXN+1]; void dfs(int u, int p, lli x) { rootXor[u] = x; for(ii v: adj[u]) { if(v.first == p) { con...
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define sc(x) scanf("%lld",&(x)); int n; vector<pair<int,int> > G[200005]; int dp[200005][62][2]; const int mod = 1e9+7; int ans = 0; void dfs(int x,int fa) { int w,t; for(auto &a : G[x]) { if(a.first != fa) ...
// #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 <bits/stdc++.h> using namespace std; typedef long long ll; const ll LINF = 1001001001001001001; #ifdef _DEBUG #define show(x) \ cerr << #x << " : "; \ showVal(x) template <typename T> void showVal(const T &a) { cerr << a << endl; } template <typename T> void showVal(const vector<T> &a) { for (const...
#include <bits/stdc++.h> using namespace std; int main() { int A, B, C; cin >> A >> B >> C; pair<int, int> p = {A, B}; string ans; string next = C == 0 ? "A" : "B"; while (true) { if (next == "A") { if (p.first < 0) { ans = "Aoki"; break; } p.first--; next = "B"...
#pragma GCC optimize("O3") #pragma GCC optimize ("unroll-loops") #define io_init cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(20) #include <bits/stdc++.h> constexpr int INF = 2147483647; constexpr long long int INF_LL = 9223372036854775807; constexpr int MOD = 1000000007; constexpr double PI = 3.1415926...
//#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 cos...
#include <bits/stdc++.h> using namespace std; typedef long double ldb; #define pb push_back const int N = 1500005; struct pldld { ldb x,y; friend pldld operator + (const pldld x,const ldb y) { return {x.x,x.y+y}; } friend pldld operator + (const pldld x,const pldld y) { return {x...
// Problem: E - Spread of Information // Contest: AtCoder - AtCoder Regular Contest 116 // URL: https://atcoder.jp/contests/arc116/tasks/arc116_e // Memory Limit: 1024 MB // Time Limit: 3000 ms // // Powered by CP Editor (https://cpeditor.org) #include <bits/stdc++.h> using namespace std; inline int read(){ int s...
//================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<iostream> using namespace std; int main(){ int N; cin>>N; if(N%2==0) cout<<"White"; else cout<<"Black"; }
#include<bits/stdc++.h> #define eps 1e-9 #define MOD1 998244353 #define MOD2 1000000007 #define INV_2 499122177 #define INF 1000000000 #define PI 3.14159265358979323846 using namespace std; int main() { ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int m, h; cin >> m >> h; if(h%m == 0) cout << "Yes\n"; else ...
#pragma GCC optimize ("O2") #pragma GCC target ("avx") #include<bits/stdc++.h> //#include<atcoder/all> //using namespace atcoder; #include<iostream> #include<cstring> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) #define rep1(i, n) for(int i = 1; i <= (n); i++) #define co(x)...
#include <bits/stdc++.h> using namespace std; // #include <atcoder/all> // using namespace atcoder; #define rep(i,n) for (int i = 0; i < (n); ++i) using ll = long long; void solve(long long N, std::vector<long long> X){ set<int> all; vector<vector<int>> v(N, vector<int>(50)); rep(i, N) { ll x = ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define lb lower_bound #define ub upper_bound #define fe(x) (*(x.begin())) #define le(x) (*(x.rbegin())) #define pb ...
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; const int N=5e5+10; typedef double lb; lb dp[N][2],sum[N][2]; int bk[N],m,n,k; int main(){ cin>>n>>m>>k; for(int i=1,x;i<=k;i++){ cin>>x;bk[x]=1; } dp[n][0]=dp[n][1]=0; for(int i=n...
//インクルード(アルファベット順) #ifndef TEMPLATE #define TEMPLATE #include<algorithm>//sort,二分探索,など #include<bitset>//固定長bit集合 #include<cmath>//pow,logなど #include<ctime> #include<complex>//複素数 #include<deque>//両端アクセスのキュー #include<functional>//sortのgreater #include<iomanip>//setprecision(浮動小数点の出力の誤差) #include<iostream>//入出力 #include...
#include<bits/stdc++.h> using namespace std; using namespace chrono; #define ff first #define ss second #define pb push_back #define ppb pop_back #define int long long #define mp make_pair #define all(x) (x).begin(), (x).end() #de...