code_file1 stringlengths 87 4k | code_file2 stringlengths 82 4k |
|---|---|
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<cmath>
#define rep(i,a,b) for(ll i=a;i<=b;++i)
#define per(i,a,b) for(ll i=a;i>=b;--i)
#define fi first
#define se second
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
typedef unsigned ... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
string X;
ll M;
cin >> X >> M;
int d = 0;
for (char c : X) if (c-'0'>d) d = c-'0';
if (X.size() == 1) {
cout << (d<=M) << endl;
return 0;
}
ll L = d, R = M +1;
while (R-L>1) {
ll ... |
#include <bits/stdc++.h>
#include <climits>
using namespace std;
template<class T>
using V = vector<T>;
template<class T>
using VV = V<V<T>>;
using ld = long double;
#define ll long long
using ull = unsigned ll;
using PLL = pair<ll, ll>;
using VLL = V<ll>;
using VB = V<bool>;
using VVB = VV<bool>;
using VVLL = VV<ll... | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;ret... |
/*
* Author : YangDavid
* Created Time : 2020.10.24 20:00:41
*/
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 1; i <= n; ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 2e18;
int main() {
ll x, p3 = 3, p5 = 5, deg3 = 1, deg5 = 1;
map<ll, int> st;
while(p5... | #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<iostream>
#include<math.h>
#include<bits/stdc++.h>
#include<queue>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#define rep(i,n) for (int i=0;i<(n);++i)
using ll = long long;
using namespace std;
using P = pair<int,int>;
#define INF 100000
int main(){
double si,sj,gi,gj;
cin>... | #include<bits/stdc++.h>
using namespace std;
#define int long long
//#define N 510
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int i,n,a,b,c,d;
cin>>a>>b>>c>>d;
cout<<max(a,b)-min(c,d);
} |
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
int main(){
int n,k;
string s;
cin >> n >> k >> s;
rep(i,k){
string t;
i... | #include <cstdio>
#define N 1048576
#define ll long long
#define mem(x, a) memset(x, a, sizeof x)
#define mpy(x, y) memcpy(x, y, sizeof y)
#define fo(x, a, b) for (int x = (a); x <= (b); x++)
#define fd(x, a, b) for (int x = (a); x >= (b); x--)
#define go(x) for (int p = tail[x], v; p; p = e[p].fr)
using namespace std;... |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long N, xi, ans1=0, ans3=0;
cin >> N;
long double ans2=0, an;
for(int i=0; i<N; i++){
cin >> xi;
ans1 += abs(xi);
ans2 += abs(xi) * abs(xi);
ans3 = max(ans3, abs(xi));
}
an = sqrt(ans2);
cout << ans1 << endl... | #include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define coy c... |
#include <algorithm>
#include <iostream>
#include <functional>
using namespace std;
using ll = long long;
const int MAXN = 40, MAXH = 20;
int n, lim, p1, p2;
ll t, a[MAXN], s1[1 << MAXH], s2[1 << MAXH];
void dfs1(int cur, ll sum) {
if (cur == lim) {
s1[p1++] = sum;
return;
}
dfs1(cur + 1, sum);
dfs1(c... | #include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
//////////////////////////////////
int main() {
int h, w; cin >> h >> w;
vector<vector<int>> a(h, vector<int>(w));
int mn = 1e9;
for(int i=0; i<h; i++) for(int j=0; j<w; j++) {
cin >> a[i][j];
... |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define MEM(x,val) memset(x,val,sizeof(x))
#define LL long long
#define F first
#define S second
#define PI pair<int,int>
#define PLL pair<LL,LL>
#define ALL(x) x.begin(),x.end()
#define int LL
const int Mx = 300005;
int N,q;
int tree[Mx * 4];
void u... | #include <bits/stdc++.h>
using namespace std;
#define IO ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define double long double
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vii vector<pii>
#def... |
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define ud unsigned int
#define ll long long
#define ull unsigned long long
#define MAX_INF 0x3f
#define MAX_INF_VAL 0x3f3f3f3f
#define MAX_INF_VAL_LL 0x3f3f3f3f3f3f3f3f
//#define pi 3.141592653589
#define eps 1e-9
#define F(x) ((x)/3+((x)%3==1?0:tb))
#define G(x) ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << '\n'; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Ar... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#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 all(a) (a).begin(),(a).end()
#define bit(k) (1LL<<(k))
#define SUM(v) accumulate(all(v), 0LL)
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
int q;
cin >> n >> s >> q;
int flipcount = 0;
for (int i = 0; i < q; i++) {
int t, a, b;
cin >> t >> a >> b;
if (t == 1) {
a--;
b--;
if (flipcount % 2 == 1) {
... |
// Example program
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
cin >> s;
swap(s[0],s[2]);
swap(s[0],s[1]);
cout << s;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pii pair<int , int>
#define pb push_back
#define F first
#define S second
const int mod = 1e9 + 7;
const int MAXX = 1e6 + 5;
int n;
signed main()
{
_Fa... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< "... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
co... |
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define RREP(i, n) for (int i = (int)(n); i >= 0; i--)
#define rep(i, a, n) for (int i = (a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = (a); i >= (int)(n); i--)
#define ALL(obj) (obj).begin(), (obj).end()
#def... | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define poly vector<ll>
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#defi... |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define endl '\n'
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define FordE(... | #include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;
const int maxN = 2e5; int n, q;
const lli inf = 1e16;
lli a[maxN], t[maxN], x[maxN];
int main()
{
while (~scanf("%d", &n))
{
lli maximumLimit = inf, minimumLimit = -inf, base = 0;
for (i... |
/*First,solve the problem then write the code:);)*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test ll t;cin>>t;while(t--)
#define sets(a) memset(a, -1, sizeof(a))
#define clr(a) memset(a, 0, sizeof(a))
#define... | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a;
cin>>a;
if(a==1)
{
cout<<1;
return 0;
}
else if(a<100) cout<<1;
int b=a/100;
if(a%100==0) cout<<b;
else cout<<b+1;
return 0;
} |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=1000000007;
constexpr ll INF=2e18;
//#define DEBUG
const int n=30;
const int q=1000;
VV... | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
struct edge{
int to,cost;
edge(int a,int b):to(a),cost(b) {}
};
vector<vector<edge>> G(900);
vector<int> d(900);
vector<int> prevs(900);
const int INF = 1e9;
string res = "";... |
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long
#define ull unsigne... | //Bulbul khan-420...
#include <bits/stdc++.h>
#include <cstring>
#define ll long long int
#define pb() push_back()
#define f(i,n) for(i=0;i<n;i++)
using namespace std;
int main()
{
float t,b,c,d,i,j,k,l,n,m,x,y,z;
cin>>n;
ll a;
a=n*(1.08);
if(a<206)
cout<<"Yay!";
else if(a==2... |
#include <bits/stdc++.h>
#define For(i, a, b) for (int(i) = (int)(a); (i) < (int)(b); ++(i))
#define rFor(i, a, b) for (int(i) = (int)(a)-1; (i) >= (int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
... | #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<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).beg... |
#include<bits/stdc++.h>
using namespace std;
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
typedef long long int ll;
#define all(x) (x).begin(),(x).end()
#define print(x) if(x)cout<<"YES\n"... | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi 2*acos(0.0)
#define f first
#define s second
#define pb push_back
#define gap ' '
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define N 300005
int main()
{
int n;
cin>>n;
cout<< ceil(n/100... |
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define per(i,a,n) for(int i=a;i>=n;i--)
typ... | #pragma region head
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
template <class T>
using vv = vector<vector<T>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (in... |
#include "bits/stdc++.h"
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
typedef pair<int,int> pii;
#define fi first
#define se second
#define Sort(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++)
#define REP(i,n) for(int i = 0;i < (n) ; 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;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
#define fi first
#define se second
#define sz(c) ((int)(c).size())
#define all(c) (c).begin(), (c).en... | // #pragma GCC optimize("Ofast,unroll-all-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")
// #pragma GCC target("popcnt")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
#define all(v) v.begin()... |
#include <bits/stdc++.h>
#define M 998244353
#define fio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define d(x) cout << #x << " " << x << "\n";
#define min(x1, x2) (x1 > x2 ? x2 : x1)
#define max(x1, x2) (x1 < x2 ? x2 : x1)
#define min3(x1, x2, x3) (x3 > min(x1, x2) ? min(x2... | #include <bits/stdc++.h>
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(w, n) FOR(w, 0, n)
using namespace std;
typedef long long ll;
const int MOD = 998244353;
long long kai[101];
void kaijo()
{
kai[0] = 1;
FOR(i, 1, 100)
{
kai[i] = i * kai[i - 1];
kai[i] %= MOD;
// cout << kai[i] << endl;
}
... |
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define fi first
#define se second
#define pub push_back
#define pi pair<int,int>
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for(int i=(int)(l);i<(int)(r);... | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,m,n) for (int i = (m); i < (n); ++i)
#define rrep(i,n) for (int i = (n)-1; i >= 0; --i)
#define RREP(i,m,n) for (int i = (n)-1; i >= (m); ++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespac... |
#include<iostream>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int h,m;
cin>>m>>h;
cout<<((h%m==0)?("Yes"):("No"))<<"\n";
} | #include <bits/stdc++.h>
using namespace std;
#define inf 1e15
#define mod 1000000007
#define N 100001
#define ll long long int
#define vint vector<int>
#define vll vector<ll>
#define vstr vector<string>
#define vvint vector<vector<int> >
#define ... |
//{{
/*
* Created at: 06/27/21 18:12:05
*
* FB: https://facebook.com/tgbaodeeptry
* From Viet Nam with Love :D
*
*/
#include <bits/stdc++.h>
using namespace std;
#define fast_io() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define REP(i, a, b) for (int i = int(a); i < int(b); ++i... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vp... |
#include <bits/stdc++.h>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define PI acos(-1)
using namespace std;
int main()
{
fast_io;
int n;
cin>>n;
int arr[n];
for(int i=0; i<n; i++)
{
cin>>arr[i];
}
int sum=0;
for(int i=0; i... | #include <bits/stdc++.h>
#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 fori(i,n) for(ll i=0;i<(n);++i)
#define fora(i,a,n) for(ll i=a;i<=(n);++i)
#define forad(i,a,n) for(ll i=a;i>=(n);-... |
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std ;
int a[ 4 ] ;
void input ( ) {
for ( int i = 0 ; i < 4 ; ++ i ) {
scanf ( "%d" , &a[ i ] ) ;
}
}
void solve ( ) {
for ( int mask = 0 ; mask < 16 ; ++ mask ) {
int sm = 0 ;
for ( int i = ... | #include<bits/stdc++.h>
using namespace std;
#define intt long long int
#define intu unsigned long long int
#define vi vector<intt>
#define ii pair<int,int>
#define pb push_back
#define ff first
#define ss second
#define fast_io ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL);
# define PI 3.14159265... |
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#include <random>
#include <cmath>
#include <deque>
#include <unordered_map>
#include... | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "/debug.h"
#else
#define db(...)
#endif
#define all(v) v.begin(), v.end()
#define pb push_back
using ll = long long;
const int NAX = 2e5 + 5, MOD = 1000000007;
void solveCase()
{
int n;
cin >> n;
vector<ll> a(n), b(n);
for (size_t i ... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using ll = long long;
// using P = pair<int, int>;
int main() {
int m,h;
cin >> m >> h;
bool a = false;
for(int i = 1; i <= 1001; i++){
if(m*i == h){
a = true;
}
}
if... | #include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265359
int main(){
int M, H;
cin >> M >> H;
if (H % M == 0) cout << "Yes" << endl;
else cout << "No" << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define boost \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define testcases \
int t; \
cin >> t; \
while (t--)
#define rep(i, n) for (int i = 1; i <= n; i++)
#define Rep(j, n) for (int j = ... | #include<bits/stdc++.h>
int main(){
using namespace std;
unsigned long N;
cin >> N;
for(unsigned long i{1}; i <= N; ++i)cout << 64 - __builtin_clzl(i) << " ";
cout << endl;
return 0;
}
|
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define ll long long
#define int long long
template <typename T>... | /*HAR HAR MAHADEV
ヽ`、ヽ``、ヽ`ヽ`、、ヽ `ヽ 、ヽ`🌙`ヽヽ`ヽ、ヽ`
ヽ`、ヽ``、ヽ 、``、 `、ヽ` 、` ヽ`ヽ、ヽ `、ヽ``、
ヽ、``、`、ヽ``、 、ヽヽ`、`、、ヽヽ、``、 、 ヽ`、
ヽ``、 ヽ`ヽ`、、ヽ `ヽ 、 🚶ヽ````ヽヽヽ`、、ヽ`、、ヽ*/
# include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef ... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll a,b,c;
cin>>a>>b>>c;
if(c==0){
if(a>b){
cout<<"Takahashi";
}else{
cout<<"Aoki";
}
}else{
if(a>=b){
cout<<"Takahashi";
}else{
cout... | #include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define all(a) a.begin(),a.end()
#define mid ((r+l)>>1)
#define lson p<<1,l,mid
#define rson p<<1|1,mi... |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
//reverse(s.begin(),s.end())
ll gcd(ll a,ll b){
ll s=1,c;
while(a&&b){
if((~a&1)&&(~b&1))
a>>=1,b>>=1,s<<=1;
else if(~a&1)a>>=1;
else if(~b&1)b>>=1;
else if(a>b)a=a-b;
else c=b-a,b=a,a=c;
}... | #include <bits/stdc++.h>
using namespace std;
int main(){
int ans{};
string s;
cin>>s;
int o{},x{};
for (unsigned int i{};i<s.length();i++){
if (s.at(i) == 'o'){
o++;
}else if(s.at(i) == '?'){
x++;
}
}
if (o > 4){
ans = 0;
}else if(... |
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const LL P=1e9+7;
const LL X2=2;
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-'0';ch=getchar();}
return x*f;
}
void print(LL x){
if(x>9) print(x/10)... | #include<bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;
int sum(int a, int b) {
return a + b >= MOD ? a + b - MOD : a + b;
}
int sub(int a, int b) {
return a - b < 0 ? a - b + MOD : a - b;
}
int mul(int a, int b) {
return (1LL*a*b)%MOD;
}
int pw(int a, int b) {
if (!b) return 1;
int r = pw(a,... |
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N;
cin >> N;
vector<int> A(N);
for(int i = 0; i < N; ++i){
cin >> A[i];
}
const int MIN_ELEM = *min_element(A.begin(), A.end());
unordered_map<int, int> memo;
... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename A, typename B> ostream& operator <<(ostream& out, const pair<A, B>& a) { out << "(" << a.first << "," << a.second << ")"; return out; }
template <typename T, size_t N> ostream& operator <<(ostream& out, const array<T, N>& a) { bool... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define F0R(i, n) FOR(i, 0, n)
#define ROF(i, a, n) for(int i=(n)-1;i>=(a);--i)
... | #include <bits/stdc++.h>
using namespace std;
int n;
int ans = INT_MAX;
int main()
{
cin >> n;
vector<int> wa(n);
vector<int> wb(n);
for (int i = 0; i < n; i++)
{
int a, b;
cin >> a >> b;
wa.at(i) = a;
wb.at(i) = b;
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
... |
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define ull unsigned long long
#define mst(a,b) memset(a,b,sizeof(a))
#define foR(i,k,j) for(int i=(k);i>=(j);i--)
#defin... | /*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <stdio.h>
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorit... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
int t,n,s,k;
void exgcd(ll a,ll b,ll &x,ll &y){
if(!b){
x=1,y=0;
return;
}
... | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define DIV 1000000007 //10^9+7
#define INF LONG_MAX/3
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<... |
#include "bits/stdc++.h"
#include <random>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(... | // Generated by 2.3.1 https://github.com/kyuridenamida/atcoder-tools
#include <bits/stdc++.h>
// #include "atcoder/all"
#define SUBMIT
using namespace std;
using i64 = long long;
const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;
template <typename T>
bool chmin(T& x, T y){
if(x > y){
x = y;
... |
#include<cstdio>
#define max(a,b) ((a)>(b)? (a):(b))
#define min(a,b) ((a)<(b)? (a):(b))
typedef long long ll;
const ll inf=1e8;
int n,m,res=0,cnt=0,tot=0;
int b[300005];
ll f[300005],g[300005];
int h[300005],to[600005],ver[600005];
inline int read() {
register int x=0,f=1;register char s=getchar();
while(s>'9'||s<'0... | #include <bits/stdc++.h>
#define Fast cin.tie(0), ios::sync_with_stdio(0)
#define All(x) x.begin(), x.end()
#define louisfghbvc int t; cin >> t; for(int tt = 0; tt < t; ++tt)
#define sz(x) (int)(x).size()
#define sort_unique(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()));
using namespace std;
typedef... |
#include <bits/stdc++.h>
using namespace std;
const int mod=998244353,maxn=2e5+10;
int T,n,m,k,x,y;
long long a[maxn],b[maxn],c[maxn];
void solve(long long a[], long long b[], long long d[]) {
memset(c,0,sizeof(c));
for (int i=1;i<=m;++i) {
for (int j=i;j<=m;j+=i) {
c[j] += a[i]*b[j/i];
c[j] %= mod;
}
}
... | #include <iostream>
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <array>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#in... |
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x... | #include<bits/stdc++.h>
#define il inline
#define re register
#define ll long long
using namespace std;
#define MAXN 200005
namespace hyy
{
#define DEBUG 1
#define isdigit(x) (x>='0'&&x<='9')
const int MAXSIZE=1<<20;
inline char gc()
{
#if DEBUG
return getchar();
#endif
static char buf[MA... |
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stri... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct point
{
ll x;
ll y;
};
const ll MxN = 1e3+5;
point arr[MxN];
double dist(point a, point b)
{
return sqrt((b.x - a.x)*(b.x - a.x) + (b.y-a.y)*(b.y-a.y));
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
ll n; cin >... |
#include <bits/stdc++.h>
using namespace std;
#define fast_io cin.tie(0);ios_base::sync_with_stdio(0);
string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "fa... | #include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
typedef long long ll;
cs int N = 505;
int n, m; char mp[N][N];
int c[N << 1];
int main() {
#ifdef FSYo
freopen("1.in", "r", stdin);
#endif
cin >> n >> m;
for(int i = 1; i <= n; i++)
scanf("%s", mp[i] + 1);
memset(c, -1, sizeof... |
#include <bits/stdc++.h>
int64_t sqrt(int64_t x) {
int64_t l = 0, r = 2e9;
while (l < r) {
int64_t m = (l + r) / 2;
if (m * m > x) {
r = m;
}
else {
l = m + 1;
}
}
return l - 1;
}
int64_t ceil(int64_t _x, int64_t _y) {
if (_y < 0) {
... | #include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using ld = long double;
ll in() {
ld x;
cin >> x;
x *= 10000;
return round(x);
}
bool ok(ll dx, ll dy, ll z) { return dx * dx + dy * dy <= z * z; }
ll f(ll x, ll y, ll z, ll lim) {
ll l = 0, r = 1, res = 0;
for (int i = int(1e9) + 50000; i... |
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <random>
#include <chrono>
#include <numeric>
#include <unord... | // 問題の URL を書いておく
//
#include <bits/stdc++.h>
using namespace std;
//#define ENABLE_PRINT
#if defined(ENABLE_PRINT)
#define Print(v) \
do {\
cout << #v << ": " << v << endl; \
}while(0)
#define PrintVec(v) \
do {\
for(int __i = 0; __i < v.size(); ++__i) \
{ \
cout << #v << "[" << __i << "]: "... |
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,... | #include<bits/stdc++.h>
#define re register
inline int read(){
re int t=0;re char v=getchar();
while(v<'0')v=getchar();
while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
return t;
}
int n,m,t,nxt[500002],pos,Nxt;
char a[500002],b[500002];
long long ans;
int main(){
n=read();
scanf("%s%s",a+1,b+1);
for(re int i=n;i;... |
#include <stdint.h>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define FOR_N(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define FOR_R(i, b, e) for (int64_t i = int64_t(b); i < (int64_t)(e); i++)
int main()... | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
int main(){
ll b,c;cin>>b>>c;
ll ans=0;
bool f=true;
if(b<0) f=false;
b=abs(b);
if(b==0){
ans=c;
}else if(c>2*b){
if(f) ans=2*b+c-1;
else ans=2*b+c;
}else if(c>=3){
ans=2*c-1;
... |
#include<bits/stdc++.h>
using namespace std;
#define INF 2047483647
#define INFL 9223372036854775807
#define ll long long
#define pii pair<ll,ll>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define ull unsigned long long
#define M 1000000007
//#define M 998244353
#define FASTIO ios_base::... | #include <bits/stdc++.h>
// #include <atcoder/all>
// #include "icld.cpp"
using namespace std;
using ll = long long int;
using vi = vector<int>;
using si = set<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using ss = string;
using db = double;
template<typename T> using minpq = priority_queue <T,vector... |
#include <bits/stdc++.h>
#define repie( i, a, b ) for( i = a; i <= b; i ++ )
using namespace std;
using ll = long long;
int gcd( int a, int b ) {
int c = max( a, b );
int d = min( a, b );
int e;
while( c % d != 0 ) {
e = c % d;
c = d;
d = e;
}
return d;
}
int main() {... | //*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//*/
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<"... |
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define ll long long
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define vi vector<int>
using namespace std;
const int INF = 1001001001;
const int MOD = 998244353;
template<class T> inline bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0;... | #include <iostream>
#include <algorithm>
#define MOD 998244353
int N, K;
int A[50][50];
int row_ok[50][50];
int col_ok[50][50];
long long num[51];
using namespace std;
long long calc(int line_ok[][50]) {
long long ans = 1;
int group[50];
int groupN[50];
for (int i=0; i<N; i++) group[i] = i;
for (in... |
#include <bits/stdc++.h>
using namespace std;
// clang-format off
/* accelration */
// 高速バイナリ生成
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
// cin cout の結びつけ解除, stdioと同期しない(入出力非同期化)
// cとstdの入出力を混在させるとバグるので注意
struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(fals... | #include<iostream>
using namespace std;
string s,t;
int n,a[200010],b[200010],shi[10]={1,10,100,-1,-10,-100},f[200010][10];
int dfs(int x,int y)
{
int t1,t2;
if(f[x][y]!=0) return f[x][y];
if(b[x]==1)
{
t1=dfs(x+1,y);
t2=dfs(x+1,(y+a[x])%7);
if(t1==1||t2==1)
return f[x][y]=1;
else
return f[x][y]=-1;
... |
#include <bits/stdc++.h>
using namespace std;
int main() {
double sx, sy, gx, gy;
cin >> sx >> sy >> gx >> gy;
double ans;
ans = ((sx * gy) + (gx * sy)) / (sy + gy);
cout <<fixed<<setprecision(6)<< ans <<endl;
} | #include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,d;
cin >> a >> b >> c >> d;
cout << b - c << endl;
return 0;
} |
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
#ifdef _hogwarts
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n;
cin >> n;
int x = (n + 100) / 100;
cout << (100 * x) - n << "\n";
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define REP(i,a,b) for(int i = (a); i < (b); i++)
#define MOD 1000000007
int main(void) {
vector<int> a(3);
rep(i,3) cin >> a[i];
sor... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
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;... | #include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;
us... |
/**
* Author: kumasento
* Date: 2021-05-22T13:24:20.000-05:00
*/
#include <bits/stdc++.h>
using namespace std;
/// Types:
using LL = long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLI = pair<LL, int>;
using PLL = pair<LL, LL>;
/// Constants:
constexpr int INT_INF = 1000000000;
constexpr... | #include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/******... |
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
te... | #include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define lli long long int
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define plli pair<lli,lli>
#define vi vector<int>
#define vlli vector<lli>
#define vpi vector<pii>
#de... |
#include <iostream>
#include <algorithm>
using namespace std;
const int NMAX = 200000;
int main() {
int N; cin >> N;
int A[NMAX];
for (int i = 0; i < N; i++) {
cin >> A[i];
}
long long cumsum[NMAX + 1];
cumsum[0] = 0;
for (int i = 0; i < N; i++) {
cumsum[i + 1] = cumsum[i] + A[i];
}
pair<... | #include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <list>
#include <climits>
#include <bitset>
#include <fstream>
#include <algorithm>
#include <functional>
#include <stack>
#include <string>
#include <cm... |
// Problem:
// D - Orientation
//
//
// Contest: AtCoder - AtCoder Regular Contest 111
// URL: https://atcoder.jp/contests/arc111/tasks/arc111_d
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using n... | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int n, m;
int a[5055], b[5055];
int dir[5055];
int c[155];
bool used[155];
int dfn[155], t;
vector<pair<int, int>> g[155];
void dfs(int v) {
used[v] = true;
dfn[v] = t++;
for (auto p: g[v]) {
if (dir[p.second >> 1] == -1) {
... |
#define MOD 998244353
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
#include <numeric>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,sw{0};
int64_t ans{0};
a... | //#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <functional>
#include <cstring>
#include <string>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <dequ... |
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vii;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define fastio ios_base::sync_with_stdio(false);cin... | #pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>... |
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mkp make_pair
#define pb push_back
#define sz(v) (int)(v).size()
typedef long long LL;
typedef double db;
template<class T>bool ckmax(T&x,T y){return x<y?x=y,1:0;}
template<class T>bool ckmin(T&x,T y){return x>y?x=y,1:0;}
#define re... | #include <bits/stdc++.h>
using namespace std;
#define pii pair<long long, long long>
#define FOR(x, j) for(int x = 0; x < j; x++)
typedef long long ll;
const int INF = 2e9;
const int maxN = 3e5+10;
const int LEAF = (1 << 19);
int TREE[2*LEAF];
int A[maxN];
int n, q;
void add(int x, int v){
x += LEAF;
while(... |
/////keep going!~!one day u will int get there
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ppb pop_back
#define pii pair<ll int,ll int>
#define vi vector<ll int>
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define all(a) ... | #include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
#include <cstdint>
#include <string>
#include <sstream>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return ... |
#include<bits/stdc++.h>
using namespace std;
#define INFTY (1<<29)
#define rep(i,n) for (ll i = 0; i < (n); ++i)
typedef long long int ll;
using ipair = pair<int,int>;
using lpair = pair<ll,ll>;
bool operator< (const ipair a, const ipair b){return a.first < b.first;};
const ll MOD=998244353;
const ll MAX = 5100000;
con... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define SZ(x) ((int)(x).size())
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, leng... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define For(i,a,b,c) for(ll i=a;i<b;i+=c)
#define For2(i,a,b,c) for(ll i=a;i>=b;i-=c)
#define vec_ll vector<vector<ll>>
#define vec_pr vector<pair<ll,ll>>
#define pr pair<ll,ll>
#define pbk push_back
#define mkpr make_pair
#define fst first
#define snd s... | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using ll = long long;
using ld = long double;
#define FOR(i, a, b) for(ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, n) FOR(i, 0, n)
#define rFOR(i, a, b) for(ll i = (ll)(a - 1); i >= (ll)(b); i--)
#define rrep(i, a) rFOR(i, a, 0)
#define pb push_back
using namespace s... |
/* ====Bismillahir Rahmanir Rahim=====
===ImRan Hossen===
==Bangladesh University Of Business And Technology==
*/
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#i... | #include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << '=' << x << endl
#define rep(i, b, e) for (int i = b; i <= e; i++)
char ss1[512345], ss2[512345];
char s1[512345], s2[512345];
int work(char *s1, char *s2, int n) {
vector<int> a(1), b(1);
int ans = 0;
rep (i, 1, n) {
if... |
#include <iostream>
#include <vector>
using namespace std;
string cout_vector_separator = " ";
template<typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
bool is_first = true;
for (const auto& i : v) {
if (is_first) is_first = false;
else s << cout_vector_separator;
s <... | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+5;
int a[maxn],n,k;
int main() {
scanf("%d%d",&n,&k);
for(register int i=1; i<=n; i++) {
scanf("%d",&a[i]);
if(a[i]==k)i--,n--;
}
for(register int i=1; i<=n; i++)printf("%d ",a[i]);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, l, r) for (int i = l; i <= r; ++i)
const int N = 1e5 + 5;
int n, Q, a[N], q[N], id[N], ans[N];
bool cmp (int a, int b) {
return q[a] < q[b];
}
signed main () {
cin >> n >> Q;
rep(i, 1, n) cin >> a[i];
a[++n] = 3e18;
rep(i, 1, Q) cin... | #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;
typedef long long ll;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<long long>> vvll;
typedef std::vector<bool> vb;
typedef std::vector<std::vector<bool>> vvb;
#define INF 1999999999
#define MODA 1000000007
#define rep(i,n) for (long long i = 0; i < (... | #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... |
// clang-format off
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcountl... | #include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long int;
using ll = long long int;
using du = double;
using ld = long du;
using vi = vector<int>;
using vll = vector<ll>;
using vld = vector<ld>;
using vdu = vector<du>;
using vs = vector<string>;
using vc = vector<char>;
#define FASTIO ios_base... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
vector<int> A(100001),B(100001),C(100001);
vector<int> count(100001);
for(int i=0;i<N;i++){
cin>>A.at(i);
}
for(int i=0;i<N;i++){
cin>>B.at(i);
}
for(int i=0;i<N;i++){
cin>>C.at(i);
}
for(int j=0;j<N;... | #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;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define reset(x) memset(x... |
#include <bits/stdc++.h>
using namespace std;
bool solve(string s){
if(s.size() == 1) return s == "8";
if(s.size() == 2){
if(stoi(s) % 8 == 0) return 1;
swap(s[0], s[1]);
return stoi(s) % 8 == 0;
}
vector<int> cnt(10);
for(char x : s) cnt[x - '0']++;
for(int i = 104; i ... | #include <bits/stdc++.h>
using namespace std;
#define all(c) c.begin(), c.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep2(i, a, b) for (int i = a; i <= b; ++i)
#define rep3(i, a, b) for (int i = a; i >= b; --i)
#define endl '\n'
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define u... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
__int128_t X;
ll x, y, a, b;
cin >> x >> y >> a >> b;
ll v = 0;
while (true) {
if (x < y) {
X = (__int128) x * (__int128) a;
if (X > b || X >= y - 1) break;
v++;
... | #include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ll = long long;
using vl = vector<long long>;
using vi = vector<int>;
int main(){
double x,y,z; cin >> x >> y >> z;
double ans;
if(x == z) ans = y-1;
else{
ans = floor(((double)y/(double)x*(double)z));
if(y/x ==... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repp(i, st, en) for (ll i = (ll)st; i < (ll)(en); i++)
#define repm(i, st, en) for (ll i = (ll)st; i >= (ll)(en); i--)
#define all(v) v.begin(), v.end()
void c... | #include <bits/stdc++.h>
using namespace std;
#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)... |
/*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set... | #include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const ... |
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
using namespace std;
using pairint = pair<int, int>;
template <typename T>
struct SegmentTree{
SegmentTree(unsigned int n, function<T(T, T)> AssociativeFunction, T ZeroElement=0){
length = 1;
fn = Asso... | #include <bits/stdc++.h>
using namespace std;
int main(){
int N,D,H;
cin >>N>>D>>H;
vector<int>d(N),h(N);
for(int i=0; i<N; i++) cin >> d[i]>>h[i];
cout << fixed << setprecision(10);
double maxi=0;
for(int i=0; i<N; i++){
double a=d[i]-D;
double b=H*d[i]-D*h[i];
double n = b/a;
maxi=max(max... |
#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>
using namespace std;
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
typedef long long int ll;
#define all(x) (x).begin(),(x).end()
#define print(x) if(x)cout<<"YES\n"... |
// Containers
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
#define ll long long
#define pb push_back
#define mp ma... | //NAME-DEEPESH BHATT
//Institute-IIT Dhanbad
//MOTTO-THINK FIRST,CODE LATER
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 998244353 ;
/*#define endl '\n'*/
//Check for signed int overflow
// use __builtin_popcountll(num) to calculate no.of setbits in num
//__builtin_clz() -> leadin... |
#ifdef xay5421
#define D(...) fprintf(stderr,__VA_ARGS__)
#else
#define D(...) ((void)0)
#define NDEBUG
#endif
#include<bits/stdc++.h>
#define int long long
#define LL long long
#define MP make_pair
#define PB push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size... | #include <bits/stdc++.h>
using namespace std;
const int N=205;
int vis[N];//-2表示前面有人,-1表示后面有人.
bool f[N];
int main()
{
int n;
scanf("%d",&n);
bool flag=1;
for(int i=1;i<=n;i++)
{
int a,b;
scanf("%d%d",&a,&b);
if (a>0&&vis[a]) flag=0;
if (b>0&&vis[b]) flag=0;
i... |
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (INT_MAX >> 1);
const ll LLINF = (LLONG_MAX >> 1);
#define all(x) x.begin(), x.end()
#define rep(i, s, e) for(ll i = s; i < e; ++i)
#define repr(i, s, e) for(ll i = s; i > e; --i)
temp... | #include<bits/stdc++.h>
using namespace std;
/**templates**/
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld",&x)
#define sull(x) scanf("%llu",&x)
#define sf(x) scanf("%lf",&x)
#def... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);
template <typename T>
bool chmax(T &a, const T &b)
{
if (a < b)
{
a = b;
return true;
}
return false;
}
template <typename T>
bool chmin(T &a... | #include <bits/stdc++.h>
#define MAXN 500005
#define ll long long
#define F first
#define S second
#define MOD 1000000007
#define ll long long
using namespace std;
int n, q;
ll a[MAXN], b[MAXN];
void solve()
{
cin >> n >> q;
for(int i = 1; i <= n; ++i) cin >> a[i], b[i] = a[i] - i;
for(int i = 1; i <= q;... |
#include <bits/stdc++.h>
#define int long long
#define PI pair<int,int>
using namespace std;
const int maxm=2e5+5;
const int mod=1e9+7;
int d[maxm][17][2];
char s[maxm];
int n,k;
int dfs(int len,int st,bool limit,bool pre){
int cnt=__builtin_popcount(st);
if(!len)return cnt==k;
if(d[len][cnt][limit]!=-1)ret... | #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 <iostream>
#include <string>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
#include <cmath>
#include <map>
using ll=long long;
using namespace std;
int main(){
int N;
cin>>N;
N*=2;
vector<ll> A(N);
for(int i=0;i<N;i++){
cin>>A[i];
}
vector<ll>... | #include <bits/stdc++.h>
#define ln '\n'
#define all(dat) dat.begin(), dat.end()
#define loop(i, to) for (int i = 0; i < to; ++i)
#define cont(i, to) for (int i = 1; i <= to; ++i)
#define circ(i, fm, to) for (int i = fm; i <= to; ++i)
#define foreach(i, dat) for (__typeof(... |
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vvvi = vector<vvi>; // intの2次元の型に vvi という別名をつける
const ll llMAX=922337203685477... | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
struct UnionFind {
vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
... |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sys/types.h>
#include <unistd.h>
#include <vector>
#pragma region macros
#define _overload(_1, ... | //#include <atcoder/maxflow.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
#include <map>
#include <list>
#include <set>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#inclu... |
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <list>
#include <unordered_set>
#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug... | #include <bits/stdc++.h>
using namespace std;
typedef long long int64;
int main()
{
int64 n;
set<int64> S;
cin >> n;
int64 j=0;
for(int64 i=2;i<=100000;i++)
{
//printf("%lld\n",i);
j = i;
while(j<=10000000000)
{
j*=i;
//printf("%lld\n",j)... |
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec) (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_IN... | #include<iostream>
#include<stack>
using namespace std;
const int maxsize = 1e5 + 5;
long long l3[maxsize];
long long l5[maxsize];
int main() {
long long n;
long long x = 1;
long long i = 0,j = 0;
cin >> n;
while (x < n) {
x *= 3;
l3[++i] = x;
}
x = 1;
while (x < n) {
x *= 5;
l5[++j] = x;
}
for (int m... |
#include "bits/stdc++.h"
using namespace std;
using namespace std::chrono;
using ll = long long;
using str = string;
using db = double;
#define tcT template <class T
#define tcTU tcT, class U
tcT> using V = vector<T>;
tcT> using VV = V<V<T>>;
tcTU> using PR = pair<T, U>;
tcT> using PQ = priority_queue<T>;
#define ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
int exchange(int i,map<int,int> &dic){
if(dic.find(i) == dic.end()) return i;
else {
dic[i] = exchange(dic[i],dic);
return dic[i];
}
}
template <typename T,typename S> void print_map(map<T,S> &a){
for(aut... |
#include<bits/stdc++.h>
using namespace std;
int a[65540];
int main(){
int n,i;
cin>>n;
int maxn=-100,maxn1=-100,temp,temp1;
for(i=1;i<=pow(2,n);i++){
cin>>a[i];
if(i<=pow(2,n)/2){
if(a[i]>maxn){
temp=i;
maxn=a[i];
}
}
else{
if(a[i]>maxn1){
temp1=i;
maxn1=a[i];
}
}
}
if(maxn>... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n;
cin>>n;
vector<pair<ll,ll>> v, v1;
ll po=1;
for(ll i=1; i<n; i++){
po*=2;
}
for(ll i=1; i<=po; i++){
int a;
cin>>a;
v.push_back({a,i});
}
... |
#include <bits/stdc++.h>
using namespace std;
/*
#include <atcoder/all>
using namespace atcoder;
*/
#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).... | #include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
const int N=200005;
int n,l,a[N],b[N],goal[N],p[N];
ll ans;
vector<int> vec;
map<int,vector<int>> mp;
void mandown(){
puts("-1");
exit(0);
}
ll solve(int l,int r){
if(l+1==... |
#include <bits/stdc++.h>
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define reprrev(i, a, b) for (int i = b - 1; i >= a; i--) // [a, b)
#define reprev(i, n) reprrev(i, 0, n)
using ll = long long;
using ull = unsigned long long;
template <class T>
inline bool chmax(T... | #include "bits/stdc++.h"
using namespace std;
#define dbg(x) cout << #x << " is " << x << endl
#define all(x) x.begin(), x.end()
#define pb push_back
#define sz(x) (int)(x.size())
#define ll long long
#define fi first
#define se second
const int MOD = 1e9 + 7;
const... |
#include<bits/stdc++.h>
using namespace std;
#define N 200005
#define pb push_back
#define ll long long
#define mod 1000000007
ll jc[N],ans,ny[N],er[N];
ll ksm(ll x,ll y){
ll ret=1;for(;y;y>>=1,x=x*x%mod)if(y&1)ret=ret*x%mod;return ret;
}
ll C(int n,int m){
return jc[n]*ny[m]%mod*ny[n-m]%mod;
}
int n,i;... | #include <bits/stdc++.h>
using namespace std;
typedef long long i64;
const int MAX_N = 200000 + 5;
const int A = 1e8;
int n[2], N, Q;
int a[2][MAX_N];
i64 ans;
int Root[2], total_node;
struct SegmentNode {
i64 cnt, sum;
int ls, rs;
} node[MAX_N * 50];
inline void segment_update(int i) {
node[i].cnt = ... |
#include <bits/stdc++.h>
#include <variant>
#define rep2(i,k,n) for(i64 i=(i64)(k);i<(i64)(n);i++)
#define rep(i,n) rep2(i,0,n)
#define all(x) begin(x),end(x)
#ifdef ENV_LOCAL
#define dump if (1) cerr
#else
#define dump if (0) cerr
#endif
using namespace std;
using namespace std::string_literals;
using i32 = int32_t... | #include <bits/stdc++.h>
using namespace std;
#define POW2(X) (1<<(X))
#define CKBIT(S,X) (((S)&POW2(X))!=0)
const double pi=acos(-1.0);
const double eps=1e-11;
template<class T> inline void ckmin(T &a,T b){ a=min(a,b); }
template<class T> inline void ckmax(T &a,T b){ a=max(a,b); }
template<class T> inline T sqr(T x)... |
#include<bits/stdc++.h>
using namespace std;
#define int long long //delete if causing problems
#define F first
#define dbg(x) cout<<#x<<" "<<x<<endl;
#define S second
#define setbit(n) __builtin_popcount(n)
#define all(x) x.begin() , x.end()
#define clr(x) memset(x,0,sizeof(x))
#define fast ios_base::sync_with_stdio... | #include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <ctype.h>
#include <stdlib.h>
#include <map>
using namespace std;
int main() {
int N, A, B;
cin >> N >> A >> B;
cout << N - A + B << endl;
} |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define vi vector <int>
#define vp vector <pair<int,int>>
#define f(x,y,z) for(x=y;x<z;x++)
#define pb push_back
#define mp make_pair
#define ld long double
#define fb(x,y,z) f... | #include<bits/stdc++.h>
using namespace std;
//#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vect... |
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
const long long INFLL = 1e18;
using ll = long long;
int main(){
int h, w;
cin >> h >> w;
vector<string> f(h);
for(int i = 0; i < h; i++) cin >> f[i];
int ans = 0;
for(int i = 1; i < h; i++){
for(int j = 1; ... | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constex... |
#include <bits/stdc++.h>
using namespace std;
#define clr(a) memset(a, 0, sizeof(a))
#define full(a) memset(a, 0x3f, sizeof(a))
#define fornext(x, i) for(int i = head[x], y = ver[i]; i; i = nxt[i], y = ver[i])
#define mset(a, b) memset(a, b, sizeof(a))
#define Rep(i, a, b) for(int i = (a); i <= (b); ++i)
#define dRep(i... | #include <bits/stdc++.h>
using namespace std;
// @title mod int
#include <iostream>
using ll = long long;
#ifdef MUTABLE
int mod;
#else
template<int mod>
#endif
struct ModInt {
int val;
ModInt inv() const{
int tmp,a=val,b=mod,x=1,y=0;
while(b)tmp=a/b,a-=tmp*b,std::swap(a,b),x-=tmp*y,std::swap(x,y);
ret... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v... | #include<iostream>
#include<utility>
#include <queue>
#include<vector>
#include <functional>
double h[30][29],v[29][30];
typedef std::pair<int, std::pair<int,int>> P;
char prev[30][30] = {0};
int d[30][30] = {0};
const int INF = 9000*30*30;
void dijkstra(int ti,int tj) {
const int dir[4][2] = {{-1,0},{1,0},{0,-1... |
#include<bits/stdc++.h>
using namespace std;
int H,W;
int A[101][101];
int func(int i,int j)
{
int ans = 0;
if((j > 0)&&(A[i][j-1] == 1))
{
ans++;
}
if((i > 0)&&(A[i-1][j] == 1))
{
ans++;
}
if((j < W-1)&&(A[i][j+1] == 1))
{
ans++;
}
if((i < H-1)&&(A[i+1][j] == 1))
{
... | // includes
#include <bits/stdc++.h>
using namespace std;
// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.