code_file1 stringlengths 87 4k | code_file2 stringlengths 85 4k |
|---|---|
#include<bits/stdc++.h>
using namespace std;
int n,k;
long long get(int x)
{
//x-r>=1 r<=x-1 x-l<=n l>=x-n
return min(n,x-1)-max(1,x-n)+1;
}
int main()
{
scanf("%d%d",&n,&k);
long long res=0;
for(int i=2;i<=2*n;i++)
{
int t=i-k;
if(t>=2&&t<=2*n)
{
res+=get(i)*... | #include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FOR(index, start, end) for(int index = start; index < end; ++index)
#define F0R(index, end) for(int index = 0; index ... |
#include<bits/stdc++.h>
using namespace std;
//////////////////////////////////////////////////////////////////////////////
void files(){freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);}
void speed(){ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
int lcm(int a,int b){return (a*b)/__gcd(a,b);}... | #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 mod 998244353
#define ll long long
#define N 400010
using namespace std;
inline int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')f*=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=x*10+int(ch-48);
ch=getchar();
}
return x*f;
}
int n,m;
int tr[N]... | #include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < (t); ++i)
#define dsrep(i,t,s) for(int i = (t)-1; i >= (s); --i)
#define rng... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr <... | #include <bits/stdc++.h>
using namespace std;
int main(){
long double x, y, r;
cin >> x >> y >> r;
r = nextafter(r, INFINITY);
long long ans = 0;
for (long long i = ceil(x - r); i <= floor(x + r); i++){
long double p = sqrt(r * r - (x - i) * (x - i));
ans += floor(y + p) - ceil... |
// 2021-03-06 21:04:00
// clang-format off
#include <bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i =... | #include <bits/stdc++.h>
using namespace std;
int n, k;
int main()
{
cin >> n >> k;
for (int i = 0; i < k; i++) {
vector<int> g;
while (n > 0) {
g.push_back(n % 10);
n /= 10;
}
sort(g.begin(), g.end());
int u = 0;
for (int j : g) {
u *= 10;
u += j;
}
reverse(g.begin(), g.end());
... |
#include <algorithm>
#include <iostream>
#include <string>
#include <functional>
#include <vector>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cmath>
#include <climits>
#include <queue>
#include <bitset>
#include <set>
#include <assert.h>
using namespace std;
typedef vector<vector<long> > dim2vec... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
ll pow_mod(ll a, ll n, ll mod) {
ll res=1;
while(n>0){
if(n&1) res=res*a%mod;
a=a*a%mod;
n/=2;
}
return res;
}
int main() {
ll N,M,K; cin>>N>>M>>K;
ll ans = 0;
if(N==1 || M==1) ans=pow_mod(K,M+N-1,... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define pb push_back
vector<vector<int> > adj ;
vector<ll> val,m ;
vector<bool> vis ;
ll ans ;
ll dfs(int x)
{
if(vis[x]) return m[x] ;
ll ma=-1e9 ;
vis[x]=1 ;
rep(i,0,adj[x].size())
{
ma=max(ma,df... | #include <bits/stdc++.h>
using namespace std;
using lint = long long;
int main() {
int N, M;
cin >> N >> M;
vector<vector<int>> adj(N);
vector<int> A(N);
for (auto &i : A) cin >> i;
for (int i = 0; i < M; i++) {
int u, v;
cin >> u >> v;
adj[--u].emplace_back(--v);
}
vector<lint> dp(N, -1e18... |
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> A(N),B(N);
int ans=1e9;
for(int i=0;i<N;i++){
cin >> A.at(i) >> B.at(i);
}
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
if(i==j){
ans=min(ans,A.at(i)+B.at(j));
}else{
ans=min(ans,max(... | #include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
// #define MOD 998'244'353
// #define MOD 1'000'000'007
// #define INF 1'000'000'000'000'000'000
using namespace std;
// using namespace atcoder;
typedef long long ll;
int ma... |
#include <bits/stdc++.h>
using namespace std;
long long N;
vector<long long> divisor(long long n) {
vector<long long> res;
for (long long i = 1; i * i <= n; i++) {
if (n % i == 0) {
res.push_back(i);
if (i != n / i) {
res.push_back(n / i);
}
}
}
return res;
}
bool check(long... | #include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
using namespace std;
//int N=1;
int P[11] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
int binary(int bina) {
int ans = 0;
for (int i = 0; bina > 0; i++)
{
ans = ans + (bina % 2) * pow(10, i);
bina = bina / 2;
}
return ans;
... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, start, n) for (ll i = (ll)(start); i < (ll)(n); ++i)
static const ll INFTY = 1L << 62L;
ll solver(vector<ll> &h, ll n, ll *w, ll m)
{
ll j, k, answer = INFTY, ans;
sort(h.begin(), h.end());
//r1: 0,h[1]-h[0],h[3]-h[2],h[5]-h[... | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string(string(s)); }
string to_string(bool b) { return to_string(int(b)); }
string to_string(vector<bool>::reference b) { return to_string(int(b)); }
string to_stri... |
#include <vector>
#include <array>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#inc... | #include <bits/stdc++.h>
using namespace std;
#define int long long
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
int charToInt(char c){
char zero_num = '0';
return (int)c - (int)zero_num;
}
void co... |
// Problem: A - Rock-paper-scissors
// Contest: AtCoder - AtCoder Beginner Contest 204
// URL: https://atcoder.jp/contests/abc204/tasks/abc204_a
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
#include <bits/stdc++.h>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
if (x == y) cout << x;
else cout << 3... | #include<iostream>
using namespace std;
int main(){
int x, y;
cin >> x >> y;
if ((x==1&&y==2)||(x==2&&y==1)||(x==0&&y==0)) cout<<0;
else if ((x==0&&y==2)||(x==2&&y==0)||(x==1&&y==1)) cout<<1;
else cout<<2;
return 0;
} |
#pragma region
#ifdef LOCAL
#include "pch.h"
#else
#include <bits/stdc++.h>
#endif
// debug
template<typename ... Types>
void __read(Types& ... args) {
((std::cin >> args), ...);
}
#define read(type, ...) type __VA_ARGS__; __read(__VA_ARGS__)
template <typename Type, typename... Types>
auto print(Type const &arg, ... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
#define all(v) begin(v), end(v)
#define sz(v) (int)(v).size()
#define fi first
#define se second
const int md = 998244353;
namespace modular {
inline int mul() { return 1; }
template <typename..... |
#include <bits/stdc++.h>
#define ll long long
#define maxn 100005
#define mod 1000000007
#define pii pair<int, int>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
ll a[maxn], b[maxn];
priority_queue<pii,vector<pii>, less<pii> > pq;
int main() {
io
ll k, n, ... | #include <algorithm>
#include <iomanip>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <sstream>
#include <unordered_map>
#in... |
// '-.-'
// () __.'.__
// .-:--:-. |_______|
// () \____/ \=====/
// /\ {====} )___(
... | #include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset>
using namespace std;
#define FAST ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
typedef long long ll;
int main(void)
{
... |
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
using namespace std;
int main()
{
int H, W, X, Y, count = 0;
cin >> H >> W >> X >> Y;
vector<string> S(H);
for (int i = 0; i < H; i++) cin >> S.at(i);
if (S.at(X - 1).at(Y - 1) == '#') goto finish;
else count++;
for (... | #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 <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n;
int64_t x, c;
cin >> n;
vector<vector<int64_t>> balls(n + 1, vector<int64_t>(0));
for (size_t i = 0; i < n; i++)
{
cin >> x >> c;
balls[c].push_back(x);
}
for (int i = 1;... | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(),(a).rend())
#define ll long long
#define pb(a) push_back(a)
#define PRINTV(v) {for(ll deB=0; deB<(v).size(); ... |
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#includ... | /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author Kein Yukiyoshi
*/
// clang-format off
#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx")
#define int long long
using namespace std;
#define stoi stoll
#define fi first
#define se secon... |
#include "bits/stdc++.h"
using namespace std;
int main() {
int N;
long long X;
cin >> N >> X;
vector<long long>A(N + 1);
for (int i = 0; i < N; ++i) {
cin >> A[i];
}
A[N] = A[N - 1] * 1000;
vector<vector<long long>> dp(N + 1, vector<long long>(2, 0));
dp[0][0] = 1;
for (int i = 0; i < N; ++i) {
for (int ... | #include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;
typedef pair<int, int> Pii;
const ll mod = 1000000007;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int ... |
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
cin.tie(0);ios::sync_with_stdio(false);
ll a,b;
cin>>a>>b;
vector<int>primes={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71};
vector<ll>dp(1<<20);
dp[0]=1;
for(ll i=a... | #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 pi 3.141592653589793238
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999
#define pb push_back
#define ff first
#define ss second
#define mt make_tuple
#define ll long long
#defin... | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<ll>
#define rep(i,a,b) for(int i=a; i<b; ++i)
#define pb push_back
#define endl '\n'
#define sa(x) sort((x).begin(), (x).end());
#define int long long
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
... |
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <cmath>
#include <cassert>
#include <stack>
#include <numeric>
typedef long long ll;
typedef std::pair<int, i... | #include <bits/stdc++.h>
using namespace std;
#define R register
#define LL long long
inline int read() {
int x = 0, f = 1; char a = getchar();
for(; a > '9' || a < '0'; a = getchar()) if(a == '-') f = -1;
for(; a <= '9' && a >= '0'; a = getchar()) x = x * 10 + a - '0';
return x * f;
}
const int N = 4e5 + 10;
i... |
#include <bits/stdc++.h>
#define N 21
#define M 101
#define popcnt __builtin_popcount
using namespace std;
using ll = long long;
int n, m;
vector<pair<int, int>> qs[M];
ll dp[1<<N];
int main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
cin>>n>>m;
for (int i=0; i<m; i++) {
int x, y, z; cin>>x>>y>>z;
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 1e5 + 5;
vector<tuple<int, ll, ll>> G[N];
int n, m, u, v, x, y, vis[N];
ll t, k, d[N];
void bfs() {
priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<>> q;
fill(d, d + N, 1e18);
d[x] = 0;
q.push({0, x});
wh... |
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long lo... | #include<bits/stdc++.h>
#define ll long long
#define llu unsigned long long
#define pb push_back
#define f(n) for(ll i=0;i<n;i++)
#define ina for(ll i=0;i<n;i++)cin>>a[i];
#define all(v) v.begin(),v.end()
#define YES printf("YES\n")
#define NO printf("NO\n")
#define IsComp(n) (_c[n>>6]&(1<<((n>>1)&31)))
#define SetCom... |
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin(... | #include <bits/stdc++.h>
using namespace std;
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
//#define... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll LINF = 1e18;
const int INF = 1e9;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
template <class T>
inline bool chmax(T &a, T b)
{
if (a < b)
{
a = b;
return 1;
}
return 0;
}
template... | #pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_nod... |
#include<iostream>
#include<cstring>
#include<algorithm>
#include<map>
#include<cstring>
using namespace std;
const int N=1e6+10,mod=998244353;
typedef long long LL;
int a[20]={0,1,2,3,4,5,6,7,8,9};
map<char,int>mp;
long long get_num(char s[]){
if(a[mp[s[1]]]==0)return -1;
int len=strlen(s+1);
long long ans=a[mp[s... | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb p... |
#include<bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define rep(i,n) for(int(i)=0;(i)<(int)(n);++(i))
#define v vector
#define r return
/*
Do-while:do {
} while();
endif:#ifndef
#endif
*/
using namespace std;
typedef long long ll;
string ss,st,tt,ts,s,t;
ll b,c,d,n,m,q,k;
struct pc{
int ddd,ffg,eheu... | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define Rep(i,n) for(int i=0;i<=(int)n;i++)
const ll mod = 1e9+7 ;
const ll INF = 1e18 ;
ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
ll lcm(long long a,long long b){return a/gcd(a,b... |
#include<iostream>
#include<vector>
#include<string>
using namespace std;
using LL = long long;
int main(){
int H, W;
cin >> H >> W;
vector<string> field;
for (int i = 0; i < H; i++){
string si;
cin >> si;
field.emplace_back(si);
}
vector<vector<int>> diag; //0:R, 1:B,... | #include <bits/stdc++.h>
using namespace std;
int main()
{
int N,M;
int x,y;
vector<string> A;
char dna[20][20];
cin >> N >> M;
for(int i=0; i<M; i++) {
string a;
cin >> a;
bool iscontain=false;
for( int j=0; j<A.size(); j++)
if(A[j].find(a)!=stri... |
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 100005;
vector<int> G[MAX_N];
int dp[MAX_N][2]; // 0:f(v) 1:size
void dfs(int n)
{
if (G[n].size() == 0)
{
dp[n][0] = 1;
dp[n][1] = 1;
return;
}
vector<P>... | #include <bits/stdc++.h>
// #include <atcoder/modint>
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define INF 2000000000000000000
#define ll long long
#define ld long double
#define pll pair<ll, ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; }... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define debug(a,n) for(ll i = 0;i<n;i++) cout<<a[i]<<" ";
#define sum(a,n,s) for(ll i = 0;i<n;i++) s+=a[i];
#define scan(a,n) for(ll i = 0;i<n;i++) cin>>a[i];
ll counter=0;
vector <ll> SieveOfEratosthenes(ll n)
{
vector <ll> ans;
bool prime[... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(),a.end()
#define vi vector<int>
#define vvi vector<vi>
#define P pair<int,int>
#define vP vector<P>
#define vvP v... |
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<random>
#... | #include <bits/stdc++.h>
//#include "debugger.h"
#define int long long
#define pb push_back
#define pp pop_back
#define f first
#define s second
#define all(x) x.begin(),x.end()
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
string s;
c... |
#include<bits/stdc++.h>
#define MOD 1000000007
#define MAX 1000
using namespace std;
int a[MAX+10],b[MAX+10],dp[MAX+10][MAX+10];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m;
cin>>n>>m;
for(int i=1;i<=n;++i)
cin>>a[i];
for(int i=1;i<=m;++i)
cin>>b[i];
for(int i=0;i<=n;++i)
{
for(i... | /*/ Author: _Math.man /*/
#include<bits/stdc++.h>
using namespace std;
/*/---------------------------Defines-----------------------------------------/*/
#pragma GCC optimize("Ofast")
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#... |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using tii = ... | #include<iostream>
using namespace std;
long int max(long int a,long int b)
{
if(a>=b) return a;
else return b;
}
long int min(long int a,long int b)
{
if(a>=b) return b;
else return a;
}
long int gcd(long int a,long int b)
{
if(a%b==0) return b;
else return gcd(b,a%b);
}
int main()
{
int N;
cin >> N;
lon... |
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset>
using namespace std;
#define FAST ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
typedef long long ll;
#define N 200005
... | #include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;
using VLL = vector <long long>;
using VVLL = vector <VLL>;
int main() {
int N;
int K;
long l... |
/* Problem name : A - i Scream
Time Limit: 2 sec / Memory Limit: 1024 MB
Score : 100 points
Problem Statement
In Japan, there are four major categories of ice cream type products:
an ice cream type product with at least 15 percent milk solids and at least 8 percent milk fat is called an ice cream;
an ice cream type... | #include <bits/stdc++.h>
#define fi first
#define se second
#define pp pop_back
#define ll long long
#define pb push_back
#define ld long double
#define debug cout << "OK\n";
#define all(x) x.begin(), x.end()
using namespace std;
const int N = 5e5 + 200;
const int mod = 1e9 + 7;
const int mod2 = 9982443... |
// include
#include <bits/stdc++.h>
using namespace std;
// conversion
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T>
inline string toString(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
// change
template <class T>
bool chmax(T &a, const ... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> ii;
const ll inf=1e15;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n,tot,nextVil=-1;
priority_queue<ii,vector<ii>,greater<ii>> pq;
cin>>n>>tot;
ll a,b;
for (int i=0;i<n;i++){
cin>>a... |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
const int INF = 1e9;
const ll LINF = 1e18;
template <class T>
bool chmax(T... | #include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <ctime>
#include <numeric>
#include <vector>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <complex>
#include <deque>
#include <functional>
... |
// #undef _GLIBCXX_DEBUG
// #define NDEBUG
#include <bits/extc++.h>
using i64 = int_fast64_t;
using namespace std;
int main() {
i64 x, y;
cin >> x >> y;
unordered_set<i64> usd;
priority_queue<pair<i64, i64>, vector<pair<i64, i64>>, greater<>> q;
q.emplace(0, y);
i64 ans = 1e18;
while (!q.empty()) {
a... | #include <iostream>
using namespace std;
typedef long long ll;
#define min(x,y) ((x)<(y)?(x):(y))
#define max(x,y) ((x)<(y)?(y):(x))
ll comb(ll n, ll k){
if (k == 0 || k == n) return 1;
if (k == 1 || k == n-1) return n;
return comb(n-1,k)+comb(n-1,k-1);
}
int main(){
ll n,k;cin >> n >> k;--k;
... |
#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), cout.tie(0)
#define read freopen("in.txt", "r", stdin)
#define write freopen("out.txt", "w", stdout)
#define var(...) " [" << #__VA_AR... | #include<bits/stdc++.h>
using namespace std;
#define int long long int
#define mp(a,b) make_pair(a,b)
#define vi vector<int>
#define mii map<int,int>
#define mpi map<pair<int,int>,int>
#define vp vector<pair<int,int> >
#define pb(a) push_back(a)
#define fr(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#defi... |
#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 mp make_pair
#define pb(x) push_back(x)
#define vll vector<long long>
#define pll pair<long long, long long>
#define mll map<long long, long long>
#define sz(v)... | #include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;i++)
#define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;i--)
inline int read() {
int x=0,f=1;char c=getchar();
while(c<48||c>57){if(c=='-')f=-1;c=getchar();}
while(c>=48&&c<=57)x=(x<<1)+(x<<3)+(c^48),c=getchar();
return x*f;
}
using namespac... |
// Problem: A - twiblr
// Contest: AtCoder - AtCoder Beginner Contest 182
// URL: https://atcoder.jp/contests/abc182/tasks/abc182_a
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using namespace std;
#define ff first
#def... | #include <bits/stdc++.h>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mod 998244353
//#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#d... |
#include<bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long bigmod(long long a, long long p){
if(p == 0){
return 1;
}
long long ans = bigmod(a, p/2);
ans = (ans * ans) % mod;
if(p % 2 == 1){
ans = (ans * a) % mod;
}
return ans;
}
long long nCr(long long n,... | #include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
typedef long long ll;
ll mod_pow(ll x, ll n, ll mod) {
ll res = 1;
while (n > 0) {
if (n & 1) res = res * x % mod;
x = x * x % mod;
n >>= 1;
}
return res;
}
int main() {
ll N, ... |
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vvvvll = vector<vector<vector<vector<ll>>>>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = ve... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep_up(i, a, n) for (ll i = a; i < n; ++i)
#define rep_down(i, a, n) for (ll i = a; i >= n; --i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
#define vvv... |
#include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(ios::badbit | ios::failbit);
int n;
cin >> n;
vector<vector<int>> a{{1, 0}};
for(auto i = 2; i <= n; ++ i){
vector<vector<int>> b;
for(auto v: a){
vector<int> vv = v; vv.insert(vv.end(), v.begin(), v... | #include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define Rep(i, j, n) for (ll i = j; i < (n); i++)
#define repr(i, j, n) for (ll i = j; i >= (n); i--)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX
#define INFL LLONG_MAX
typedef l... |
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<int,int> pi;
typedef pair<lld,lld> pl;
typedef pair<int,lld> pil;
typedef pair<lld,int> pli;
typedef vector<int> vit;
typedef vector<vit> vitt;
typedef vector<lld> vlt;
typedef vector<vlt> vltt;
typedef vector<pi> vpit;
typedef vector... | #include "bits/stdc++.h"
using namespace std ;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
void solve()
{
long long n ;
cin >> n ;
vector<long long> v ;
for(int i=1; i<=sqrt(n); i++)
{
if(n % i == 0)
{
cout << i << "\n" ;
... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using mld = map<ll, double>;
using mls = map<ll, string>;
using mlb = map<ll, bool>;
using sl = set<ll>;
using sd = set<doubl... | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define ll long long
#define F(type, i, a, b, incr) for (type i = a; i <= (type)(b); i += (type)(incr))
#define RF(type, i, a, b, decr) for (type i = a; i >= (type)(b); i -= (type)(decr))
#define sz(a) sizeof(a)
#define deb(a) cerr ... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e6+10;
const double eps = 0.01;
const double pi = 3.1415926;
inline ll read()
{
ll x=0,f=1;char ch=getchar();
while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;
... | //#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>
#includ... |
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
#define ld long double
using namespace __gnu_pbds;
using namespace std;
template <typename T>
u... | #include<stdio.h>
#include<bits/stdc++.h>
#define ll long long int
#define inf 1000000000000
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define sz(x) (int)x.size()
#define ps(x,y) fixed<<setprecision(y)<<x
using namespace std;
const int N = 2005;
ll dp[N][N], H[N][N], V... |
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
using ll = int64_t;
ll score(string S){
vector<ll> cnt(10);
iota(cnt.begin(), cnt.end(), 0);
for(char c : S) cnt[c - '0'] *= 10;
return accumulate(cnt.begin(), cnt.end(), 0);
}
int main(){
ll K;
string S, T;
cin >... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_... |
#include <bits/stdc++.h>
int main() {
long long n; std::cin >> n;
// 3で割って
int digit = 0;
int sum = 0;
int n_zero = 0; // 余り0の倍数の数
int n_one = 0; // 余り1の倍数の数
int n_two = 0; // 余り2の倍数の数
// std::cout << n << std::endl;
// std::string s;
while (n) {
int d = n%10;
++digit;
sum += d;
n_z... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
void make(vector<int>& v,vector<int>v1,int index,int &cnt){
if(v1.size()>4) return;
if(v1.size()==4){
map<int,int> m;
for(auto i: v1){
m[i]++;
//cout<<i<<" ";
}
//cout<<"\n";
int p... |
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
vector<pair<ll,ll>> cond[105];
void solve()
{
ll n,m;
cin>>n>>m;
for(ll i=1;i<=m;i++)
{
ll x,y,z;
cin>>x>>y>>z;
cond[x].push_back({y,z});
}
vector<ll> dp((1LL<<n),0);
dp[0]=1;
for(ll i=1;i<(1LL<<n);i++)
{
ll c=0;
for(ll j=0;j<n... | #include <iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
#include<map>
#include<random>
#include<complex>
#include<math.h>
#include<functional>
#include<stack>
#include<queue>
#include<unordered_map>
#include<set>
#include<numeric>
#include <cassert>
using namespace std;
#define rep(i... |
#include <algorithm>
#include <iostream>
using ll = long long;
using namespace std;
int main() {
int a[4];
for (int i = 0; i < 4; i++) cin >> a[i];
sort(a, a + 4);
if (a[0] + a[3] == a[1] + a[2] || a[0] + a[1] + a[2] == a[3])
cout << "Yes" << endl;
else
cout << "No" << endl;
return 0;
} | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
int main() {
int a, b, c;
cin >> a >> b >> c;
int ans = 0;
ans = max(ans, a + b);
ans = max(ans, a + c);
ans = max(ans, b + c);
cout <<... |
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
//#i... | // Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
#include <bits/stdc++.h>
// #include "atcoder/all"
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;
return tr... |
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:36777216")
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <cstr... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main()
{
string s;
cin >> s;
ll ans = 0;
// 1つ前の文字
char c = s.at(0);
// 直前の連続した文字
char lc = '0';
// 連続した文字列が何個あったか
ll lcnt = 0;
// 文字連続カウンター
ll c... |
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=(n)-1;i>=0;i--)
#define perl(i,r,l) for(ll i=(r)-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue... | #include <bits/stdc++.h>
using namespace std;
#define LL long long
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n; LL k; cin >> n >> k;
LL dp[4][3000005] = {0};
dp[0][0] = 1;
#if 0
// A slower way of calculating dp[i][j] is:
// Will give TLE: https://atcoder.jp/contests/abc200/... |
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }
template<typename A, typename B> inline bool ch... | #pragma GCC optimize("O3")
#include "bits/stdc++.h"
#define sz(x) (int)(x).size()
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
cout << (1<<n)-1 << "\n";
for(int i=1; i<=(1<<n)-1; i++) {
for(int j=0; j<(1<<n); j++)
cou... |
#include <bits/stdc++.h>
using namespace std;
int main()
{
//int arr[] = {1, 2, 90, 10, 110};
//int n = sizeof(arr) / sizeof(arr[0]);
// Function calling
//cout << "Maximum difference is " << maxDiff(arr, n);
int a,b,c,d;
cin>> a;
cin>>b;
cin>> c;
cin>>d;
cout<< b-c;
return ... | #include <bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//#include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#d... |
#include<algorithm>
#include<iostream>
#include<cstring>
#include<bitset>
#include<cstdio>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
#define neinf 0xc0c0c0c0c0c0c0c0ll
#define inf 0x3f3f3f3f3f3f3f3fll
#define uint unsigned int
#define ull unsigned ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<vl> vvl;
double EPS=1e-9;
int INF=1000000005;
long ... |
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N,X;
cin>>N>>X;
vector<int> V;
for(int i=0;i<N;i++)
{
int x;
cin>>x;
if(x != X)
{
V.push_back(x);
}
}
for(int i=0;i<V.size();i++)
{
if(i == (V.size()-1))
{
cout<<V[i]<<endl;
}
else
{
cout<<V[i]<<" ";... | #include <bits/stdc++.h>
using namespace std;
char S1[400005];
char S2[400005];
char S3[400005];
char S4[400005];
int main(){
int T;
scanf("%d", &T);
while(T --){
int N;
scanf(" %d %s %s %s", &N, S1, S2, S3);
memset(S4, 0, sizeof(S4));
for(int i = 0; i < N; i ++){
... |
#include <bits/stdc++.h>
#define endl '\n';
typedef long long ll;
using namespace std;
const int maxn = 1e5 + 10;
int main()
{
ios::sync_with_stdio(false);
int n,x;
char aws;
cin >> n >> x;
for (int i = 0; i < n; i++) {
cin >> aws;
if (aws == 'o')x++;
else if (x != 0) x--;
}
cout << x << endl;
return ... | // B - Quizzes
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, x; string s; cin>>n>>x>>s;
for(auto c:s) x = c=='o'? x+1:max(0, x-1);
cout<< x <<endl;
}
|
#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair<ll,ll>; const ll INF=4e18;
void print0() {}
template<typename H,typename... T> void print0(H h,T... t){cout<<fixed<<setprecision(15)<<h;print0(t...);}
void print() { print0("\n"); }
templat... | #include <bits/stdc++.h>
using namespace std;
long long MOD;
int main(){
int N, K;
cin >> N >> K >> MOD;
vector<vector<long long>> f(N);
f[0].push_back(1);
for (int i = 1; i < N; i++){
int sz = f[i - 1].size();
f[i] = vector<long long>(sz + i * K, 0);
for (int j = 0; j < sz; j++){
f[i][j] = ... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define each(e, v) for(auto &e: v)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x)... | #include <bits/stdc++.h>
#define speedup ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr),cout.precision(12)
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_sta... |
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
#define P pair<int,ll>
#define MOD 1000000007
using namespace std;
ll n, a,b,c, m;
int main(){
cin >> n;
m = n+1;
rep(i, 60){
a = (n >> i);
b = i;
... | #include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <cassert>
#include <stack>
#include <numeric>
typedef int64_t ll;
typedef std::pair<int, int> Pii;
typedef st... |
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <numeric>
#include <chrono>
#include <random>
#include <bitset>
#include <tuple>
#include <queue>
#include <map>
#include <unordered_map>
#include <cstring>
#include <cassert>
#include <climits>
#inclu... | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 17;
int n,m,k;
vector<vector<int>> G;
int d[N][N], c[N];
int dp[1 << N][N];
void bfs(int s) {
vector<int> dist(n, INT_MAX);
queue<int> que;
que.push(c[s]);
dist[c[s]] = 0;
while(!que.empty()) {
int v = que.front();
que... |
#include <bits/stdc++.h>
using namespace std;
// TYPEDEF ------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
ll gcd(ll x, ll y) {return (x%y) ? gcd(y, x%y) : y; }
const int inf = 1000000000;
const int dx[]={1,0,-1,0};
const int dy[]={0,1,0,-1};
const ll mod = 1e9+7;
int main(){
string a, b;
cin >> ... |
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define FASTIO1 srand(chrono::high_resolution_clock::now().time_since_epoch().count())
#define gc getchar_unlocked
#define ll long long
#define PI 3.1415926535897932384626
#define br cout << endl
#define... | #include <bits/stdc++.h>
#define arr array
#define pb push_back
#define fs first
#define sc second
#define eb emplace_back
#define vt vector
#define all(x) (x).begin(), (x).end()
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end... |
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
typedef long long ll;
using namespace std;
int n;
vector<vector<int>> a;
set<int> ids;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
int main() {
cin >> n;
rep(i, n) {
int x, y;
cin >> x >> y;
a.emplace_back(vecto... | #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int H,W;... |
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <queue>
#include <numeric>
#include <iomanip>
using namespace std;
using ll = long long;
#define For(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFor(i,a,b) for(ll i=(a);i>=(ll)(b);i--)
#define co(a) cout<<a<<endl
#... | #include <bits/stdc++.h>
using namespace std;
int main(){
int A, B;
cin >> A >> B;
cout << 2 * A + 100 - B;
}
|
// https://atcoder.jp/contests/arc108/tasks/arc108_b
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
char a[200010];
memset(a,0,200010);
cin>>N>>a;
for(int i=0;i<N;i++){
if(a[i]=='f'&&a[i+1]=='o'&&a[i+2]=='x'){
for(int j=i;j<N;j++) a[j]=a[j+3];
i=i-3;
N=N-3;
}
}
cout<<N;
return 0;... |
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/trie_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define inf 1e18
#defin... |
#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
using namespace std;
using Graph = vector<vector<int>>;
using vst= vector<string>;
using vin= vector<int>;
using ll=long long;
using ull=unsigned long long;
using vll= vector<ll>;
using P=pair<int ,... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<bool> vbl;
typedef vector<vector<bool>> vvbl;
typedef vector<ld> vld;
void ... |
#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;
int gcd_extend(int a, int b,
long long& x,long long& y)
{
// Base Case
if (b == 0) {
x = 1;
y = 0;
return a;
}
// Recursively find the gcd
else {
int g = gcd_extend(b,
... |
#include <stdio.h>
#include <math.h>
int main() {
long long R, X, Y;
scanf("%lld %lld %lld", &R, &X, &Y);
int ans;
if (X * X + Y * Y < R * R) {
ans = 2;
}
else {
double dis = sqrt((1.0 * X * X + 1.0 * Y * Y) / (1.0 * R * R));
ans = ceil(dis);
}
printf("%d\n", ans... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define endl "\n"
ll mod=1000000007;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
IOS;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#end... |
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
#include <cmath>
#include <algorithm>
using namespace std;
int K, N, M;
int A[100005];
typedef tuple<long long, int, int> P;// (error, original-index, scaled-value)
P Q[100005], R[100005];
int main() {
scanf("%d%d%d", &K, &N, &M);
for (int i ... | #include <bits/stdc++.h>
#define int ll
typedef long long ll;
const int K = 100000;
int k, n, m;
ll a[K + 5]; int l[K + 5], r[K + 5];
bool check(ll x) {
ll sl = 0, sr = 0;
for (int i = 1; i <= k; i++) {
if (a[i] - x > 0) l[i] = (a[i] - x + n - 1) / n;
else l[i] = 0;
r[i] = (a[i] + x) / n;
sl += l[i], sr... |
#include <bits/stdc++.h>
#define endl "\n"
#define ff first
#define ss second
#define PB push_back
#define MP make_pair
#define ll long long
#define llu unsigned long long
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define ABS(X) ((X) < 0 ? -(X) : (X))
#define LCM(X, Y) (((X... | // Coder: @SumitRaut
#include <bits/stdc++.h>
#define speedup ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr),cout.precision(16)
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_ta... |
#include<iostream>
using namespace std;
int N;
string S,X;
int dp[2<<17][7];
bool dfs(int t,int k)
{
if(dp[t][k]!=0)
{
return dp[t][k]>0;
}
bool win=false;
if(t==N)
{
if(k==0)win=true;
}
else if(X[t]=='T')
{
if(dfs(t+1,k*10%7))win=true;
else if(dfs(t+1,(k*10+S[t]-'0')%7))win=true;
}
else
{
if(!dfs... | #include <iostream>
using namespace std;
const int kMaxN = 2e5;
int n, s[kMaxN], x[kMaxN];
int f[kMaxN][7];
string tmp;
int main() {
ios_base::sync_with_stdio(NULL);
cin.tie(nullptr), cout.tie(nullptr);
cin >> n >> tmp;
f[n][0] = 1;
for (int i = 0; i < n; i++) {
s[i] = tmp[i] - '0';
}
cin >> tmp;... |
#include<bits/stdc++.h>
#define int long long
constexpr long long mod = 1000000007;
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
#define puts(x) cout << x << "\n"
using namespace std;
int dp_a[1234], dp_b[1234];
sig... | #include <bits/stdc++.h>
using namespace std;
using Int = long long;
const char newl = '\n';
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}
te... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define repl(i,n) for(ll i=0;i<n;i++)
#define repl1(i,n) for(ll i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i... | #include <bits/stdc++.h>
using namespace std;
long long A[200005];
int main(){
int N;
scanf("%d", &N);
for(int i = 0; i < N; i ++){
scanf("%lld", &A[i]);
}
long long max1 = 0;
long long tempSum = 0;
long long prefixSum = 0;
for(int i = 0; i < N; i ++){
prefixSum += A[... |
//#define _GLIBCXX_DEB // Iterator safety; out-of-bounds access for Containers, etc.
//#pragma GCC optimize "trapv" // abort() on (signed) integer overflow.
#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 ... | #include <bits/stdc++.h>
using namespace std;
string s;
char get (char c) {
if (c == '0') return '0';
if (c == '1') return '1';
if (c == '6') return '9';
if (c == '9') return '6';
if (c == '8') return '8';
return 0;
}
int main() {
cin >> s;
reverse(s.begin(), s.end());
for (char &c : s) c = get(c)... |
#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()
template<typename T> bool chmax(T &x, const T &y) {return (x<y)?(x=y,true):false;};
template<typename T> b... | /*
author : aryan57
created : 13-June-2021 17:30:46 IST
*/
#include <bits/stdc++.h>
using namespace std;
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable... |
//#pragma GCC optimize ("O2")
//#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#include<cstdio>
#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 ... | #include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define time_taken_start int begtime = clock();
#define time_taken_end int endtime = clock(); \
cerr << "\n\n" << "Time elapsed: " << \
(endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
return 0;
#define ll l... |
#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a; i<b; i++)
#define fr(i,a,b) for(int i=a; i>=b; i--)
typedef vector<int> vi;
typedef long long int ll;
typedef vector<ll> vll;
#define fastio std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PI 3.1415926535
// ll Mod = 1e9+7;... | #include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pa pair<int,int>
const int Maxn=5010;
const int inf=2147483647;
const int mod=998244353;
const double pi=acos(-1.0);
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... |
#include <bits/stdc++.h>
using namespace std;
template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }
template <typename T>
struct fenwick {
int n, ... | #include <bits/stdc++.h>
using namespace std;
int n;
long long t, arr[45];
vector<int> v[2];
vector<long long> p[2];
int id;
long long ans = 0;
void solve(int idx, long long sum) {
if (sum > t) return;
if (idx == v[id].size()) {
// cout << "SUM " << sum << endl;
p[id].push_back(sum);
... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a... | #include <bits/stdc++.h>
using namespace std;
#define DEBUG
#ifdef DEBUG
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << '(' << p.first << ',' << p.second << ')';
return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
os << '{';
f... |
#include <bits/stdc++.h>
#include <chrono>
#include <ctime>
using namespace std;
using namespace chrono;
#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) for(auto x:obj)cout<<x<<' ';cout<<endl;
typedef vector<vector<int>> state;
boo... | #include<bits/stdc++.h>
#define int long long
#define ll long long
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fs first
#define sd second
#define rept(x,n) for(int i=x;i<n;i++)
#define rrept(n,x) for(int i=n-1;i>=x;i--)
#define all(v) v.begin(),v.end()
#define mpit map<int,int>::... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<double, int> P;
#define rep(i, x) for (int i = 0; i < x; i++)
auto start = std::chrono::system_clock::now();
int cnt = 0;
double gettime() {
auto end = std::chrono::system_clo... | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using ll = long long;
using... |
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_bac... | /* May the force be with you */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define FASTANDFURIOUS ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define For(i,n) for(ll i=0;i<n... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define f(i,n) for(int i=0; i<n; ++i)
#define fi(i,st,n) for(int i=st; i<=n; ++i)
#define veci vector<int>
#define vecp vector<pair<int,int> >
#define vecl vector<ll>
int prime[100000+10];
ll lcm(ll ... | /**
* author: sourav rakshit
* created: 13.12.2020 17:30:15
**/
/*
#pragma GCC optimize("O3")
#pragma GCC target ("avx2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include... |
// Etavioxy
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#define il inline
#define ll long long
#define rep(i,s,t) for(register int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[... | #include <bits/stdc++.h>
// #include <atcoder/all>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1... |
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define per(i,n) for(int i=(n)-1;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define per1(i,n) for(int i=(n);i>=1;i--)
#define repk(i,a,b) for(int i=(a);i<=(b);i++)
#define perk(i,a,b) for(int i=(a);i>=(b);i--)
#define rep0(i,a,b) for(int i=(a);i<... | #include <cctype>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <ios>
#include <iostream>
#include <iterator>
#include <string_view>
#include <utility>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <climits>
#include <cmath>
#include <sstream>
#inc... |
#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;
// #pragma GCC optimize("O2")
typedef long long int ll;
typedef long double ld;
typedef map <ll,ll> mm;
typedef vector <ll> mv;
typedef pair <ll,ll> mp;
typedef set <l... | #include<iostream>
#include<cmath>
#define ll long long
using namespace std;
const double eps = 1e-8;
int main() {
long double a, b, c, d;
cin >> a >> b >> c >> d;
if (d*c-b < eps) cout << -1;
else cout << ceil(a/(d*c-b));
return 0;
}
|
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<functional>
#include <random>
#include<iostream>
#include<iomanip>
using namespace std;
int main() {
/*(P-1)*(P-2)^(N-1)を出力すればよい。*/
long long N, P;
cin >>... | #include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <queue>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
long long MOD = 1000000007;
long long modpow(long long a, long long n, long long mod) {
long long res... |
//#include <atcoder/all>
//using namespace atcoder;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#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 ALL(v) v.begin(), v.end()
#define bit(n) (1LL<<(n))
#define FI... | #include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
bool can_go(int x, int y, vector<vector<char>> s) {
if(s[x][y] == '.') return true;
else return false;
}
int main() {
int h, w, x, y;
cin >> h >> w >> x >> y;... |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#ifdef TEST
#define getchar_unlocked _getchar_nolock
#endif
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
... | #include<bits/stdc++.h>
using namespace std;
const int N=201000;
const long long mod=1e9+7;
int n,K,Cnt;
int Num[N];
long long Ans;
string st;
bool vis[N];
long long Mul[N];
long long G[N][21][21];
long long F[N][21];
long long Pow(long long x,long long y){
long long sum=1;
for(;y;y>>=1,x=x*x%mod)if(y&1)sum=sum*x%mod... |
#include <bits/stdc++.h>
using namespace std;
long long dist(long long r1,long long c1,long long r2,long long c2){
return abs(r1-r2)+abs(c1-c2);
}
int main(){
long long r1,c1,r2,c2,x1,y1,x2,y2;
string s;
cin >> r1 >> c1 >> r2 >> c2;
int ct = 0;
while(dist(r1,c1,r2,c2)>0){
ct++;
if (r1+c1 ==... | /*
“The only way that we can live is if we grow.
The only way we can grow is if we change.
The only way we can change is if we learn.
The only way we can learn is if we are exposed.
And the only way that we are exposed is if we throw ourselves into the open.”
*************************************** *************... |
#pragma GCC optimize ("O2")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(... | #include <bits/stdc++.h>
#define spd ios::sync_with_stdio(false),cin.tie(0)
#define mod 1000000007;
#define pie acos(-1)
#define eps 1e-9
#define fr(i,a,b) for(i = a; i < b; i++)
#define Fr(i,a,b) for(i = a; i >= b; i--)
#define rst(a,b) memset(a,b,sizeof(a))
#define in1(a) cin >> a
#define in2(a,b) cin >> a >> b
#defi... |
#include <bits/stdc++.h>
using namespace std;
int n;
bool validDec(int value){
bool ret = true;
while(value>0){
if(value%10==7){
ret = false;
break;
}
value /= 10;
}
return ret;
}
bool validOct(int value){
bool ret = true;
while(value>0){
i... | #include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define vi vector<int>
#define ll long long int
#define us unsigned long long int
#define dig(n) floor(log10(n)) + 1
#def... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MOD = 1000000007;
int main(){
int n;
cin >> n;
vector<int> a(1 << n);
for (int i = 0; i < (1 << n); i++){
cin >> a[i];
}
int leftmax = 0, rightmax = 0;
for (int i = 0; i < (1 <... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (b), _a = (a); i >= _a; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = (n) - 1; i >= 0; i--)
#define debug(x) cout<<"deb... |
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<set>
#include<cstdlib>
#include<cmath>
#include<numeric>//fill
#include<iomanip>
#include<functional>//https://cpprefjp.github.io/reference/functional/function.html
#include<cstdlib>//https://cpprefjp.githu... | #include <bits/stdc++.h>
using namespace std;
int main()
{
long long int n,f=0;
cin>>n;
string s,ans;
map<string,long long int>m;
vector<string>v;
for(int i=0; i<n; i++)
{
cin>>s;
if(s[0]=='!')
{m[s]=1;}
else v.push_back(s);
}
for(int i=0;i<v.size... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define MOD 1000000007LL
#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(... | #include <bits/stdc++.h>
//#include <atcoder/all>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
template<class T>
inline bo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.