code_file1 stringlengths 87 4k | code_file2 stringlengths 82 4k |
|---|---|
#include <bits/stdc++.h>
using namespace std;
///* input vector */
//template <typename T>
//istream& operator >>(istream& in, vector<T>& v) {
// for (size_t i=0; i<v.size(); ++i) {
// in >> v[i];
// }
// return in;
//}
///* output vector */
//template <typename T>
//ostream& operator <<(ostream& out, ... | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a,c,u;
cin>>a>>c;
for(int i=1;i<=a;i++)
{
cin>>u;
if(u!=c)
{
cout<<u<<" ";
}
}
return 0;
} |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(n);i++)
void chmax(ll& a, ll b) {if (b>a) a=b;}
int main() {
int N;
cin >> N;
vector<int> a(N), b(N);
rep(i,N) cin >> a[i];
rep(i,N) cin >> b[i];
ll ans = 0, maxa = 0;
rep(i,N) {
chmax(maxa, a[i]);
... | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
int main() {
long long N;
cin >> N;
vector<long long> A(N);
map<long long,long long> mpA;
rep(i,N) {
cin >> A[i];
mpA[A[i]]++;
}
vector<pair<long long,long long>> B(N);
rep(i,N) {
B[i].first ... |
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <unordered_map>
#include <vector>
using namespace std;
#define MP make_pair
#define PB push_back
#define REP(i, L, R) for (int i = L; i < (R); ++i)
#define SZ(x) (int)x.size()
using ll = long long;
using ld = long double;
using pi = ... | #include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i=0; i<(n); i++)
#define ALL(n) n.begin(), n.end()
int main(){
ll a, b, k;
cin >> a >> b >> k;
// パスカルの三角形
vector<vector<ll>> p(60, vector<ll>(60));
p[0][0] = 1;
for(int i=1; i<60; i++)for(int j=0; j<60;... |
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#include <limits>
#include <stack>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
using namespace s... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1L... |
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair <int, int>;
using pll = pair <ll, ll>;
#define FIO() ios_base::sync_with_stdio(0);cin.tie(NULL);
const ll inf = 9e18;
int main() {
FIO();
string atc = "atcoder";
int tc; cin >> tc;
while (tc--) {
string s... | #include <iostream>
#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 <climits>
#include <ctime>
... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define fore(i, a) for (auto &i : a)
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
const ll INF = 1LL << 60;
const ll mod = 1E9 + 7;
ll gcd(ll a, ll b) {
if (a < b) {
ll temp = a;
a = b;
... | #include<bits/stdc++.h>
#define ll long long int
#define pi acos(-1)
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll mod=1000000007;
bool sortBysec(pair<ll,ll>a,pair<ll,ll>b)
{
return a.second>b.second;
}
bool prime[2000010];
vector<ll>vv;
void SieveOfEratosthe... |
#include <iostream>
#include <vector>
//#include <string>
#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>
// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>
typedef long long LL;
/... | #include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
#define ll long long
#define lowbit(i) ((i) & -(i))
ll exgcd(ll a, ll b, ll &x, ll &y)
{
if (!b)
{
x = 1, y = 0;
return a;
}
ll gd = exgcd(b, a % b, y, x);
y -= a / b * x;
return gd;
}
void solve()
{
... |
#include <chrono>
#include <thread>
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define T top()
#define E end()
#define PS push
#define Q queue
#define PP pop()
#define L0 (LL)0
#define V vector
#define ST stack
#... | /*************************************************************************
> File Name: 1.cpp
> Author: Knowledge_llz
> Mail: 925538513@qq.com
> Blog: https://blog.csdn.net/Pig_cfbsl
> Created Time: 2020/10/11 22:45:26
************************************************************************/
#include<bits/stdc+... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;
int main() {
int N; ci... | #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<unordered_map>
using namespace std;
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
const double pi = acos(-1);
const int N = 2e5 + 100;
const int mod = 1e9 + 7;
typedef long long ll;
template<typena... |
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <list>
#include <cstring>
#include <map>
#include <set>
#define ll long long
#define mod 1000000007
#define pi 3.141592653589
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using ... | #include <stdio.h>
#include <map>
int x[100010],y[100010];
int type[100010];
std::map<int,int> check;
int main()
{
int a,b;
scanf("%d%d",&a,&b);
for(int i=1;i<=a;i++) scanf("%d",&x[i]);
for(int i=1;i<=a;i++) scanf("%d",&y[i]);
x[0] = 0, y[0] = 0;
x[a+1] = b+1, y[a+1] = b+1;
for(int i=1;i<=a;i++)
{
if(x[i]>y... |
//fake_name
#include<bits/stdc++.h>
#define int long long
using namespace std ;
#define F first
#define S second
int MOD = 998244353 ;
int mod = 1e9 + 7 ;
string s[2005] ;
int vis[2005][2005] ;
int n , m ;
int check( int i , int j )
{
if( i >= n || j >= m || i < 0 || j < 0 )
return 0 ;
if( vis[i][j] ||... | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int64_t i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int64_t i=(a),_b=(b);i>=_b;--i)
using ull = uint64_t;
using... |
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // ... | #include <bits/stdc++.h>
using namespace std;
int main(){
char a,b,c;
cin >> a >> b >>c;
if (a == b && b == c){
cout << "Won";
}else {
cout<< "Lost";
}
return 0;
}
|
#include<bits/stdc++.h>
//#include <atcoder/all>
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define fi first
#define se second
#define sz(x) ((int)x.size())
using namespace std;
//using namespace atc... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; (i) < (int)(n); ++(i))
#define rep3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i))
using namespace std;
int64_t solve(int N, const vector<int64_t> &A)
{
vector<vector<int64_t>> DP(N, vector<int64_t>(N, INT64_MAX));
rep(l, N){
rep3(r, l, N){
... |
#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<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#in... | #include <bits/stdc++.h>
using namespace std;
//gcd
int gcd (int a, int b) {
return b ? gcd (b, a % b) : a;
}
//lcm
int lcm (int a, int b) {
return a / gcd(a, b) * b;
}
//faster gcd
int fgcd(int a, int b) {
if (!a || !b)
return a | b;
unsigned shift = __builtin_ctz(a | b);
a >>= __builti... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(){
ll n,k;
cin >> n >> k;
string s;
cin >> s;
for(ll i=0;i<k;i++){
string t=s+s;
for(ll j=0;j<n;j++){
if(t[j*2]=='R'&&t[j*2+1]=='R') s[j]='R';
else if(t[j*... | #include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define LLMAX 9223372036854775807
#define ALL(x) x.begin(),x.end()
using ll = int64_... |
#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;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define F first
#define S second
#define all(x) begin(x), end(x)
#define allr(x) rbegin(x), rend(x)
using ll = long long;
using ull = unsigned long long;
using ld = long double;
constexpr ll INF = 2e18;
const... |
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
int h, w, x, y;
cin >> h >> w >> x >> y;
string s[101];
for (int i = 1; i <= h; i++)
cin >> s[i];
int sum = 0;
for (int i = y - 1; i >= 0; i--) {
if (s[x][i] == '.')
sum++;
else break;
}
for (int i = y; i < w; i++... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P =pair<int,int>;
int main (){
int H,W,X,Y,count=0;
cin >>H>>W>>X>>Y;
vector<vector<char>> det(H,vector<char>(W));
rep(i,H){
rep(j,W){
cin >>det.at(i).at(j);
}
}
i... |
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(),(v).end()
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi=vector<vi>;
constexpr int inf=1e9+7;
constexpr ll longinf=1LL<<60... | #include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define bit(n,k) ((n>>k)&1) //nのk bit目
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmax(T& ... |
#ifdef _DEBUG
#include "../../../library/src/debug_template.hpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else
#define DMP(...) ((void)0)
#endif
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#inclu... | #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<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
signed main(){
int n,k,m;cin>>n>>k>>m;
vector<int> a(n,0);
rep(i,n-1)cin>>a[i];
int sum=0;
rep(i,n-... | #include <iostream>
using namespace std;
int main()
{
int n,k,m,x,y=0,z;
cin>>n>>k>>m;
int a[100];
x=m*n;
for(int i=0; i<n-1; i++)
{
cin>>a[i];
y=y+a[i];
}
z=x-y;
if(k>=z && z>0)
{
cout<<z<<endl;
}else if(k<z){
cout<<"-1"<<endl;
}else{
cout<<"0"<<endl;
}
} |
#include<bits/stdc++.h>
using namespace std;
int main(){
long long n,x;
cin>>n>>x;
string s;
cin>>s;
int m= s.length();
for(int i=0; i<m;++i){
if(x==0 && s[i]== 'x'){
x+=0;
}
else if (s[i]== 'x'){
x--;
}
else{
x++;
}
}
cout<<x;
}
| #include<cstdio>
inline int in();
inline void wr(int);
inline int mx(int,int);
int main(int argc,char**argv){
register int n=in(),x=in();
while(n--){
register char c=getchar();
while(c!='o'&&c!='x')c=getchar();
if(c=='x')x=mx(0,x-1);
else ++x;
}
wr(x),putchar('\n');
}
inline int mx(int x,int y){
return x>y... |
#include <bits/stdc++.h>
#define ls rt << 1
#define rs rt << 1|1
#define lson ls,l,m
#define rson rs,m+1,r
#define st first
#define ed second
#define Point pair<int,int>
typedef long long ll;
using namespace std;
const int N = 1e6+5;
const int PI = 314;
int main(){
ll n,k;
scanf("%lld%lld",&n,&k);
n += 100;
ll l... | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pii pair <int, int>
#define pb push_back
#define F first
#define S second
#define ll long long
#define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define M_PI 3.14159265358979323846
const int N = 100005;
const int mod = 1e9 + 7;
in... |
#include <cstdio>
int main()
{
int n, k, f1, r1;
scanf("%d%d", &n, &k);
r1=(1+k)*k*n/2;
f1=(1+n)*n*k/2;
printf("%d\n", f1*100+r1);
return 0;
} | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#incl... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;
template<class T>inline bool chmax(T &a, const T &b) { if (b > a) { a = b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b < ... | #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
int main() {
int n,k; string s;
cin >> n >> k >> ... |
#include <bits/stdc++.h>
#define loop(s, e, i) for (int i = s; i < e; ++i)
#define print(s) cout << s << endl;
#define DIV 1000000007
#define ll long long
using namespace std;
const int INF = 1e9+7;
/*
浮動小数点の入力
cout << fixed << setprecision(9) << endl;
*/
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(f... | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long int a,b;
cin>>a>>b;
cout<<((2*a)+100)-b<<endl;
return 0;
}
|
#include<iostream>
#include<string>
using namespace std;
int main(){
int n,k;
string s;
char win[222][222];
win['R']['S']=win['S']['R']=win['R']['R']='R';
win['S']['P']=win['P']['S']=win['S']['S']='S';
win['P']['R']=win['R']['P']=win['P']['P']='P';
cin>>n>>k>>s;
while(k--){
const auto t=s+s;
... | #include<bits/stdc++.h>
#define ll long long
#define re register
#define INF 2147483647
using namespace std;
inline int read()
{
int f=1,x=0;char s=getchar();
while(s<'0'||s>'9')
{
if(s=='-') f=-1;
s=getchar();
}
while(s>='0'&&s<='9')
{
x=x*10+s-48;
s=getchar();
}
return f*x;
}
inline char cmp(char a,... |
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#pragma region DEBUG
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef
tree<
pair<int,int>,
null_type,
less<pair<int,int>>,
rb_tree_tag,
tree_order_statistics_node_update>
o... | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int a, B, c;
inline int fpow(int x, int b, int m) {
int res = 1;
while (b) {
if (b & 1) res = 1ll * res * x % m;
x = 1ll * x * x % m;
b >>= 1;
}
return res;
}
int main() {
cin >> a >> B >> c;
cout << f... |
//#pragma GCC optimize ("O2")
//#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#include<cstdio>
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)... | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>
#include <bitset>
// #include <atcoder/all>
#include <fstream>
#include <random>
//#inclu... |
#include<bits/stdc++.h>
using namespace std;
int a[200005];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n,i,j;
cin >> n;
for(i=1;i<=n;i++)
cin >> a[i];
int last = 1;
vector<int>ans;
for(i=2;i<=n;i++)
{
if(a[i] < i)
{
if(a[i] <... | #include <bits/stdc++.h>
int ri() {
int n;
scanf("%d", &n);
return n;
}
int main() {
int n = ri();
int a[n];
for (auto &i : a) i = ri() - 1;
int plus[n];
int minus[n];
memset(plus, 0, sizeof(plus));
memset(minus, 0, sizeof(minus));
for (int i = 0; i < n; i++) {
if (a[i] < i) {
plus[a[i]]++;
plus[... |
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for... | #include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pll pair<ll, ll>
#define pb push_back
#define pii pair<ll ,pll>
#define task "parentheses"
using namespace std;
const int N = 105;
const ll mod = 1e18+7;
const int base = 350;
ll n, t, m, k, tong, a[N], dp[N][N], ans;
vector<ll> kq... |
#include <bits/stdc++.h>
#define pii pair<int, int>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int h, w;
cin >> h >> w;
bool g[h][w];
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
char temp;
cin ... | #include <bits/stdc++.h>
using namespace std;
int h,w;
int dp[2001][2001];
int c[2001][2001];
int main(){
char cha;
cin>>h>>w;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin>>cha;
if(cha=='+') c[i][j]=1;
else c[i][j]=-1;
}
}
for(int j=h-1;j>=0;j--){
for(int k=w-1;k>=0;k--){
if(j>=h||k>=w) c... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(a) a.begin(), a.end()
#define All(a) a.rbegin(), a.rend()
typedef vector<int> VI;
typedef long long int ll;
int main() {
int x;
ci... | #include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'... |
#include <bits/stdc++.h>
#define rep(begin, end) for (i=begin;i<end;i++)
#define repj(begin, end) for (j=begin;j<end;j++)
#define init(arr, end, val) for (i=0;i<end;i++) arr[i] = val;
#define printint(i0, i1) printf("%d %d\n", i0, i1)
using namespace std;
typedef long long int ll;
const int inf = 1000000000;
const int... | #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<class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> ostream& operator<<(ostream &... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> inline v2<T> fill(int r, int c, const T& t){ return v2<T>(r, vector<T>(c, t)); }
const int MOD = 1e9+7;
void solve(){
int h, w;
cin >> h >> w;
v2<char> grid = fill(h... | #include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265359
int main() {
int N;
int64_t W;
cin >> N >> W;
vector<vector<int>> T(N, vector<int>(N));
vector<int> v;
for (int i = 0; i < N; i++){
v.push_back(i);
for (int j = 0; j < N; j++){
cin >> T[i][j];
}
}
v.erase(remove(v... |
/*
/^--^\
\____/
/ \ _____ _ __ __ ____ _ ____ ____ _____
| || ()_)| |\ \/ /| ===|| |__ / (__` / () \|_ _|
\__ __/ |_| |_|/_/\_\|____... | #include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define pf push_front
#define sz(x) (int)(x).size()
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x)... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0,endrep=(n); i<endrep; ++i)
#define rep1(i,n) for(ll i=1,endrep=(n); i<=endrep; ++i)
#define revrep(i,n) for(ll i=(n)-1; i>=0; --i)
inline constexpr ll Inf = (1ULL << 60) -123456789;
#define fastio cin.tie(0); ios_base::sync_... | #include<bits/stdc++.h>
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define puts(x) cout << (x) << "\n"
using namespace std;
int si, sj, t[60][60], p[60][60], M;
bool b1[50 * 51];
int score(string s) {
int xs = si, ys = sj, r = p[xs][ys];
for (char c : s) {
if (c ... |
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp> // #include<ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp> //#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds; //using namespace __gnu_pbds;
#define pb push_back
#define ins insert
#define var auto
#define F first
#defin... | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x) cerr << "Line " << __LINE__ << ": " << #x << " = " << (x) << "\n";
#define spa << " " <<
#define fi first
#define se second
#define ALL(a) (a).begin(),(a).end()
#define ALLR(a) (a).rbegin(),(a).rend()
using ld =... |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
char s[MAXN];
struct Deque {
bool rev;
char buffer[MAXN << 1];
int head = MAXN, tail = MAXN - 1;
bool empty() {
return tail < head;
}
int size() {
return tail - head + 1;
}
char front() {
return rev ? buffer[tail] : bu... | #include <bits/stdc++.h>
using namespace std;
int main(){
string S; cin >> S;
list<char> T;
bool f=false;
for(int i=0; i<S.size(); i++){
if(S[i]=='R'){
f=!f;
}else if(f==true){
if(T.front()==S[i]) T.pop_front();
else T.push_front(S[i]);
}else{
if(T.back()==S[i]) T.pop_back()... |
#include <math.h>
#include <stdio.h>
#include <time.h>
#include <algorithm>
//#include <atcoder/all>
#include <cassert>
#include <complex>
#include <cstdint>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <qu... | #include <bits/stdc++.h>
using namespace std;
int n, TTT;
const int mod = 1e9 + 7;
long long ksm(long long a, int n)
{
if (n == 1)
return a;
if (n == 0)
return 1;
long long ans = ksm(a, n >> 1);
ans = ans * ans % mod;
if (n & 1)
ans = ans * a % mod;
return ans;
}
struct m... |
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define f(x, m) for(auto x : m)
#define cpu() ios::sync_with_stdio(false); cin.tie(nullptr)
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#d... | #include<bits/stdc++.h>
#define pb push_back
#define mod 1000000007
#define endl '\n'
using namespace std;
#define ll long long int
ll ceil_div(ll a, ll b) {
return (a + b - 1) / b;
}
ll maxi(ll a,ll b){
return (a>b)?a:b;
}
ll mini(ll a,ll b){
return (a<b)?a:b;
}
long double nthRoot(ll A, ll N)
{
long d... |
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for... | #include <iostream>
#include <stack>
#include <string>
#include <vector>
#pragma warning(disable:4996)
using namespace std;
#define int long long
stack<int>way;
int N,M,K;
double ex[200100];
double ep[200100];
double epex[200100];
vector<pair<int, int>>x;
signed main()
{
ios_base::sync_with_stdio(false);
cin >> N>>M ... |
#include <bits/stdc++.h>
using namespace std;
#define IO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define whilet int T;cin>>T;while(T--)
#define clr(a,x) memset(a,x,sizeof(a));
#define ll long long
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#d... | #include<iostream>
#include<vector>
using namespace std;
typedef long long li;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts))... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //int:2*10**9
typedef long double ld;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007 //998244353... | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define For(i,a,b) for(register int i=a;i<=b;++i)
#define Down(i,a,b) for(register int i=a;i>=b;i--)
#define reg register
namespace yspm{
inline int read(){
int res=0,f=1; char k;
while(!isdigit(k=getchar())) if(k=='-') f=-1;
while(isdigit(k)) re... |
#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
int main(void) {
ll N;
cin >> N;
ll num = 2 << (N-1);
vector<pair<int, int>> A(num);
rep(i, num) {
... | #include<bits/stdc++.h>
#define ll long long
#define inf 1e18
#define mod 1000000007
using namespace std;
int main()
{
ll n;
cin>>n;
vector<ll> a;
n=pow(2,n);
a.resize(n);
unordered_map<ll,ll> ump;
for(ll p=0;p<n;p++)
{
cin>>a[p];
... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<ll> vll;
#define all(v) v.begin(), v.end()
#define rep(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define lep(i,s,n) for(ll i=(ll)(s);i<(ll)(n);i++)
#define vep(v) for(auto&& x : v)
#def... | #include <iostream>
#include <vector>
using namespace std;
int main() {
string s;
cin >> s;
vector<int>a(10,0);
int sum=0;
for(int i=0; i<s.size(); i++){
sum += s[i]-'0';
a[s[i]-'0']++;
}
if(sum%3==0){
cout << 0 << endl;
return 0;
}else if(sum%3==1){
... |
#include<bits/stdc++.h>
using i28 = __int128_t;
using namespace std;
// using i28 = long long;
using pint = pair<i28,i28>;
const i28 G = 10000;
const i28 lim = 2e9;
// #include"debug.hpp"
ostream &operator<<(ostream &dest, __int128_t value) {
ostream::sentry s(dest);
if (s) {
__uint128_t tmp = value < 0 ? -val... | #include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <set>
#include <sta... |
#include <bits/stdc++.h>
using namespace std;
typedef int int2;
#define int long long
#define pi pair<int, int>
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define f first
#define s second
const int inf = 1e18;
int t;
const int maxn = 2e5 + 5;
int a[maxn], suf[maxn];
int2 main() {
ios::syn... | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
int n;
cin>>n;
ll ans=0;
while(n--)
{
ll a,b;
cin>>a>>b;
ans+=b*(b+1)/2-a*(a-1)/2;
}
cout<<ans;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, x, y;
cin >> a >> b >> x >> y;
const int y_ = min(y, x + x);
a = 2 * a;
b = 2 * b + 1;
int d = abs(a - b);
cout << d / 2 * y_ + d % 2 * x << endl;
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;
template <typename T> using vvec = vector<vector<T>>;
template <typename T> using lqueue = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using gqueue = priority_queue<T, vector<T>, less<T>>;
int main() {
co... |
/*
** author : Dhiraj Govindvira
** date : 08 May 2021 ~ Saturday
** time : 05:35:49 PM
*/
#include <bits/stdc++.h>
using namespace std;
#ifdef DHIRAJ
#include "D:/dhiraj/Programming/debug.h"
#else
#define dbg(...) 1
#define cerr if(0) cerr
#endif
using ll = long long int;
#define endl '\n'
... | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define rf(i, a, b) for (ll i = a; i >= b; i--)
typedef std::vector<long long> vi;
#define F first
#define S second
#define fast \
ios_base::sync_with_stdio(0); \
cin.tie(0)... |
#include<bits/stdc++.h>
typedef int64_t i64;
typedef long double f128;
using namespace std;
template<typename T>
void scan(T& n)
{
cin>>n;
return;
}
void scan()
{
return;
}
template<typename T,class... Args>
void scan(T& n,Args&... args)
{
scan(n);
scan(args...);
return;
}
template<typename T>
void scan... | #include <iostream>
using namespace std;
typedef long long ll;
const ll INF=2e18;
ll clamp(ll x, ll min, ll max) {
if (x>max) {
return max;
}
if (x<min) {
return min;
}
return x;
}
int main() {
ll n;
cin>>n;
ll low=-INF;
ll high=INF;
ll bias=0;
for (... |
/*
@author : ashnove
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define lld long double
#define F first
#define S second
#define Th third
// #define endl "\n"
#define nl cout << endl;
#define pb push_back
#define f(i, a, b) for (ll i = a; i < b; i++)
#define what_is(x) cerr << #x <<... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define PI 3.14159265359
#define mod 1000000007
#define ALL(a) (a).begin(),(a).end()
int main(){
string s;
cin >> s;
string a = "";
string b = "";
int count = 0;
rep(i,s.size()){
i... |
#include <iostream>
#include <numeric>
#include <vector>
#include <algorithm>
#include <iostream>
#include <functional>
#include <cstdlib>
#include <cmath>
#include <utility>
#include <cmath>
long long FindCentral(std::vector<std::vector<long long>> &A, long long K, long long si, long long sj, std::vector<long long> ... | #include<bits/stdc++.h>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define m_p make_pair
#define pb push_back
#define fi first
#define se second
#define foreach(i,c) for(__... |
#include <algorithm>
#include <cmath>
#include <climits>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_set>
#include <vector>
#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;
using LLONG = long long;
const... | #include<bits/stdc++.h>
#include <iostream>
#include <stack>
#include <list>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ss second
#define ff first
#define ub upper_bound
#define lb lower_bound
const ll M=1000000007;
#define inf 1000000000000000000
#define infn -1000000000000000000
ll ncr(int n,int r){if(r>n)return 0;if(r > n - r) r = n -... | #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;
int isprime (int n)
{
int j;
for ( j = 2 ; j <= n / 2 ; j ++ )
{
if ( !(n % j) )
return 0;
}
return 1;
}
int main (void)
{
int n;
while (cin >> n)
{
long long ans = 1;
int i;
for ( i = 2; i <= n ; i ++)
{
if (isprime (i))
{... | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll x,ll y)
{
return __gcd(x,y);
}
ll lcm(ll x,ll y)
{
return (x*y)/(gcd(x,y));
}
int main()
{
long long n,i,a;
cin>>n;
a=1;
for(i=2;i<=n;i++)
{
a=lcm(a,i);
}
cout<<a+1<<endl;
}
|
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<int>>;
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplac... | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
using P = pair<int,int>;
const int N=2000;
const int INF=1e9;
const int White=0,Gray=1,Black=2;
vector<P> G[N];
int dist[N][N];
int color[N], self[N];
priority_queue<P,vector<P>, greater<P>> que;
void dijkst... |
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#include<iostream>
#include<cstring>
#include<algorithm>
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 <= ... | //QwQcOrZ yyds!!!
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include... |
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define chmin(x,y) x = min((x),(y))
#define chmax(x,y) x = max((x),(y))
#define popcount(x) __builtin_popcount(x)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
const int INF = 1e9;
const ... | #include <cstdio>
#include <algorithm>
using namespace std;
int n;
long long k;
long long a[3000006];
long long sum[3000006];
int main(){
scanf("%d%lld",&n,&k);
int l=3;
for(int i=1;i<=n;++i)a[l++]=1ll*i;
for(int i=n-1;i>=1;--i)a[l++]=1ll*i;
for(int i=3;i<=n+2;++i){
sum[i]=sum[i-1]+a[i];
a[i]=sum[i];
}
for(i... |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#define int128 __int128
#else
#define int128 long long
... | #include <stdio.h>
int i, N, A[2][100001];
long long dp[2][100001];
int main()
{
scanf("%d", &N);
for (i = 1; i <= N; i++) scanf("%d", &(A[0][i]));
for (i = 1; i <= N; i++) scanf("%d", &(A[1][i]));
int j, k, l, r;
const long long inf = -(1LL << 60);
for (i = 0; i <= N; i++) {
dp[0][i] = inf;
dp[1][i] = i... |
#include <cstdio>
#include <cstdlib>
using namespace std;
#define ll long long
const ll MAXN = 400011;
struct fhqTreap {
ll tot, rt;
ll val[MAXN], sum[MAXN], sz[MAXN], ls[MAXN], rs[MAXN], rd[MAXN];
void pushup(ll u) {sz[u] = sz[ls[u]] + sz[rs[u]] + 1; sum[u] = sum[ls[u]] + sum[rs[u]] + val[u];}
void split(ll u, ... | #include <iostream>
using namespace std;
long long n,k,x,y,a,b,c,d, ansx, ansy;
long long ans;
main(){
cin>>n>>k;
k=abs(k);
for(x=1; x<=2*n+1; x++){
ansx=1; ansy=1;
y=x-k;
//cout<<"----"<<endl;
//cout<<x<<" "<<y<<endl;
if(x-1>=n) ansx=2*n-x+1;
else ansx=x-1;
if(y-1>=n) ansy=2*n-y+1;
else ansy=y-1... |
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
int a[3];
cin >> a[0] >> a[1] >> a[2];
sort(a, a+3);
if(a[0]==a[1]){
cout << a[2] <<endl;
}else if(a[... | #define _DEBUG
#include "bits/stdc++.h"
//#include <atcoder/all>
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,a5,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "... |
/**
* author: Pocket7878
**/
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <queue>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
template <class T>
bool chmax... | #include <iostream>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
using namespace std;
typedef long long int ll;
typedef pair <int,int> pii;
typedef pair<ll,ll> pll;
/*bool compare_function(const pair<int, int> a, const pair<int, int> b... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (n-1); i >= 0; i--)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
template <class S>S sum(vector<S>& a) {return accumulate(all(a), S(... | #include "bits/stdc++.h"
using namespace std;
using P = pair<int, int>;
bool seen[100010], seen2[100010];
vector<vector<P>>graph;
int ans[100010];
void dfs(vector<vector<P>> &G, int v) {
seen[v] = true;
for (auto nv : G[v]) {
if (seen[nv.first])continue;
graph[v].push_back({ nv.first,nv.second });
graph[nv.firs... |
#include <iostream>
#include <cstdio>
using namespace std;
int m;
long long n;
struct node
{
int res, rem;
};
node work(long long x)
{
if(x == 0)
{
return (node){0, 1};
}
if(x % 2 == 1)
{
node tmp = work(x - 1);
int Res = (tmp.res * 10 + (tmp.rem * 10) / m) % m;
int Rem = (tmp.rem * 10) % m;
return (nod... | //#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <algorithm>
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define PI acos(-1.0)
#define No cout<<"No\n"
#define Yes cout<<"Yes\n"
#define no ... |
#include <sstream>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <array>
#include <deque>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <cassert>
#include <cmath>
#include <climits>
#include <map>
#include <queue>
... | /**
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⢀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡖⠁⠀⠀⠀⠀⠀⠀⠈⢲⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣇⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣿⣿⡇⠀⢀⣀⣤⣤⣤⣤⣀⡀⠀⢸⣿⣿⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣔⢿⡿⠟⠛⠛⠻⢿⡿⣢⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣷⣤⣀⡀⢀⣀⣤⣾⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀
⠀⠀⢠⣾⣿⡿⠿⠿⠿⣿⣿⣿⣿⡿⠏⠻⢿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣷⡀⠀⠀
⠀⢠⡿⠋⠁⠀⠀⢸⣿⡇⠉⠻⣿⠇⠀⠀⠸⣿⡿⠋⢰⣿⡇⠀⠀⠈⠙⢿⡄⠀
⠀⡿⠁⠀⠀⠀⠀⠘⣿⣷⡀⠀⠰⣿⣶⣶⣿⡎⠀⢀⣾⣿⠇⠀⠀⠀⠀⠈⢿⠀
⠀⡇⠀⠀⠀⠀... |
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(ll i=a; i<=b; i++)
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define INF 2147483647
#define INFLL 1000000000000
#define MOD 998244353
#define PI 3.14159265359
#define dij priority_que... |
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,temp;
cin >> n;
vector<int> myvec(n);
for(int i = 0;i < n;i++){
cin >> myvec[i];
}
int result = 0;
for(int i = 0;i < n;i++){
cin >> temp;
result += temp*myvec[i];
}
if(result == 0){
cout... | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vec vector<int>
#define mii map<int,int>
#define pqb priority_queue<int>
#def... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define f... | #include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define pii pair<ll,ll>
#define inf 1000000000000000000
#define bpc(x) __... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using ll =long long;
using P =pair<int,int>;
int main() {
// codehere
string s;
cin >> s;
cout << s[1] << s[2] << s[0]<<'\n';
return 0;
}
| #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<cstring>
#include<vector>
#include<queue>
using namespace std;
const int N = 1e3 + 10;
int main(){
int a,b,c;
cin >> a>> b >>c;
if(a - b == b - c || a - c == c - b || b - a == a - c || b - c == c - a || c - a == a - b){
cout << "Yes" <<endl;
}else cout <<"No" <... | #include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <utility>
#include <map>
#include <set>
#include <queue>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c... |
#include <bits/stdc++.h>
using namespace std;
void potato() {
long long n;
cin >> n;
int ans = 0;
for(auto x = 1LL; ; x++) {
if(stoll(to_string(x) + to_string(x)) > n)
break;
ans++;
}
cout << ans << '\n';
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int tt=1;
while(tt-... | #include <bits/stdc++.h>
using namespace std;
int main(){
double N;
cin >> N;
if((int)(N*1.08)<206) cout << "Yay!" << endl;
else if((int)(N*1.08)==206) cout << "so-so" << endl;
else cout << ":(" << endl;
} |
#include<bits/stdc++.h>
typedef int LL;
typedef double dl;
#define opt operator
#define pb push_back
const LL maxn=1e6+9,mod=998244353,inf=0x3f3f3f3f;
LL Read(){
LL x(0),f(1); char c=getchar();
while(c<'0' || c>'9'){
if(c=='-') f=-1; c=getchar();
}
while(c>='0' && c<='9'){
x=(x<<3ll)+(x<<1ll)+c-'0'; c=getchar()... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define endl '\n'
#define pb push_back
#define ub upper_bound
#define lb lower_bound
... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define F first
#define S second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define debug(a) cout << #a << " = " << a << " ";
template<typename T> istream &operator>>(istream &is, vector<T> &vec) { for (auto &v : v... | #include <iostream>
#include <vector>
//#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>
// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>
typedef long long LL;... |
#undef _GLIBCXX_DEBUG
// Problem: F - Rook on Grid
// Contest: AtCoder - Panasonic Programming Contest (AtCoder Beginner Contest 186)
// URL: https://atcoder.jp/contests/abc186/tasks/abc186_f
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/s... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(obj) (obj).begin(),(obj).end()
template<class T> using priority_queue_reverse = priority_queue<T,vector<T>,greater<T>>;
constexpr long long MOD = 1'000'000'000LL + 7; //'
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF =... |
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <sys/time.h>
using namespace std;
class XorShift128 {
private:
uint32_t x, y, z, w;
public:
XorShift128() : x(123456789), y(362436069), z(521288629), w(88675123) { }
uint32_t rnd() {
uint32_t t = x ^ (x << 11);
x = y;
y = z;
... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define mat vector<vector<int>>
#define vi vector<int>
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define pi pair<int, int>
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for(int i=a; i<b; i++)
#def... |
//#include "bits/stdc++.h"
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <array>
#include <unordered_map>
#include<unordered_set>
#include <numeric... | #include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<set>
#include<string>
#include<string.h>
#include <sstream>
#include<map>
#include<iomanip>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization("unrol... |
#include <bits/stdc++.h>
#define mid(l,r) ((l + r) >> 1)
#define lsb(x) (x & (-x))
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define FOR(X,L,R) for(int X=L;X<R;++X)
#define endl '\n'
#define int long long
#define MOD ((int)1e9 + 7)
#define INF (0x3f3f3f3f)
#define LLINF (0x3f3f3f3f3f3f3f3f... | #include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <sstream>
#include <limits.h>
#include <stdio.h>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n];
for(int i=0; i<n; i++){
int tmp;
cin... |
#include <iostream>
#include <limits>
#include <vector>
#include <algorithm>
using namespace std;
long long count(int x, const vector<int> primes) {
// {i : i <= x, gcd(i, prod(primes) ) == 1}
int n = primes.size();
long long res = 0;
for (int msk = 0; msk < (1<<n); msk++) {
int c = 0;
... | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define p(x,y) pair<x,y>
#define oset(x) tree<x, null_type, less<x>, rb_tree_tag, tree_order_statistics_node_update>
#define all(x) (x).begin(),(x).end()
#define ll ... |
//Common Header Simple over C++11
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end(... | //##### ##### ##### ##### ##### # ##### # #//
//# # # # # # # # # # # ## ##//
//##### ##### ##### # ##### # ##### # # #//
//## # # # # # # # # # # #//
//# # # # # # # # # # # ... |
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
queue<pair<int,int> >Q;
VI ans;
map<int, int> m;
int a[300010];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int n;
cin >> n;
for (int i = 1; i <= n; i ++ ) {
... | #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 ff first
#define ss second
#define int long long int
#define pb push_back
#define mp make_pair... |
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>;
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
const vector<int> dy={-1... | #include <bits/stdc++.h>
#define F first
#define S second
#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 bck(i, a, b) if ((i) >= (a) && (i) < (b))
#define trav(x, a) for (auto &x : (a))
#define sz(a) (int)(a).size()
#define all(x) (x).begin(), (x).end(... |
#ifdef GCC_VERSION
#include<bits/stdc++.h>
#endif
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <tuple>
#include <algorithm>
#include <functional>
#include <deque>
#include <queue>
#include <cstring>
#include <chrono>
#include <numeric>
#ifdef _DEBUG
... | #include<bits/stdc++.h>
using namespace std;
int const maxn = 1e6+10;
long double const eps = 1e-3;
#define ll long long
int a[1100];
int b[1100];
int main(){
int n;
cin>>n;
int mini2=1e9;
int mini=1e9;
for(int i=1;i<=n;i++){
scanf("%d%d",&a[i],&b[i]);
mini=min(mini,a[i]+b[i]);
}
for(int i=1;i... |
#include <bits/stdc++.h>
using namespace std;
int main(){
int N, C=206;
scanf("%d", &N);
if( N+((N*8)/100) > C) cout<<":("<<'\n';
else if( N+((N*8)/100) == C) cout<<"so-so"<<'\n';
else cout<<"Yay!"<<'\n';
}
| #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
long long int ans=1;
for(long long int i=2;i<=n;i++)
{
ans=(ans*i)/(__gcd(ans,i));
}
cout<<ans+1<<endl;
}
|
#include <bits/stdc++.h>
#include <chrono>
#include <ctime>
using namespace std;
using chrono::steady_clock;
using chrono::milliseconds;
#define sp " "
#define INF 1e18
#define INT_INF 1e9
typedef long long ll;
typedef pair<int,int> P;
chrono::steady_clock::time_point now_t;
chrono::steady_clock::time_point start_t;
... | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <cassert>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
using namespace std;
#define mp make_pair
#define pb push_back
#define fi first
#define fs first
#defi... |
#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(fals... | #include <bits/stdc++.h>
using namespace std;
int main(){
int N, M;
while(scanf("%d%d", &N, &M) > 0){
map<int, unordered_set<int>> pawns;
for(int i = 0; i < M; i++){
int X, Y;
scanf("%d%d", &X, &Y);
pawns[X].insert(Y);
}
unordered_set<int> reachable;
reachable.insert(N);
... |
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<n; i++)
#define rng(i,l,r) for (int i=l; i<r; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define endl "\n"
#define INF 1000000007 // 1e9+7
#define LINF 1152921504606846976 // 1LL<<60
using namespace std;
using ll = long long;
usi... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
template<typename T>
using maxhe... |
#include <algorithm>
#include <cmath>
#include <cstdlib>
template <typename T, typename P>
T bisect(T ok, T ng, const P& is_ok)
{
while (std::abs(ok - ng) > 1) {
auto mid = ok + (ng - ok) / 2;
if (is_ok(mid)) {
ok = mid;
}
else {
ng = mid;
}
}
return ok;
}
#include <iostream>
#include <vector>
#inc... | #include<iostream>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>
#include<stack>
#include<string>
#include<vector>
#include<set>
#define rep(i,n) for(int i = 0;i < n;i++)
using namespace std;
std::vector<bool> IsPrime;
void sieve(long long int max){
if(max+1 > IsPrime.size()){ // resizeで要... |
//bismillahir rahmanir rahim
//@uthor : mubin_akib
#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... | #include <bits//stdc++.h>
using namespace std;
#define int long long
#define rep(i,n,k) for(int i=n;i<k;i++)
#define P make_pair
#define F first
#define S second
#define M LLONG_MAX
signed main(void){
int n,m,p,q,ans;
ans=0;
string s;
cin>>n>>m;
rep(i,0,m){
if(n%200)
n=n*1000+200;
... |
/* @memendra_singh */
#include<bits/stdc++.h>
using namespace std;
#define m7 1000000007
#define m9 1000000009
#define ll long long
#define boost ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define F first
#define S second
#define pb push_b... | #include<bits/stdc++.h>
#define LOCAL
#define ft first
#define sd second
#define endl '\n'
#define io ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define weishu setprecision
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define lowbit(x) ((x)&(-x))
#define debug1() cout<<"hello world!"<<endl
#define debug2... |
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>
#include <stack>
#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c... | #include<bits/stdc++.h>
using namespace std;
#define rep(i, r, n) for(int i = r; i < (int)(n); i++)
// 答えで二分探索
int N, X[3030][5];
int getMask(int i, int lim) {
int res = 0;
rep(j, 0, 5) if(X[i][j] >= lim) res += 1 << j;
return res;
}
int cnt[1 << 5];
bool check(int lim) {
rep(i, 0, 1 << 5) cnt[i] = ... |
// E - Rush Hour 2
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define vec vector
using vl = vec<ll>;
#define rep(i,e) for(int i=0;i<(e);++i)
using PR = pair<ll,int>;
// 本問用に修正
// dijkstra O(|E|log|V|)
int V;
vec<tuple<int,int,int,int>> E;
vec<vec<int>> G;
ll INF = 1e18;
ll cost(ll c, ll d, ll t... | #include<bits/stdc++.h>
#define int long long
#define nb 200010
using namespace std;
bool vis[nb];
int n, m, cnt, head[nb], dis[nb];
struct edge{int to, next, c, d;}e[nb];
void add_edge(int u, int v, int c, int d){
e[++cnt].to = v;
e[cnt].c = c;
e[cnt].d = d;
e[cnt].next = head[u];
head[u] = cnt;
}
struct node{... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
int N,K;
cin >> N >> K;
vector<vector<int>> T(N,vector<int>(N));
for(int i=0; i<N; i++){
for(int j=0; j<N; j++){
cin >> T[i][j];
}
}
vector<int> town = {1,2,3,4,5,6,7};
int ans = 0;
do{
int cnt ... | #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long lo... |
#include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
cout << (N + 99) /100 << endl;
} | #include<bits/stdc++.h>
using namespace std;
long long k,n;
vector<long long>v;
int main(){
cin>>n;
for(k=1;k<=sqrt(n);k++){
if(n%k==0){
v.push_back(k);
if(k*k!=n) v.push_back(n/k);
}
}
sort(v.begin(),v.end());
for(k=0;k<v.size();k++)
cout<<v[k]<<endl;
} |
#include <bits/stdc++.h>
using namespace std;
int main(){
int N, M, Q; cin >> N >> M >> Q;
vector<pair<int, int>> vp;
for(int i = 0; i < N; i++){
int w, v; cin >> w >> v;
vp.emplace_back(w, v);
}
vector<int> X;
for(int i = 0; i < M; i++){
int x; cin >> x;
X.push_back(x);
}
sort(vp.begin... | #include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#define itrout(x) for(int i=0;i<x.size();i++) {cout << x[i] << (i==x.size()-1 ? "\n" : " ");}
#ifdef LOCAL
#define de... |
#include <cstdio>
const int mod=998244353;
const int maxn=2e5+10;
struct E{
int to;
int next;
}ed[maxn*2];
int head[maxn];
int tot;
void J(int a,int b){
ed[++tot].to=b;
ed[tot].next=head[a];
head[a]=tot;
}
int vis[maxn];
void Dfs(int x){
vis[x]=1;
for(int i=head[x];i;i=ed[i].next){
if(vis[ed[i].to])
continu... | #include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#include <complex>
... |
#include<bits/stdc++.h>
#include<string>
#include <algorithm>
using namespace std;
const int N=2e5+10;
typedef long long ll;
int n,k,q,m,h,w;
const ll mod=998244353;
int a[N];
int b[N];
map<int,map<int,int> > mpp;
map<int,int> mp;
set<int> se;
string s;
stack <int> st;
int X[]={0,0,1,-1};
int Y[]={-1,1,0,0};
void... | #include<bits/stdc++.h>
#include<iostream>
#include<set>
#include<map>
#include<iterator>
#define ll long long
#define lli long long int
#define pb push_back
#define mp make_pair
#define RIP(i,n) for(int i=0; i<n; i++)
#define RIP1(i,n) for(int i=n-1; i>=0... |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int main() {
int n;
cin >> n;
vector<int> p(n);
rep(i, n) {
cin >> p[i];
p[i]--;
}
vector<int> s(n - 1), m(n - 1);
rep(i, n) {
if (i == p[i]) {
cout << -1 << e... | #include <bits/stdc++.h>
using namespace std;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(... |
// clang-format off
#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;
#ifndef godfather
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,a... | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=2e5+6;
//const int mod=1e9+7;
string x;
LL m;
bool check(LL mod){
LL res=0;
LL base=1;
for(int i=0;i<(int)x.size();i++){
LL temp=x[i]-'0';
if(temp>m/base) return 0;
if(res>m-temp*base) return 0;
res+=temp*base;
if(i!=x... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define faster ios_base::sync_with_stdio(false), cin.tie(0)
#define read freopen("in.txt", "r", stdin)
#define write freopen("out.txt", "w", stdout)
#define var(...) " [" << #__VA_ARGS__ ": " << ... | #include<bits/stdc++.h>
using namespace std;
int dp[2][200000],ara[1000];
int main()
{
int n,a,sum=0,s,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a); sum=sum+a; ara[i]=a;
}
int fr,sc,tr,ans=90000000;
int idx,cap;
for(idx=n;id... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define P pair<ll,ll>
using Graph = vector<vector<int>>;
int main() {
ll N,M,Q; cin >> N;
ll x[N+1],y[N+1];
rep(i,N){
cin >> x[i+1] >> y[i+1];
}
vector<P> op; ll a,b,c; cin ... | #include<bits/stdc++.h>
//#include <atcoder/all>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define fi first
#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.