code_file1 stringlengths 87 4k | code_file2 stringlengths 82 4k |
|---|---|
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
static const ll mod=1000000007;
int pow_mod(long long n,long long m,long long p){
if(p==0) return 1;
else if(p%2==1){
return pow_mod(n,m,p-1)*n%m;
}
else{
long long t=pow_mod... | #include<bits/stdc++.h>
using namespace std;
#define DONTSYNC ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) //dont use stdio with iostream functions //input and output are out of order now!
#define TEST unsigned long long T; cin>>T; while(T--) //loop over each testcase
#define endl "\n"
#define for... |
//https://oeis.org/search?q=0%2C0%2C1%2C2%2C4%2C6&language=english&go=Search
//https://smallpdf.com/result#r=dc43c99933feaa1c7f3a2f2e2036bc6a&t=pdf-to-word
#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <string.h>
using namespace std;
#define ll long long
#define INF 1000007
#define MAX 500007
#... | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
void solve()
{
int n,m,x,y;
cin>>n>>m>>x>>y;
x--,y--;
string s[n];
for(int i=0;i<n;i++) cin>>s[i];
int ans=0;
if(s[x][y]=='.')
{
ans++;
int x1 = x;
x--;
while(x>=0 && s[x][y]=='.') x--... |
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <vector>
static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;
template <typename T> std::vector<T> ... | #include <bitset>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <algorithm>
#include <functional>
#include <iterator>
#include <locale>
#include <memory>
#include <stdexcept>
#include <utility>
#include <string>
#include <fstream>
#include <i... |
#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;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r)
{
uniform_int_distribution<int> uid(l, r);
return uid(rng);... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define MOD(a, m) ((a % m + m) % m)
template<class T>bool chm... |
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <numeric>
typedef long long ll;
ll stringToFixedPoint(const std::string s, const int digitAfterDecimalPoint)
{
ll fp = std::stoi(s) * pow(10, digitAfterDecimalPoint);
const auto pos = s.find('.');
if (pos !... | #include "bits/stdc++.h"
using namespace std;
int main() {
long long N, K, M, COUNT = 0, A;
cin >> N >> K >> M;
COUNT = N * M;
for (int i = 0; i < N - 1; i++) cin >> A, COUNT -= A;
cout << (COUNT > K ? -1 : max(0LL, COUNT)) << endl;
} |
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
const int N = 4e6 + 7;
const int mod = 1e9 + 7 ;
int n , m, k ;
long long fact[N] ;
ll faspow(ll x, ll y, ll MOD = mod)
{
ll ret = 1ll;
while (y)
{
if (y & 1)
ret = 1ll * ret * x % MOD;... | //#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<st... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
double dp[101][101][101];
bool vis[101][101][101];
double func(int a,int b,int c){
if(a==100 || b==100 || c==100)
return 0;
if(vis[a][b][c]==1)
return dp[a][b][c];
vis[a][b][c]=1;
int cnt=a+b+c... | #include<iostream>
#include<cmath>
using namespace std;
int main() {
long long x, y, a, b;
cin >> x >> y >> a >> b;
long long now = 0;
long long tar = b / (a - 1);
while (x < tar && x * a < y) {
x *= a;
now++;
}
if (y - x - 1 > 0)
now += (y - x - 1) / b;
cout << ... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define INF LONG_MAX/3
//#define DIV 1000000007
//#define DIV 998244353
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, con... | #include <bits/stdc++.h>
using namespace std;
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '['; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << ']'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os <<... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template < typename T_cont... | #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
double n,d;
cin>>n;
cout<<n-1;
} |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)//iをaからn
#define per(i,a,n) for (int i=a-1;i>=n;i--)//iをnからa
#define db(x) cout << #x << " = " << x << endl
#define db2(x, y) cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; //デバッグ用
#define all(x) (x).begin(), (... | #pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<stdio.h>
#include<vector>
#include<algorithm>
constexpr unsigned long long MOD = 998244353;
constexpr unsigned long long IM = 18479187003;
constexpr unsigned long long MOD32 = 665496236;
unsigned long long dp[500... |
#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setpre... | #include<bits/stdc++.h>
using namespace std;
int n,m;
vector <int> f[233];
long long Ans = 1;
bool vis[233];
vector <int> v;
long long Now = 0;
void Find(int x)
{
v.push_back(x);
vis[x] = true;
for(auto X : f[x])
{
if(vis[X]) continue;
Find(X);
}
}
int c[233];
void DFS(int Ind)
{
if(Ind == v.size())
{
... |
#include<bits/stdc++.h>
using namespace std;
int main()
{
cout << fixed << setprecision(15);
int n;
cin >> n;
vector<int>x(n);
for(int i=0;i<n;i++)cin >> x[i];
long ans1=0;
for(int i=0;i<n;i++)ans1+=abs(x[i]);
cout << ans1 << endl;
long ans2=0;
for(int i=0;i<n;i++)ans2+=abs(x[i])*(long)abs(x[i]);
cout << ... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define inf 1e18
#define endl "\n"
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define pii pair<... |
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
int main(){
ld x,y,r;
cin >> x >> y >> r;
r += 1e-14;
long long ans = 0;
for(int i=ceil(x-r);i<=floor(x+r);i++){
ld sq = (x - i) * (x - i);
ld a = floor(y + sqrt(r * r - sq));
ld b = ceil(y - sqrt(r * r - sq));
ans += (a - b) + 1;
}
c... | #include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
using ll = long long;
using ld = long double;
#define all(s) (s).begin(),(s).end()
#define vcin(n) for(ll i=0;i<ll(n.size());i++) cin>>n[i]
#define rep2(i, m, n) for (int i = (m); i < (n... |
#include <bits/stdc++.h>
using namespace std;
#define int long long
//#define int unsigned int
//#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
//#define lb lower_bound
//#define ub upper_bound
//#define bs binary_search
#define mod 1000000007 // mod+2
#define double long double
#defin... | #include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using namespace std;
int main() {
int n;
cin >> n;
int t[n];
string s[n];
string a="string";
stri... |
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
using namespace std;
int main(){
long a,b,c;
cin >> a >> b >> c;
a %= 10;
b %= 4;
long iIndex = 0;
if(b == 0){
iIndex... | #include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <cstring>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(int i... |
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if(a > b) {
a = b;
return 1;
}
return 0;
}
#define DEBUG
#ifdef DEBUG
templ... | #include <bits/stdc++.h>
using namespace std;
const int N = 2005;
int n, m;
char s[N][N];
pair<int, int> st, en;
vector<pair<int, int>> teleports[26];
int dx[4] = {0, -1, 0, 1};
int dy[4] = {1, 0, -1, 0};
int dist[N][N];
bool used[26];
bool vis[N][N];
void bfs() {
queue<pair<int, int>> q;
q.push(st);
vis[st... |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x;
scanf("%d",&x);
printf("%d",100-x%100);
return 0;
} | #include<cstdio>
#include<algorithm>
using namespace std;
inline int read(){
char c=getchar();int x=0,f=1;
for(;c<'0'||c>'9';c=getchar())if(c=='-')f=0;
for(;c<='9'&&c>='0';c=getchar())x=(x<<1)+(x<<3)+(c^48);
return f?x:-x;
}
inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
i... |
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
int main(){
int N;
cin >> N;
vector<int> W(N);
for (int i = 0; i < N; i++){
cin >> W[i];
}
int S = 0;
for (int i = 0; i < N; i++){
S += W[i];
}
if (S % 2 == 1){
cout << 0 << endl;
} else {
vector<vector<lo... | # pragma GCC optimize ("O3")
# pragma GCC optimize ("Ofast")
# pragma GCC optimize ("unroll-loops")
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define rep2(i,a,b) for(int i = (b) - 1; i >= (a); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int... |
#include <bits/stdc++.h>
using namespace std;
const int f[3][3] = {
{1, 0, 0},
{1, 1, 0},
{1, 2, 1}
};
const int mod = 3;
int lucas(int x, int y) {
int res = 1;
while (x) {
res = res * f[x % mod][y % mod] % mod;
x /= mod, y /= mod;
}
return res;
}
int mp[200];
void solve()... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for (int i = 0; i < (int)(n) ; i++)
#define rep2(i,a,b) for (int i = (a); i < (int)(b); i++)
#define repR(i,n) for (int i = (int)(n)-1; i >= 0; i--)
#define ENDL '\n'
#define pb push_back
#define SIZE(a) (int)(a... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define f first
#define s second
const int N = 20;
int n , m , ans , cur , dp[1<<N];
bool edge[N][N] , good[1<<20];
vector<int> v;
void solve(int i)
{
if (i == n)
{
for(int j=0; j<v.size(); j++)
{
... | #include <cstdio>
#include <algorithm>
const int Maxn=200000;
const int Inf=0x3f3f3f3f;
int n,k;
int head[Maxn+5],arrive[Maxn<<1|5],nxt[Maxn<<1|5],tot;
void add_edge(int from,int to){
arrive[++tot]=to;
nxt[tot]=head[from];
head[from]=tot;
}
int dis;
int num;
int f_1[Maxn+5],f_2[Maxn+5];
void work_dfs(int u,int fa){
... |
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define ll long long
//#define cccgift
#define lowbit(x) ((x)&-(x))
#define rep(i,l,r) for(res i=l,_r=r;i<=_r;++i)
#define per(i,r,l) for(res i=r,_l=l;i>=_l;--i)
#define mkp make_pair
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ff first
#define ss second
#define rsz resize
#define ins insert
#define mp make_pair
#define pf push_front
#define pb push_back
#define eb emplace_back
#define ft front()
#define bk back()
#define sz(x) (int)(x).siz... |
#include <bits/stdc++.h>
using namespace std;
double eps = 1e-9;
double pi = acos(-1);
int fx[8] = {1, -1, 0, 0, 1, -1, -1, 1};
int fy[8] = {0, 0, 1, -1, 1, -1, 1, -1};
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0);
#define ll long long
#define en "\n"
#define ff first
#define ss second
#define sp(x) ... | #include <bits/stdc++.h>
using namespace std;
int N, c, r, i{2}, m;
int main()
{cin >> N; int A[N]; for (int &a: A) cin >> a;
for (; c = 0, i <= 1000; m = c > m ? r = i, c : m, ++i) for (int a : A) c += !(a % i);
cout << r;} |
// abc199_b
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../../debug_util/cxx-prettyprint/prettyprint.hpp"
#include "../../debug_util/rng.hpp"
#include "../../debug_util/timer.hpp"
#endif
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>... | //@formatter:off
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define rrep(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = int(s); i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#de... |
#include<bits/stdc++.h>
using namespace std;
#define N 400005
struct node{int pos,val;}b[N];
int a[N],n,i,val[N],st[N],hd;
char ans[N];
inline bool cmp(node aa,node bb){return aa.val<bb.val;}
int main(){
cin>>n;
for(i=1;i<=n+n;++i)cin>>a[i],b[i].pos=i,b[i].val=a[i];
sort(b+1,b+n+n+1,cmp);
for(i=n+1;i<=n+n;++i){
v... | #include <iostream>
#include <map>
using namespace std;
void test_case()
{
int N,curr;
cin>>N;
map<int,int> freq;
for (int index=0; index<N;index+=1){
cin>>curr;
freq[curr] += 1;
}
string res = "Second";
if (N%2 == 0){
// even
// A goal is to break symmerty and... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define pb push_back
#define fi first
#define se second
using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1e8;
const ll MOD = 1000000007;
ll GCD(ll x, ... | #include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define tf(x) get<0>(x)
#define ts(x) get<1>(x)
#define tt... |
#include <bits/stdc++.h>
int n;
int main(){
std::scanf("%d", &n);
for(int i = 1; i <= n; ++i)
std::printf("%d %d\n", i * 2 % n + 1, (i * 2 - 1) % n + 1);
} | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MTP make_tuple
typedef long long int ll;
constexpr int kN = int(1E3 + 10), kInf = int(1E9 + 10);
int a[kN], b[kN];
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) a[i]... |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n; cin >> n;
vector<pair<int, int>> z;
pair<int, int> c;
for (int i=0; i<n; i++)
{
cin >> c.first >> c.second;
z.push_back(c);
}
bool flag = false;
for (int i1=0; i1<n; i1++)
{
for (int i2=i1+1; i... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll t;
scanf("%lld",&t);
while(t--){
ll l,r;
scanf("%lld %lld",&l,&r);
ll t = (r-l)-l+1;
ll res;
if(t>0) res = (t+1)*t/2;
else res = 0;
printf("%lld\n",res);
}
return 0;
}
|
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ull=unsigned long long;
const ll LL_MAX=LLONG_MAX;
struct In{
template<typename T>
operator T(){
T x;
cin >> x;
return x;
}
};
In in;
template <typename T,typename U>
void forin(T* x,U n){
... | #include <bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(0), cin.tie(NULL)
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl '\n'
#define mkp make_pair
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
constexpr int INF = INT_MAX;
using namespace std;
int m... |
#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
#define DEBUG
#ifdef DEBUG
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
os << '(' << ... | #include <bits/stdc++.h>
using namespace std;
int arr[1500002];
int krr[1500002];
int tree[4*1500002];
void update(int node,int b,int e,int i,int val)
{
if(b==e&&b==i){
tree[node]=val;
return;
}
int mid=(b+e)>>1;
int left=node*2;
int right=left+1;
if(i<=mid)update(left,b,mid,i,va... |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#ifndef aa
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define u... | #include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define int long long
#define pb push_back
#define pii pair<int,int>
#define endl "\n"
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7,mxn=1e5 + 5;
signed main(){
gok
int t=1;
//cin>>t;
while(t-... |
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
en... | #include<bits/stdc++.h>
using namespace std;
int main(){
int i,N; cin>>N;
string S,kariS; cin>>S;
int Q; cin>>Q;
int T[300005],A[300005],B[300005];
for(i=0;i<Q;i++) cin>>T[i]>>A[i]>>B[i];
string S1,S2;
S1=S.substr(0,N);
S2=S.substr(N);
for(i=0;i<Q;i++){
if(2==T[i]){
swap(S1,S2);
}
... |
#include <bits/stdc++.h>
#define DEBUG if(0)
#define lli long long int
#define ldouble long double
using namespace std;
const int maxSz = 2e5, maxCnt = 16;
char s[maxSz + 1];
int n[maxSz]; int sz, k;
const lli mod = 1e9 + 7;
lli memo[maxSz][maxCnt + 1][2][2];
lli solve(int mask = 0, int i = 0, bool equal = true, bool... | #include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b, x, y;
while (cin >> a >> b >> x >> y)
{
int a2 = 0x7fffffff, a3 = 0x7fffffff, a4 = 0x7fffffff;
int a1 = abs(a - b) * y + x;
if (a > b)
a2 = ((a - b) * 2 - 1) * x, a4 = (a - b - 1) * y + x;
else
a3 = ((b - a) * 2 + 1) ... |
#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 ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define si(n) scanf("%d",&n);
#define PI acos(-1.0... | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a;
cin >> a;
int b;
cin >> b;
int c;
c = n - a + b;
cout << c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main()
{
size_t N, M;
cin >> N >> M;
vector<int> A(M + 2, 0);
for (size_t i = 1; i <= M; i++)
{
cin >> A[i];
}
A.back() = N + 1;
sort(A.begin(), A.end());
map<int, size_t> count;
int minimum = N;
for (size_t i = 0; ... | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<ll>
#define pb push_back
#define ff first
#define ss second
#define inf 2e18
#define ull unsigned long long
#define pi acos(-1.0)
#define mod 1000000007
#define lop0(n) for(ll i=0;i<n;i++)
#define lop(j,n) for(ll j=0;j<n;j++)
#define l... |
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define tr(x, it) for(auto (it) = (x).begin();it != (x).end();it++)
#define fo(i, k, n) ... | #include <bits/stdc++.h>
//#include <atcoder/modint>
#define inc(i, n) for (int i = 0; i < (n); i++)
#define incs(i, s, n) for (int i = (s); i < (n); i++)
#define yes printf("Yes\n")
#define no printf("No\n")
using namespace std;
//using mint = atcoder::modint998244353;
using pii = pair<int, int>;
using ll ... |
#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 ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
typedef long double ld;
typedef unsigned lon... | #include <iostream>
#include <string>
using namespace std;
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <set>
#include <map>
#include <cassert>
#include <queue>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 20... |
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define ull unsigned long long
void testcase(){
ll n,ans=0;
cin>>n;
for(int i=1;i<=n;i++){
bool st=true;
int j=i;
while(j){
if(j%10==7){
st=false;
bre... | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);
int n;
cin >> n;
cout << (1<<n) - 1 << '\n';
vector<string> ans = {"AB"};
for (int i = 1; i < n; ++i) {
for (int j = 0; j < (1<<i) - 1; ++j) {
string tmp = ans[j];
for (int k ... |
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x) cerr << "Line " << __LINE__ << ": " << #x << " = " << (x) << "\n";
#define spa << " " <<
#define fi first
#define se second
#define ALL(a) (a).begin(),(a).end()
#define ALLR(a) (a).rbegin(),(a).rend()
using ld =... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll findMaxGCD(vector<ll> &arr) {
ll n=arr.size();
ll high = 0;
for (ll i = 0; i < n; i++)
high = max(high, arr[i]);
ll divisors[high + 1] = { 0 };
for (ll i = 0; i < n; i++) {
for (ll j = 1; j <= sqrt(arr[i... |
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define hackcyborg shresth_walia
#define all(a) a.begin(), a.end()
#define ll long long
#define ld long double
#define pb push_back
#define mod 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NUL... | #include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,n) for(int i = n-1; i >= 0; i--)
#define ll long long
#define P pair<int, int>
#define INF32 2147483647 //2.147483647×... |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define deb(...)
#endif
#define endl "\n"
#define pb push_back
#define int long long
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define all(c) c.begin(),c.end()
#define read(v) for(auto &it:v) cin>>i... | //#include<bits/stdc++.h>
#include<algorithm>
#include<iostream>
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<vector>
#define swap(x,y) (y -= (x = ((y += x) - x)))
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define rep(i,n) for(int i = 0; i <... |
#include <bits/stdc++.h>
#include <vector>
using namespace std;
typedef long long int64;
struct Edge {
int to;
int cost;
};
using Graph = vector<vector<Edge>>;
int ans[200010]={0};
int N=0;
// 深さ優先探索
vector<bool> seen;
void dfs(const Graph &G, int v,int prev_label) {
//printf("%d is seen prev_label=%d... | // *********************************************************************************
// * MURTAZA MUSTAFA KHUMUSI *
// * NIT-DGP,CSE - 2019-2023 *
// **************************************************************... |
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define mp make_pair
#define ll long long
#define pb push_back
#define INF 1e6
vector<int>ans,a,b;
void dfs(int u, vector<int>&visited, vector<vector<pair<int,int> >>&adj)
{
visited[u] =1;
for(auto p:adj[u])
{
int v = p.fi... | #include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#... |
#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18;
void print0() {}
template<typename Head,typename... Tail> void print0(Head head,Tail... tail){cout<<fixed<<setprecision(15)<<head;print0(tail...);}
void print() { print0("\n"); }
template<typ... | #define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printA... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,x,n) for(int i=x;i<(int)n;++i)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define out(a) cout<<a<<endl;
#define vout(v) rep(i,0,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vvout(vv) rep(j,0,vv.size()){vout(vv[j])}
#define mout(m) for(auto... | #include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
//mt19937_64 mrand(42);
#define ii for(int i=1;i<=n;++i)
#define ji for(int j=1;j<=n;++j)
#define jj for(int j=1;j<=m;++j)
#define ij for(int i=1;i<=m;++i... |
#include<iostream>
using namespace std;
int main()
{
int m,h;
cin>>m>>h;
if(h%m==0)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
} | #include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long ... |
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#end... | //#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
//#include<ctime>
//#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
... |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define M 1000000007
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
const int N = 1e5 , inf = 1e9;
int n , m , k , c[17] , dist[17][N] , id[N] , dp[17][1<<17] , vis[N];
... | #include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#inc... |
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<cstdint>
#include<algorithm>
#include<cstddef>
#include<vector>
//#include<atcoder/all>
//using namespace atcoder;
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using usize =... | #include<bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'
typedef long long ll;
typedef pair<int,int> pii;
typedef... |
#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;
int main(void) {
int a, b, w;
cin >> a >> b >> w;
w *= 1000;
int ca = w / a, cb = (w + b - 1) / b;
if (cb <= ca) {
cout << cb << " " << ca << endl;
} else {
cout << "UNSATISFIABLE" << endl;
}
return 0;
}
|
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
int h,w,x,y;
cin >> h >> w >> x >> y;
vector<string> s(h);
for(int i = 0;i < h;i++){
cin >> s[i];
}
x--;
y--;
int ans = 1;
for(int i =y+1;i < w;i++){
if(s[x][i] == '.'){
... | #include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#incl... |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long ll;
using namespace std;
const ll INF = 1e18;
struct edge {
ll to;
ll cost;
ll d;
};
using P = pair<ll, ll>;
vector<vector<edge>> G;
vector<ll> d;
void dijkstra(int s) {
priority_queue<P, vector<P>, greater<P>> que... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
int n,m;
vector<int> a,b;
vector<ll> c,d;
vector<vector<int>> links;
vector<ll> earliest;
priority_queue<pair<ll,int>, vector<pair<ll,int>>,greater<pair<ll,int>>> q;
void initialize(){
cin >> n >> m;
links.resize(n,v... |
#include<iostream>
using namespace std;
int main(){
int A,B,C;
cin >> A >> B >> C;
int AB,AC,BC;
AB = A + B;
AC = A + C;
BC = B + C;
if(AB >= AC && AB >= BC){
cout << AB;
}
else if(AC >= AB && AC > BC){
cout << AC;
}
else{
cout << BC;
}
return 0;
} | ///******* In the name of Allah *******///
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false), cin.tie(NULL);
#define nl '\n'
void Ok()
{
long int a[13],b,c, d, e, f, g, h, t, i, j, k, l, m, n, Mn, Mx;
long int ans_1, ans_2, ans_3, cnt_1, cnt_2, cnt_3, flag_1, flag_2... |
#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 chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template <t... | #pragma warning(disable:4996)
#include<iostream>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_map>
#include<numeric>
#include<fstream>
#include<iomanip>
#include<string>
#include<cmath>
#include<cstring>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<sta... |
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdint>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <regex>
#incl... | #include<bits/stdc++.h>
#define pll pair<ll, ll>
#define fi first
#define se second
#define pb push_back
#define task "SKILEVEL"
#define pii pair<ll, pll>
using namespace std;
using ll = long long;
const int N = 5e5+5;
const ll mod = 1e9+7;
const ll base = 350;
const ll cs = 331;
ll m, n, t, k, tong, q, ans, a[N], b[N... |
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;
const ll INF = 1000000000000000000;
ll dfs(ll z, int j, ll y, map<ll, ll> &mp){
if(j == 0){
return mp[z] = abs(z - y);
}
if(mp.count(z)) return mp[z];
ll res = INF;
if(((z + 1) << j) <= y){
res = min(res,... | #include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>... |
// JG GAP GG
#include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
#include<set>
#include<math.h>
#include<map>
#include<unordered_map>
#include<iomanip>
#include<queue>
using namespace std;
using ll = long long;
using ull = unsigned long long;
ll amari = 1000000007;
#define re... | #include <iostream>
#include <cstring>
using namespace std;
int N;
long long dp[105][105][105];
int a[101];
long long X;
int len;
// f(i, j, k) -> minimo tiempo para alcanzar X tomando a i pociones y llevando j pociones actualmente con suma k
long long f(int i, int j, int k)
{
if (i == 0)
return k == X%... |
#include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
if (a == b) {
cout << c << endl;
return 0;
} else if (a == c) {
cout << b << endl;
return 0;
} else if (b == c) {
cout << a << endl;
return 0;
} else {
... | #include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,d;
cin >> a >> b >> c >> d;
cout << b - c << endl;
} |
#include <bits/stdc++.h>
#define int long long
#define endl "\n"
#define mod 1000000007
#define inf 0xFFFFFFFFFFFFFFFL
using namespace std;
void solve()
{
int n, q;
cin >> n >> q;
vector<int> v(n);
int mn = INT_MAX, mx = INT_MIN;
for (int i = 0; i < n; i++)
cin >> v[i], mn = min(v[i], mn), mx = max(v[i], mx);... | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define fr(i,k,n) for (int i = k; i < n; ++i)
#define fri(i,k,n) for (int i = k; i >= n... |
#include <bits/stdc++.h>
#include <random>
#include <chrono>
using namespace std;
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef ... | #include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
//#include <atcoder/convolution>
//#incl... |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define inf 1e18
#define mod 1000000007
#define mod1 998244353
#define mod2 999983
#define N 200000
//***DON'T GET STUCK ON ONE APPROACH
ll power(ll a, ll n, ll m);
ll power(ll a, ll n, ll m)
{
if (n == 0)
return 1;
ll x = power(a, ... | /// ||====================================================================||
/// || Name: Ezaz Hossain ||
/// || CodeChef: ezaz21025 ||
/// || NIT Durgapur ||
/// ||=... |
#include<bits/stdc++.h>
using namespace std;
int n,k,mod,dp[110][1000010],sum[110];
int main() {
ios::sync_with_stdio(0);cin.tie(0);
cin>>n>>k>>mod;
dp[0][0]=1;
for(int i=1;i<=n;i++) {
memset(sum,0,4*i);
for(int j=0,lim=n*n*k;j<=lim;j++) {
int r=j%i;
sum[r]=(sum[r]+dp[i-1][j])%mod;
if(j-(k+1)*i>=0) s... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,l,r) for(int i=l;i<r;i++)
const int inf=2e9+10;
const int INF=9e18+10;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
const ll tmax=200000;
int main(){
int h,w;cin>>h>>w;
... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;
typedef pair<int,int> P;
typedef tuple<int,int,int> tpl;
#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).e... | #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef pair<string,int> psi;
typedef pair<int,string> pis;
typedef array<int,2> aii;
typedef array<int,3> aiii;
typedef array<int,4> aiiii;
typedef unsigned long long ull;
typedef long long int ll;
typedef array<ll,2> all;
typedef array<ll,3> all... |
#include <bits/stdc++.h>
#define FASTIO
using namespace std;
using ll = long long;
using Vi = std::vector<int>;
using Vl = std::vector<ll>;
using Pii = std::pair<int, int>;
using Pll = std::pair<ll, ll>;
constexpr int I_INF = std::numeric_limits<int>::max();
constexpr ll L_INF = std::numeric_limits<ll>::max();
templ... | #include <iostream>
using namespace std;
int a[110][110];
int main(){
int i,j,h,w,mn = 1000; cin >> h >> w;
for(i=0;i<h;i++){
for(j=0;j<w;j++){
cin >> a[i][j];
mn = min(mn,a[i][j]);
}
}
int sum = 0;
for(i=0;i<h;i++){
for(j=0;j<w;j++){
sum ... |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
#define SZ(x) (int) x.size()
#define F first
#define S second
const int N = 2e5 + 10, MOD = 1e9 + 7;
int id[N], P[N], F[N], n; ll inv = 0;
... | #include <bits/stdc++.h>
using namespace std;
typedef long long i64;
void test_case() {
int n;
while (scanf("%d", &n) != EOF) {
vector<int> p(n+1);
vector<bool> used(n+1);
for (int i = 1; i <= n; i++) {
scanf("%d", &p[i]);
}
vector<int> a;
int k = 0;
for (int i = 2; i <= n; i++)... |
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000007
using namespace std;
int main(){
long n;
cin >> n;
vector<long> ans;
for(int i=1;i<sqrt(n)+1;i++){
if(n%i==0){
ans.push_back(i);
if(i*i != n)ans.push_back(n/i);
}
}
sort(ans.begin(), ans.end());
rep(i... | #include <bits/stdc++.h>
using namespace std;
long long n;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
vector<long long> ans;
for(long long i = 1; i*i <= n; i++) {
if(n%i == 0) {
cout << i << '\n';
if(i*i != n) ans.push_back(n/i);
... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ff first
#define ss second
int main(void){
// Your code here!
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int i,j,ans,m,n;
cin >> n;
int a[n];
for(i=0;i<n;i++)
cin >> a[i];
ans=0;
for(i=0;i<n;i++)
{
... | #include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long
#define ull unsigne... |
#include <bits/stdc++.h>
using namespace std;
void solveOne()
{
vector<string> strings(3);
for(int i = 0; i < 3; i++)
cin >> strings[i];
set<char> letters;
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < strings[i].length(); j++)
{
letters.insert(strings[i][j]... | /*
Author : MatsuTaku
Date : 03/21/21
Certificate:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDF9T447OEo8XSQ6O1AznN5tKC8mzvYc4Zs3+oOKfMqgLXfOwQnpfcoxKs4MAP1eICBD13PkcIezJ9IlV6nKQZKs1BQmvjSXJ+zKK8YCKvAueNPuNO0Bim43IBaNHNFWcMvcmUvHgRb6hUSO0V8I7OsjiFo20KDBj3gAznu9tir0Q== CompetitiveProgrammingCertification:tk... |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define manytests int TT;cin >> TT; while (TT--)
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define FORd(i,a,b) ... | #include <bits/stdc++.h>
#define No return puts("-1"), 0
using namespace std;
typedef long long i64;
const int N = 2e5+10;
int n, m, a[N], b[N], c[N], to[N], bt[N];
vector<int> da[N], db[N];
void add(int x, int v=1) { for(; x <= n; x += x&-x) bt[x] += v; }
int ask(int x) { int y = 0; for(; x; x -= x&-x) y += bt[x]; re... |
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
#define PIL pair<int,LL>
#define PLI pair<LL,int>
#define PIII pair<int,PII>
#define PLL pair<LL,LL>
#define PLII pair<LL,PII>
#define VI vector<int>
#define VVI vector<VI>
#define VL vector<LL>
#define VVL vector<VL>
#define VPII vector<PII>
#defi... | #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 n,a,ans;
int main() {
cin>>n;
while(n--) {
cin>>a;
ans+=max(0,a-10);
}
printf("%d\n",ans);
return 0;
}
| #pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define max(a, b) (a < b? b : a)
#define min(a, b) ((a>b)?b:a)
#define MOD 1000000007
#define FOR(a,c) for ( ll (a)=0; (a)<(c); (a)++)
#define FORL(a,b,c) for ( ll (a)=(b); (a)<(c); (a)++)
#define FORR(a,b,c) ... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define V vector
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define sz(x) int(x.size()... | /* हरे कृष्ण हरे कृष्ण कृष्ण कृष्ण हरे हरे
हरे राम हरे राम राम राम हरे हरे */
#include<bits/stdc++.h>
using namespace std;
#define pb emplace_back
#define pob pop_back
typedef long long int lli;
#define test lli t; cin>>t;... |
#include <bits/stdc++.h>
#define fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define ll long long
//#define file
using namespace std;
int n,i,j,k,l,m,sum;
ll s[2];
char st[21];
int main()
{
#ifdef file
freopen("a.in","r",stdin);
#endif
scanf("%d%d",&n,&m);
fo(i,1,n)
{
scanf("%s",st... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define Rep(i, a, b) for(ll i = a; i <= b; i++)
#define repr(i, a, b) for(ll i = b-1; i >= a; i--)
// #define _GLIBCXX_DEBUG
template <class T> using V = vector<T>;
#define ALL(v) (v).begin(),(v).end()
#... |
#pragma region Region_1
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
using ll = long long;
using ... | #include <bits/stdc++.h>
#define FASTIO
using namespace std;
using ll = long long;
using Vi = std::vector<int>;
using Vl = std::vector<ll>;
using Pii = std::pair<int, int>;
using Pll = std::pair<ll, ll>;
constexpr int I_INF = std::numeric_limits<int>::max();
constexpr ll L_INF = std::numeric_limits<ll>::max();
templ... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define All(a) (a).begin(),(a).end()
#define INF numeric_limits<ll>::max()
int main(){
ll n,i,ans;
cin >>n;
n++;
for(i=(ll)sqrt(2*n);i*(i+1)>2*n;i--){
}
cout << n-i << endl;
return 0;
}
| #include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{ ios_base::sync_with_stdio(false); cin.tie(0);
long long n, min, max;
cin>>n;
min = 0;
max = n+1;
while(max > min){
min++;
max-=min;
}
cout<<n-min+1<<endl;
} |
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a... | //#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;
using namespace std;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0)... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pii pair <int,int>
#define pll pair <ll,ll>
#define testcase() int t; cin>>t; while(t--)
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,n)... | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cmath>
// #include <atcoder/all>
using namespace std;
using ll = long long int;
using vi = vector<int>;
using vll = vector<ll>;
using ss = string;
using db = double;
template<class T> us... |
#include<bits/stdc++.h>
using namespace std;
#define asll unsigned long long
#define ll long long
#define ld long double
#define imt int
#define pii pair<int,int>
#define st first
#define nd second
#define psbk(x) push_back(x);
#define For(x,a,b) for(int x=(a);x!=(b+((b-a)/abs(b-a)));x+=(b-a)/abs(b-a))
#define FOR(x,n... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << end... |
#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... | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
using ll=long long int;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool ch... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 1001001001;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
std::string to_string(long long);
using std::stol;
int main() {
ll n;
cin >> n;
vector<double> x(n);
vector<do... | #include<iostream>
#include<vector>
using namespace std;
float findslope(vector<long> point1, vector<long> point2)
{
double x1 = point1[0];
double y1 = point1[1];
double x2 = point2[0];
double y2 = point2[1];
return ((y2-y1)/(x2-x1));
}
int main(){
long N;
cin >> N;
vector<vector<long>> coordinates;
... |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define lb lower_bound
#define ub upper_bound
#define fe(x) (*(x.begin()))
#define le(x) (*(x.rbegin()))
#define pb ... |
// Problem: C - ORXOR
// Contest: AtCoder - AtCoder Beginner Contest 197(Sponsored by Panasonic)
// URL: https://atcoder.jp/contests/abc197/tasks/abc197_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include<bits/stdc++.h>
typedef long long int ll;
#d... |
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
using namespace std;
const int max_n = 2010;
const int Mod = 1e9+7;
const int inf = 1e18;
const int lim = 3e3+20;
char a[max_n][max_n];
int dist[max_n][max_n],visited[max_n][max_n];
int v_char[26];
vector<pair<int,int> > adj[26];
pair<int,int> dir[4] =... | #include <bits/stdc++.h>
#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;
using P = pair<int, int>;
const int inf{int(1e9)};
int main(void){
int N;
string T;
cin >> N >> T;
// N == 1 or 2を例外処理
if (N == 1){
if (T == "0") cout << 10... |
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define SET0(a) memset(a,0,sizeof(a))
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DWN(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll;
const ll INF=LLONG_MAX;
typedef pair<ll,ll> PII;
const int N=1e5+5;
ll d[N];
struct node{
l... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vld = vector<ld>;
using vvld = vector<vld>;
#define fi first
#define se second
#define pb push_back
#define all(a) a.begi... |
#include <bits/stdc++.h>
#define fi first
#define se second
//#define ivorysi
#define enter putchar('\n')
#define space putchar(' ')
#define pii pair<int,int>
#define MOD 998244353
#define MAXN 100005
typedef long long int64;
using namespace std;
template<class T>
void read(T &res) {
res = 0;T f = 1;char c = getchar... | #include<bits/stdc++.h>
#define ll long long int
using namespace std;
void solve(){
ll n;
cin>>n;
vector<ll>v;
for(ll i=2; i*i<=n; i++){
for(int j=2; j<=50;j++){
ll x = pow(i,j);
if(x>n){
break;
}
else{
v.push_back(pow(i,j));
}
}
... |
#include <iostream>
using namespace std;
int main() {
int a,b;cin>>a>>b;
cout<<(a+b)/2<<" "<<(a-b)/2<<endl;
return 0;
} | #include <bits/stdc++.h>
#include <fstream>
using namespace std;
typedef long long ll;
double pi = 3.141592653589793238;
const ll LL_INF_BIG = 1e18 + 7;
const ll LL_INF = 1e9 + 7;
const int INF = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template <class T> void chmin(T& a, T b) {
... |
# include<bits/stdc++.h>
using namespace std;
# define ll long long int
double amount(ll v,ll p)
{
return (v*p);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
ll n; cin>>n;
double x ; cin>>x;
pair <int,int> pr[n];
for(ll i=0;i<n;i++)
{
ll v,p; cin>>v>>p;
pr[i]={v,p};
}
double sum=0;
ll i;
for( i=0;i... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = (a), i##end = (b); i < i##end; ++i)
#define per(i, a, b) for (int i = (a) - 1, i##end = (b); i >= i##end; --i)
#define REP(i, a) rep(i, 0, a)
#define PER(i, a) per(i, a, 0)
namespace IO {
const int MAXIOSIZE = 1 << 24 | 1;
unsigned char... |
#include <bits/stdc++.h>
using namespace std;
typedef string str;
typedef long long ll;
typedef double db;
typedef pair<int,int> pi;
#define fi first
#define se second
#define int ll
#define all(x) begin(x), end(x)
typedef vector<int> vi;
typedef vector<str> vs;
#define pb push_back
#define rall(x) rbegin(x), rend(x)
#... | #include <iostream>
using namespace std;
int main()
{
int n, s, d;
cin >> n >> s >> d;
bool ans = false;
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
if (x < s && y > d)
{
ans = true;
}
}
if (ans)
{
cout << "Yes" <... |
#include <bits/stdc++.h>
#define LL long long
using namespace std;
template <typename T> void read(T &x){
x = 0; int f = 1; char ch = getchar();
while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
while (isdigit(ch)) {x = x * 10 + ch - '0'; ch = getchar();}
x *= f;
}
inline void write(int x){if (x > 9) wr... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define MP make_pair
using P = pair<int, int>;
const... |
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
using namespace std;... | #include <bits/stdc++.h>
int n;
inline int highbit(int a){
for(int i = 10; ~i; --i)
if(a & (1 << i))
return 1 << i;
return 0;
}
int main(){
std::scanf("%d", &n);
for(int i = 1; i <= n; ++i){
int a = i * 2, b = i * 2 + 1;
while(a > n) a -= highbit(a);
while(b > n) b -= highbit(b);
if(!a) a = 1;
if(... |
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define lln long long int
#define ld long double
#define all(x) (x).begin(),(x).end()
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int MOD = 1e9 + 7;
int main(){
IOS;
double a, b;
cin >> a >> b;
cout << ((a - b)... | // 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 <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <string>
#include <list>
#include <map>
#include <unordered_map>
using namespace std;
long long modpow(long long a, long long n, long long mod) {
long long re... | #include<bits/stdc++.h>
using namespace std;
#define fo(i,n) for(i = 0 ; i < n ; i++)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it ... |
#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>;
using namespace std;
#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)
const ll mod = 1e9 + 7;
ll f1(ll n) {
if (n < 0) return 0;
ll res = n * (n... | #include <iostream>
#include <algorithm>
using namespace std;
const long long waru = 1000000007;
int main()
{
long long t;
cin >> t;
long long ans[100000];
for (long long q = 0; q < t; q++) {
long long n, a, b;
cin >> n >> a >> b;
if (a < b) swap(a, b);
long long answer = 0;
long long m_answer = 0;... |
//#include <atcoder/mincostflow>
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using namespace std;
typedef pair<long long,long long> ii;
typedef long long lint;
signed main(){
//freopen("i.txt","r",stdin);
ios_base::sync_with_stdio(false); cin.tie(0... | #include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define pb push_back
using namespace std;
void test(){
string s;
cin>>s;
int a[3]={0};
int n = s.length();
int sum = 0;
f(i,n){
int x = s[i]-'0';
a[x%3]++;
sum = sum... |
#include <bits/stdc++.h>
using namespace std;
//ofstream cout("output.out");
#define fast() {ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define mii map<int, int>
#define pii pair<int, int>
#define qii prio... | #include <bits/stdc++.h>
using namespace std;
const int N=1e6+5,mod=1e9+7;
int n,a[N];
int main() {
cin>>n;
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
sort(a+1,a+1+n);
long long ans=1;
for(int i=n-1;~i;i--) ans*=(a[i+1]-a[i]+1),ans%=(mod);
cout<<ans;
}
|
#include<bits/stdc++.h>
struct em {
using type = std::pair<unsigned long, unsigned long>;
static type id(){ return {}; }
static type op(const type& a, const type& b){return {a.first + b.first, a.second + b.second};}
};
// from https://kazuma8128.hatenablog.com/entry/2018/11/29/093827
template <typename M... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define mod2 998244353
#define pi 3.1415926535897932384626
#define endl '\n'
#define all(x) x.begin(), x.end()
#define deb(x) cout << #x << " : " << x << endl;
#define deb2(x, y) cout << #x << " : " << x << ", " << #y << " : " <... |
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define nl cout<<endl
#define pii pair<ll,ll>
#define vi vector<ll>
#define vii vector<pii>
#define mi map<ll,ll>
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define ... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mk make_pair
int main(){
int n,m;
scanf("%d%d",&n,&m);
if(n==1&&m==0){
printf("%d %d\n",1,2);
return 0;
}
if(m<0||m==n||m==n-1){
printf("-1\n");
}
else if(m==0){
for (int i = 1; i <= n... |
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <numeric>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#define DEBUG(x) std::cout << '>' << #x << ':' << x << '\n';
#define PRINTVEC(x) for (int... | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); i++)
#define rep2(i,n) for (int i=1; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
int main() {
ll s,p; cin >> s >> p;
rep2(i,1000100) {
if(i*(s-i) == p) {
cout << "Yes" << endl;
return 0;
}
}
co... |
#include <bits/stdc++.h>
#include <string>
#include <sstream>
using namespace std;
int main(){
long n;
cin >> n;
string s;
long seven = 0;
stringstream ss;
std::string o;
for(int i = 1; i <= n; i++){
ss.str("");
ss << std::dec << i;
s = ss.str();
ss.str("")... | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/tag_and_trait.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
#include <ext/rope>
//#include <boost/multiprecision/cpp_int.hpp>
usi... |
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 998244353
using namespace std;
using ll = long long;
template<int M>
class ModInt {
public:
ll value;
constexpr ModInt(ll v = 0) { value = v % M; if (value < 0) value += M; }
c... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define BE(x) x.begin(), x.end()
int main() {
int h, w;
cin >> h >> w;
vector<string> s(h);
for (auto &x : s) cin >> x;
vector<bitset<2>> cnt;
for (int j = 0; j < w; j++) {
bitset<2> bs;
int jj = j;
for... |
#include <bits/stdc++.h>
#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 = 1e9 + 7;
constexpr ll inf =... | using namespace std;
#include<string>
#include<cmath>
#include<list>
#include <map>
#include <unordered_map>
#include <set>
#define ll long long
#define ld long double
#define ull unsigned long long
#define ml map<ll,ll>
#define pb push_back
#define mp make_pair
#define ppl pair<ll,ll>
#define F first
#define S second
... |
#include <bits/stdc++.h>
using namespace std;
int main() {
int a,b;
cin >> a >> b;
cout << (a+b)/2 << endl;
cout << (a-b)/2 << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vld vector<ld>
#define vvi vector<vector<int>>
#def... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.