code_file1 stringlengths 80 4k | code_file2 stringlengths 91 4k | similar_or_different int64 0 1 |
|---|---|---|
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'... | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
long a[n];
for(int i=0;i<n;i++)cin >> a[i];
long dai = 0;
for(int i=1;i<n;i++){
if(a[i] >= a[i-1]){
continue;
}else{
dai += a[i-1] - a[i];
a[i] = a[i-1];
}
}
... | 0 |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
vector<vector<pair<int, int> > >edge(n + 3);
vector<vector<int> >rails(n + 3);
for(int i = 1; i <= m; i++){
int u, v, c;
cin >> u >> v >> c;
edge[u].push_back({c, v});
edge[v].push_back(... | #include <bits/stdc++.h>
#define INF 1023456789
#define sacnf scanf
#define scnf scanf
#define scnaf scanf
#define CRLF <<'\n';
#define ALL(v) v.begin,v.end()
#define SIZE(v) (int)v.size()
#define PRPAIR(x) x.first << x.second
#define DEBUG(x) do { std::cerr <<(x)<<'\n'; } while (0)
#define rep(i,a,b) for(int i=(a);i!=... | 0 |
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPS(i, n) for(int i = 1; i <= (n); i++)
#define RREP(i, n) for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#... | #include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
string s;
cin>>s;
string ans="Yes";
for(int i=0;i<s.size();i+=2){
if(s.size()%2==1){
ans="No";
break;
}
if(s.at(i)!='h' || s.at(i+1)!='i'){
ans="N... | 0 |
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define MAXN 5010
int main(void) {
while (1)... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a;
vector<int> an;
vector<vector<int>> AN;
while (cin >> n) {
if (n == 0)break;
for (int i = 0; i < n; i++) {
cin >> a;
an.push_back(a);
}
AN.push_back(an); an.clear();
}
for (int i = 0; i < AN.size(); i++) {
long long int max = 0... | 1 |
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;
typedef pair<int , int> ii;
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxn = 1e5 + 10;
int N;
string S;
ll fac[maxn];
int main(){
cin >> N;
cin >> S;
fac[0] = 1;
for(int i = 1; i < maxn; ++i)fac[i] = fac[i - 1] * i % m... | #include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
int remainder;
bool vqrno=false;
while(n!=0){
remainder=n%10;
if(remainder==7){
vqrno=true;
break;
}
els... | 0 |
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for... | #include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>
using ll = long long int;
using namespace std;
int main(){
ll N, tmp;
vector<ll> A;
cin >> ... | 1 |
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
ll x=0,f=1;
char ch=getchar();
while(!isdigit(ch))f^=ch=='-',ch=getchar();
while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
return f?x:-x;
}
std::mt19937 rnd(time(NULL));
#define rand rnd
#define pr std::pair<int,int>
#define fi first
#define se second
template<c... | #include<cstdio>
#define N 600
int a[2][2],i,j,m,n,o,p,x,y;bool b[N][N],c[N][N];
int main()
{
scanf("%d%d%d",&n,&o,&p),m=n<<1;
while(~o&1)o>>=1,x++;
while(~p&1)p>>=1,y++;
if(x&y&1)for(i=0,x=1<<(x>>1),y=1<<(y>>1);i<m;i++)for(j=0;j<m;j++)a[b[i][j]=i&x][c[i][j]=i&y]++;
else if(x&1)for(i=0,x=1<<(x>>1),y=1<<(y>>1);i<m;... | 1 |
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;using pld=pair<ld,ld>;
const ll INF=1LL<<60;void solve();int main(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();}
#define foreach(i,a) for(auto &i:a)
#define SELECTOR(_1,_2,_3,_... | #include <cstdio>
#include <iostream>
#include <vector>
#include <set>
using namespace std;
#define M 100000
vector<int> G[M];
int N;
bool visited[M];
int prenum[M], parent[M], lowest[M], timer;
void dfs(int current, int prev){
//?????????current????¨???????????????¨?????????
prenum[current] = lowest[current] = ... | 0 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;
#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i... | #include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int H,W;
cin>>H>>W;
vector<vector<int>> A(H,vector<int>(W));
for(vector<int> &v:A)
for(int &i:v)
cin>>i;
int k=0;
vector<vector<int>> B(0);
for(int i=0;i<H;i++){
for(int j=0;j<W-1;j++){
if(A[i][j]%2==1){
... | 1 |
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
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'
... | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000; // n の最大値
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-... | 0 |
#include <bits/stdc++.h>
#ifdef LOCAL_DEBUG
#define DEBUG 1
#define CERR if(DEBUG) cerr
#define MACRO(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...) NAME
#define pr(...) CERR<<MACRO(__VA_ARGS__,pr10,pr9,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)<<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#def... | /*First observation is that little numbers should be summed up to go to above 3
* any number above 3 is better multiplied
* also given a set of numbers to add, the best pairs to pick are least with most since we will multiply them next
* also if the number of numbers we are going to add is N
* then the numbers we w... | 1 |
#include <bits/stdc++.h>
using namespace std;
template <typename T>
T random(T lo, T hi) {
std::random_device rd;
std::uniform_int_distribution<T> uid(lo, hi);
return uid(rd);
}
class RollingHash {
private:
const uint64_t mod = (UINT64_C(1) << 61) - 1;
static inline uint64_t base = random(UINT32_C(10007),... | #include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using P = p... | 0 |
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
class Node{
public:
vector< int > e_to;
vector< int > e_cost;
bool def;
int min_cost;
Node(){
def = false;
min_cost = -1;
}
};
bool operator==(const Node& ot1, const Node& ot2){
return ot1.min_cost == ot2.mi... | #include<iostream>
#include<algorithm>
using namespace std;
int n,m;
int a[100][100],b[100][100];
main()
{
while(cin>>m>>n,n)
{
for(int i=0;i<n;i++)for(int j=0;j<n;j++)
{
if(i==j)continue;
a[i][j]=1e9;
b[i][j]=1e9;
}
for(int i=0;i<m;i++)
{
int s,t,u,v;cin>>s>>t>>u>>v;
... | 0 |
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pa... | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,h,w;
cin >> n >> h >> w;
int a = 0;
int b = 0;
for(int i = 1; i <= n; i++){
if(i+w-1 <= n) a++;
if(i+h-1 <= n) b++;
}
cout << a*b << endl;
return 0;
} | 1 |
#include<iostream>
using namespace std;
int main() {
int n,a[101];
cin >> n;
for ( int i = 0; i < n; i++ ) {
cin >> a[i];
}
for ( int i = 0; i < n; i++ ) {
cout << a[n - i -1];
if ( i != n - 1 ) cout << " ";
}
cout << endl;
}
| #include <bits/stdc++.h>
using namespace std;
int abs(int x) {
if (x < 0) {
return -x;
} else {
return x;
}
}
int main() {
int N;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; i++) {
cin >> a.at(i);
}
int sum = 0;
for (int i = 0; i < N; i++) {
... | 0 |
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
using namespace std;
int main() {
int m, d;
while (cin >> m >> d&&m != 0 && d != 0) {
int sum = 0;
for (int i = 1; i < m; i++) {
if ... | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int main(){
int a,b,month[]={0,31,29,31,30,31,30,31,31,30,31,30,31};
string week[]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
while(cin>>a>>b){
if(a==0 && b==0)break;
for(int i=1;i<a;... | 1 |
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
int main(void) {
Int r;
cin >> r;
if (r < 1200) {
cout << "ABC" << endl;
} else if (r < 2800) {
... | #include <bits/stdc++.h>
using namespace std;
#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
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
using ll = long long;
#... | 0 |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod ll(1e9+7)
ll exp(ll a,ll b)
{
if(b==0)
return 1;
if(b%2==0)
return exp(a*a%mod,b/2);
return a*exp(a*a%mod,(b-1)/2)%mod;
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout... | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;
int main() {
int N,K;
cin >> N >> K;
... | 1 |
#include <cstdio>
#include <algorithm>
#define INF 2147483647
#define max_n 1000000
using namespace std;
int a[max_n+1];
long long psm[max_n+2],nsm[max_n+2];
long long calc(long long a,long long b,long long c,long long d){
a>b&&(swap(a,b),1),c>d&&(swap(c,d),1);
return max(b,d)-min(a,c);
}
template<typename T>void min... | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using... | 0 |
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<cstdlib>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include<unordered_set>
#include <stack>
#include ... | #include<bits/stdc++.h>
using namespace std;
const long mod=1e9+7;
long long sum,t;
int n;
long long a;
int main()
{
cin>>n;
while(n>0)
{
cin>>a;
(sum+=a*t)%=mod;
(t+=a)%=mod;
n--;
}
cout<<sum<<endl;
return 0;
}
| 1 |
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
void fnInput(int &rnMaxSiz, vector<int> &rvnNum)
{
cin >> rnMaxSiz;
rvnNum.resize(rnMaxSiz);
for (int i = 0; i < rnMaxSiz; i++)
cin >> rvnNum[i];
}
void fnPartition(vector<int> &rvnNum, int nStart, int nEnd, int &nCur)
{
for (... | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int n;
vector<int> S;
int partition(int p, int r)
{
int x=S[r];
int i=p-1;
for(int j=p; j<r; j++){
if(S[j]<=x){
i++;
swap(S[i], S[j]);
}
}
swap(S[i+1], S[r]);
return i+1;
}
i... | 1 |
#include <bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int x;
cin >> x;
cout << x*x*x << endl;
}
| #include <iostream>
#include <math.h>
using namespace std;
int main(){
int x;
cin >> x;
x = pow(x, 3);
cout << x << "\n";
} | 1 |
#include<iostream>
using namespace std;
int main(){
int n, x, y, sumx=0, sumy=0;
while(cin >> n && n > 0){
sumx=0, sumy=0;
for(int i=0; i<n; i++){
x=0,y=0;
cin >> x >> y;
if(x > y){
sumx = sumx + x + y;
}
else if(x < y){
sumy = sumy + x + y;
}
else if(x == y){
sumx = sumx + x;... | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool SortComp(pair<int, int> num1, pair<int, int> num2)
{
if(num1.second > num2.second)
return true;
else if(num1.second < num2.second)
return false;
else if(num1.first < num2.first)
return true;
else
return false;
}
int main(... | 0 |
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>
#include <tuple>
#include <random>
using namespace std;
typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_... | /**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author
*/
#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
using namespace std;
char piece[10][10][10];
bool DONE = false;
typedef pair<int, int> pii;
vector<pair<pii, pii>> placement[10];
int done[10][10... | 1 |
#define rep(i,n) for (int i=0;i<n;i++)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
int main(){
unsigned long long l,r;
cin >> l >> r;
unsigned long long mi=INT_MAX,i=0,j=0;
if(r/2019-l/2019!=0)
cout << 0 << endl;
else{
l%=2019;
r%=2019;
whil... | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
vector<ll> a(300);
a[0] = 300000;
a[1] = 200000;
a[2] = 100000;
int x, y;
cin >> x >> y; x--; y--;
ll ans = a[x] + a[y];
if(x == y && x == 0)ans += 400000;
cout << ans << endl;
} | 0 |
#include <cstdio>
#include <cstring>
#include <algorithm>
const int MOD = 998244353;
const int MAXN = 5e5 + 10;
int n, m;
namespace {
inline int add(int x) { return x >= MOD ? x - MOD : x; }
inline int sub(int x) { return x < 0 ? x + MOD : x; }
inline int mul(int x, int y) { return 1ll * x * y % MOD; }
inline ... | #include <iostream>
#include <cstdio>
#include <cstring>
#define ll long long
#define ls(_o) (_o << 1)
#define rs(_o) ((_o << 1) | 1)
#define abs(_o) ((_o < 0) ? -(_o) : _o)
using namespace std;
namespace ywy {
inline int get() {
int n = 0;
char c;
while ((c = getchar()) || 23333) {
... | 0 |
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define str to_string
#define endl "\n"
#define PI 3.141592653589
using namespace std;
using lint = long long;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size()... | %:pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 5;
const int M = 4e6 + 5;
const int mod = 1e9 + 7;
int n, k, dp[N][N], fac[M], ifac[M];
inline int mul(int a, int b) {
return (long long) a * b % mod;
}
inline int add(int a, int b) {
return (a += b) >= mod ? a - mod : a;
}
... | 0 |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<v<<"\n";
#define fi(v) get<0>(v)
#define se(v... | #pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mu... | 1 |
//FIRST THINK THEN CODE.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define MOD 998244353
#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 v... | #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define in read()
#define re register
#define fur(i,a,b) for(re int i=a;i<=b;++i)
#define fdr(i,a,b) for(re int i=a;i>=b;--i)
#define cl(a,b) memset(a,b,sizeof(a))
#define jinitaimei signed
#define int long long
inline int read()
{
int x=0;
ch... | 0 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
int main(){
int n; cin>>n;
set<int> st;
rep(i,n){
int a; cin>>a;
if(st.count(a)==1) st.erase(a);
else st.insert(a);
}
cout<<st.size()<<endl;
}
| #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long long INF = 1LL << 60;
const ll MOD = 1000000007;
using pint = pair<ll, ll>;
int main() {
ll N;
cin >> N;
map<ll, ll> A;
for (int i = 0; i < N; i++){
ll tmp = 0;
cin >> tmp;
A[tmp]++;
}
... | 1 |
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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 ... | #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#i... | 1 |
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>
using namespace std;
#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)
int main(){
while(1){
int n;
... | #include <bits/stdc++.h>
using namespace std;
#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()
int N, M;
int p[1010];
int main() {
while (cin >> N >> M, N) {
for_(i,0,N... | 0 |
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
int n,h,w;
cin>>n>>h>>w;
cout<<max(0,(n-h+1)*(n-w+1))<<endl;
return 0;
} | #include <bits/stdc++.h>
#include <algorithm>
#include<string>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int N, H, W;
bool flag = false;
cin >> N >> H >> W;
int count = 0;
for (int i = 1; i <= N; ++i) {
for (int j = 1; j <= N; ++j) {
i... | 1 |
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstring>
#include<map>
#include<cmath>
#include<set>
//#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d... | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll =... | 1 |
#include<bits/stdc++.h>
using namespace std;
int arr[100003] , N;
int main(){
cin >> N; for(int i = 1 ; i <= N ; ++i) cin >> arr[i];
bool flag = 0;
while(1){
flag ^= 1; int cnt = 0; for(int i = 1 ; i <= N ; ++i) cnt ^= arr[i] - 1;
if(cnt & 1){puts(!flag ? "Second" : "First"); return 0;}
int id = 0;
for(int... | // This amazing code is by Eric Sunli Chen.
#include<bits/stdc++.h>
using namespace std;
template<typename T> bool get_int(T &x)
{
char t=getchar();
bool neg=false;
x=0;
for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
for(; t<='9'&&t>='0'; t=getchar())x=x... | 0 |
#include<bits/stdc++.h>
using namespace std;
#include<string>
#define fo(i, n) for(ll i = 0; i < n; i++)
#define endl "\n"
#define of(i, n) for(ll i = n - 1; i >= 0; i--)
#define ll long long
#define vec vector<ll>
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tr(container, it) \
for(typ... | #include<bits/stdc++.h>
using namespace std;
typedef int in;
#define int long long
int MAX=1e9;
int MAXEST=1e18;
int MOD=1e9+7;
int d;
string s;
int dp[10005][101][2];
int f(int idx,int cur,bool gr)
{
if(idx==s.size())
{
return (!cur);
}
int &ret=dp[idx][cur][gr];
if(ret!=-1)
retu... | 1 |
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for (int i = 0; i < (n); i++)
typedef pair<int,int> P;
const int INF = 100000000;
typedef long long ll;
int W,H;
int sy, sx, gy, gx;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
bool movable(vector<vector<char>> &c, ... | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
ll dp[11][210000];
const int INF=1e9;
int main() {
ll d,g;
cin>>d>>g;
g/=100;
vector<int> P(d+1),C(d+1);
int x;
rep(i,d){
cin>>P[i+1]>>x;
C... | 0 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
int X, Y, Z;
cin >> X >> Y >> Z;
int a = Z;
Z = Y; Y = X; X = ... | #include <bits/stdc++.h>
using namespace std;
// double mathdist(double, double, double, double);
int main()
{
/* 始めからdouble型で読み込むべし */
/* 読み込み時のキャストは危険 */
double x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
// cout << mathdist(x1, x2, y1, y2) << endl;
cout << fixed << setprecision(cout.preci... | 0 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout << setprecision(20) << fixed;
int n;
cin >> n;
vector<int> odd(100001);
vector<int> even(100001);
for (int i = 0; i < n; i++) {
int v;
cin >> v;
if (i % 2 == 0) {
odd[v]++;
} e... | #include<bits/stdc++.h>
using namespace std;
int main(void){
int N;
cin>>N;
vector<int> X(N);
for(int i=0;i<N;i++){
cin>>X[i];
}
int sum=0;
for(int i=0;i<N-1;i++){
sum+=abs(X[i+1]-X[i]);
}
for(int i=0;i<N;i++){
if(i==N-1){
cout<<sum+abs(X[0])+abs(X[N-2])-abs(X[i]-X... | 0 |
#include <bits/stdc++.h>
using namespace std;
using P = pair<int,int>;
int main(){
int h, w;
cin >> h >> w;
vector<string> hw(h);
for(int i=0; i<h; ++i) cin >> hw[i];
queue<P> que;
vector<vector<int>> dis(h, vector<int>(w, -1));
for(int i=0; i<h; ++i) for(int j=0; j<w; ++j){
if(hw[i][j] == '#'){
... | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)
int main(){
int H, W, ans=1; cin >> H >> W; string A[H];
REP(i, H){ cin >> A[i]; }
int B[H][W]={}; vector< pair<int, int> > C;
REP(i, H){ REP(j, W){
if(A[i][j]=='#'){ B[i][j]=1; C.push_back(make_pair(i, j)); }
} }
REP(i, ... | 1 |
#include <bits/stdc++.h>
#define fi first
#define se second
#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 sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#defin... | #include <iostream>
#include <vector>
#include <utility>
#include <queue>
using namespace std;
class node {
public:
int parent,children[2],sib,val;
node() {
parent = -1;
children[0] = -1;
children[1] = -1;
sib = -1;
val = -1;
}
int deg() {
int c = 0;
for(int i=0;i<2;i++)if(children[i]!=-1)c++;
ret... | 0 |
#include <bits/stdc++.h>
#define FASTIO
using namespace std;
using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();
//=================================... | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
int R, G, x;
cin >> R >> G;
x = G * 2 - R;
cout << x << endl;
} | 0 |
#include <iostream>
#include <vector>
#include <queue>
#include <functional>
#include <string.h>
using namespace std;
typedef pair<int, int> P;
struct edge
{
int to;
int cost;
};
vector<edge> G[101];
bool isUsed[101];
void solve()
{
int n;
cin >> n;
vector< vector<int> > data((n), vector<int>(n));
for (int i =... | #include<bits/stdc++.h>
using namespace std;
int n,m,a[310][310];
int c[310],u[310],ans;
int main(){
scanf("%d %d",&n,&m);
ans=n;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
scanf("%d",&a[i][j]);
}
}
for(int x=1;x<=m;x++){
memset(u,0,sizeof(u));
for(int i=... | 0 |
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
struct dice {
P x[3];
dice(int x_[6]) {
x[0] = P(x_[0], x_[5]);
x[1] = P(x_[1], x_[4]);
x[2] = P(x_[2], x_[3]);
}
int X(int n) {
return n < 3 ? x[n].first : x[5 - n].second;
}
void N() {
swap(x[0], x[1]);
swap(x[1].first, x[1].sec... | #include <iostream>
#include <string>
using namespace std;
int top, S, E, W, N, bot;
void what(char c)
{
int tmp;
switch (c) {
case 'S':
tmp = top;
top = N;
N = bot;
bot = S;
S = tmp;
break;
case 'E':
tmp = top;
top = W;
W = bot;
bot = E;
E... | 1 |
#include<iostream>
using namespace std;
#include<map>
#include<vector>
#include<cmath>
#include<set>
#include<algorithm>
#define int long long int
#define mod 1000000007
int binary_search(int arr[],int start,int end,int val)
{
if(start>end)
return -1;
else
{
int mid=(start+end)/2;
if(arr[mid]<=val)
r... | #include <fstream>
#include <iostream>
// BE CAREFUL WITH HASH TABLE & UNORDERED MAP
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define MOD 998244353
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = (b-1... | 0 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x;
cin >> n >> x;
vector<int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a.begin(), a.end());
int ans = 0, sum = 0;
for (int i = 0; i < n; i++) {
if (sum + a[i] > x) break;
sum += a[i];
ans++;
if (i==n-1 && x > sum) ... | #include <bits/stdc++.h>
using namespace std;
bool check(int x, vector<int> &d){
while(x > 0){
int c = x % 10;
for (int i=0; i<d.size(); i++){
if(c == d[i]) return false;
}
x /= 10;
}
return true;
}
int main(void){
// Your code here
int n, k;
cin >>... | 0 |
#include <iostream>
using namespace std;
#define repi(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
int main() {
ios::sync_with_stdio(false);
int w[3]={}, k[3]={};
int a;
rep(i, 10) {
cin >> a;
if(w[0]<a) {
w[2]=w[1];
w[1]=w[0];
w[0]=a;
}else if(w[1]<a) {
w[2]=w[1];... | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define... | 0 |
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<sstream>
#include<vector>
#include<cstdlib>
#include<ctime>
#include<list>
#include<deque>
#include<bitset>
#... | #include <stdio.h>
#include <math.h>
int n;
int a[1000000];
int cnt;
void insertionSort(int g) {
for (int i = g; i < n; i ++) {
int v = a[i];
int j = i - g;
while (j >= 0 && a[j] > v) {
a[j + g] = a[j];
j -= g;
cnt ++;
}
a[j + g] = v;
}
}
void shellSort() {
int g[100000];
g[0] = 1;
int m = 0;... | 0 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef long long lli;
type... | #include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring>
#include <map>
using namespace std;
const int MAXN = 1000005;
char S[MAXN], T[MAXN];
int n, q[MAXN], head = 1, tail;
signed main () {
scanf("%d%s%s", &n, S+1, T+1);
if(strcmp(S+1, T+1) == 0) { puts("0"); return 0; }
int ans = ... | 0 |
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b)... | #include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef long long ll;
int read() {
char ch;
for(ch=getchar();ch<'0'||ch>'9';ch=getchar());
int x=ch-'0';
for(ch=getchar();ch>='0'&&ch<='9';ch=getchar()) x=... | 0 |
#include <bits/stdc++.h>
struct Point
{
long long x, y, distance{1000000000000};
std::vector<std::pair<int, long long>> edge;
};
using pli = std::pair<long long, int>;
int main()
{
int n;
Point points[100000];
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%lld%lld", &points[i].... | #include<bits/stdc++.h>
#define INF 100000000
using namespace std;
int n,m[101][101],p[101];
void dp();
int main(){
cin>>n;
for(int i=0;i<n;i++)cin>>p[i-1]>>p[i];
dp();
cout<<m[1][n]<<endl;
return 0;
}
void dp(){
for(int l=2;l<=n;l++)
for(int i=1;i<=n-l+1;i++){
int j=i+l-1;
m[i][j]=INF;
... | 0 |
#include <iostream>
using namespace std;
int n = 0, a[100000] = { 0 };
int partition(int a[100000], int p, int r) {
int x = a[r - 1];
int i = p - 1;
for (int j = p; j < r; j++) {
if (a[j - 1] <= x) {
i++;
swap(a[i - 1], a[j - 1]);
}
}
swap(a[i], a[r - 1]);
return i + 1;
}
int main()
{
cin >> n;
f... | #include <iostream>
#include <iterator>
#include <vector>
#include <algorithm>
using namespace std;
void swap(int &a, int &b) {
int t = a;
a = b;
b = t;
}
int partition(vector<int> &A, int p, int r) {
int x = A[r];
int i = p;
for (int j = p; j < r; j++) {
if (A[j] <= x) {
swap(A[i], A[j]);
i++;
}
}... | 1 |
#include <bits/stdc++.h>
const double pi = 3.141592653589793238462643383279;
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, ... | #pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>
using namespace std;
#define GODSPEED ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision... | 1 |
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <numeric>
#include <map>
#include <set>
#include <q... | #include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,m,ans[N],a[N],b[N],t[N<<2],t1[N<<2],t2[N<<2];
void update(int l,int r,int k)
{
t1[k]=t[k]+r-l;t2[k]=t[k];
if(l!=r)
{
int m=l+r>>1;
t[k<<1]=t[k];t[k<<1|1]=t[k]+m+1-l;
}
t[k]=0;
}
int query(int l,int r,int k,int x)
{... | 1 |
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cctype>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#i... | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
using namespace std;
#def... | 1 |
#include<stdio.h>
int main(){
int W[10],K[10],i,j,c;
for(i=0;i<10;i++){
scanf("%d",&W[i]);
}
for(i=0;i<10;i++){
scanf("%d",&K[i]);
}
for(i=0;i<10;i++){
for(j=i;j<10;j++){
if(W[i]<W[j]){
c=W[i];
W[i]=W[j];
W[j]=c;
}
if(K[i]<K[j]){
c=K[i];
K[i]=K[j];
K[j]=c;
}
}
}
p... | #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;
int main(){
vint w(10... | 1 |
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1000000007;
signed main(){
int N;
cin>>N;
vector<int> A(64,0);
for(int j=0;j<N;j++){
int B;
cin>>B;
bitset<64> C(B);
for(int i=0;i<64;i++)
if(C.test(i))
A[i]++;
}
int ans=0;
for(int i=0,j=1;i<64;... | /* ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
ঔৣमहाकालᴳᵒᵈঔৣ
*/
#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;
//template <typename T, typename cmp=less<T>> using oset =... | 0 |
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S max_L(S a,T b){
return a>=b?a:b;
}
inline int my_getchar_unlocked(){
static char buf[1048576];
static int s = 1048576;
static int e = 1048576;
if(s == e && e == 1048576){
e = fread_unlocked(buf,... | #include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7... | 0 |
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()
int main() {
int n,k;
while(cin >> n >> k, n && k) {
long long INF = 1e10;
vector<vector<long long>> dist(n, vector<long long>(n, INF));
for(int ... | #include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#define PAIR pair<long long,int>
using namespace std;
class island{
public:
vector<PAIR> road;
void add(int goal,int much){
road.push_back(PAIR(much,goal));
}
};
long long func(vector<island>&,int,int);
int... | 1 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
#define fi first
#define se second
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
c... | #include <bits/stdc++.h>
#include <vector>
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n-1,0)
#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e13;
const int mod... | 1 |
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
if (a + b >= a - b && a + b >= a * b) {
cout << a + b << endl;
}
else if (a - b >= a + b && a - b >= a * b) {
cout << a - b << endl;
}
else if (a * b >= a + b && a * b >= a - b) {
cout <<... | #include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979
using namespace std;
ll power(ll n, ll k){
ll res = 1;
while(k > 0){
if (k & 1)
res = res * n % MOD;
n = n * n % MOD;
k >>= 1;
}
return res;
}
ll genfact(ll n, ll k){
ll... | 0 |
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
mt19937 mrand(random_device{} ());
int rnd(int x) {
return mrand() % x;
}
typedef long double ld;
typedef long long ll;
#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(.... | #include<bits/stdc++.h>
using namespace std;
// Reference : Erichto + https://www.youtube.com/watch?v=1HiJ332iZQU
long double dp[301][301][301];
long double solve(int ones, int twos, int threes, int n) {
// cout<<"At "<<ones <<" "<< twos <<" "<< threes<<endl;
if(ones + twos + threes == 0) {
// cout<<"Base:"<<0<<en... | 0 |
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int n,m,p;
std::deque<int> deq;
while (cin>>n>>m) {
if (n==0&&m==0) {
break;
} else {
for (int i=0;i<n;i++) {
cin>>p;
deq.emplace_back(p);
}
sort(deq... | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
using namespace std;
type... | 0 |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll cl[1000000][2];
int main(void){
ll i,len,lv,cnt,p,pp,x;
char s[1000001];
cin>>s;
len=strlen(s);
for(i=0;i<len;i++) cl[i][1]=0;
cnt=1; p=0; pp=0;
if(s[0]=='J') cl[0][0]=0;
else if(s[0]=='O') cl[0][0]=1;
else cl[0][0]=2;
for(i=0;i<len;i++){
... | #include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
//#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii... | 1 |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T... | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const double PI = 3.14159265358979323846;
int main() {
int a, b, c, d, e, k;
cin >> a >> b >> c >> d >> e >> k;
if(e - a <= k) cout << "Yay!" << endl;
else cout << ":(" << endl;
} | 1 |
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b)... | #include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
int arr[101] = {0};
int main()
{
long long int a, total=0;
cin >> a;
for(int i=1; i<=a; i++)
{
if(i%3 !=0 && i%5 != 0)
{
total += i;
}
}
cout << total;
}
| 0 |
#include <iostream>
#include <queue>
#include <map>
using namespace std;
typedef pair<int, int> P;
int B[101][101];
bool bfs(int w, int h, int xs, int ys, int xg, int yg);
int main(int argc, char** argv)
{
int w, h;
int xs, ys;
int xg, yg;
int n;
int c, d, x, y;
while( 1 )
{
cin >> w;
cin >> h;
if(w=... | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <chrono>
using namespace std;
#define INF 1e18
long long DP[5001][5001];
struct Constraint {
long long H, P;
Constraint(long long H = 0, long long P = 0):H(H), P(P){}
bool operator<(const Constraint& r)const {
return P+H < r.... | 0 |
#include <bits/stdc++.h>
using namespace std;
int main() {
// ここにプログラムを追記
int R,G;
cin >> R >> G;
double x = 2 * G - R;
cout << x << endl;
} | #include<iostream>
int main(){
int R,G;
std::cin >> R >> G;
std::cout << G + G - R;
} | 1 |
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1... | #include <bits/stdc++.h>
using namespace std;
int main() {
int x,y;
cin >> x;
y = x % 500;
x /= 500;
y /= 5;
cout << 1000*x+5*y << endl;
return 0;
}
| 0 |
#include <bits/stdc++.h>
// #undef DEBUG // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
std::cerr << value << ", ";
debug(args...);
}
#define dbg(...) ... | #include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
const int INF = 1e9;
int main() {
string S; cin >> S;
int N = S.size();
vector<vector<int>> dp(N + 1, vector<int>(2, INF));
dp[0][0] = 0;
for(int i = 0... | 0 |
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
using namespace std;
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#defin... | #include <iostream>
#include <vector>
using namespace std;
typedef vector <int> VI;
typedef vector <VI> VVI;
const int dx[5] = { 0, 0, 0, 1, -1 };
const int dy[5] = { 0, 1, -1, 0, 0 };
int w, h;
int sx, sy, gx, gy;
VVI M;
int answer;
//==================================================
// Tõ
//==================... | 1 |
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lc... | #include "bits/stdc++.h"
#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}
using namespace std;
using ... | 0 |
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define ... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
ll n,m,d;
cin>>n>>m>>d;
cout<<fixed<<setprecision(10)<<((d==0)?1.:2.)*(n-d)/n*(m-1)/n;
}
| 1 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//約数列挙(√N)
vector< int64_t > divisor(int64_t n) {
vector< int64_t > ret;
fo... | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;
int main(){
string s;
int w;
cin>>s>>w;
for(int i(0);i<int(s.size());i++){
if(i%w==0) cout << s[i];
}
cout << endl;
return 0;
}
| 1 |
#include<bits/stdc++.h>
using namespace std;
template<typename T>inline T read(){
T f=0,x=0;char c=getchar();
while(!isdigit(c)) f=c=='-',c=getchar();
while(isdigit(c)) x=x*10+c-48,c=getchar();
return f?-x:x;
}
#define int long long
namespace run{
const int N=2e5+9;
int a[N],m,v,p,n,ans,sum[N];
int main(){
n=r... | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
long long N, M, V, P; cin >> N >> M >> V >> P;
vector<long long> A(N);
for(auto& t : A) cin >> t;
sort(A.begin(), A.end());
int L = -1, R = N-1;
while(R-L > 1){
int mid = (L+R)/2;
long l... | 1 |
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout... | #include <bits/stdc++.h>
using namespace std;
int main() {
int A, B, C, D, E, X;
cin >> A >> B >> C >> D >> E >> X;
int ma, mi;
ma = max(max(max(max(A, B), C), D), E);
mi = min(min(min(min(A, B), C), D), E);
if(ma - mi > X) {
cout << ":(" << endl;
}
else {
cout << "Yay!" << endl;
}
} | 1 |
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
// order_of_key (val): r... | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
// 強連結成分分解
// 計算量: O(V + E)
// operator[]: 頂点kが属する強連結成分の番号を返す
class StronglyConnectedComponents {
int V;
vector<vector<int>> G, rG;
vector <int> comp; // 強連結成分の番号(トポロジカル順)
vector <int> order; // DFSで辿った順
vector <in... | 1 |
#include <bits/stdc++.h>
using namespace std;
int main(void){
int n,r;
cin>>n>>r;
if(n>=10){
cout<<r<<endl;
}else{
cout<<r+1000-100*n<<endl;
}
return 0;
}
| #include<stdio.h>
#include<bits/stdc++.h>
#define mod 1000000007
#define maxn 4000095
using namespace std;
int f[2005][2005],fac[maxn],inv[maxn];
int add(int a,int b){a+=b; return a>=mod?a-mod:a;}
int ksm(int a,int b)
{
int s=1;
for(;b;b>>=1,a=1ll*a*a%mod)
if(b&1) s=1ll*s*a%mod;
return s;
}
int n,k;
void Pre()
{
... | 0 |
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define mp make_pair
#define pb push_back
#define endl "\n"
#define rep(i,a,n) for(int i=a;i<n;i++)
const int mod = 1e9 + 7;
void solve() {
int n;
cin >> n;
int a[n];
rep(i, 0, n) {
cin >> a[i];
}
int s = 0;
rep(i, 1, n) {
if (a[i] < a... | #include <iostream>
typedef long long ll;
using namespace std;
int main() {
ll N;
cin >> N;
ll A;
cin >> A;
ll height = A;
ll ans = 0;
for (int i = 0; i < N - 1; ++i) {
cin >> A;
if (height > A) {
ans += height - A;
}
else {
height ... | 1 |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, m; scanf("%d%d", &n, &m);
for (int i = 1; i <= m; ++i)
if (2 * i < m + 2) printf("%d %d\n", i, m + 2 - i);
for (int i = 1; i <= m; ++i)
if (2 * i < m + 1) printf("%d %d\n", m + 1 + i, 2 * m + 2 - i);
return 0;
}
| #include <bits/stdc++.h>
#define int long long
typedef long long ll;
using namespace std;
const ll MAXN = 200000;
const ll INF = 1001001001;
const ll MOD = 1000000007;
ll N, M, tmp=0;
vector<pair<ll,ll>> ans;
signed main(){
cin >> N >> M;
for(int i=1;i<=M;i++) {
tmp = 0;
if(N%2==0&&4*i>=N) tm... | 1 |
#include <iostream>
using namespace std;
int main(void){
int n,i,k;
cin >> n;
int day[n];
for(i=0;i<n;i++){
cin >> day[i+1];
}cout << day [n];
for(k=1;k<n;k++){
cout << " ";
cout << day[n-k];
}
cout << endl;
}
| #include <iostream>
#include <string>
#include <sstream>
#include <stack>
using namespace std;
int main()
{
string s;
getline(cin, s);
getline(cin, s);
stringstream ss(s);
stack<string> st;
while (ss.peek() != EOF) {
uint t;
ss >> t;
st.push(to_string(t));
if (ss.peek() == EOF) break;
... | 1 |
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
int main() {
... | #include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <cmath>
#include <cstdint>
using namespace std;
inline namespace atcoder {
using i32 = int32_t; using u32 = uint32_t;
using i64 = int64_t; using u64 = uint64_t;
using f32 = float; using f64 = double;
template <typenam... | 0 |
//Date and time of submission:
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e5+5;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll a,b;
cin>>a>>b;
cout<<(a%b!=0);
return 0;
}
| #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char* argv[]){
int N, M;
scanf("%d %d", &N, &M);
int A = M + 2;
int B = M + 1;
int C = 2*M + 2;
for(int i=1, j=0; j < M; i++){
printf("%d %d\n", i, A - i);
if(++j < M){
printf("%d %d\n", B + i, C - i);
j++;
}
}
return 0;... | 0 |
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, q; string s;
cin >> n >> s >> q;
for(int i=0; i<q; i++){
int k;
cin >> k;
long long int d = 0, m = 0, dm = 0, ans = 0;
for(int i=0; i<n; i++){
if(s[i] == 'D') d += 1;
if(s[i] == 'M'){ ... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
#ifdef _DEBUG
inline void dump() { cerr << endl; }
template<typename Head> void dump(Head&& head) { cerr << head; dump(); }
template<typename Head, typename... Tail> void dump(Head&& head, Tail&&... tail) { c... | 0 |
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
using namespace std;
int main() {
vector<int> result;
string n;
string input;
getline(cin, n);
getline(cin, input);
istringstream iss(input);
string num;
while (getline(iss, num, ' ')) {... | #include <iostream>
using namespace std;
int main(void){
int max=-2147483648;
int min=2147483647;
long sum=0;
int n,in;
cin >> n;
for (int i=0;i<n;i++){
cin >> in;
if(min>in) min=in;
if(max<in) max=in;
sum = sum + in;
}
cout << min <<... | 1 |
/**
* author: souzai32
* created: 13.08.2020 01:38:59
**/
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main() {
int n;
cin >> n;
vector<int> d(n);
rep(i,n) cin >> d.at(i);
long long ans=1;
if(d.at(0)!=0) ans=0;
sort(d.begin(... | #include <bits/stdc++.h>
using namespace std;
#define print cout <<
#define printl(s) cout << s << endl;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
const ll modval = pow(10,9) + 7;
template <typename T>
vector<T> getValues(int num){
vector<T> values(num);
for(int i=0;i<num;i++){
... | 0 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define prec(n) fixed << setprecision(n)
#define maxpq priority_queue<ll>
#define minpq priority_queue<int, vector<int>, greater<int>>
#define PI 3.14159265
#define pb push_back
#define bits(n) __builtin_popcount(n)
void solve()
{
int a,b,c;
... | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef vector<int> vi;;
typedef vector<ll> vll;
#define l() length()
#define sz() size()
#define b() begin()
#define e() end()
#define all(x) x.begin(... | 0 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); ++i)
int main() {
int n;
cin >> n;
vector<int> v(n);
rep(i, n) cin >> v[i];
int count = 0;
bool flag = true;
while (flag) {
rep(i, n) {
... | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi firs... | 0 |
#include <iostream>
using namespace std;
int main(){
int n, a[150];
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n - 1; i++)
cout << a[n - i - 1] << " ";
cout << a[0];
cout << endl;
return 0;
}
| //Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
... | 0 |
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
int main(){
int N;
int score[101];
vector<int> res;
int A, B, C, D;
int rank[101];
int n, r;
scanf("%d", &N);
for(int i = 1; i <= N; i++){
score[i] = 0;
}
for(int i = 0; i < N * (N - 1) / 2; i++){
scanf(... | #include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
int N;
vector<pii> P;
bool cmp(pii a, pii b) {
return a.first + a.second < b.first + b.second;
}
ll dp[2][5002];
int main() {
scanf("%d", &N);
P.resize(N);
for(int i = 0; i < N; i++) {
scanf("%d ... | 0 |
// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; if (i != v.size() - 1) os << ", "; } os << "]"; return os; }
template <typename T> void print(T v, string s = "\n") ... | #include<bits/stdc++.h>
using namespace std;
const int N=502;
int n,m,q;
int f[N][N];
int main()
{
cin>>n>>m>>q;
for(int i=1;i<=m;++i)
{
int u,v;
cin>>u>>v;
for(int j=v;j<=n;++j)
{
f[u][j]++;
}
}
for(int i=1;i<=q;++i)
{
int u,v;
cin>>u>>v;
int res=0;
for(int j=u;j<=v;++j)
{
res+=f[j]... | 1 |
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
#define repeat(n, i) for(int i=0; i<(n); i++)
int w, h;
int xs, ys;
int xg, yg;
int n;
int st_color;
int board[300][300];
#define VISITED 6
bool get_input() {
memset(board, 0, sizeof(board));
cin >> w >> h;
if (w == 0 && h =... | #include <iostream>
#include <string>
using namespace std;
string ans;
int w,h,gx,gy;
int map[110][110];
int dx_[4] = {0,1,0,-1};
int dy_[4] = {1,0,-1,0};
int dx[2][8] = {
{0,1,2,3,0,1,2,3},
{0,1,0,1,0,1,0,1}
};
int dy[2][8] = {
{0,0,0,0,1,1,1,1},
{0,0,1,1,2,2,3,3},
};
void solve(int x,int y,int color){
if( ans =... | 1 |
#include <cstdio>
#include <utility>
#include <cmath>
#include <algorithm>
using namespace std;
#define gcu getchar_unlocked
int in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
int in() {return in(gcu());}
bool scan(int &n){int c=gcu();return c==EOF?fa... | #include <iostream>
using namespace std;
int main(){
while(1){
int E;
cin >> E;
if(E==0) break;
int x=0,y=0,z=0;
int m = 1000000;
for(z=0;z*z*z<=E;z++){
for(y=0;(z*z*z)+(y*y)<=E;y++){
x=E-(z*z*z)-(y*y);
if(x+y+z<m){
m=x+y+z;
//cout << x << y << z << endl;
}
}
}
co... | 1 |
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#define llint long long
using namespace std;
typedef pair<llint, llint> P;
typedef pair<llint, P> E;
struct UnionFind{
int size;
vector<int> parent;
UnionFind(){}
UnionFind(int size){
this->size = size;
parent.resize(size+1);
in... | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,ll>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=9... | 0 |
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ifor(st,lim) for(int i=st;i<lim;i++)
#define ... | #include <bits/stdc++.h>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
//#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
string W;
cin >> W;... | 1 |
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,a,b;
cin>>n;
if(n==1){
cout<<"Hello World"<<'\n';
}
if(n==2){
cin>>a>>b;
cout<<a+b<<'\n';
}
return(0);
}
| #include <bits/stdc++.h>
using namespace std;
// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// container util
#define all(x) (x).begin(), (x).end()
// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double... | 0 |
#include <bits/stdc++.h>
#define trans(x) add(nxt[ d[i][x] ], cur[i])
const int N = 300054, mod = 1000000007;
const int d[8][2] = {{2, 3}, {6, 6}, {4, 5}, {6, 7}, {2, 2}, {2, 3}, {1, 3}, {7, 7}};
int dp_[2][8], *cur = *dp_, *nxt = dp_[1];
char s[N];
inline int & add(int &x, const int y) {return x += y - mod, x += x ... | #include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"--------... | 1 |
/// In The Name Of God
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define pp pop_back
#define mp make_pair
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) fo... | #include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)
#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>
#define MOD 1000000007
#defin... | 0 |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int lb = 9, ub = 44;
int v[lb+ub+5][lb+ub+5];
int main () {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int n; cin >> n;
int i, j, z, e, pin, p2, p5;
ll m, ans = 0;
string s;
for (i = 1; i <= n; i++) {
cin >> s;
m ... | #include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;
#pragma GCC target("avx2")
#... | 0 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(A) A.begin(),A.end()
void ALLIN1_NUMBER(vector<ll>& V)
{
for(auto& x : V)
{
cin >> x;
}
}
template<class T>
void OUT0(T N)
{
cout << N << endl;
}
static const double pi = acos(-1.0);
double Cos(double D)
{
... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.