code_file1
stringlengths
87
4k
code_file2
stringlengths
85
4k
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <cmath> using namespace std; int main() { int A,B,C; int ans; cin >> A >> B >> C ; if (A == B) { cout << C; } else if (B == C) { cout << A; } else if (A == C) { cout << B; } else { cout << 0; } }
#include<bits/stdc++.h> using namespace std; #define int long long int a,b,k; int gcd(int x,int y) { if(y==0) return x; else return gcd(y,x%y); } void dfs(int n,int m,int x) { if(n==0){while(m--)cout<<'b';return;} if(m==0){while(n--)cout<<'a';return;} int q=1,w,ci=n+m-1,hh=1,yue=max(n-1,m),shao=min(m,n-1); ...
//@formatter:off #include<bits/stdc++.h> #define rep(i,n) for (int i = 0; i < int(n); ++i) #define rrep(i,n) for (int i = int(n)-1; i >= 0; i--) #define rep2(i,s,n) for (int i = int(s); i < int(n); ++i) #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define pb push_back #define eb emplace_back #de...
#include <algorithm> #include <cmath> #include <cstring> #include <iostream> #include <sstream> #include <numeric> #include <map> #include <vector> using namespace std; typedef long long LL; map<pair<LL, LL>, LL> memo; LL solve(LL x, LL i, const vector<LL> &a) { if (i >= a.size()) return 1; pair<LL, LL> key(x, i);...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vl = vector<ll>; using vll = vector<vl>; using Pll = pair<ll, ll>; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) #define Rep(i,j,n) for (ll i=(ll)(j);i<=(ll)(n);++i) #define all(v) v.begin(), v.end() #define sz(x) ((int) x.si...
#include<bits/stdc++.h> using namespace std; int n,m,q; struct node{ int w,v; }a[55]; struct node1{ int x,num; }b[55]; int cmp(node x,node y){ if(x.v==y.v)return x.w<y.w; return x.v>y.v; } int cmp2(node1 x,node1 y){ return x.x<y.x; } typedef long long ll; int x[55]; bool v[55]; ll ans=0ll; int main(){ cin>>n>>m>>...
#include<bits/stdc++.h> using namespace std; #define ll long long #define vt vector #define ar array #define sz(x) (int)(x).size() #define all(x) x.begin(), x.end() #define pb push_back template<class A> void read(vt<A>& v); template<class A, size_t S> void read(ar<A, S>& a); template<class T> void read(T& x) { cin ...
//Δke_D #include<iostream> #include<cstdio> #include<fstream> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #include<bitset> #include<cmath> #include<cstring> #include<cstdlib> using namespace std; typedef long long LL; typedef double DB; const int N = 333; int n,m,a[N][N]; int main()...
//x<<y=x*2^y,x>>y=x/2^y //1e5+3 is prime // in a matrix, all elements of a primary diagonal have constant diff of coordinates // and a secondary diagonal has constant sum of coordinates //use ll() for using an integer in self-built fn //(x&-x) bitwise and of (x and its 2's complement) returns (last set bit) //eg if x=1...
#include<bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> a(n); for (auto &i : a) cin >> i; a.emplace_back(0); sort(a.begin(), a.end()); ll ans = 1; for (int i = ...
#include <bits/stdc++.h> #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define ll long long #define ALL(a) (a).begin(),(a).end() #define rep(i,n) for(int i=0;i<(n);i++) #define rrep(i,n) for(int i=n-1;i>=0;i--) #define fi first #define se second #define pb push_back #define ...
#include <algorithm> #include <bitset> #include <cmath> #include <cctype> #include <fstream> #include <functional> #include <iostream> #include <iomanip> #include <limits> #include <map> #include <numeric> #include <queue> #include <stdio.h> #include <string> #include <sstream> #include <stack> #include <set> #include ...
//Utkarsh.25dec #include <bits/stdc++.h> #include <chrono> #include <random> #define ll long long int #define ull unsigned long long int #define pb push_back #define mp make_pair #define mod 1000000007 #define rep(i,n) for(ll i=0;i<n;i++) #define loop(i,a,b) for(ll i=a;i<=b;i++) #define vi vector <int> #define vs vecto...
#include<bits/stdc++.h> using namespace std; #define res register int #define ll long long //#define cccgift #define lowbit(x) ((x)&-(x)) #define rep(i,l,r) for(res i=l,_r=r;i<=_r;++i) #define per(i,r,l) for(res i=r,_l=l;i>=_l;--i) #define mkp make_pair #define pb push_back #define mem0(a) memset(a,0,sizeof(a)) #define...
#pragma GCC optimize("O3") #include<bits/stdc++.h> using namespace std; using ll=long long; using P=pair<ll,ll>; template<class T> using V=vector<T>; #define fi first #define se second #define all(v) (v).begin(),(v).end() const ll inf=(1e18); //const ll mod=998244353; const ll mod=1000000007; const vector<int> dy={-1...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define rep(i, n) rep2(i, 0, n) #define re...
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; #define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0) #define p_map(map,it) do {cout << "{";for (auto (it) = map.begin(...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(long long i=0;i<(long long)(n);i++) #define REP(i,k,n) for(long long i=k;i<(long long)(n);i++) #define all(a) a.begin(),a.end() #define pb emplace_back #define eb emplace_back #define lb(v,k) (lower_bound(all(v),k)-v.begin()) #define ub(v,k) (upper_bo...
#include<bits/stdc++.h> #define pb push_back using namespace std; typedef unsigned long long ull; typedef unsigned uint; typedef long long ll; #define G getchar() int read() { int x=0; bool flg=false; char ch=G; for (;!isdigit(ch);ch=G) if (ch=='-') flg=true; for (;isdigit(ch);ch=G) x=(x<<3)+(x<<1)+(ch^48); return ...
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ cin.tie(nullptr)->sync_with_stdio(false); int h,w,a,b; cin >> h >> w >> a >> b; int ans = 0; for(int i = 0; i<(1<<((h-1)*w)); i++){ for(int j = 0; j<(1<<((w-1)*h)); j++){ if(__builtin_popcount(i)+__builtin_popcount(j)!=a)cont...
#include <bits/stdc++.h> #define inf 0x7fffffff typedef long long ll; using namespace std; const ll mod = 1e9 + 7; const double pi = acos(-1); using namespace std; inline ll read(){ ll x = 0, f = 1;char ch = getchar(); while(ch > '9' || ch < '0'){if(ch == '-') f = -1;ch = getchar();} while(ch >= '0' && ch ...
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int> T(N); for (int i = 0; i < N; i++){ cin >> T[i]; } int S = 0; for (int i = 0; i < N; i++){ S += T[i]; } vector<vector<bool>> dp(N + 1, vector<bool>(S + 1, false)); dp[0][0] = true; for (int i = 0; i < N; ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ppb pop_back #define um unordered_map #define MOD 1000000007 #define rep(i,s,e) for(int i=s; i<e; i++) #define rrep(i,s,e) ...
#include<bits/stdc++.h> typedef long long ll; #define V(a) vector<a> #define P(a,b) pair<a,b> #define A(a) set<a> #define M(a,b) map<a,b> #define F first #define S second #define mp make_pair #define pb push_back #define in insert #define bp __builtin_popcount #define ppb pop_back #define FOR(a,b,c) for(ll(a) = b; a < ...
#include <bits/stdc++.h> using namespace std; #define tani_nachi_ke ios_base::sync_with_stdio(false); cin.tie(NULL); #define M_PI 3.14159265358979323846 #define data data_ #define ff first #define ss second #define pb push_back #define ld long double ...
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; typedef vector<int> vi; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int H, W; cin >> H >> W; vector<string> A(H); for(int i = 0; i < H; ++i) cin >> A[i]; vector<vi> dp(H, vi(W)); for(int i =...
#include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsigned long long int ull; typedef vector<int> vi; typedef set<int> si; typedef set<ll> sll; typedef vector<ll> vll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define pvec(v) for(auto e: v) cout << e << " "; #define IO ios_b...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using vll = vector<ll>; using vi = vector<int>; using vb = vector<bool>; using vs = vector<string>; using pll = pair<ll, ll>; using pii = pair<int, int>; using vpii = vector<pii>; using vpll = vector<pll>; const ll LIN...
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <cmath> #include <map> #include <queue> #include <iomanip> #include <set> #include <tuple> #define mkp make_pair #define mkt make_tuple #define rep(i,n) for(int i = 0; i < (n); ++i) #define all(v) v.begin(),v.end() using namespace std...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll a, b, c, d; cin>>a>>b>>c>>d; if(b < c*d) { ll cy = a; ll r = 0; for(ll i = 0; ; i++) { //cout<<"r = "<<r<<" cy = "<<cy<<endl; if(r*d >= cy) { ...
#include <bits/stdc++.h> using namespace std; int N, Q; const int maxn = 2e5 + 5; typedef long long ll; inline ll read() { ll x = 0; int s = 1; char c = getchar(); while (c < 48 || c > 57) { if (c == '-') s = -1; c = getchar(); } while (c >= 48 && c <= 57) { ...
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() int main(){ int a,b,c;cin>>a>>b>>c; cout<<a+b+c-min({a,b,c})<<endl; }
//clear adj and visited vector declared globally after each test case //check for long long overflow //while adding and subs check if mod becomes -ve //while using an integer directly in a builtin function add ll //Mod wale question mein last mein if dalo ie. Ans<0 then ans+=mod; //Dont keep array name as size or any o...
#include<bits/stdc++.h> #define st first #define nd second #define mp make_pair #ifndef LOCAL #define cerr if(0)cerr #endif using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using pii = pair<int, int>; const int MAXN = 101, MAXM = MAXN*MAXN; int n, m, c[MAXN], a[MAXM], b[MAXM],...
// Author : Sarthak Kapoor #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define int ll #define rep(i,n) for(int i=0;i<n;++i) #define repa(i,a,n) for(int i=a;i<n;++i) #define repr(i,n) for(int i=n-1;i>=0;--i) #define ll long long #define pi pair<int,in...
#include<bits/stdc++.h> using namespace std; int main(){ int aa,b,t=0,sum=0; cin>>aa>>b; int d[aa+1][aa+1]; for(int i=1;i<=aa;i++){ for(int ii=1;ii<=aa;ii++){ cin>>d[i][ii]; } } int a[aa+2],e[aa+2],c[aa+2],z[aa+2]; c[1]=1;c[aa+1]=1;e[1]=1;e[aa+1]=1;z[1]=1;z[1+aa]=1; for(int i=0;i<=aa-2;i++)a[i]...
#include <vector> #include <cmath> #include <algorithm> #include <iostream> #include <string> using namespace std; #define lo(i,a,b) for(int i=a; i<b; i++) // loop int main(){ int A, B; cin >> A >> B; int res = 2 * A + 100 - B; cout << res << endl; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int a, b; cin >> a >> b; cout << max (2 * a + 100 - b, 0) << '\n'; return 0; }
#include<bits/stdc++.h> #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize("Ofast") using namespace std; inline int read(){ int res=0; bool zf=0; char c; while(((c=getchar())<'0'||c>'9')&&c!='-'); if(c=='-')zf=1; else res=c-'0'; while((c=getchar())>='0'&&c<='9')res=(res<<3)+(res<<1)+c-'0'; if(...
/* /^--^\ \____/ / \ _____ _ __ __ ____ _ ____ ____ _____ | || ()_)| |\ \/ /| ===|| |__ / (__` / () \|_ _| \__ __/ |_| |_|/_/\_\|____...
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() struct UnionFind{ int num;//連結成分の数 vector<int> r,p;//そのグループのサイズ,自分の親っぽいやつ vector<map<int,int>> mp; UnionFind(){} UnionFind(int n):num(n),r(n,1),mp(n),p(n,0){iota(p.begin(),p.end(),0);} i...
#include <bits/stdc++.h> using namespace std; using ll = long long int; using iPair = pair<int,int>; using lPair = pair<ll, ll>; using ivector = vector<int>; using lvector = vector<ll>; using istack = stack<int>; using iqueue = queue<int>; using ivv = vector<vector<int>>; using lvv = vector<vector<ll>>; const int INF =...
#include <bits/stdc++.h> using namespace std; #define ll long long //data types used often, but you don't want to type them time by time #define ull unsigned long long #define ui unsigned int //#define ld long double #define mod 1000000007 //define inf 100000000000010 #define us unsigned short #define IOS ios_base::sy...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; #define endl '\n' #define pb push_back #define ub upper_bound #define lb lower_bound ...
#include <bits/stdc++.h> int ri() { int n; scanf("%d", &n); return n; } int main() { int n = ri(); int a[n]; for (auto &i : a) i = ri(); int res = 2000000000; for (int i = 0; i < 1 << (n - 1); i++) { int xored = 0; int ored = 0; for (int j = 0; j <= n; j++) { if (j < n) ored |= a[j]; if (j == n ...
#include<bits/stdc++.h> using namespace std; int main() { int n; long long int count=0; cin>>n; int ar[n]={}; int arr[200]={}; for (int i = 0; i < n; i++) { cin>>ar[i]; } for (int i = 0; i < n; i++) { arr[ar[i]%200]++; } for (int i = 0; i <n; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { int t; t=1; while(t--) { string s; cin>>s; for(int i=s.size()-1;i>=0;i--) { if(s[i]=='9') cout<<6; else if(s[i]=='6') cout<<9; else ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod = 1e9+7; #define all(x) (x).begin(),(x).end() #define fr first #define sc second #define nl '\n' void solve(){ ll n;cin>>n; ll ans=0; ll a[5]={999,999999,999999999,999999999999,999999999999999}; int i=0; while(n-a[...
#include "bits/stdc++.h" using namespace std; int n,ans; string a; int main() { cin>>n>>a; for(int i=0;i<n;i++) { map <char,int> m; for(int j=i;j<n;j++) { m[a[j]]++; if(m['A']==m['T'] and m['C']==m['G']) ans++; } } cout<<ans; }
#pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimization ("unroll-loops") #include<bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define ll long long #define ld ...
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--) #define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++) #define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--) #define repit(itr,x) for(auto itr = x.begin(); itr != x...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int,int>; #define pb push_back #define mp make_pair const ll INF = 1e16; const int MOD = 1e9+7; const int MAX_N = 2e5+12; int N, Q; ll a[MAX_N],t[MAX_N]; ll x[MAX_N]; void solve() { ll lo = -INF, hi = INF, add = 0; for(int i=0;i<N;+...
#include<bits/stdc++.h> #define mod 998244353 using namespace std; struct DSU{ int n; int parent[55]; int size[55]; void init(int _n){ n = _n; for(int i=1;i<=n;i++){ parent[i]=i; size[i]=1; } } int findSet(int i){ if(parent[i]==i)return i; ...
#pragma GCC optimize ("O2") #pragma GCC target ("avx2") //#include<bits/stdc++.h> //#include<atcoder/all> //using namespace atcoder; #include<cstdio> #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 <iostream> #include <iomanip> #include <vector> #include <stack> #include <queue> #include <set> #include <map> #include <algorithm> #include <cstdio> #include <utility> #include <string> #include <cmath> #include <cstdlib> #include <cstring> #include <deque> #include <numeric> using namespace std; typedef u...
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define nline "\n" const ll M1=1e9+7; const ll M=998244353; const ll N=100005; const ll INF_ADD=1e18; const ll INF_MU...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef long long int lli; typedef unsigned long long int ulli; typedef long double ld; #define vec(s) vector<s> #define vvec(s) vector<vector<s>> typedef vector<lli> vi; typedef vector<vi> vvi; typedef pair<lli, lli> pii; #define rep(i, n) for (int i...
#include<bits/stdc++.h> using namespace std; #define endl '\n' typedef long long int ll; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n;cin >> n; vector<vector<int>> dist(n, vector<int>(n)); vector<tuple<int, int, int>> pos; vector<vector<int>> dp(n, vector<int>(1 << n, 2e9)); dp[0][0] = 0; ...
//#include <atcoder/maxflow.hpp> #include <memory> #include <iostream> #include <map> #include <list> #include <set> #include <algorithm> #include <vector> #include <sstream> #include <string> #include <functional> #include <queue> #include <deque> #include <stack> #include <limits> #include <unordered_map> #include <...
#include <stdio.h> #include <set> #include <map> #include <unordered_map> #include <unordered_set> #include <list> #include <queue> #include <stack> #include <cmath> #include <ctime> #include <cstdio> #include <vector> #include <string> #include <bitset> #include <cctype> #include <cstdlib> #include <cstring> #include ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned int ui; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; const int INF = int (1e9) + int (1e5); const ll INFL = ll(2e18) + ll(1e10); const ui MOD = 1E9 ...
#include<bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define pf push_front #define ff first #define ss second #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define gcd(a,b) __gcd((a),(b)) #define lcm(a,b)...
#include<bits/stdc++.h> using namespace std; void output(vector<int> &a){ cout << a.size(); for(auto &nx : a){ cout << ' ' << nx; } cout << '\n'; } int main(){ int n; cin >> n; vector<int> a(n); for(auto &nx : a){cin >> nx;} vector<vector<int>> bk(200,vector<int>(0)); int cnt=min(n,8); ...
#include <bits/stdc++.h> using namespace std; #define eni(x) template < class c > typename \ enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) { template < class c > struct rge { c b, e; }; template < class c > rge<c> range(c i, c j) { return rge<c>{i, j}; } template < class c > auto dud(c* x) -> decltype...
#include <iostream> #include <algorithm> #include <map> #include <set> #include <queue> #include <stack> #include <numeric> #include <bitset> #include <cmath> static const int MOD = 1000000007; using ll = long long; using u32 = unsigned; using u64 = unsigned long long; using namespace std; template<class T> constexpr...
#include<bits/stdc++.h> using namespace std; #define INF 1000000007 #define INF_ll 1000000000000000007 #define ll long long #define endl "\n" #define uint unsigned long long #define unmp unordered_map #define unst unordered_set #define int long long #define watch(x) cerr << "\n" << (#x) << " is " << (x) << endl #defi...
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<vector<vector<int>>> vvvi; typedef vector<long long> vl; typedef vector<vector<long long>> vvl; typedef vector<vector<vector<long long>>> vvvl; typedef pair<int, int> pii; typedef pair<long long, long l...
#include<stdio.h> #include<queue> #include<vector> #include<string.h> #include<iostream> #include<math.h> #include<map> #include<algorithm> using namespace std; #define int long long #define ll long long #define speed(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);} const int maxn=2e5+10; const int inf=0x3f3f3f3f; co...
#include <bits/stdc++.h> using namespace std; #define ll long long ll fact(ll n) { ll f=1; for(int i=1;i<=n;i++){ f*=i; } return f; } int main() { #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif ios_base::sync_with_stdio(false);...
#include<bits/stdc++.h> #define inf 0x3f3f3f3f typedef unsigned long long ull; typedef long long ll; #define rep(i,l,r) for(int i=l;i<=r;i++) #define nep(i,r,l) for(int i=r;i>=l;i--) void sc(int &x){scanf("%d",&x);} void sc(int &x,int &y){scanf("%d%d",&x,&y);} void sc(int &x,int &y,int &z){scanf("%d%d%d",&x,&y,&z);} vo...
#include<bits/stdc++.h> using namespace std; namespace Sakurajima_Mai{ #define ms(a) memset(a,0,sizeof(a)) #define repi(i,a,b) for(int i=a,bbb=b;i<=bbb;++i)//attention reg int or reg ll ? #define repd(i,a,b) for(int i=a,bbb=b;i>=bbb;--i) #define reps(s) for(int i=head[s],v=e[i].to;i;i=e[i].nxt,v=e[i].t...
#include<bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;i++) #define INF 1000000007 using namespace std; long power(long x, long y, long mod){ if(y==0)return 1; else if(y==1)return x%mod; else if(y%2==0)return (power(x,y/2,mod)*power(x,y/2,mod))%mod; else return (((power(x,y/2,mod)*power(x,y/2,mod))%mod) *x)%...
#include <bits/stdc++.h> #define X first #define Y second #define pb push_back #define rep(X,Y) for (int (X) = 0;(X) < (int)(Y);++(X)) #define reps(X,S,Y) for (int (X) = (int)(S);(X) < (int)(Y);++(X)) #define rrep(X,Y) for (int (X) = (int)(Y)-1;(X) >=0;--(X)) #define rreps(X,S,Y) for (int (X) = (int)(Y)-1;(X) >= (int)(...
#include <bits/stdc++.h> #define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define X first #define Y second #define nl '\n' #define AC return 0 #define pb(a) push_back(a) #define mst(a,b) memset(a, b, sizeof a) #define rep(i,n) for(int i = 0; (i)<(n); i++) #define rep1(i,n) for(int i = 1; (i)<=(n); i++) #de...
/* Saturday 01 May 2021 05:47:35 PM IST @uthor::astrainL3gi0N */ #include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef std::vector<int> vi; typedef std::vector<ll> vll; typedef std::pair<int,int> ii; #define debg(x) std::cerr<<(#x)<<" => "<<x<<'\n'; #define debgg(x,y) std::cerr<<(#x)...
#include <iostream> using namespace std; int main(void){ int N, D, H; cin >> N>> D>>H; double b, d, h; double ans = 0.0; for( int i=0; i<N; ++i){ cin >> d >>h; b = ((double)D*h - (double)H*d) / ((double)D-d); if(ans < b) ans = b; } cout<<ans; return 0; }
#include <iostream> //#include <vector> //#include <string> //#include <algorithm> //#include <math.h> //#include <queue> //#include <stack> //#include <iomanip> // sometimes used //#include <set> //#include <map> //#include <numeric> //#include <list> //#include <deque> //#include <unordered_map> typedef long long L...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define f first #define s second int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll b , c , l , r; vector< pair<ll,ll> > v; cin >> b >> c; //awel segment, min positive number a2dar ag...
#include <bits/stdc++.h> const int N = 300; using std::cout; bool f[N]; int n, id[N]; std::pair<int, int> p[N]; int main() { std::ios::sync_with_stdio(false); std::cin >> n; for (int i = 1; i <= n; ++i) { std::cin >> p[i].first >> p[i].second; if (~p[i].first) { if (id[p[i].first]) { cout << "No"; ret...
#pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #define int long long int const int mod = 1e9 + 7; using namespace std; int ple; int f(vector<int>arr,vector<int>brr) { sort(arr.begin(),arr.end...
#include <iostream> #include <cstdio> #include <vector> #define N 55 using namespace std; typedef long long ll; ll n, ans = 1e18, a[N]; bool vpr[N]; vector<ll> pr; ll gcd(ll p, ll q) { if (q == 0) return p; return gcd(q, p % q); } void f(ll p, ll q) { ll i; if (q >= ans) return; if (p == pr.size()) { for (i =...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,srt,end) for(ll i = (srt); i < (ll)(end); i++) ll MOD=1000000007; ll mod=998244353; int inf=1000001000; ll INF=1e18+5; //cout << std::fixed << std::setprecision(15) << y << endl; // For debug // Ref: https://qiita.com/ysuzuki19/items/d89...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define ALL(obj) (obj).begin(),(obj).end() template<class T> using priority_queue_reverse = priority_queue<T,vector<T>,greater<T>>; constexpr long long MOD = 1'000'000'000LL + 7; //' constexpr long long MOD2 = 998244353; constexpr long long HIGHINF =...
#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> //#include<atcoder/all> using namespace std; //using namespace atcoder; #define fs first #define sc second #define pb push_back #define mp make_pair #define eb emplace_back #define ALL(A) A.begin(),A.end() #define RALL(A) A.rbegin(),A.rend() typedef long long ll; typedef pair<double,double> P; t...
#include <bits/stdc++.h> #define rep(i,n) for(LL i=0;i<n;++i) #define repn(i,n) for(LL i=1;i<=n;++i) #define LL long long #define pii pair <LL,LL> #define pb push_back #define fi first #define se second #define mpr make_pair using namespace std; const LL MOD=1e9+7; LL qpow(LL x,LL a) { LL res=x,ret=1; while(a>0) ...
#include<bits/stdc++.h> using namespace std; typedef long long ll; const long double k=0.6180339887498948482045; ll x,y,tmp; vector<int> ans; int main(){ scanf("%lld",&tmp);if(tmp==0) {printf("0\n");return 0;} //printf("%lf\n",((long double)tmp)*k-50); for(ll i=max((ll)(((long double)tmp)*k)-50,0ll);;i++){ x=tmp;y...
#include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #include<climits> #include<stack> #include<queue> #include<set> #include<array> #include<cstdlib> #include<string> #include<sstream> #include<cctype> #include<cstring> #include<ctime> #include<functional> #include<numeric> #include<map> #include<li...
#include<bits/stdc++.h> #define ll long long int using namespace std; int seiv[200007]; ll res[200007]; int main () { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif memset(seiv, 0, sizeof(seiv)); memset(res, 0, sizeof(res)); res...
#include "bits/stdc++.h" using namespace std; using LL = long long; constexpr int N = 1e5 + 5; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; LL res = 0; for (int i = 1; i * i * i <= n; i++) { for (int j = i; i * j * j <= n; j++) { int k = n / (i * j); if (i == j) { ...
//雪花飄飄北風嘯嘯 //天地一片蒼茫 #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace std; using namespace __gnu_pbds; using namespace __gnu_cxx; #define ll long long #define ii pair<ll,ll> #define iii pair<ii,ll> #define fi first #define se seco...
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int maxn=1e5+2; int num[maxn]; int f[maxn][2],last[maxn][2]; bool check(int x,int y) { int v=num[x]^num[y],res=0; while(v) res++,v^=v&(-v);return res&1; } void solve() { int N,L;scanf("%d%d",&N,&L); for(int i=1;i<=N;i++) { f...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int _t = 1; //cin >> _t; while(_t--) { float x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2; float ans = x1 + ( (x2-x1)/(1+y2/y1) ); cout << fixed << setprecision(8) << ans << endl; } return 0;...
#include <iostream> #include <string> #include <vector> #include <map> #include <list> #include <algorithm> #include <stack> #include <queue> #include <utility> #include <cmath> #include <set> #include <iomanip> using namespace std; typedef long long ll; int main() { double sx, sy, gx, gy; cin >> sx >> sy >> gx >> ...
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mp make_pair #define mt make_tuple #define pii pair<int,int> #define pll pair<ll,ll> #define ldb double template<typename T>void ckmn(T&a,T b){a=min(a,b);} template<typename T>void ckmx(T&a,T b)...
#include <bits/stdc++.h> // clang-format off using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair<ll,ll>; const ll INF=4e18; void print0() {} template<typename H,typename... T> void print0(H h,T... t){cout<<fixed<<setprecision(15)<<h;print0(t...);} void print() { print0("\n"); } templat...
#include<cstdio> using namespace std; int num[8]={6,10,12,15,18,20,24,30}; int n; int main() { scanf("%d",&n); printf("6 10 15 "); for(int i=1;i+3<=n;i++) { int lun=(i-1)/8+1; printf("%d ",lun*30+num[(i-1)%8]); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> ans = {6, 10, 15}; int x = 16; while (ans.size() < n) { if (x % 6 == 0 || x % 10 == 0 || x % 15 == 0) { ans.push_back(x); } x++; } for (int i = 0; i < n; i++) { cout << ans[i]; if (i == n - 1) cout << endl; ...
/** * code generated by JHelper * More info: https://github.com/AlexeyDmitriev/JHelper * @author */ #include <iostream> #include <fstream> #include <bits/stdc++.h> using namespace std; #define ll long long inline int inint(istream& in) {int x; in >> x; return x;} inline ll inll(istream& in) {ll x; in >> x; retur...
#include <bits/stdc++.h> using namespace std; long long A, B, K; vector<int> ans(100, 0); long long COM(long long n, long long k) { long long ans = 1; for (long long i = 1; i <= k; i++) { ans = ans * (n - i + 1) / i; } return ans; } void saiki(long long countA, long long now, long long rank) { if (now == A ...
/* Clearink */ #include <map> #include <cstdio> inline int rint () { int x = 0, f = 1; char s = getchar (); for ( ; s < '0' || '9' < s; s = getchar () ) f = s == '-' ? -f : f; for ( ; '0' <= s && s <= '9'; s = getchar () ) x = x * 10 + ( s ^ '0' ); return x * f; } template<typename Tp> inline void wint ( Tp x ) ...
#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<cstdio> using namespace std; long long C(int u,int d) { long long ans=1; for(long long i=d,num=1; num<=u; num++,i--) ans=ans*i/num; return ans; } long long a,b,k; int main() { scanf("%lld%lld%lld",&a,&b,&k); for(; a+b;) { if(a==0) { b--; printf("b"); continue; } if(b==0) { a--; prin...
#include <iostream> #include <string> #include <vector> #include <algorithm> #define rep(i,n) for(int i=0;i<n;i++) #define ll long long #define P pair<int,ll> #define MOD 1000000007 using namespace std; int n, c1,c2, p, res; vector<int> v1, v2; string s, t; int main(){ cin >> n >> s >> t; rep(i, n)if(s[i]==...
#include <iostream> #include <bits/stdc++.h> #define ll long long int #define ull unsigned long long #define max_value 0x3f3f3f #define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout); using namespace std; typedef pair<ll,ll> pii; ...
#include <bits/stdc++.h> using namespace std; using ll =long long; typedef pair<ll,ll> P; #define SORT(a) sort((a).begin(),(a).end()) #define REV(a) reverse((a).begin(),(a).end()) #define For(i, a, b) for(int i = (a) ; i < (b) ; ++i) #define rep(i, n) For(i, 0, n) #define debug(x) cerr << #x << " = " << (x) ...
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int> x(N), y(N); for(int i = 0; i < N; i++) cin >> x[i] >> y[i]; int cnt = 0; for(int i = 0; i < N; i++){ for(int j = i + 1; j < N; j++){ int t = abs(y[j] - y[i]); int s = abs(x[j] -...
#include <cstdio> #include <string> #include <vector> #include <algorithm> #include <memory.h> #include <cmath> #include <map> #include <set> #include <queue> #include <stack> #include <ctime> #include <iostream> #include <functional> #include <complex> #include <stdlib.h> #include <fstream> #include <random> using na...
#include <bits/stdc++.h> using namespace std; #define REP(i, e) for (int i = 0; i < (e); ++i) #define REP3(i, b, e) for (int i = (b); i < (e); ++i) #define RREP(i, b, e) for (int i = (b)-1; i >= e; --i) struct Initializer { Initializer() { std::cin.tie(0); std::ios::sync_with_stdio(0); std::cout << std::...
#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #include<bits/stdc++.h> #define ll int64_t #define ff first #define ss second #define mkp make_pair #define pb push_back #define pf push_front #define inf 100000000 #define maxn 100005 #define mod 998...
#include<bits/stdc++.h> using namespace std; int main(){ int64_t n; cin>>n; vector<int>ans(n+1,1); for(int i=1;i<=n;i++){ for(int j=i*2;j<=n;j+=i){ ans[j]=max(ans[j],ans[i]+1); } } for(int i=1;i<=n;i++)cout<<ans[i]<<' ';puts(""); }
#include <algorithm> #include <cctype> #include <cmath> #include <cstring> #include <iostream> #include <sstream> #include <numeric> #include <map> #include <set> #include <queue> #include <vector> using namespace std; typedef long long LL; LL solve(long long N) { LL N2 = N * 2, ans = 0; for (LL i = 1; i * i <= N2...
#pragma GCC optimize("Ofast") #define _USE_MATH_DEFINES #include "bits/stdc++.h" using namespace std; using u8 = uint8_t; using u16 = uint16_t; using u32 = uint32_t; using u64 = uint64_t; using i8 = int8_t; using i32 = int32_t; using i64 = int64_t; constexpr char newl = '\n'; constexpr double eps = 1e-10; #define F...
#include<bits/stdc++.h> #define all(v) v.begin(), v.end() #define sz(x) (int)x.size() #define ini(x, y) memset(x, y, sizeof(x)); #define pb push_back using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; const int MOD = (int)1e9 + 7; const int MAX = (int)2e9; const double PI =...
#include <bits/stdc++.h> using namespace std; int main() { int n, cnt1, cnt2, m; cin >> n >> m; cnt1 = cnt2 = 0; for (int i = 1; i <= n; i++) { string s; cin >> s; int cnt = 0; for (auto p : s) p == '1' ? cnt++ : 0; cnt & 1 ? cnt1++ : cnt2++; } cout << 1ll * cnt1 * cnt2 << endl; }
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<(n); i++) using namespace std; using ll = long long; using vi = vector<ll>; using vv = vector<vi>; const ll INF = 1001001001001001001; int main(){ int n, m; cin >> n >> m; vi a(2, 0); rep(i,n){ string s; cin >> s; int num ...
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ int A, B; cin >> A >> B; vector<int> sum(1001,0); for(int i=1; i<=1000; i++){ sum[i] = sum[i-1] + i; } if(A==B){ for(int i=1; i<=A; i++) cout << i << " " << -i << " "; } else if(A>B)...
#include <bits/stdc++.h> #ifndef ONLINE_JUDGE #define _GLIBCXX_DEBUG #endif using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repn(i, s, n) for (int i = s; i <= (int)(n); i++) #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define vec vector #define rip return 0 typ...
#include <bits/stdc++.h> #define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;i++) #define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;i--) inline int read() { int x=0,f=1;char c=getchar(); while(c<48||c>57){if(c=='-')f=-1;c=getchar();} while(c>=48&&c<=57)x=(x<<1)+(x<<3)+(c^48),c=getchar(); return x*f; } using namespac...
#include<bits/stdc++.h> using namespace std; typedef pair<int,int> pii; typedef pair<string,int> psi; typedef pair<int,string> pis; typedef array<int,2> aii; typedef array<int,3> aiii; typedef array<int,4> aiiii; typedef unsigned long long ull; typedef long long int ll; typedef array<ll,2> all; typedef array<ll,3> all...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define pb push_back const ll MOD = 1e9+7; bool sprawdz(vector<vector<int>> & grid, int n, int k, int value){ vector<vector<int>> edit(n+1, vector<int>(n+1)); vector<vector<int>> sums(n+1, vector<int>(n+1, 0)); for(int i = 1; ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define deb(x) cout << #x << " " << x << endl; #define debtwo(x,y) cout << x << ", " << y << endl; #define mod 1000000007 #define N 1000001 void solve() { ll n, m; cin >> n >> m; vector<ll> arr(n), brr(m); for (ll &x : arr) cin >> x; for (ll...
#include <iostream> #include <fstream> #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iomanip> #include <map> #include <memory> #include <numeric> #...
#include <bits/stdc++.h> using namespace std; int main() { int64_t A, B, C; cin >> A >> B >> C; C = C % 2; if(C==0){C+=2;} if(C==2){ A*=A; B*=B; } if (A > B) cout << '>' << endl; else if (A < B) cout << '<' << endl; else cout << '=' << endl; }
#include<bits/stdc++.h> #include<tuple> typedef long long ll; #define INF 99999999999999 #define mod 1000000007 #define eps 1e-9 using namespace std; ll n,h,l=1,r=1000000000; ll val[10][3005]; ll ans,res; set<ll>bsk; map<ll,ll>cnt; bool check(ll x){ bsk.clear(); ll can=0; //cout<<"x="<<x<<endl; for(ll i...
#include <bits/stdc++.h> #define li long int #define lli long long #define pb push_back #define fi first #define se second #define si size() #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define lb lower_bound #define ub upper_bound #define BS binary_search #define pll pair < lli, lli ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vl = vector<ll>; template<class T> using vc = vector<T>; template<class T> using vvc = vector<vector<T>>; #define eb emplace_back #define all(x) (x).begin(), (x).end() #define rep(i, n) for (ll i = 0; i < (n); i++) #defin...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef complex<double> point; #define endl '\n' #define F first #define S second #define dbg(x) cerr<<#x<<" = "<<x<<endl #define dbg2(x,y) cerr<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<endl #define dbg3(x,y,z) cerr<<#x<<" = "...
#include <bits/stdc++.h> #define f first #define s second using namespace std; using ll = long long; using ii = pair<int, int>; using pl = pair<ll, ll>; constexpr int MX = 5005, MOD = 998244353; pl DP[MX][2]; int main() { if (fopen("in", "r")) freopen("in", "r", stdin), freopen("out", "w", stdout); cin.tie(0)->sync...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll z = 0; int main(){ ll H, W; cin >> H >> W; vector<vector<char>> S(H + 1, vector<char>(W + 1)); for (ll i = 1; i <= H; i++){ for (ll j = 1; j <= W; j++){ cin >> S[i][j]; } } vector<vector<ll>> Wtate(H + 1, vector<...
#include<bits/stdc++.h> using namespace std; long long t,l,r; int main() { cin>>t; while(t--) { cin>>l>>r; if(r-2*l+1>0) cout<<(r-2*l+1)*(r-2*l+2)/2<<endl; else cout<<0<<endl; } return 0; }
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 #define MOD2 998244353 #define rep(i,n) for (int i = 0; i < (int)(n); i++) #define reps(i,s,n) for (int i = (int)(s); i < (int)(n); i++) #define repit(i,C) for (auto i = (C).begin(); i != (C).end(); i++) #define pr(a) cout << a #define prl(a) cout << ...
#include<iostream> using namespace std; int N; main() { cin>>N; for(int i=0;i<N;i++) { cout<<i/2+1<<" "<<(i+N)/2+1<<endl; } }
#include<bits/stdc++.h> using namespace std; #define int long long #define rep(i,n) for (int i = 0; i < n; i++) #define rep1(i,n) for(int i=1;i<=(n);i++) #define rrep(i,n) for(int i=(n)-1;i>=0;i--) template<class T> ostream& operator << (ostream &s, vector<T> &P) { for (int i = 0; i < P.size(); ++i) { if (i > 0) { s <<...
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL string to_string(string s) { return '"' + s + '"'; } string to_string(const char* s) { return to_string(string(s)); } string to_string(bool b) { return to_string(int(b)); } string to_string(vector<bool>::reference b) { return to_string(int(b)); } string to_stri...
#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; using ll = long long; int main() { int a, b, c; cin >> a >> b >> c; cout << a + b + c - min({ a, b, c }) << endl; return 0; }
#include <iostream> #include <bits/stdc++.h> using namespace std; #define ll long long #define LL unsigned long long #define vec(x) vector<x> #define emb(x) emplace_back(x) #define fall(x) x.begin(),x.end() #define rfall(x) x.rbegin(),x.rend() #define fo(a,b) for(int i=a; i < int(b); i++) #define fset(x) setprecisi...
// #define _GLIBCXX_DEBUG #include <algorithm> #include <bitset> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <l...
#include <bits/stdc++.h> using namespace std; const int N=2e5+5; const int M = 1000000007; #define AKTG ios_base::sync_with_stdio(false); cin.tie(NULL); #define int long long #define ff first #define all(x) x.begin(),x.end() #define ss second #define pb push_back #define...
#include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <deque> #include <complex> #include <stack> #include ...
#include <stdio.h> #define _USE_MATH_DEFINES #include <math.h> #include <vector> #include <algorithm> #include <iostream> #include <map> #include <queue> #include <set> #include <iomanip> using namespace std; int main(){ long k; cin >> k; string s,t; cin >> s >> t; vector<long> viCount(10,k); ...
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(ll i=0;i<(ll)n;i++) #define dump(x) cerr << "Line " << __LINE__ << ": " << #x << " = " << (x) << "\n"; #define spa << " " << #define fi first #define se second #define ALL(a) (a).begin(),(a).end() #define ALLR(a) (a).rbegin(),(a).rend() using ld =...
#include<iostream> #include<string> #include<queue> using namespace std; typedef long long ll; const int N = 5e5+10; string s,t; int sums = 0,sumt = 0,cnt; bool st[N],flag = false; priority_queue<int,vector<int>,greater<int>> fla; int main() { int n; scanf("%d",&n); cin>>s>>t; for(int i = 0;i<n;i++) { sums+=s[i]...
#include<bits/stdc++.h> using namespace std; using ll=long long int; #define mod 998244353 int main() { ll a,b,c; cin>>a>>b>>c; ll sum1 = ((a*(a+1))/2); ll sum2= ((b*(b+1))/2); ll sum3= ((c*(c+1))/2); cout<<(((sum1%mod)*(sum2%mod))%mod*(sum3%mod))%mod; }
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; typedef vector<ll> vl; typedef vector<bool> vb; typedef vector<string> vs; typedef vector<char> vc; typedef queue<ll> ql; typedef deque<ll> dql; typedef priority_queue<ll> pql; typedef set<ll> sl; typedef pair<ll, ll> pl; ty...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (n); ++i) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() using ll = long long; using Graph = vector<vector<int>>; const long long INF = 1LL << 60; const int SINF = 1LL << 29; const ll mod = 1000000000+7; const int...
#include <bits/stdc++.h> using namespace std; typedef long long ll; // THINGS TO REMEMBER // ENDL is slow, '\n' is fast // Clear everything (including graphs) between test cases // use anti-anti-hash: https://codeforces.com/blog/entry/62393 // pb-ds: https://codeforces.com/blog/entry/11080 // check when to use LLONG_M...
#include <algorithm> #include <bitset> #include <cassert> #include <cmath> #include <cstdio> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <unordered_set> using namespace s...
#include <iostream> #include <string> #include <algorithm> using namespace std; using std::cout; using std::endl; using std::string; using std::reverse; // 自己テンプレート typedef long long ll; // 比較して上書きマクロ template<class T> inline void chmin(T& a, T b) { if(a>b) {a=b;} } template<class T> inline void chmax(T& a, T b) { i...
#include<stdio.h> int main(){ int n; scanf("%d", &n); int a[n],b[n]; int temp; int maxa=0; int minb=1001; for (int i = 0;i< n; i++){ scanf("%d",&a[i]); } for (int i = 0;i< n; i++){ scanf("%d",&b[i]); } for (int i = 0; i < n; i++){ if (a[i] > maxa) maxa...
#include <iostream> #include <vector> #include <numeric> #include <algorithm> #include <climits> constexpr int SINT_MAX = std::numeric_limits<int>::max(); constexpr int SINT_MIN = std::numeric_limits<int>::min(); using namespace std; using vi = vector<int>; using vvi = vector<vi>; using ll = long long; using vll = ve...
#include <bits/stdc++.h> using namespace std; int main(){ int N, S, D; cin >> N >> S >> D; int a=0; for(int i=0; i<N; i++){ int X, Y; cin >> X >> Y; if(X<S && Y>D){ cout << "Yes" << endl; a++; break; } } if(a==0){ cout << "No" << endl; } }
#include <bits/stdc++.h> #define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i) #define rrepi(i,a,b) for(int i=((int)(b)-1);i>=(a);--i) #define rep(i,n) repi(i,0,n) #define rrep(i,n) rrepi(i,0,n) #define ALL(x) (x).begin(),(x).end() #define SZ(x) ((int)(x).size()) #define ZERO(x) memset(x,0,sizeof(x)) #define MINUS(x) ...
#include<bits/stdc++.h> using namespace std; int main() { double R, X, Y; cin >> R >> X >> Y; double d = sqrt(X * X + Y * Y); int ans = ceil(d / R); if (ans == 1 && d != R) ans++; cout << ans << 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 fastio ios_base::sync_with_stdio(0);cin.tie(0) #define fp(i,a,b) for(ll i=a ; i<b ; i++) #define fn(i,a,b) for(int i=a ; i>=b ; i--) #define ones(x) __built...
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; int price; string answer = ""; price = N * 1.08; if(price < 206){ answer = "Yay!"; } else if(price == 206){ answer = "so-so"; } else{ answer = ":("; } cout << answer << endl; }
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; int count = 0; int sub = 1; while(1){ count += sub; if (count >= N){ cout << sub<< endl; break; } sub += 1; } }
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef set<int>::iterator sit; typedef map<int,int>::iterator mit; typedef vector<int>::iterator vit; const int INF = 1e9 + 7; const int MOD = 1e9 + 7; const int MAXN = 1e6 + 3; #define each(it,s) for(auto i...
/* * Created By: 'Present_Sir' * Created On: 02.05.2021 10:06:31 */ #include<bits/stdc++.h> using namespace std; #define IOS ios_base::sync_with_stdio(false); cin.tie(NULL) #define all(v) v.begin(),v.end() #define allr(v) v.rbegin(),v.rend() #define sz(v) ((int)v.size()) #define int long long //#define i_...
#include <bits/stdc++.h> using namespace std; #define ll long long #define PI acos(-1) #define vi vector<int> #define pi pair<int, int> #define pl pair<ll, ll> template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;} template<class T,class U> istream &operator>>(istream&is...
#include <bits/stdc++.h> #define fo(i,a,b) for(int i=a;i<=b;i++) #define fod(i,a,b) for(int i=a;i>=b;i--) #define me0(a) memset(a,0,sizeof(a)) #define me1(a) memset(a,-1,sizeof(a)) #define op freopen("in.txt", "r", stdin) #define op1 freopen("C:\\acm\\Cproj\\in.txt","r",stdin); #define pr freopen("C:\\acm\\Cproj\\out.t...
typedef long long ll; typedef long double ld; #include <bits/stdc++.h> using namespace std; int main() { ll a,b,c; std::cin >> a>>b>>c; vector<vector<vector<ld>>> memo(100,vector<vector<ld>>(100,vector<ld>(100,-1))); function<ld(ll,ll,ll)> rec = [&] (ll a,ll b,ll c) { if(a==100||b==10...
#include <bits/stdc++.h> using namespace std; void solve() { int n, s, k; cin >> n >> s >> k; int m = sqrt(n) + 1; map<int, int> mp; int jk = 0; for (int j = 0; j < m; ++j) { if (mp.count(jk)) break; mp[jk] = j; jk = (jk + k) % n; } long long mk = jk; for (in...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for(ll i=0;i<ll(n);i++) #define FOR(i, a, b) for(ll i=a;i<=ll(b);i++) int read_int() { int n; scanf("%d", &n); return n; } int main() { string S; bool flag = true; cin >> S; REP(i, S.length()) { ...
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; string s; int main() { cin >> s; for (int i = 0; i < s.size(); i++) if (!((i % 2 == 0 && s[i] >= 'a' && s[i] <= 'z') || (i % 2 == 1 && s[i] >= 'A' && s[i] <= 'Z'))) { cout << "No"; return 0; } cout << "Yes"; return 0; }
#include <bits/stdc++.h> #define fi first #define se second #define rep(i,s,n) for (int i = (s); i < (n); ++i) #define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i) #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define len(x) (int)(x).size() #define dup(x,y) (((x)+(y)-1)/(y)) #define pb push_bac...
#include <bits/stdc++.h> using namespace std; typedef long long ll; bool ll_sqrt(ll x, ll& lower_bound, ll& upper_bound) { constexpr ll ll_max = numeric_limits<ll>::max(); bool first_boost = true; lower_bound = 0; upper_bound = x; while (upper_bound - lower_bound > 1) { if (first_boost) { ll guess = ...
#pragma GCC optimize("Ofast") #pragma GCC optimization ("unroll-loops") #include <bits/stdc++.h> #define IOS ios_base::sync_with_stdio(0); cin.tie(0); #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define ff first #define ss second #define ins insert #define sz(x) (int)x.size...
#include <bits/stdc++.h> #define Fr(i,a,b) for(int i=(a);i<=(b);++i) #define Fl(i,a,b) for(int i=(a);i>=(b);--i) #define Fe(i,u) for(int i=H[u];i;i=e[i].nx) #define ms(a,x) memset((a),(x),sizeof(a)); using namespace std; int N,W; long long p[200005],f; int main() { scanf("%d%d",&N,&W); Fr(i,1,N) { int s,t,x; sca...
#include <bits/stdc++.h> using namespace std; #define INF_LL (int64)1e18 #define INF (int32)1e9 #define REP(i, n) for(int64 i = 0;i < (n);i++) #define FOR(i, a, b) for(int64 i = (a);i < (b);i++) #define all(x) x.begin(),x.end() #define fs first #define sc second using int32 = int_fast32_t; using uint32 = uint_fast32_...
#include <bits/stdc++.h> #define ll long long int #define db double #define pb push_back #define mpr make_pair #define andl "\n" #define f first #define s second #define mset(x,y) memset(x,y,sizeof(x)) #define fr(i,n) for(long long int i=0;i<n;i++) #define trace(it,x) for(auto it = (x).begin(); it != (x).end(); it++) #...
// -- // #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 5e5+228; const ll C = 600000; char c[3*N]; signed main(){ cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0); string s; cin >> s; ll l=C, r=C; ll rc=1; for(auto i : s){ if(i=='R'){ if(rc=...
#line 1 "main.cpp" #include <bits/stdc++.h> using namespace std; // template {{{ using i32 = int; using u32 = unsigned int; using i64 = long long; using u64 = unsigned long long; #define range(i, l, r) for (i64 i = (i64)(l); i < (i64)(r); (i) += 1) #define rrange(i, l, r) for (i64 i = (i64)(r) - 1; i >= (i64)(l); (i...
#include<iostream> using namespace std; typedef long long ll; const int N = 2e5 + 10; const int mod = 1e9 + 7; int main() { int a, b; cin >> a >> b; int mx = 0; for (int i = 1; i <= b; i++) { int cnt = (b / i - (a - 1) / i); if (cnt >= 2) { mx = max(mx, i); } } cout << mx << endl; return 0; }
#include <bits/stdc++.h> #define ll long long #define re register int #define rl register ll #define rep(i,a,b) for(re i=(a),i##end=(b);i<=i##end;++i) #define pre(i,a,b) for(re i=(a),i##end=(b);i>=i##end;--i) #define mem(arr,val) memset(arr,val,sizeof(arr)) #define cpy(a1,a2) memcpy(a1,a2,sizeof(a2)) using namespace st...
#include <bits/stdc++.h> #define rep(i,n) for(ll i=0;i<n;++i) #define rrep(i, n) for(ll i=n-1;i>=0;--i) #define rep1(i, n) for(ll i=1; i<=n; ++i) #define repitr(itr,mp) for(auto itr=mp.begin();itr!=mp.end();++itr) #define ALL(a) (a).begin(),(a).end() template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}} ...
#include<cstdio> #include<cstring> #include<cmath> #include<cassert> #include<iostream> #include<iomanip> #include<map> #include<unordered_map> #include<set> #include<unordered_set> #include<vector> #include<algorithm> #include<string> #include<queue> using namespace std; #define DEBUG(x) cout<<#x<<"="<<x<<endl #define...
#include <algorithm> #include <cmath> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <vector> #define pb push_back #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, n, s) for (int i = (s...
#include<iostream> #include<math.h> #include<vector> #include<algorithm> using namespace std; void solve(){ float a, b; cin >> a >> b ; vector<float>arr; arr.push_back(a);arr.push_back(b); sort(arr.begin(),arr.end()); cout << 100-((arr[0]*100)/arr[1]) << "\n"; return; } int main(){ solve(); }
#include <bits/stdc++.h> #define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); typedef long long ll; typedef long double ld; #define pb push_back #define mp make_pair #define ff first #define ss second #define mod 1000000007 #define pii pair<ll,ll> #define inf 1000000000000000000 #define bpc(x) __...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(long long i=0;i<(long long)(n);i++) #define REP(i,k,n) for(long long i=k;i<(long long)(n);i++) #define pb emplace_back #define lb(v,k) (lower_bound(all(v),(k))-v.begin()) #define ub(v,k) (upper_bound(all(v),(k))-v.begin()) #define fi first #define se ...
#include<bits/stdc++.h> using namespace std; #define db(x) cout<<x<<'\n' #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 repi(i,n) for(int i=0;i<(n);++i) //#define repA(i,a,n) for(int i=a;...
#include <bits/stdc++.h> using namespace std; using ll = long long; #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 all(v) begin(v), end(v) #define sz(v) v.size() #define INF 1e17 #define EPSILON 1e-14 template <typename T> bool chmax(T &a, const T& b)...
/** * author: Dooloper * created: 26.10.2020 13:52:11 **/ #include <iostream> #include <string> #include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for (int i=0;i<n;i++) typedef pair<int,int> P; int main() { ll n,k; cin >> n >> k; rep(i,k){ int small,b; ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(ll i=0;i<(ll)(n);i++) #define rep1(i,n) for(ll i=1;i<=(ll)(n);i++) const int mod = 1e9+7; template< int mod > struct ModInt { int x; ModInt() : x(0) {} ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}...
#include <iostream> using namespace std; int main() { double A,B,sum; cin>>A>>B; sum=A*B/100; cout<<sum; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; constexpr ll MOD = 1e9 + 7; //constexpr ll MOD = 998244353; //constexpr ll MOD = ; ll mod(ll A, ll M) {return (A % M + M) % M;} constexpr ll INF = 1LL << 60; template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return tru...
#include <bits/stdc++.h> using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) #define pll pair<ll,ll> #define pint pll using ll = long long; const int inf=1e9+7; const ll longinf=1LL<<60 ; const ll mod=1e9+7 ; int main() { int n; cin >> n; string s,t; c...
#include <bits/stdc++.h> #include <numeric> using namespace std; #define int long long #define FOR(i, size) for (int i = 0; i < size; i++) #define all(x) x.begin(), x.end() #define endl "\n" #define MOD 1000000007 #define deb(...) logger(#__VA_ARGS__, __VA_ARGS__) template <typename... Args> void logger(string vars, ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define FIO ios::sync_with_stdio(false); cin.tie(nullptr) #define TC(t) int t; cin >> t; for(int i = 1; i <= t; i++) #define deb(x) cerr << #x << " = " << x << e...
#include <iostream> #include <cstring> #include <cmath> #include <algorithm> #include <queue> #include <string> #include <vector> using namespace std; typedef long long ll; const ll MAX = 1e18 + 100; const int maxN = 1e5 + 5; const int maxM = 2e5 + 5; ll head[maxN], cnt; struct edge { ll c, d; ll to, best_time, next...
#include <iostream> #include <algorithm> #include <vector> #include <deque> #include <queue> #include <set> #include <map> #include <limits> #include <cmath> #include <iomanip> #include <functional> #include <random> #include <set> using namespace std; using ll = long long; const long long BASE_NUM = 1000000007; //ht...
#include <bits/stdc++.h> #define fi first #define se second #define rep(i,n) for(int i = 0; i < (n); ++i) #define rrep(i,n) for(int i = 1; i <= (n); ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) #define srep(i,s,t) for (int i = s; i < t; ++i) #define rng(a) a.begin(),a.end() #define rrng(a) a.rbegin(),a.rend()...
#include <iostream> #include <vector> using namespace std; int main() { int a, b; cin >> a >> b; int x, y; x = (a + b) / 2; y = (a - b) / 2; cout << x << " " << y; return 0; }
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define ff first #define ss second #define rsz resize #define ins insert #define mp make_pair #define pf push_front #define pb push_back #define eb emplace_back #define ft front() #define bk back() #define sz(x) (int)(x).siz...
#include<bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define pii pair<long long,long long> #define mp make_pair #define pb push_back int n,a[200005],maxx,sum,s2; void solve() { int ans=0; cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; sum=a[1],s2=a[1]; ans=a[1]*2; maxx=a...
#pragma region Macros #include <bits/stdc++.h> #if defined(LOCAL) || defined(ONLINE_JUDGE) || defined(_DEBUG) #include <atcoder/all> #endif using namespace std; #define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i) #define REPR(i, n) for(int i=(n); i>=0; --i) #define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##...
#include<bits/stdc++.h> #define maxn 300010 using namespace std; typedef long long LL; int read() { int s=0,w=1; char ch=getchar(); while(ch<'0'||ch>'9') {if(ch=='-')w=-1;ch=getchar();} while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48),ch=getchar(); return s*w; } int n; long long A[maxn],s,ans; signed main() { n=re...
#include<cstdio> #include<set> #include<vector> #include<algorithm> #include<queue> #include<map> #include<cstdlib> #include<time.h> #include<string> #include<stack> #include<cmath> #include<iostream> #include<cstring> #include<complex> #include<tr1/unordered_set> #include<tr1/unordered_map> #include <chrono> #include ...