code_file1 stringlengths 87 4k | code_file2 stringlengths 85 4k |
|---|---|
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<long long> A(N+1);
for(int i=0;i<N;i++){
cin >> A.at(i+1);
A.at(i+1)+=A.at(i);
}
long long maxans=0;
long long C=0;
long long D=0;
for(int i=0;i<N+1;i++){
D=max(D,A.at(i));
maxans=max(maxans,C+D);
C+=... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> P;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).b... |
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#incl... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;
int main() {
ll n, w, ans = 0;
cin >> n >> w;
vector<ll> imos(200005, 0);
rep(i, n) {
ll s, t, p;
cin >> s >> t >> p;
imos[++s] += p;
imos[++t] -= p;
}
... |
# include <bits/stdc++.h>
using namespace std;
# define endl "\n"
# define io_boost std::ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
typedef unsigned long long int ulli;
typedef long long int lli;
typedef unsigned int ui;
int a[3];
int main(){
cin >> a[0] >> a[1] >> a[2];
if(2 * a[1]... | #include<bits/stdc++.h>
#define endl '\n'
#define ri register
#define QAQ(m, n) for(ri ll i = m;i <= n;i++)
#define QWQ(m, n) for(ri ll j = m;j <= n;j++)
#define uQAQ(n, m) for(ri ll i = n;i >= m;--i)
#define uQWQ(n, m) for(ri ll j = n;j >= m;--j)
#define ALL(a) a.begin(), a.end()
#define all(a, n) a + 1, a + n + 1
#de... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << (2 * a + 100) - b << endl;
}
| #include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define ll long long
#define coYes cout << "Yes" << endl
#define coYES cout << "YES" << endl
#define coyes cout << "yes" << endl
#define coNo cout << "No" << endl
#define coNO cout ... |
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b... | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
long long k, n;
pair<long long, long long> m[(int)2e5];
scanf("%lld%lld", &n, &k);
for (int i=0;i<n;++i){
scanf("%lld%lld", &m[i].first, &m[i].second);
}
sort(m,m+n);
long long current = 0;
for (int i=0;i<n;i++){
... |
#include <bits/stdc++.h>
using namespace std;
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define MAX(v) (*max_element((v).begin(), (v).end()))
#define MIN(v) (*min_element((v).begin(), (v).end()))
#define pb push_back
... | //#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define SZ(x) ((int)x.size())
#define uni(x) sort(all(x)),x.resize(unique(all(x))-x.begin());
#define GETPOS(c,x) (lower_bound(all(c),x)-c.begin())
#define lown1(x,val) low(in(x),val)-x
#define lowm1(x,val) low(im(x),val)-x
#define low1(x,nums,val) low(x+1,x+nums+1,val)... |
#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int... | #pragma GCC optimize("Ofast", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template<ll mod = 1000000007LL>
ll modpow(ll a, ll b){
if (b == 0) return 1LL;
ll tmp = modpow(a * a % mod, b / 2);
if (b % 2 == 0) return tmp;
return tmp * a % m... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,j,n) for(ll i=j;i<n;i++)
#define scn(a) scanf("%lld",&a)
#define scns(a,b) scanf("%lld %lld",&a,&b)
#define print(a) printf("%lld\n",a)
#define vec vector<ll>
#define pb push_back
#define pair... | //#include <bits/stdc++.h>
#include <cstdio>
//#include <cmath>
//#include <algorithm>
//#include <map>
//#include <iostream>
//#include <string>
//#include <string.h>
//#include <bitset>
//#define _GLIBCXX_DEBUG
//#include <vector>
//#include <regex>
using namespace std;
int N;
int main()
{
scanf("%d", &N);
int ... |
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#inc... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(ll r,ll x,ll y)
{
double step=sqrt((double)(x*x+y*y)/(r*r));
if (step<1)
{
cout<<2<<endl;
return;
}
if (step>(ll)step)
cout<<(ll)step+1<<endl;
else
cout<<step<<endl;
return;
}
int m... |
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
void printout(set<int>* g, long* values, long curval, int cn, long* res)
{
curval+=values[cn];
res[cn] = curval;
for (set<int>::iterator it = g[cn].begin();it!=g[cn].end();++it){
if (res[*it]==-1) printout(g,values,curval,*it,res);
... | #include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P =pair<int,int>;
#define rep(i,n) for (int i = 0; i < (n); ++i)
int n,m;
std::vector<std::vector<int> > g;
std::map<P, int> v;
std::vector<int> ans;
void bfs(int nowP ,int ncost){
// std::cout << nowP<<":"<<ncost << '\n';
if(ans[nowP]!=-... | #include <bits/stdc++.h>
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, m;
std::cin >> n >> m;
std::vector<std::vector<std::pair<int, int>>> e(n);
for (int i = 0; i < m; ++i) {
int u, v, c;
std::cin >> u >> v >> c;
--u, --v, --c;
... |
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int MOD=1000000007;
//~ const int MOD=998244353;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
int main(){
int a,b,c,d;cin>>a>>b>>c>>d;
if(a==c&&b==d){
puts("0");r... | #include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);
#define l_ength size
void mul_mod(ll& a, ll b){
a *= b;
a %= MOD;
}
void add_mod(ll& a, ll b){
... |
//Author: hyperion_1724
//Time and Date: 16:55:26 17 October 2020
//Optional FAST
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")
//Required Libraries
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_co... | #ifdef Prateek
#include "\Prateek.h"
#else
#include <bits/stdc++.h>
using namespace std;
#define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 +... |
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long n,tot;
struct node{
long long x,y,id;
}a[200010],b[200010];
struct fk{
long long w,id;
}f[10];
bool cx(node u,node v){
return u.x<v.x;
}
bool cy(node u,node v){
return u.y<v.y;
}
bool cf(fk u,fk v){
return u.... | #include<bits/stdc++.h>
//#include<bits/extc++.h>
using namespace std;
//using namespace __gnu_pbds;
#define int long long
#define pii pair<int,int>
#define float long double
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define uid uniform_int_dis... |
#include<bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define mii map<int,int>
#define mll map<long long int,long long int>
#define rep(it,m) for(auto it=m.begin();it!=m.end();it++)
#define pb push_back
#define fr first
#define sc s... | #include <bits/stdc++.h>
int main() {
using namespace std;
ios_base::sync_with_stdio(false), cin.tie(nullptr);
int N; cin >> N;
cout << 105 << ' ';
N--;
for (int v = 2; N > 0; v += 2) {
if (v % 3 == 0 || v % 5 == 0 || v % 7 == 0) {
cout << v << " \n"[--N == 0];
}
}
return 0;
}
// We'll 15, and anythi... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(),a.end()
typedef pair<ll,ll> pi;
//__builtin_popcountll(2) (the number of ones in the binary represe... | #include <bits/stdc++.h>
using namespace std;
void dfs(const int64_t s, const vector<vector<int>>& g,
vector<bool>& v, vector<int>& p) {
if (v[s]) return;
p.push_back(s), v[s] = true;
for (auto i = 0; i < (int)g[s].size(); i++)
if (g[s][i] == 1) dfs(i, g, v, p);
}
void dfs2(const int64_t ... |
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
t=0; char ch=getchar(); int f=1;
while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
int n,m,X[100010],Y[100010],c[110];
vector<int> g[110];
int ans[11... | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
vector<int> solve(const vector<int>& A, const vector<int>& B){
const int N = A.size();
vector<int> res(N, -1);
int last = -1;
for(int i=0;i<N;i++){
if(A[i] == B[i]){
res[i] = 0;
... |
#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>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#defi... |
#include<bits/stdc++.h>
namespace my_std{
using namespace std;
#define pii pair<int,int>
#define fir first
#define sec second
#define MP make_pair
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define drep(i,x,y) for (int i=(x);i>=(y);i--)
#define go(x) for (int i=head[x];i;i=edge[i].nxt)
#define templ templat... | #include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<int,int> pi;
typedef pair<lld,lld> pl;
typedef pair<int,lld> pil;
typedef pair<lld,int> pli;
typedef vector<int> vit;
typedef vector<vit> vitt;
typedef vector<lld> vlt;
typedef vector<vlt> vltt;
typedef vector<pi> vpit;
typedef vector... |
#include<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<climits>
#include<... | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define llrep(i,n) for(ll i=0; i<(ll)n; i++)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてから使う
#define INF 2147483647
#define LLINF 9223372036854775807LL
#... |
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,b;
cin>>n>>a>>b;
cout<<n-a+b<<endl;
return 0;
} | #include<iostream>
#include<cmath>
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
typedef long long int ll;
const ll maxn=1e15;
const ll mod=1e9+7;
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n,a,b;
cin>>n>>a>>b;
cout<<(n-a)+b<<"\n";
cerr<<"\nTi... |
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const long long MOD = 1000000007;
templ... | #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;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a)
#define dumparr(a,n)
#endif
#... |
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cstdio>
#include <bitset>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <functional>
#include <stack>
#include <cmath>
#include <string>... | #include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long
#define rep(i,j,n)... |
#include <stack>
#include <cstdio>
#include <vector>
using namespace std;
#define int long long
stack < int > st;
vector < int > ans;
int fib[100];
int n;
signed main() {
scanf( "%lld", &n );
fib[1] = fib[2] = 1;
for( int i = 3;i <= 88;i ++ )
fib[i] = fib[i - 1] + fib[i - 2];
for( int i = 88;i;i -- )
if( n >= ... | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
vector<bool> prime(n+1,true);
for(int i=2;i<=n;i++){
if(prime[i]){
for(int j=i*i;j<=n;j+=i){
prime[j]=false;
}
}
}
long long int count=1;
for(int i=2;i<=n;i++){
if(prime[i]){
d... |
/**
* @author: adityasonani
* */
#include <bits/stdc++.h>
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#define ll long long
#define ld long double
#define ln "\n"
#define fastio ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define MOD ... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
string X; cin >> X;
int64_t M; cin >> M;
if (X.size() == 1) {
if (stoll(X) > M) {
cout << 0 << endl;
return 0;
}
cout << 1 << endl;
return 0;
}
int64_t maxi = 0;
rep(i... |
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<l... | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
// #define int long long
template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template <class T>
inline bool chmin(T &a, T b)
{
if (a > b)
{
a = b;
return true;
}
return false;
}
template <class T... |
#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>
using namespace std;
#define ll long long
#define int ll
#define pii pair<int, int>
#define ull unsigned ll
#define f first
#define s second
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
#define SQ(x) (x)*(x)
#define MN(a,b) a = min(a,(__typeof__(a))(b))
#define MX(a,b) a = max(a... |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
constexpr ll INF = 1e11;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll n, m, ans = 0, mx = 0;
cin >> n >> m;
vector<ll> w(n), l(m), v(m);
vecto... |
// Author: Muhesh Kumar
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using db = long double;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vs = vector<string>;
using vpi = vecto... |
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
/* alias */
using ull = unsigned long long;
using ll = long long;
/* define short */
#define all(obj) (obj).begin(), (obj).end()
#define YESNO(bool) if(bool){cout<<"YES"<<endl;}else{... |
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) (int)(a.size())
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define MOD (ll)(998244353)
#define INF (ll)(1e18)
#def... |
#pragma GCC optimize("03")
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
using namespace std;
int n;
string s;
char a[200100];
int cnt[500];
int main() {
// ifstream cin("tst.in");
// ofstream cout("tst.out");
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cin >... | #include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>... |
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <... | #include <iostream>
#include <vector>
#include <utility>
#include <queue>
using namespace std;
int main()
{
long long n;
cin >> n;
vector<pair<long long, long long>> edge_num(n);
vector<vector<long long>> edge(n + 1);
vector<long long> depth(n + 1, -1);
for (long long i = 1; i <= n - 1; i++)
... |
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
const int INF=1000000000+5;
const int N=1e5+5;
const ll oo=1e18+5;
const ll mod=1e9+7;
map<int,pair<int,int>> get(int n,int L){
vector<int> v{0};
for(int i=1;i<=n... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=100010,mod=1000000007;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#def... | // Sometimes, the questions are complicated - and the answers are simple. //
#include<iostream>
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 1e3 + 5, mod = 1e9 + 7;
int n;
char AA, BB, AB, BA ;
... |
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<vector>
#define ll long long
using namespace std;
int n;
ll k,ans=0;
int t[9][9];
int num[]={2,3,4,5,6,7,8};
void solve(){
do{
ll sum=0;
sum+=(t[1][num[0]]+t[num[n-2]][1]);
for(int i=0;i<n-2;i++) sum+=t[num[i]][num[i+1]];
if(s... | /* Simplicity and Goodness */
#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;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
void my_dbg() { cout <... |
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b; return true;} return false;}
using namespace std;
i... | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... |
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb empla... | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define st first
#define nd second
#define endl '\n'
#define what_is(x) cerr << #x << " is " << x << endl;
#define what_is_v(x) cerr << #x << " is "; for(auto&e: (x)) cerr << e << ' '; cerr << '\n'; //vector, set
#define... |
// abc180_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(... | #ifdef _LOCAL
#include "local_include.hpp"
#else
#include <bits/stdc++.h>
using namespace std;
#endif
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define fto(i, s, e) for (int i = (s); i <= (e); ++i)
#define fto1(i, s, e) for (int i = (s); i < (e); ++i)
#define fdto(i, s, e) for (... |
#include<bits/stdc++.h>
////////////////////////////dbug/////////////////////////////////////////////////////////////////////////
#define dbug(a) cerr<<"==> "<<a<<endl;
#define dbug_ok cerr<<"==> ok"<<endl;
#define dbug_2d(a,n,m) {cerr<<"********"<<endl;for(int i=0;i<n;i++){for(int j=0;j<m;j++)cerr<<a[i][j]<<" "; cerr<... | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define S second
#define F first
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vll vector<long long int>
#define pll pair<long long int,long long int>
#define mod 1000000007
#define mod2 998244353
#define ll long long int
... |
#define NOMINMAX
#define TEST_MODE true
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep2(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rrep(i,n) for(int i=(n)-1;i>=0;--i)
#define rrep2(i,a,b) for(int i=(a)-... | #include <bits/stdc++.h>
#define pb push_back
#define SZ(x) ((int)(x.size()))
#define FOR(i,s,n) for (ll i = (s); (i) < (n); ++i)
#define FORD(i,s,l) for (ll i = (s); (i) >= l; --i)
#define F first
#define S second
#define TC int __tc; cin >> __tc; FOR(case_num,1,__tc+1)
#define TEST(x,i) ((x)&(1ll<<(i)))
#define SET(x... |
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<bitset>
#include<functional>
#include <fstream>
//#include<bits/stdc++.h>... | #include<iostream>
#include<algorithm>
#include<cstdlib>
#include<sstream>
#include<cstring>
#include<cstdio>
#include<string>
#include<deque>
#include<cmath>
#include<queue>
#include<set>
#include<map>
using namespace std;
struct Diff {
int thePos;
long long rPos;
long long rNeg;
long long max;
long long a;
... |
#include"bits/stdc++.h"
using namespace std;
#define ll long long
#define ul unsigned long long
#define ui unsigned int
#define ri register int
#define pb push_back
#define mp make_pair
char p[30]={'0','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
inline ll rd... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
#define rep(i, n) for (int i=0; i<(n); ++i)
#define each(v, i) for (auto i : v)
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define maxs(x, y) x = max(x, y)
#define mins(x, y) x =... |
#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
//using namespace atcoder;
const int mod = 998244353;
const int INF =1e9+1;
int ans=INF;
int main(){
int h,w,n,m;cin>>h>>w>>n>>m;
vector<vector<int>> math(h,vector<int> (... | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
int32_t main(){
int n,m,a,b;
cin>>n>>m>>a>>b;
int grid[n][m];
memset(grid,-1,sizeof(grid));
//for bulbs
for(int i=0;i<a;i++){
int r,c;
cin>>r>>c;
r... |
# include <bits/stdc++.h>
using namespace std;
# define rep(i,a,n) for (int i=a; i<=n; ++i)
# define per(i,a,n) for (int i=a; i>=n; --i)
# define bug puts("H");
# define pb push_back
# define mp make_pair
# define all(x) (x).begin(), (x).end()
# define SZ(x) (int)x.size()
# define fi first
# define se second
# define l... | #include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
... |
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<math.h>
using namespace std;
long long a[45],b[45],d=0,t,n;
void DFS(int c,long long r);
int main()
{
cin>>n>>t;
for(int i = 1;i <= n;i++)
{
scanf("%d",&a[i]);
}
sort(a+1,a+n+1);
reverse(a+1,a+n+1);
for(int i=n;i>=1;i--)
{
b[i]=b[i+1]+a[i];
... | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=ve... |
#include <bits/stdc++.h>
using namespace std;
long long INF = 1000000000000000000;
int main(){
long long A, B;
cin >> A >> B;
vector<long long> d;
for(int i = 2; i <= 72; i++){
if(i == 2) d.push_back(i);
if(i % 2 == 0) continue;
bool flag = true;
for(int j = 2; j * j <= i... | #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>
#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 <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;
const ll INF = 1001001001001001001;
void solve(long long N, std::vector<long long> a, std::vector<long long> t, long long Q, std::vector<long long> ... |
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << '\n'
typedef long long ll;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
template <typename T> inline bool ch... | #include"bits/stdc++.h"
using namespace std;
vector<string> split(const string & s, char c=' ') {
vector<string> v; stringstream ss(s); string x;
while (getline(ss, x, c)) v.emplace_back(x); return move(v);
}
template<typename T, typename... Args>
inline string arrStr(T arr, int n) {
stringstream s; s << "[";... |
#include <bits/stdc++.h>
using namespace std;
void solve(){
int N,M;
cin>>N>>M;
vector<pair<int,int>> cond(M);
for(int i=0; i<M; i++){
int t1,t2;
cin>>t1>>t2;
cond[i]=make_pair(t1,t2);
}
int K;
cin>>K;
vector<pair<i... | #include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define lli long long int
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define vi vector<... |
#include <bits/stdc++.h>
using namespace std;
int n;
vector <string> s;
vector <unsigned long long> t,f;
int main(){
cin >> n;
s = vector<string>(n);
for(int i = 0; i < n; i++){
cin >> s[i];
}
t = vector<unsigned long long>(n+1,0);
f = vector<unsigned long long>(n+1,0);
t[0]=1;
f... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
#define sz(a) int((a).size())
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(... |
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF
#define rep(i,n) for(in... | #include<bits/stdc++.h>
#define int ll
#define sz(x) int((x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using pi = pair<int,int>;
const int inf = 0x3f3f3f3f3f3f3f3f;
const int minf = 0xc0c0c0c0c0c0c0c0;
const int N = 2002002;
const int mod = int(1e9) + 7;
struct Modular {
... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,b) for(int i=a;i<=b;i++)
inline ll r() {
ll x=0,f=1;
char c=getchar();
while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c))x=x*10+c-'0',c=getchar();
return x*f;
}
#define d r()
ll n,cmp;
ll a[200010];
ll b[200010];
vector<... | #include<cmath>
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<bitset>
using namespace std;
const int maxn=105;
int n,k,m,a[maxn],sum;
inline int read()
{
int x=0,f=1;
char ch=getchar();
while(... |
#include <bits/stdc++.h>
#define INF 1e18
#define mod 998244353
#define rep(i,n,m) for(int i = (n); i < (m); i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define tii tuple<int,int,int>
#define mt make_tuple
#define pb push_back
#define pq priority_queue
using namespace std;
typedef long... | /*
* @Author: AsilenceBTF
* @LastEditTime: 2020-12-11 20:02:17
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(), x.end()
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 105;
ll pre[N] = {0};
int main(){
int n;
ll w;
cin >> n >> w;
for(int i = 1; i <= n;... |
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+(ch^48);ch=getchar();}
return x*f;
}
int a,b,c;
int main()
{
a=read(),b=read(),c=read();
if(c%2==0)
a=abs(a),b=abs(b);
if(a>b)
pu... | #include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <string.h>
using namespace std;
#define ll long long
#define INF 1000007
#define MAX 500007
#define EPS 1e-9
#define PI acos(-1.0)
#define nl "\n"
#define F first
#define S second
typedef vector<ll> vi;
typedef priority_queue<ll , vector<ll> , great... |
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define sz(v) (int)v.size()
#define nl "\n"
using namespace std;
//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
if(a.first==b.first){
return a.s... | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
if(s.length()==3 && s[0]==s[1] && s[1]==s[2]&& s[2]==s[0]){
cout << "Won" << endl;
}
else{
cout << "Lost" << endl;
}
return 0;
} |
#include<bits/stdc++.h>
#define x first
#define y second
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mem(x,val) memset(x,val,sizeof x)
#define pii pair<int,int>
#define pb emplace_back
#define ar array
#define int long long
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define M 1000000... | #include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define drep(i,j,n) for(int i=0;i<(int)(n-1);i++)for(int j=i+1;j<(int)(n);j++)
#define trep(i,j,k,n) for(int i=0;i<(int)(n-2);i++)for(int j=i+1;j<(int)(n-1);j++)for(int k=j+1;k<(i... |
#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;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i... |
#include <bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define pb push_back
#define st first
#define nd second
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
template <class T> T read(T &a) {
a=0;char x=getchar();bool f=0;
for(;x<'0'||x>'9';x=getchar())f|=x=='-';
for(;x>='0'&&x<='... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main() {
int N, M;
cin >> N >> M;
vector<int> A(M), B(M);
vector<char> C(M);
for (int i = 0; i < M; i++) {
cin >> A[i] >> B[i] >> C[i];
A[i]--;
B[i]--;
}
vector<int> dist(N*... |
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char s[3];
char a;
int j=0;
for(int i=0;i<3;i++)
{
cin>>s[i];
}
char x=s[0];
int flag=1;
for(int i=1; i<3;i++)
{
if(x!=s[i])
{
flag=0;
cout<<"Lost";
break;
... | #include<iostream>
using namespace std;
int main()
{
int n,a,b;
cin>>n>>a>>b;
cout<<n-a+b;
return 0;
} |
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#inc... | // abc189_f
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<long double, long double> P;
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = ... |
#include <bits/stdc++.h>
using namespace std;
#define M1 1000000007
#define M2 998244353
#define INF 1e18
#define ll long long
#define pll pair<ll,ll>
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define REPR(i,a,b) for(ll i=b-1;i>=a;i--)
#define forr(i,n) for(ll i=0;i<n;i++)
#define F first
#define S second
#define pb push... | #include <bits/stdc++.h>
#include<sstream>
#include<string>
#include<vector>
#include <set>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define ll long long
#define ff first
#define ss second
long long M=1000000007;
using namespace std;
ll fact[10... |
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
#define MAX (int)(1e8)
using namespace std;
int main() {
int R, C;
cin >> R >> C;
vector<vector<int>> A(R, vector<int>(C - 1)), B(R - 1, vector<int>(C));
vector<vector<vector<int>>> costs(2, vector<vector<int>>(R, vector<int>(C, 0)));
vec... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
... |
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll N;
int main() {
cin >> N;
N *= 2;
vector<ll> yakusu;
for (ll i = 1; i * i <= N; i++) {
if (N % i == 0) {
yakusu.push_back(i);
yakusu.push_back(N / i);
}
}
sort(yakusu.begin(), yakusu.end());
//初項x... | #include<bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <chrono>
// using namespace std::chrono;
// using namespace __gnu_pbds;
#define ff first
#define ss second
#define int long long
#define double long double
#define pb ... |
// abc199_d
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../../debug_util/cxx-prettyprint/prettyprint.hpp"
#include "../../debug_util/rng.hpp"
#include "../../debug_util/timer.hpp"
#endif
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>... | #include<bits/stdc++.h>
#define N 25
using namespace std;
int n,m,no[N][3],id[N],p[N];
long long ans=1,cnt;
bitset<N> f[N];
inline int find(register int x){return x==id[x]?x:id[x]=find(id[x]);}
inline void dfs(register int x,register int y){
register bool flag=0;
for(register int i=x+1;i<=n;++i)if(find(i)==y){
fla... |
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false), cin.tie(nullptr);
set<char> s;
for(int i =0; i < 3; ++i){
char c;cin >>c;
s.insert(c);
}
cout <<(s.size() == 1 ? "Won" : "Lost");
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, X;
cin >> N >> X;
vector<int> A(N);
for (int i = 0; i < N; i++) {
cin >> A.at(i);
}
for (int i = 0; i < N; i++) {
if (A.at(i)!=X) cout << A.at(i) << ' ';
}
cout << endl;
} |
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
#define f(i,a,b) for( int i=a;i<=b;++i)
#define ff(i,a,b) for( int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pai... | #include<bits/stdc++.h>
#define ll long long
using namespace std;
#define gc getchar
inline ll read(){
register ll x=0,f=1;char ch=gc();
while (!isdigit(ch)){if (ch=='-') f=-1;ch=gc();}
while (isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=gc();}
return (f==1)?x:-x;
}
int n;
ll A[1010101],B[1010101],sumB[101010... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define testcase \
ll tc, t = 1; \
cin >> tc;
#define iloop(i, n) for (i = 0; i < n; i++)
#define dloop(i, n) for (i = n; i >= 0; i--)
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0);
#define vll vector<... | #include <cstdio>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <cstring>
#include <queue>
#include <map>
#define LL long long
#define LD long double
#define MAXN 100005
#define MAXM
#define P
#define INF 0x3f3f3f3f
using namespace std;
int t, n, a[MAXN];
int main()
{
scanf("%d", &t);
whi... |
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/
//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~
#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define f... | #include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#define __AceOfSpades__ ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define rep (i, n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;
int findSumOfDigits(int n){
int digit = 0;
while(n > 0){... |
#include<bits/stdc++.h>
using namespace std;
#define DONTSYNC ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) //dont use stdio with iostream functions //input and output are out of order now!
#define TEST unsigned long long T; cin>>T; while(T--) //loop over each testcase
#define endl "\n"
#define for... | /*
Author : MatsuTaku
Date : 01/09/21
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; i++)
using lint = long long int;
template<typename T>
using vvec = vector<vector<T>>;
template<typename T>
vvec<T> make_vvec(int n, int m, T v) { r... |
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#include <limits>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
using namespace std;
template<clas... | /*
JAI JAGANNATH!
*/
//@Author : zanj0
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define ff first
#define ss second
#define pb push_back
#define MOD 1000000007
#define inf 1e18
#define ps(x,y) fixed<<setprecision(... |
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL);
int a[3];
for (int i = 0; i < 3; i++)
{
cin>>a[i];
}
sort(a,a+3);
cout<<a[2]+a[1];
return 0;
} | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,f,n) for(ll i=(f); (i) < (n); i++)
#define repe(i,f,n) for(ll i=(f); (i) <= (n); i++)
#define repc(i,f,n) for(char i=(f); (i) <= (n); i++)
//#define PI 3.14159265358979323846264338327950L
#define debug(x) cout<<#x<<" :: "<<... |
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> a(n);
for (int& it : a) cin >> it;
if (n & 1) {
cout << "Second\n";
} else {
sort(a.begin(), a.end());
bool win = false;
for (int i = 0; i < n; i += 2) {
win |= ... | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << '\n'
typedef long long ll;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
template <typename T> inline bool chmax(T &a, T b) {return a ... |
#include <bits/stdc++.h>
#define REP_(i, a_, b_, a, b, ...) \
for (int i = (a), END_##i = (b); i < END_##i; ++i)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
using i64 = long long;
using namespace std;
int main() {
i64 n, k;
cin >> n >> k;
const i64 n2 = n * 2, n3 = n * 3;
vector<... | #include <bits/stdc++.h>
long long int sum_arr(long long int start, long long int end) {
if (start < 0 || end < 0) {
return 0;
}
return (start + end) * (start - end + 1) / 2;
}
int main() {
long long int N, K;
std::cin >> N >> K;
long long int res = K;
for (long long int l = 3; ... |
// Author :- Sarvesh Chaudhary
#include<bits/stdc++.h>
using namespace std;
#define w(x) int x; cin>>x; while(x--)
#define ll long long int
#define sidha(i,a,b) for(int i=a;i<b;i++)
#define set_built(x) __builtin_popcountll(x)
#define zero_built(x) __bultin_ctzll(x)
#define pairi pair<int,int>
#define vi vector<int>
#d... | #include<bits/stdc++.h>
#define lli long long int
using namespace std;
int main()
{
lli a,b,c,d,t,n,x,y,z,i,j,k,s,v;
cin>>v>>s>>t>>d;
if(d>=v*s && d<=v*t)
{
cout<<"No"<<endl;
}
else
{
cout<<"Yes"<<endl;
}
return 0;
}
|
#include <stdio.h>
int main()
{
int arr[3], remaining = 0;
scanf("%d %d %d", &arr[0], &arr[1], &arr[2]);
bool flag = false;
for (int i = 0; i <= 1; i++)
{
for (int j = i + 1; j <= 2; j++)
{
if (arr[i] == arr[j])
{
flag = true;
... | #pragma GCC optimize("Ofast")
/*#pragma GCC target("avx,avx2,fma")
#pragma GCC target ("sse4")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld double
#define rep(i,a,b) for(ll i=a; i<b; ++i)
#define BOOST std::ios... |
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, L;
cin >> n >> L;
auto input = [&]() {
vector<int> a(n);
for (auto&& e : a) {
cin >> e;
}
a.emplace_back(L + 1);
for (auto i = 0; i <= n; i++) a[i] -= i + 1;
for (auto i = n; i; i--) a[i] -= a[i - 1];
return a;
... |
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i < n + 1; i++)
#define all(A) A.begin(), A.end()
typedef long long ll;
using P = pair<int, int>;
struct E
{
int to, co;
E(int a, int b)
{
to ... | #include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
vo... |
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read()
{
int x=0;
bool flag=1;
char c=getchar();
while(c<'0'||c>'9')
{
if(c=='-')
flag=0;
c=getchar();
}
while(c>='0'&&c<='9')
{
x=(x<<1)+(x<<3)+c-'0';
c=getchar();
}
return (flag?x:~(x-1));
... | #include<bits/stdc++.h>
#define vll vector<long long>
#define ll long long
#define dbg(x) cout << #x << " " << x <<endl;
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define farn(i,x,n) for(int i=x;i<=(int)n;i++)
#define rforn(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,s,n) for(int i=s;i<n;i++)
#define sz(x) ((int)x.siz... |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include <debugger.h>
#else
#define dbg(x...) {}
#define dbg_t() {}
#endif
using ll = long long;
using ld = long double;
const ll INF = 1e18;
void solve()
{
ll n, m; cin >> n >> m;
vector<string> grid(n);
for (ll i = 0; i < n; i++)
cin >> grid... | #include "bits/stdc++.h"
using namespace std;
#define mp make_pair
#define pb push_back
#define ll long long int
#define sdll(x) scanf("%lld",&x)
#define sd(x) scanf("%d",&x)
#define inf (ll)(1e18+9)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define bits(x) __builtin_popcount(x)
#define fastio ios_base::sync_w... |
#include <iostream>
#include <vector>
using namespace std;
int main(void){
long long N,M,T;
cin >> N >> M >> T;
long long start, end, now, B;
B = N;
now = 0;
for(int i=0;i<M;i++){
cin >> start >> end;
B -= start-now;
if(B<=0){
cout << "No";
return ... |
///−In the name of God −///
//In mathematics, an unordered pair or pair set is a set of the form {a, b},
//i.e. a set having two elements a and b with no particular relation between them.
//In contrast, an ordered pair (a, b) has a as its first element and b as its second element.
//So, (... |
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define REP(i, a, b) for (ll i = a; i <= b; i++)
#define REP_REV(i, a, b) for (ll i = a; i >= b; i--)
#define debug(x) cerr << #x << " is " << x << endl;
#define all(x) (x).begin(),... | //ver 8.1
#include <bits/stdc++.h>
using namespace std;
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vd = vector<ld>;
using vs = vector<string>;
using vb = vector<bool>;
using vvl = vector<vector<ll>>;
... |
#include <bits/stdc++.h>
// #define x first
// #define y second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 2e5 + 20;
int n, t;
bool vis[N];
int main()
{
IOS; cin >> t >> n;
// LL l = 1, r = 1e13, res = 1;
/... | #include<bits/stdc++.h>
#define int long long
#define ls (rt<<1)
#define rs (rt<<1|1)
#define pii pair<int,int>
#define fi first
#define se second
#define rd(u) u=read()
#define endl '\n'
using namespace std;
const int N=2e6+5;
const int M=1e7+5;
const int mod=1e9+7;
const int inf=3e18;
inline int read(){int u=0,f=1;c... |
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <numeric>
#include <algorithm>
#include <queue>
#include <bitset>
using namespace std;
#define rep(i,n) for(int i=0 ; i<(n) ; ++i)
typedef long long ll;
typedef pair<int,int> p;
const int MOD = 1000000000+7;
const int INF = 10010001... | #include <bits/stdc++.h>
#define N 567
typedef long long ll;
using namespace std;
const int P = 998244353;
inline void read(int &x) {
scanf("%d", &x);
}
int n, m;
char s[N];
int bin[N + N];
inline void Set(int p, int v) {
if (bin[p] == -1) {
bin[p] = v;
} else {
if (bin[p] ^ v) {
puts("0"); exit(0);
}
}
}
... |
#include <bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
const ll INF=LLONG_MAX;
const int inf=INT_MAX;
const ull md=1000000000;//10^9
void out(int ans){
cout << ans << endl;
exit(0);
}
int main(){
ios_base::sync_with_stdio(... | #include <bits/stdc++.h>
using namespace std;
int main() {
string a, saida = "";
cin >> a;
int i = 0;
while(a[i] != '.' && i < a.length()){
saida += a[i];
i++;
}
cout << saida << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
cout << (1 << n) - 1 << '\n';
for (int i = 1; i < 1 << n; ++i) {
for (int j = 0; j < 1 << n; ++j) {
if (__builtin_popcount(i & j) & 1) {
cout << 'B';
} else {
cout << ... | #include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, c) for(__typeof((c).begin()) i = (c... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int in();
ll sol(ll i){
if(i%200==0) i/=200;
else i=i*1000+200;
return i;
}
int main(){
ll n,k;
n=in();k=in();
for(int i=1; i<=k; i++) n=sol(n);
cout<<n;
return 0;
}
int in(){
ll nn=0,ff=0;
char cc;
cc=cin.get();
while((cc<'0' || cc>'9') && ... | #include <bits/stdc++.h>
using namespace std;
// #define LOCAL // 提出時はコメントアウト
#define DEBUG_
typedef long long ll;
const double EPS = 1e-9;
const ll INF = ((1LL<<62)-(1LL<<31));
typedef vector<ll> vecl;
typedef pair<ll, ll> pairl;
template<typename T> using uset = unordered_set<T>;
template<typename T, typename U> usi... |
/* *Which of the favors of your Lord will you deny ?* */
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define vpnt(ans) \
for (ll i = 0; i < ans.size(); i++) \
cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define setbit(x, ... | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define int long long
typedef vector<int> vi;typedef vector<vi> vvi;
signed main(){
ios::sync_with_stdio(0);cin.tie(0);
#ifndef ONLINE_JUDGE
freopen("E:\\in.txt","r", stdin);
#endif
int n; cin >> n;
vi a(n), b(n)... |
#include <bits/stdc++.h>
using namespace std;
vector<vector<int64_t>> v_comb(100,vector<int64_t>(100));
int64_t comb(int64_t x, int64_t y){
if(x < 0 || y < 0 || x < y) return 0;
if(y == 0 || x == y) return 1;
if(v_comb[x][y] != 0) return v_comb[x][y];
int64_t rtn = comb(x-1,y-1)+comb(x-1,y);
v_comb... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
constexpr bool typetest = 0;
constexpr int N = 35 + 5;
int a, b;
ll k;
void Read()
{
cin >> a >> b >> k;
}
ll Pow(ll a, ll b)
{
ll ans(1);
for (; b > 0; b >>= 1)
{
if (... |
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
int main()
{
int N;
cin>>N;
vector<string> S(N);
for (string &s: S)
cin>>s;
int oo = 9999;
vector<vector<int>> D(N, vector<int>(N, 9999));
for (int i=0; i<N; i++)
for (int j=0;... | #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>;
#ifndef aa
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define u... |
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000007
using namespace std;
bool visited[2001];
ll dist[2001];
vector<pair<int,int>> adj[2001];
int edges[2001][2001];
int main()
{
int N,M;
cin>>N>>M;
memset(edges,0,sizeof(edges));
memset(dist,INF,sizeof(dist));
for(int i=1; i<=M; i++)
{
int A,B;
... | #include<bits/stdc++.h>
#define ll long long
#define dl long double
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define rep(i,a,b) for(i=a;i<b;i++)
#define all(v) v.begin(),v.end(... |
/*
AUTHOR: nit1n
CREATED: 15.11.2020 18:02:29
*/
#include<bits/stdc++.h>
#define int long long
using namespace std ;
const int N = 2e5 + 10 ;
int a[N] ;
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL) ;
int n ,w ;
cin >> n >> w ;
for(int i = 0; i < n ; ++i){
int s , t , p ;
... | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using ll = long long int;
#define ss string
#define mod 1000000007
#define pi 3.14159265358979
#define rep(i,s,n) for(int i=(s);i<(int)(n);i++)
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0... |
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vv = vector<vi>;
using Graph = vector<vector<int>>;
template<class T> bool chmax(T& a, T b){ if (a < b) { a = b; r... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }
const double PI = 3.14159265358979323846;
int vector_finder(vector<int> vec, int number) {
auto itr = find(vec.begin(), vec.end(), number);
size_t index = distance(vec.begin(), itr);
if... |
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <queue>
#... | #include<cstdio>
#define fo(i,a,b) for(int i=a;i<=b;i++)
const int N=55,mo=998244353;
int n,K,fac[N],a[N][N],f[N][N],g[N][N],s,ans=1;
bool vf[N],vg[N];
void T(int&x,int y) {x=1ll*x*y%mo;}
void dg(int x,int f[N][N],bool vf[N])
{
vf[x]=1; s++;
fo(y,1,n) if(!vf[y]&&f[x][y]) dg(y,f,vf);
}
int main()
{
scanf("%d%d",&n,&K... |
#include<bits/stdc++.h>
#define SZ(x) ((int)x.size())
#define uni(x) sort(all(x)),x.resize(unique(all(x))-x.begin());
#define GETPOS(c,x) (lower_bound(all(c),x)-c.begin())
#define lown1(x,val) low(in(x),val)-x
#define lowm1(x,val) low(im(x),val)-x
#define low1(x,nums,val) low(x+1,x+nums+1,val)-x
#define mst(x,val) mems... | //面倒くさがらずに実験したらすぐ分かった…
//all - NG * NGの形にして、1次元の問題でNGを数える。
//A, Bを置く位置x, y(0≦x, y≦N-1)を考えると
//0 ≦ x ≦ N - A
//0 ≦ y ≦ N - B
//y - A + 1 ≦ x ≦ y + B - 1
//なる(x, y)を数えたくなるので、そういう(x, y)を表示してみる。(実験)
//A + B > Nのときは、(N + 1 - A) * (N + 1 - B)個全てが埋まる.
//A + B <= Nのとき、
//1辺len = N + 1 - A - Bの二等辺三角形2つを引けばよい.
//ただし、二等辺三角形の面積は1 ... |
#include <iostream>
#include <cmath>
using namespace std;
int n;
double x0, z0, xn, zn, rx, ry, dx, dy, theta, c, s;
int main(){
cin >> n;
cin >> x0 >> z0 >> xn >> zn;
rx = (x0 + xn)/2.0;
ry = (z0 + zn)/2.0;
dx = x0 - rx;
dy = z0 - ry;
c = cos(M_PI*2.0/n);
s = sin(M_PI*2.0/n);
... | #include <bits/stdc++.h>
#pragma region my_template
struct Rep {
struct I {
int i;
void operator++() { ++i; }
int operator*() const { return i; }
bool operator!=(I o) const { return i < *o; }
};
const int l_, r_;
Rep(int l, int r) : l_(l), r_(r) {}
Rep(int n) : Rep(0, n) {}
I begin() const... |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(40)
const ll MOD = 1000000007;
const ll INF = (ll) 1e15;
bool solve(vector<ll> &A) {
ll N = A.size();
... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
int main(){
ll n;
cin >> n;
while(n % 2 == 0){
n /= 2;
}
ll sq = sqrt(n);
ll ans = 0;
for(ll i = 1;i <= sq;i++){
if(n % i == 0){
ans += 2;
}
}
if(sq*sq == n) ans--;
cout << ans*... |
#include <bits/stdc++.h>
#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()
#define maxs(x, y) (x = ... | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long a[100010];
vector<pair... |
#include <bits/stdc++.h>
using namespace std;
const long long INF = 10000000000000007;
const long long mod = 1000000007;
typedef long long ll;
typedef pair<int, int> P;
template<class T> bool chmax(T &a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
vector<int> table(2500);
vector<... | #include <bits/stdc++.h>
using namespace std;
int main() {
int H, W;
cin >> H >> W;
char X[H][W];
string S;
for (int i = 0; i < H; i++) {
cin >> S;
for (int j = 0; j < W; j++) {
X[i][j] = S.at(j);
}
}
int count = 0;
for (int i = 0; i < H - 1; i++) {... |
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
s... | #include <bits/stdc++.h>
using namespace std;
void DBG() { cerr << endl; }
template<class Head, class... Tail>
void DBG(Head H, Tail... T) { cerr << ' ' << H; DBG(T...); }
#define dbg(...) cerr << "(" << (#__VA_ARGS__) << "):", DBG(__VA_ARGS__)
using ll = long long;
using ld = long double;
#define sqr(a) ll(a) * (a)... |
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define reps(i,s,n) for(int i=s;i<n;++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int M = 1e5;
int main()
{
int n;
cin >> n;
vector<int> t(n);
rep(i, n) cin >> t[i];
int sum = 0;
rep(i, n) sum += t[i... | /*
__
/\ \
_ __ ___ ___\ \ \/'\ ___ __ ___ ___ __
/\`'__\/ __`\ /'___\ \ , < / __`\ /'__`\ /' _ `\ /' _ `\ /'__`\
\ \ \//\ \L\ \/\ \__/\ \ \\`\ /\ \L\ \/\ \L\.\_/\ \/\ \/\ \/\ \/\ \L\.\_
\ \_\\ \____/\ \____\\ \_\ \_\ \____/\ \__/.\_\ \_\ \_\ ... |
#include <bits/stdc++.h>
using namespace std;
int main(){
int r1, c1, r2, c2;
cin >> r1 >> c1 >> r2 >> c2;
int r = r2 - r1, c = c2 - c1;
int ans = 3;
if(!r && !c) ans = 0;
else if(r == c || r == -c || abs(r) + abs(c) <= 3) ans = 1;
else if((r ^ c ^ 1) & 1 || abs(r + c) <= 3 || abs(r - c) <= ... | #include <bits/stdc++.h>
using namespace std;
int main() {
int A[3];
for (int i = 0; i < 3; i++) cin >> A[i];
int p[3] = {0, 1, 2};
bool res = false;
do {
if (A[p[2]] - A[p[1]] == A[p[1]] - A[p[0] ]) res = true;
} while (next_permutation(p, p + 3));
if (res) cout << "Yes";
else cout << "No";
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.