code_file1 stringlengths 87 4k | code_file2 stringlengths 85 4k |
|---|---|
/**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author tatsumack
*/
#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (... | #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
#define M 998244353
#define INF 1e18L
int main()
{
int n, k;
cin >> n >> k;
vector<vector<long long>> t(n, vector<long long>(n));
for(int i = 0; i < n; i++)
... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define SZ(x) ((int)(x).size())
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, leng... | /* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
#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;
// ... |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(a==b && b==c)
cout<<a;
else if(a==b)
cout<<c;
else if(b==c)
cout<<a;
else if(a==c)
cout<<b;
else
cout<<"0";
} | #include <bits/stdc++.h>
#include <cmath>
#include <list>
#include <algorithm>
#include <stdio.h>
using namespace std;
#define M1 1000000007
const double pi = 3.14159265;
#define ll long long
#define lld long double
#define frf(i,n) for(ll i=0;i<n;i++)
#define pb push_back
#define fi first
#define se second
#define i... |
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vvvi = vector<vvi>;
using vb = vector<bool>;
using ll = long long; //約9.0*10^18
using vll = vector<ll>;
us... | #include<iostream>
#include<vector>
using namespace std;
int main() {
int n;
cin >> n;
bool b = true;
vector<int>vec(n);
fill(vec.begin(), vec.end(), 0);
for (int i = 0; i < n; i++) {
int m;
cin >> m;
if (vec[m-1]==0) {
vec[m-1] = 1;
}
else {
b = false;
break;
}
}
if (b)
cout << "Yes" << ... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define len(a) (int)a.size()
#define all(a) a.begi... | #include<bits/stdc++.h>
//#include<atcoder/all>
using namespace std;
//using namespace atcoder;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int, int>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rrep(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
... |
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#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 fast \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define ll long long
#define ld long double
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mkpr make_pair
#define fi(i,a,b) for ... |
#include<bits/stdc++.h>
using namespace std;
const int N = 2e3+100;
const int P = 1e9+7;
#define fr(i,a,b) for(int i = a;i <= b; ++i)
#define nfr(i,a,b) for(int i = a;i >= b; --i)
int a[N],b[N];
int n,m;
inline int pow_mod(int x,int k){
int res = 1,base = x;
while(k){
if(k&1)res = 1LL*res*base%P;
k ... | #include <bits/stdc++.h>
using namespace std;
int gi() {
int res = 0, w = 1;
char ch = getchar();
while (ch != '-' && !isdigit(ch)) ch = getchar();
if (ch == '-') w = -1, ch = getchar();
while (isdigit(ch)) res = res * 10 + ch - '0', ch = getchar();
return res * w;
}
const int MAX_N = 4e5 + 5;
int N, a[MAX_N];
lo... |
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int M = 1e9+7;
ll mod(ll x){
return (x%M + M)%M;
}
ll mul(ll a, ll b){
return mod((mod(a)*mod(b)));
}
ll add(ll a , ll b){
return mod(mod(a)+mod(b));
}
void solve(){
string s;
cin>>s;
int ok=0;
... | #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 cm (1 << 17)
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
if (ci - cn == cm) {
fread(cn, 1, cm, stdin);
ci = cn;
}
return *ci++;
}
inline int getint() {
int A = 0;
while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
ret... | #include <bits/stdc++.h>
using namespace std;
#define mnto(x, y) x = min(x, (__typeof__(x)) y)
#define mxto(x, y) y = max(x, (__typeof__(x)) y)
#define REP(i, s, e) for (int i = s; i < e; i++)
#define RREP(i, s, e) for (int i = s - 1; i >= e; i--)
typedef long long ll;
#define ALL(_a) _a.begin(), _a.end()
#define pb e... |
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int64_t> A(N);
for(int i=0; i<N; i++)
cin >> A.at(i);
int64_t o=0, x, ans=INT64_MAX;
for(int64_t bit=0; bit<(1<<N); bit++){
bit |= 1<<(N-1);
x = 0;
for(int i=0; i<N; i++){
o |= A.at(i);
if(1 & (bi... | #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>
#define int long long
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define puts(x) cout << (x) << "\n"
using namespace std;
int n, x[300], y[300], R[300], xe[300], ye[300];
bool fb(int i, int j) {
if (x[i] + xe[i] <= x[j])return 1;
if (x[j] + ... | #include <iostream>
#include <queue>
using namespace std;
const int da[4] = {-1, 0, 0, 0};
const int db[4] = {0, -1, 0, 0};
const int dc[4] = {0, 0, 1, 0};
const int dd[4] = {0, 0, 0, 1};
const int D = 10000;
struct Str
{
int s, r;
int id;
int dir;
bool operator<(const Str &right)const{
... |
/*
author : dunk_066
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
int n;
cin>>n;
if(n&1) cout<<"Black";
else{
cout<<"White";
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
int t=1;//cin>>t;
while(t--)
solve();
return 0;
}
| #include <bits/stdc++.h>
using namespace std;
#define FREP(i,a,b) for(long long i=a;i<b;i++)
#define REP(i,n) FREP(i,0,n)
#define PB push_back
#define ll long long
#define MP make_pair
#define mod 1000000007
#define endl "\n"
#define vi vector<ll>
#define si set<ll>
#define mi map<ll,ll>
#define bs binary_search
#defi... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a, b)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, n) for (ll i = n - 1; i >= 0; i--)
template <class T>
boo... | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define REP(i,k,n) for(ll i=k;i<ll(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se secon... |
#include<bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long
#define db double
#define rep(i,be,en) for(int i=be;i<=en;i++)
const int INF = 0x3f3f3f3f;
const ll inf=0x3f3f3f3f3f3f3f3f;
//const double pi=acos(-1);
const int mod=1e9+7;
#define eps 1e-8
#define zero(x) (((x)>0?(x):-(x))<eps)
using name... | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n;
cin>>n;
long long ans =1000000000000000000;
for(int i=0;i<61;i++){
long long b=i;
long long a=n/(1LL<<i);
long long c=n-a*(1LL<<i);
ans = min(ans,a+b+c);
}
cout << ans << endl;
}
|
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define ti3 tuple<int,int,int>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll mod = 1e... | #include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>
#include <ctype.h>
using namespace std;
typedef long long ll;
const int INF = (1<<30)-1;
const ll LINF... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0) val += MOD;
}
constexpr int g... | #pragma GCC target("avx2")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
// 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... |
/*
/+===================================================+\
//+---------------------------------------------------+\
|.|\...>>>>>>> Hollwo_Pelw's 2nd template<<<<<<<...//|.|
\+---------------------------------------------------+//
\+===================================================+/
*/
#include <bits/stdc++.h>
usin... | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using lint=long long;
int main(){
int n; scanf("%d",&n);
vector<lint> a(2*n);
rep(i,2*n) scanf("%lld",&a[i]);
priority_queue<lint,vector<lint>,greater<>> Q;
Q.emplace(max(a[n-1],a[n]));
for(int i=1;i<n;i++){
Q.emplace(a[n-... |
// 3 years challenge become master.
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f first
#define s second
#define nl "\n";
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pair<int,int>>
#define r... | #include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define debug(x) cout << "Line " << __LINE__ << ", " << #x << " is " << x << endl
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ll long long... |
#include <bits/stdc++.h>
#define f(i,a,b) for( ll i = a; i < b ; i++ )
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(ini) (ll) __builtin_popcountll(x)
#define revll greater<ll>
#define revii greater<ii... | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <queue>
#include <map>
#include <iomanip>
using namespace std;
int64_t min(int64_t a,int64_t b) {
if (a > b)
{
return b ;
}else
{
return a ;
}
}
int64_t gcd(int... |
#include <stdio.h>
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define puu pair<ull,ull>
#define fi first
#define se second
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define mset(a, b) memset(a, b, sizeof a)
using namespace std;
ty... | #include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
t=0; char ch=getchar(); int f=1;
while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const int mod=998244353;
int n,m;
void updat... |
#include<bits/stdc++.h>
using namespace std;
int main()
{
float d,h,m=0;
int n;
cin>>n>>d>>h;
float dist[n],hei[n];
for(int i=0;i<n;i++)
{
cin>>dist[i]>>hei[i];
float y=hei[i]-((h-hei[i])/(d-dist[i]))*dist[i];
if(y>=0)
m=max(m,y);
}
cout<<m<<endl;
return 0;
}
| #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;
int main(){
int N, K, M;
cin >> N >> K >> M;
int A[N-1];
rep(i, N-1) cin >> A[i];
int goal = N * M;
int sums = 0;
rep(i... |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define R(i,b,a) for(int i=(int)(b);i>=(int)(a);i--)
#define endl "\n"
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pii pair<int,int>
#define pb push_back
#define all(v) v.begin... | #include <algorithm>
#include <array>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include... |
#include <bits/stdc++.h>
#define fi first
#define se second
#define lc (x << 1)
#define rc (x << 1 | 1)
#define gc getchar() //(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define IT iterator
#define V vect... | #include <bits/stdc++.h>
using namespace std;
#define DEBUG
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, co... |
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define ar array
#define all(x) x.begin(), x.end()
#define siz(x) (int) x.size()
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define FOR(i, a, b) for(auto i=(a); i<(b); i++)
#define ROF(i, a, b) for(auto ... | #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... |
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)
using namespace std;
using ld = long double;
using ll = long long int;
using pl = pair<ll, ... | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct xy {
int x;
int y;
};
const int n = 50;
vector<vector<int>> t(n, vector<int>(n));
vector<vector<int>> p(n, vector<int>(n));
xy s;
clock_t start;
string ans = "";
int ma... |
#include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,k;
cin>>n>>k;
vector<int>cnt(n+1);
for(int i=0;i<n;i++){
int a;cin>>a;
cnt[a]++;
}
int ans=0;
int lst=k;
for(int i=0;i<=n;i++){
if(cnt[i]=... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for (int i = (m); i < (int)(n); i++)
using ll = long long;
using vl = vector<ll>;
using P = pair<ll, int>;
ll solve(vl& A, map<P, ll>& m, ll x, int i) {
if (i == int(A.size()) - 1) return 1;
... |
#include <bits/stdc++.h>
using namespace std;
#define INF 0x7fffffff
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<ld> vld;
#define fastIO ios_base::sy... | #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef unsigned long long ull;
int main() {
ull n, k, m, ans;
cin >> n;
k = 1;
m = n + 1;
ans = 1;
m = n;
k = 2;
while (m > k) {
ans++;
m... |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x,n;
cin>>x;
for(int i=1;i<=100000;i++)
{
if((x+i)%100==0)
{
cout<<i;
return 0;
}
if(x%100==0)
{
break;
}
}
cout<<"100";
return 0;
} | #include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
if(n%100==0){
cout<<"100";
}
else{
cout<<100-(n%100);
}
return 0;
} |
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<long long int> vi;
#define MOD 1000000007
#define INF 0x3f3f3f3f3f
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define RB pop_back
#define debug(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define t... | #include<bits/stdc++.h>
using namespace std;
int a[10010];
int main(){
int n;
cin >> n;
for(int i=0;i<n;i++)cin >> a[i];
int ans=0;
for(int l=0;l<n;l++){
int x=a[l];
for(int r=l;r<n;r++){
x=min(x,a[r]);
ans=max(ans,x*(r-l+1));
}
}
cout << ans;
} |
#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 faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0... | /*_____________________
|Author : canhnam357|
|___________________|
*/
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <string>... |
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
typedef long long ll;
using namespace std;
int n;
bool cmp(int x1,int y1,int x2,int y2)
{
if(min(x1,x2)==min(y1,y2)) return false;
if(max(x1,x2)==max(y1,y2)) return false;
return true;
}
void solve()
{
cin... | #include <bits/stdc++.h>
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define rep(i,n) Rep(i,0,n)
#define all(v) v.begin(),v.end()
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
#define _GLIBCXX_DEBUG
using graph=vector<vi>;
vi d;
queue<int> q;
int bfs(graph &G,int s){
d... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
void solve()
{
ll n;
cin >> n;
map<ll, ll> mp;
for (ll i = 0; i < n; ++i)
{
ll x;
cin >> x;
mp[x]++;
}
ll ans = n * (n - 1) / 2;
for (auto itr = m... | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ld long double
#define sz size()
#define lala for(ll i=0;i<n;i++)
#define pll pair<ll,ll>
#define ed "\n"
#define ct cout
#define m_p make_pair
#define vi vector<ll>
#define vc vector<char>
#define ff first
#defin... |
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <vector>
using namespace std;
int facctorial(int k){
int sum = 1;
for (int i = 1; i <= k; ++i)
{
sum *= i;
}
return sum;
}
int H, W, A, B;
struct Point {
Point(int x, int y) : x(x)... | // abc183_d
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(... |
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
void solver() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int N;
cin >> N;
vector<int> p(N);
for (int i = 0; i < N; i++) {
cin >> p[i];
p[i]--;
}
vector<int> ans;
... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
const ll mod = 1e9+7;
main(){
int n;cin>>n;
ll x[n];
for(int i=0;i<n;i++) cin>>x[i];
ll man=0,cheb = 0;
double euc=0;
for(int i=0;i<n;i++){
man+=... |
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cst... | #include<bits/stdc++.h>
using namespace std;
using lli = long long int;
int main()
{
int n;
cin >> n;
int arr[n];
for(int i=0;i<n;i++)
cin >> arr[i];
int ans=INT_MIN, res;
for(int k=2; k<=1000; k++)
{
int cnt=0;
for(int i=0;i<n;i++)
{
if(!(arr[i]%k... |
#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... | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n) ;i++)
using namespace std;
using p=pair<int,int>;
typedef long long ll;
int main() {
ll n;
cin >> n;
int counter = 0;
for(int i=1; i <= sqrt(n);i++){
if(n%i==0 && i!=sqrt(n)){
counter+=2;
}
else if(n%i==0 && i==sqrt(n)){
... |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define unused [[maybe_unused]]
#define tempT template<class T>
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << '\n'
#define ans_exit(x) { co... | #include <bits/stdc++.h>
using namespace std;
int main(){
long long N, X;
vector<long long> A;
cin >> N >> X;
long long temp;
long long a_cnt = 0;
for(long long i = 0; i<N; i++){
cin >>temp;
if(temp != X){
A.push_back(temp);
cout << A[a_cnt] << " " ;
a_cnt++;
}
}
} |
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
int main(){
int N, A, ans=0; cin >> N; vector<int> T;
stack< vector<int> > S; S.push({0, -1});
REP(i, N+1){
if(i<N){ cin >> A; }else{ A=0; }
T=S.top();
if(A>T[0]){ S.push({A, i}); continue; }
while(A<T[0]){
ans=ma... | #include <bits/stdc++.h>
using namespace std;
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#define rng_init mt19937 rng(chrono::steady_clock::n... |
//Thanks for viewing, hope it helps :)
#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(ll i=(a);i<(b);i++)
#define fr(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define pob pop_back
#define F first
#define S second
#define P(a,n) f(i,0,n) cout<<a[i]<<" ";cout<<"\n"
#define fast ios_base::... | #include <iostream>
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define inf 9223372036854775807
#define minf -9223372036854775808
#define mod 1000000007
//#include "stdc++.h"
using namespace std;
ll min(ll a,ll b){
if(a<b)
return a;
return b;
}
ll max(ll a... |
//12252024832524
#include <cstdio>
#include <cstring>
#include <algorithm>
#define TT template<typename T>
using namespace std;
typedef long long LL;
const int MAXN = 2005;
const int INF = 0x3f3f3f3f;
int n,m;
char a[MAXN][MAXN];
LL Read()
{
LL x = 0,f = 1;char c = getchar();
while(c > '9' || c < '0'){if(c == '-')... | #include <bits/stdc++.h>
using namespace std;
int main() {
#ifndef LOCAL
ios::sync_with_stdio(0);
cin.tie(0);
#endif
int h, w;
cin >> h >> w;
vector<string> field(h);
for (auto &it : field) {
cin >> it;
}
vector<vector<int>> score(h, vector<int>(w));
auto getPlayer = [... |
#include <iostream>
#include <cmath>
int main()
{
long long A, B, C;
std::cin >> A >> B >> C;
char ans;
if (C == 0)
{
ans = '=';
}
else if( C%2 == 0)
{
A = std::abs(A);
B = std::abs(B);
if (A == B)
{
ans = '=';
}
else if (A < B)
{
ans = '<';
}
else
... | #include <bits/stdc++.h>
#include <vector>
#include<math.h>
#include<string.h>
using namespace std;
#define MAX 300005
#define MOD 1000000007
#define SMOD 998244353
#define ROOT 512
#define GMAX 10000
#define INF 8000000000000000000
#define EPS 0.000000001
#define NIL 0
#define FASTIO ios_base::sync_with_stdio(false);c... |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector... | #include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/rope>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/trie_policy.hpp>
// using namespace __gnu_pbds;
// using namespace __gnu_cxx;
// typedef tree<long long, null_type, std::less<long l... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define ... | #include<iostream>
#include<map>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...)... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
char X[1010];
ll m;
int len;
bool check(ll x)
{
ll res = 0;
for (int i = 1; i <= len; i++)
{
res = res * x + X[i] - '0';
if (res > m || res < 0)
return 0;
}
return 1;
}
int main()
{
scanf("%s%lld... | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <math.h>
#include <queue>
#include <list>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <ctime>
#include <iomanip>
#include <f... |
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
typedef unsigned long long ui64;
typedef vector<i64> vi;
typedef vector<vi> vvi;
typedef pair<i64, i64> pi;
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)
inlin... | #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long LL;
const int N = 200010;
const int mod = 998244353;
int qmi(int a, int b)
{
int res = 1;
while(b)
{
if(b & 1) res = (LL) res * a % mod;
b >>= 1;
a = (LL)a * a % mod;
}
return res;
}
int n, m, k;
int main ()
{
LL an... |
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
int main(){
int a,b,c;
cin >> a >> b >> c;
if(a*a+b*b < c*c){
cout << "Yes"<< endl;
}else{
cout << "No" << endl;
}
return 0;
}... | #include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const... |
#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_if<!is_same<T_container, string>::value, typename T_container::value_... | #include <iostream>
#include <vector>
#include <queue>
#include <string>
using namespace std;
struct edge{
int to;
int cost;
};
int main(){
int H, W;
cin >> H >> W;
vector<string> S(H);
for(int i = 0; i < H; i++) cin >> S[i];
int gi = 0, gj = 0, si = 0, sj = 0;
int INF = 1e9;
vector<... |
#include"bits/stdc++.h"
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(x) x.begin(),x.end()
#define MOD 1000000007
#define INF INT_MAX
#define FLOAT_ANS setprecision(20)
#define elif else if
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
//最大公約数
template<typename T>
T gcd(T a, T b) {
if... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
//約数列挙
vector<ll> diviser_list(ll x){
vector<ll> res;
stack<ll> big;
for(ll i = 2; i*i <= x; i++){
if(x%i == 0){
res.push_back(i);
if(x/i != i)big.push(x/i);
}
}
while(!... |
#include <stdio.h>
using namespace std;
long long pr[20] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71};
long long a, b, n, ans = 1;
long long dp[1 << 21];
long long te[73];
void dfs(long long now, long long t) {
if (t == n) {
return;
}
for (int i = t; i < n; i++) {
if (... | // Cookie197
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<string>
#include<iomanip>
#include<math.h>
using namespace std;
#define no_tle_please ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define pii pair<ll,ll... |
#include <cstdio>
#include <cstring>
#define ll long long
using namespace std;
const ll mod=1e9+7;
ll f[200010][17][2][2],ans;int k,n,a[200010];
char s[200010];
int num(int x)
{
if(s[x]<='9'&&s[x]>='0') return s[x]-'0';
return s[x]-'A'+10;
}
ll dfs(int pos,int st,int maxx,bool zero)
{
int cnt=__builtin_popc... | #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 <= (n... |
#include <bits/stdc++.h>
using namespace std;
bool check(int x, string flag){
for(int d = 0; d < 4; ++d){
int id = x % 10;
x/=10;
if (flag[id] == 'x') return false;
if (flag[id] == 'o') flag[id] = '?';
}
for(int d = 0; d < 10; ++d){
if (flag[d] == 'o') return false;... | #include <bits/stdc++.h>
#define M 1000000007
#define endl '\n'
#define ll long long
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string str;
cin>>str;
ll n=str.length();
ll cnt1{0}; //to count the number of 'o'
ll cnt2{0}; //to count ... |
#include <bits/stdc++.h>
using namespace std;
int M;
#warning not checked
template <class T, class I = long long>
struct modint {
T x;
modint() : x() {}
modint(T s) {
x = s % M;
if (x < 0) x += M;
}
explicit operator T() const { return x; }
modint operator+() const { return... | #include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#d... |
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#d... | #include<bits/stdc++.h>
using namespace std;
int cnt = 0;
struct tree {
int n;
vector<vector<int>> g;
vector<int> vis;
tree(int n) : n(n) {g = vector<vector<int>>(n); vis = vector<int>(n, 0);}
void dfs(int root = 0) {
cnt++;
vis[root] = 1;
for (auto i : g[root]) {
if (!vis[i]) dfs(i);
}
}
};
int main... |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0)
#define setbit0(n, i) ((n) & (~(1LL << (i))))
#define setbit1(n, i... | /*
* @Author: zhl
* @LastEditTime: 2020-12-05 20:02:46
*/
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 10;
int gcd(int a, int b) {
return a % b == 0 ? b : gcd(b, a % b);
}
int lcm(int a, int b) {
return a * b / gcd(a, b);
}
signed main() {
int n; cin >> n;
int ans = 1;
... |
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
//define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define debug(x) cout << #x << '\t' << x << endl
#else
#define debug(x)
#endif
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
#define fast ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2000 + 7;
int n, a[N];
bool b[N];
bool ok(int val) {
int g = 0;
for (int i = 1; i <= n; i++) {
if (a[i] % val == 0) g = __gcd(g, a[i]);
}
return g == val;
}
mt19937 rng((long long) (n... |
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll MOD2=(ll)998244353;
const ll INF=(ll)1e18+10;
const double PI=acos(-1);
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) {... | #include<cstdio>
int a,b,c,d;
int main()
{
scanf("%d%d%d%d",&a,&b,&c,&d);
printf("%d",a*d-b*c);
return 0;
} |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "../debug.h"
#else
#define debug(x...) 141
#endif
#define forn(i,x,n) for(int i = x; i < n; ++i)
#define forit(it, m) for(auto it = m.begin(); it!=m.end(); ++it)
typedef long long ll;
vector<vector<int>> adj;
vector<int> vis, col, good;
multiset<int>... | #include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 1; i < (n); i++)
#define all(c) (c).begin(), (c).... |
#include <bits/stdc++.h>
#define loop(s, e, i) for (int i = s; i < e; ++i)
#define print(s) cout << s << endl;
#define DIV 1000000007
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e9+7;
ll ceildiv(ll a, ll b) { return (a+b-1)/b; } // 切り上げ
ll floordiv(ll a, ll b) { retu... | #include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, s, n) for (ll i = s; i < (n); i++)
int main(){
... |
#include <bits/stdc++.h>
// #include <atcoder/all>
#define int long long
struct edge {
int to;
int cost;
};
using namespace std;
// using namespace atcoder;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vb = vector<bool>;
using qi = queue<int>;
using P = pair<int, int>;
using graph = vector<... | #include <bits/stdc++.h>
using namespace std;
int main(){
int h,w;
cin >> h >> w;
vector<vector<char>> grid(h,vector<char>(w));
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin >> grid[i][j];
}
}
int ans=0;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(j!=w-1){
if(grid[i][... |
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(n); ++i)
#define RREP(i, n) for(int i=(n);i>=0;--i)
#define FOR(i, a, n) for (int i=(a); i<(n); ++i)
#define RFOR(i, a, b) for(int i=(a);i>=(b);--i)
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define DUMP(x) c... | #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()
templa... |
#include <stdio.h>
#include <algorithm>
long long n;
long long a[100000];
double s, t, z;
int main() {
scanf("%lld", &n);
for (int i = 0; i < n; i++) {
scanf("%lld", a + i);
}
std::sort(a, a + n);
t = a[n / 2];
for (int i = 0; i < n; i++) {
if (t < a[i])z += t - a[i];
}
printf("%.10lf\n", t / 2 - z / n);
} | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using C = complex<double>;
#define rep(i,f,n) for(ll i=(f); (i) < (n); i++)
#define repe(i,f,n) for(ll i=(f); (i) <= (n); i++)
#define repc(i,f,n) for(char i=(f); (i) <= (n); i++)
//#define PI 3.14159265358979323846264338327950L
#defin... |
/*
/^--^\
\____/
/ \ _____ _ __ __ ____ _ ____ ____ _____
| || ()_)| |\ \/ /| ===|| |__ / (__` / () \|_ _|
\__ __/ |_| |_|/_/\_\|____... | #include <bits/stdc++.h>
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int a, b, c;
std::cin >> a >> b >> c;
a %= 10;
int roundTime = 2, t = a * a % 10;
while (t != a) {
t *= a;
t %= 10;
roundTime++;
}
roundTime--;
... |
#include<bits/stdc++.h>
using namespace std;
void solve() {
long long N;
cin >> N;
long long ll = 1;
long long rr = 10;
int len = 1;
long long answer = 0;
while(ll <= N) {
answer += (min(N + 1, rr) - ll) * ((len - 1) / 3);
len++;
ll *= 10;
rr *= 10;
}
... | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define println(x) cout<<(x)<<'\n';
#define print(x) cout<<(x)<<' ';
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
set<int> a;
for (int i = 2; i <= 10000; i++) {
... |
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
using namespace std;
using ll = long long;
int main(void){
int n;
cin >> n;
rep(i, n){
ll a, b;
cin >> a >> b;
ll c = b - 2*a + 1;
cout << (c >=0 ? c*(c+1)/2... | #include <bits/stdc++.h>
using namespace std;
// template {{{
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define range(i, l, r) for (i64 i = (i64)(l); i < (i64)(r); (i) += 1)
#define rrange(i, l, r) for (i64 i = (i64)(r) - 1; i >= (i64)(l); (i) -= 1)
#define w... |
#include <bits/stdc++.h>
using namespace std;
#define int long long
int chk(int x) {
int cur = 1;
for(int i = 1; true; i++) {
if(cur > x / 3) return -1;
cur *= 3;
if(cur == x) return i;
}
}
int32_t main() {
ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n; cin >> n;
int cur = 1;
for(int... | #include "bits/stdc++.h"
#define all_of(x) std::begin(x), std::end(x)
#ifdef _GLIBCXX_DEBUG
#define debug(x) cerr << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using LL = long long;
template<typename T>
ostream& operator << (ostream& out, const vector<T>& v) {
out << "["... |
#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),i##end=(b);i>=i##end;--i)
//mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
template<typename T>void chkmax(T&x,T y){if(x<y)x=y;}
template<typename T>v... | #include<bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
const ll MAX = 50000000000000;
ll MOD = 1000000007;
long long modpow(long long a, long long n, long long mod) {
long long res = 1;
while (n > 0) {
if (n & 1) res = res * a % mod;
a = a * a % mod;
... |
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
string s;
cin>>s;
ll flag=0;
for(int i=0;i<s.size();i++)
{
if(i%2==0)
{
if((s[i]>='A'&&s[i]<='Z'))
{
flag=1;
break;
... | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(p,n) for(int i=p;i<n;i++)
#define test() int t;cin>>t;while(t-->0)
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n"
#define mp make_pair
#define pb push_back
#define mod 1000000007
int ... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
int n;
cin >> n;
int C[n][n];
vector<ll> A;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++) cin >> C[i][j];
for (int i = 0; i < n; i++) A.push_back(C[0][i]);
vector<ll> B;
B.push_back(0);
ll Bmin = 1000000... | #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<x... |
#include<bits/stdc++.h>
typedef long long ll;
#define V(a) vector<a>
#define P(a,b) pair<a,b>
#define A(a) set<a>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define in insert
#define bp __builtin_popcount
#define ppb pop_back
#define FOR(a,b,c) for(ll(a) = b; a < c; a++)
#define FORN(a,b... | /* ** ** ****** ****** ****** ** ****** ***
** ** ** ** ** ** ** ** ** ** ** *********
**\../** ****** ****** ** ** ****** ** ** ***
** ** ** ** ** ** ** ** ** ** ** ** *****
** ** ** ** ** ** ** ****** ****** ****** *****
*/
#include <bits/stdc+... |
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <stack>
#include <queue>
#include <random>
#include <numeric>
#include <functional>
#include <chrono>
#include <utility>
#include <iomanip>
#include <assert.h>
using namespace std;
void dbg_out() { cerr ... | #include<bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
#define pow(n,m) powl(n,m)
#define sqrt(n) sqrtl(n)
const ll MAX = 5000000000000000000;
const ll MOD = 0;
void randinit(){srand((unsigned)time(NULL));}
template <typename T>
struct BIT {
int n; // 配列の要素数(数列の要素数+1... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll,ll>;
using pld = pair<ld,ld>;
using vll = vector<ll>;
using vld = vector<ld>;
using vstr = vector<string>;
#define _GLIBCXX_DEBUG
#define rep(j, m) for (ll j = 0; j < (ll)(m); j++)
#define rep2(i, l, n) for (... | #include <bits/stdc++.h>
typedef double D;
typedef long long int LL;
typedef long double LD;
#define OR ||
#define AND &&
#define nl '\n'
#define ff first
#define ss second
#define S string
#define inf INT_MAX
#defi... |
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <iomanip>
#define inf 2147483647
#define IosF ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
#define N 1000010
#define PNO cout<<"NO\n";
#define PYES cout<<"YES\n"
#define l... | #include <bits/stdc++.h>
using namespace std ;
int main() {
int n , y;
cin>> n >> y ;
cout<< n/y ;
return 0;
} |
#pragma GCC optimization ("O3")
#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<pair<ll,ll>,null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update>
typedef tree<long long,... | #include <bits/stdc++.h>
using namespace std;
int main() {
using ll = long long;
int n;
cin >> n;
n *= 2;
vector<pair<ll, int>> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i].first;
a[i].second = i;
}
sort(a.begin(), a.end());
vector<int> color(n);
for (int i... |
#include <iostream>
using namespace std;
long long dp[60][2];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
string s;
dp[0][0] = dp[0][1] = 1;
for (int i = 1; i <= n; ++i) {
cin >> s;
if (s[0] == 'A') {
dp[i][0] = 2 * dp[i - 1][0] + dp[i - 1][1];
dp[i][1] = dp[i - 1][1];
}
... | #include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
using ll=long long;
typedef pair<int,int> P;
struct STATE{
};
void init(STATE& state){
}
void modify(STATE& state){
}
int main(){
rep(i,1000){
int si,sj,ti,tj;
... |
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"
#define ll long long
#define int ll
#define fi first
#define si ... | #include<cstdio>
#define MOD 1000000007
#define MAXK 3000
int n;
long long a[MAXK + 5];
long long s;
int dp[MAXK + 5][MAXK + 5];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%lld", &a[i]);
for (int j = n; j >= 2; j--) {
dp[s % j][j] += dp[s % (j - 1)][j - 1];
dp[s % j][j... |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define Pr pair<ll,ll>
#define Tp tuple<ll,ll,ll>
using Graph = vector<vector<int>>;
ll mod = 998244353;
//Unionfind
struct unionfind {
//自身が親であれば、その集合に属する頂点数に-1を掛けたもの
//そうでなければ親のid
vector<int> r;
... |
#include <bits/stdc++.h>
using namespace std;
template <typename T> using triple = std::tuple<T, T, T>;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.precision(17);
int n;
cin >> n;
vector<int> X(n), Y(n);
for(int i = 0; i < n; i++) {
cin >> X[i] >> Y[i];
}
vector<triple<... |
#include <bits/stdc++.h>
#define ll long long
#define rep(j,i,n) for(int i=j;i<n;i++)
using namespace std;
int main()
{
cin.tie(0); ios_base::sync_with_stdio(0);
int n,k; cin>>n>>k;
vector<vector<ll>> v(n,vector<ll>(n));
rep(0,i,n)rep(0,j,n) cin>>v[i][j];
ll l = -1, r = 1e9 + 10;
while (r - l > 1)
{
... | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<functional>
using namespace std;
#define MOD 1000000007
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
... |
#include<bits/stdc++.h>
using namespace std;
int a[100010];
int main(){
int t;
scanf("%d",&t);
while(t--){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",&a[i]);
if(n&1)printf("Second\n");
else{
sort(a,a+n);
int f=1,c=1;
for(int i=1;i<n;i++){
if(a[i]==a[i-1])c++;
else{
if(c&1)f... | #include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#defin... |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int,int>;
#define ff first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
const int M = 1e9+7;
const int inf = 1e9;
const int mx = 1e7+5;
ll a[mx], f[mx];
ll power(ll x, ll p){
ll ans = 1;
while(p... | #pragma GCC optimize("Ofast")
#pragma GCC target ("sse4")
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#inc... |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
ll N; cin >> N;
while(N % 2==0) N /=2;
ll sN = sqrt(N), ans =0;
for (int i =1; i<=sN; i++) {
if (N % i ==0) ans +=2;
}
if (sN * sN == N) ans--;
ans *= 2;
cout << ans << endl;
return 0;
} | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
template <class T, class U>
inline bool chmax(T& a, U b) {
if (a < b) {
a = b;
return true;
... |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repp(i, st, en) for (ll i = (ll)st; i < (ll)(en); i++)
#define repm(i, st, en) for (ll i = (ll)st; i >= (ll)(en); i--)
#define all(v) v.begin(), v.end()
void c... | #include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define rep(i, begin, end) \
for (__typeof(end) i = (begin) - ((begin) > (end)); \
i != (end) - ((begin) > (end)); i += 1 - 2 * ((beg... |
#include <bits/stdc++.h>
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>
using namespace std;
int main()
{
char C1,C2,C3;
cin>>C1>>C2>>C3;
if (C1==C2&&C2==C3){
cout<<"Won";
}else{
cout<<"Lost";
}
return 0;
} |
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/*---------------------DEBUGGING--------------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(lon... | #include <bits/stdc++.h>
using namespace std;
//const int mod = (int)1e9+7;
#define int long long
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
int h, w;
cin >> h >> w;
// vecto<vector<int>>arr(h, vector<int>(w));
int total = 0;
int m = 200;
for (int i = 0; i < h; i++){
for (... |
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sys/types.h>
#include <unistd.h>
#include <vector>
#pragma region macros
#define _overload(_1, ... | #include <iostream>
#include <vector>
#include <iostream>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
for (int i = B-A; i > 0; i--) {
int gA = (A + i - 1) / i;
int gB = B / i;
if (gA < gB) {
cout << i << endl;
return 0;
}
}
} |
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pf printf
#define ff first
#define ss second
#define sef second.first
#define ses second.second
#define PI 3.14159265 /// tan inverse = atan(value)*(180/PI)
#define ms(a,b) memset(a, b, sizeof(a))
#define lp(i,a,b)... | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
struct edge { int to, cost; };
const int MAX_V =3000000;
const int INF = 1<<30;
int V;
vector<edge> G[MAX_V];
int d[MAX_V];
void dijkstra(ll s) {
// greater<P>を指定する... |
#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 <bits/stdc++.h>
using namespace std;
int main() {
double ofs = 0.0001;
int N, D, H;
cin >> N >> D >> H;
vector<int> dlist(N);
vector<int> hlist(N);
for (int i = 0; i < N; i++) {
cin >> dlist.at(i) >> hlist.at(i);
}
double ans = 0.0;
for (int i=0;i<N;i++) {
double tmp = (double)(D... |
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e8;
int main() {
int n, m;
cin >> n >> m;
if (m < 0) {
cout << -1 << '\n';
return 0;
}
if (m == 0) {
for (int i = 1; i <= n; i++) {
cout << 2 * i << ' ' << 2 * i + 1 << '\n';
}
return 0... | #include <bits/stdc++.h>
//#define DEBUG
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define deb(x) std::cout << #x << " " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
template<typename... T>
void read(T& ... a){
((cin >> a),...);
}
template<type... |
#include<cstring>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<queue>
#include<map>
#define l(x) (x<<1)
#define r(x) ((x<<1)|1)
#define IL inline
#define reg register
#define LL long long
#define INF 0x3f3f3f3f
using namespace std;
LL T,l,r,x,y,z,cnt,Ans;
IL int Ab... | #include <bits/stdc++.h>
#define ll long long
using namespace std;
const long long MAXVAL = (long long) 1e18 + 1;
//const long long MOD = 1000000007ll;
//const long long MOD = 998244353ll;
const int INF = 1000000001;
ll poww(ll x, ll pow, ll mod) {
if (pow == 0ll ) return 1ll;
if (pow == 1ll) return x % mod;
... |
#include <bits/stdc++.h>
/* #include <atcoder/all> */
using namespace std;
/* using namespace atcoder; */
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
for (int i = (begin), i##_end_ = (end); i... | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
void Yes() {cout << "Yes\n";}
void No() {cout << "No\n";}
void YES() {cout << "YES\n";}
void NO() {cout << "NO\n";}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
set<int> st;
for (int i = 0; i <= 200000; i++) st.insert(i);
int n;
cin >... |
// AtCoder Templete
#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define loop(i, r, n) for (int i = (r); i < (n); i++)
#define lloop(i, r, n) for (int i = (r) - ... | #include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll a,b,x,y;
ll r;
cin>>r>>a>>b;
x=(a*a+b*b);
ll t=ceil(sqrt((double)x));
if(r==t) cout<<"1";
else if(t<=(2*r)) cout<<"2";
else cout<<ceil((double)t/r);
return 0;
} |
#include <bits/stdc++.h>
using namespace std;
long long cur[101][10001], pre[101][10001];
long long MOD = 998244353;
int main() {
int N; cin >> N;
vector<int> W(N);
for(int i = 0; i < N; i++) {
cin >> W[i];
}
pre[0][0] = 1LL;
int sum = 0;
for(int i = 0; i < N; i++)
sum += W... | #include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const int mod = (int)1e9 + 7;
const int maxN = 1005;
int fib[maxN];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
char caa, cab, cba, cbb;
cin >> caa >> cab >> cba >> c... |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100005
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, T b) { if (a > b... | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define deb(x) cout << #x << " " << x << endl;
#define mod 1000000007
#define fast std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define endl "\n"
const ll INF = 1e18;
const ll NEGINF = -1 * INF;
/*NOTES: Take care of ll vs int
... |
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define ll long long
using namespace std;
const int mod = 998244353;
const int maxn = 2e5 + 30;
const int maxm = 5e3 + 7;
ll frac[maxn], inv[maxn];
ll dp[maxm][maxm], inp[maxm][maxm];
ll power(ll a, ll b, ll m = mod){
ll ans = 1ll;
while (b){
if (b & 1)... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;
using ll = long long;
int main(){
int N,M;
cin >> N >> M;
vector<int> A(M);
rep(i,M){
cin >> A.at(i);
}
... |
//
// Created by Abhishek Bansal on 3/28/2021
//
//#pragma GCC optimize ("O3")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,mmx,tune=native")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
clock_t startTime;
double ge... | #include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cmath>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
temp... |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read(){
ll x=0,f=1;
char c=getchar();
while(c<'0'||c>'9'){
if(c=='-')f=-1;
c=getchar();
}
while(c>='0'&&c<='9'){
x=(x<<1)+(x<<3)+c-'0';
c=getchar();
}
return x*f;
}
string s;
int main(){
cin>>s;
for(int i=0;i<=20;++i){
strin... | /////keep going!~!one day u will get there
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ppb pop_back
#define pii pair<ll int,ll int>
#define vi vector<ll>
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define all(a) (a).begin... |
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(40)
const ll MOD = 1000000007;
const ll INF = (ll) 1e15;
vector<string> ans;
ll S[300][300];
void push(st... | #include<iostream>
#include<array>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#incl... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
const int INF = 1009009009;
const ll mod = 1000000007;
int h,w;
ll t=0;
int main(){
cin >> h >> w;
vector... | #include <iostream>
#include <vector>
#define ll long long
#define mod %1000000007
using namespace std;
int main(){
int high,wide;
cin >> high;
cin >> wide;
vector<vector<int>> lamp(high+2,vector<int>(wide+2,-1));
int num = 0;
for(int i = 0;i < high;i ++){
for(int j = 0;j < wide;j ++){
char a;
... |
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
for (int i = 0; i < s.length(); i += 2){
if (!('a' <= s[i] && s[i] <= 'z')) {
cout << "No";
return 0;
}
}
for (int i = 1; i < s.length(); i += 2){
if (!('A' <= s[i] && s[i] ... | #include <bits/stdc++.h>
using namespace std;
long digit(long x){
if(x < 10){
return 1;
}
long s = 1 + digit(x/10);
return s;
}
long nine(long x){
long s = pow(10,digit(x)-1) - 1;
return s;
}
int main(){
long num,a,b,c; cin >> num;
if(digit(num)%2 == 1){
c = pow(10,digit(num) - 1);
num = nine(num);
}
c = pow(1... |
#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... | //#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 <iostream>
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll INF = 1LL << 60;
int main(){
int h, w;
cin >> h >> w;
vector<int> a(h*w);
int min_a = 100;
rep(i, h*w){
cin >> a[i];
... | #include <bits/stdc++.h>
using namespace std;
int main(){
int h, v;
cin>>h>>v;
int counter = h*v;
int m;
cin>>m;
int sum = m;
for(int i=1;i<counter;i++){
int x;
cin>>x;
sum += x;
if(m>x){
m =x;
}
}
int ans;
ans = sum - m*counter;
cout<<ans;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.