code_file1 stringlengths 80 4k | code_file2 stringlengths 91 4k | similar_or_different int64 0 1 |
|---|---|---|
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const int MAX = 200000, SENTINEL = 2100000000;
int L[MAX / 2 + 2], R[MAX / 2 + 2];
ll merge(int A[], int n, int left, int mid, int right) {
ll cnt = 0;
int n1 = mid - left;
int n2 = right - mid;
for (int i = 0; i < n1; i+... | #include <cstdio>
#include <vector>
#include <algorithm>
int main()
{
int n,v,p;
long long m;
scanf("%d%lld%d%d",&n,&m,&v,&p);
std::vector<long long> A(n);
for(int i=0;i<n;i++){
scanf("%lld",&A[i]);
}
std::sort(A.begin(),A.end());
int l=-1,r=n-p;
while(l+1<r){
int d=(l+r)/2;
bool F=true;
... | 0 |
#ifdef __GNUC__
#include <bits/stdc++.h>
auto & in = std::cin;
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#else
std::istringstream in;
#endif
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/dynamic_bitset.hpp>
using namespace std;
#define ALL(v) std::begin(v),std::end(v)
using u6 = std::uint6... | //khodaya khodet komak kon
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vect... | 0 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
ll factorial(int i) { //階乗
if (i == 0) return 1;
return (factorial(i - 1)) * i;
}
int main() {
int n, q;
cin >> n >> q;
... | #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<... | 0 |
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
int main()
{
int n;
long long sn, x, y;
vector<long long>p;
map<long, long>m;
while (1){
m.clear();
p.clear();
cin >> n;
if (n == 0)break;
for (int i = 0; i < n; i++){
cin >> sn >> x >> y;
if (m.find(sn) ==... | #include<bits/stdc++.h>
using namespace std;
long long pd,n,s,p[200005],loc,num,l,r,ss;
long long ans,val[200005];
int main(){
// freopen("go home.in","r",stdin);
// freopen("go home.out","w",stdout);
scanf("%lld%lld",&n,&s);
pd=0;l=1;r=n+1;
for (long long i=1;(i<=n);i++){
scanf("%lld%lld",&loc,&num);
if(pd==0)
... | 0 |
#include <stdio.h>
#define MAX_N 100
#define INF 1e8
int main(){
int N,i,j,k,l,q,r[MAX_N],c[MAX_N],p[MAX_N+1];
int dp[MAX_N+1][MAX_N+1];
scanf("%d",&N);
for(i = 0 ; i < N ; i++){
scanf("%d%d",&r[i],&c[i]);
}
p[0] = r[0];
for(i = 1 ; i <= N ; i++){
p[i] = c[i-1];
}
N++;
for(i = 0 ; i < N ; ... | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int mxn=2e5+3,du=1e9+7;
int m,n;
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>m>>n;
map<int,int> mp;
multiset<int> s;
for (int i=1;i<=n;i++) mp[i]=i,s.insert(0);
for (int i=1;i<=m;i++)
{
int l... | 0 |
typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;
void solve(){
ll n;
std::cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++) {
std::cin >> a[i];
}
string s;
std::cin >> s;
vector<vector<ll>> dp(n+1);
dp[n] = {0};
for ... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int, int>;
int main() {
int a[5], k;
rep(i, 5) cin >> a[i];
cin >> k;
bool ok = true;
rep(i, 5) {
for (int j = i+1; j < 5; j++) {
if (abs(a[i]-a[j... | 0 |
#include<stdio.h>
int main(void)
{
int m[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int man,day;
int s;
int i;
scanf("%d %d",&man,&day);
while(man!=0){
s=0;
if(man!=1){
for(i=0;i<man-1;i++){
s+=m[i];
}
s+=day;
}
else {
s+=day;
}
// printf("%d\n",s);
s=s%7;
if(s==0){
printf("Wed... | #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
int main() {
vector<string> s(3);
rep(i,3) cin >> s[i];
int cur = 0;
while (true) {
string t = s[cur];
if (t.empty()) {
cout << char(cur + 'A') << endl;
return 0;
}
s[cur] = t.substr(1,t.size(... | 0 |
#include<iostream>
#include<vector>
using namespace std;
int main(){
long N, A, B;
cin >> N >> A >> B;
vector<long> X(N);
for (int i=0; i<N; i++){
cin >> X[i];
}
long ans = 0;
for (int i=0; i<N-1; i++){
if ((X[i+1]-X[i]) * A < B){
ans += (X[i+1]-X[i]) * A;
... | #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
int main() {
int N, T;
cin >> N >> T;
vector<int> t(N);
rep(i, N) {
cin >> t[i];
}
long lon... | 0 |
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n, x; cin >> n;
x = int(sqrt(n));
while (n%x) x--;
cout << max(int(log10(x) + 1), int(log10(n/x) + 1)) << endl;
}
| #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 ... | 1 |
#include <iostream>
#include <map>
using namespace std;
void solve()
{
int a[5];
while(~scanf("%d,%d,%d,%d,%d", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5]))
{
map<int, int> Map;
for(int i = 0; i < 5; ++i)
{
++Map[a[i]];
}
if(Map.size() == 2)
{
int Max = 0;
for(map<int, int>::iterator Ite = Map.b... | #define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
using namespace std;
char shima[13][13];
void tansaku(int ... | 0 |
#include<bits/stdc++.h>
using namespace std;
int main(){
int k,x;
cin >> k >> x;
for(int i = x-k+1; i <= x + k - 2; i++){
cout << i << " ";
}
cout << x + k - 1 << endl;
} | #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
int main() {
int x,y;
cin >> x >> y;
int ans = 0;
switch (x)
{
case 1:
ans += 300000;
switch (y)
{
case 1:
ans += 700000;
... | 0 |
#include <bits/stdc++.h>
#define sz(x) (int((x).size()))
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
template<typename T> bool domax(T &a, T b) { return (b > a ? (a = b, true) : false); }
template<typename T> bool domin(T &a, T b) { return (b < a ? (a = b, true) : false); }
typede... | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#include <climits>
using namespace std;
int mcm(vector<int>& p)
{
vector<vector<int> > m(p.size() - 1, vector<int>(p.size() - 1));
for (int i = 0; i < m.size(); i++) {
m[i][i] = 0;
}
/*
... | 0 |
#include <bits/stdc++.h>
using namespace std;
int main()
{int A, B, c{}; cin >> A >> B;
for (int i{A}; i <= B; ++i)
{auto s{to_string(i)}, t{s}; reverse(begin(t), end(t));
c += s == t;}
cout << c;} | #include<bits/stdc++.h>
#define reg register
using namespace std;
inline int read() {
reg int s = 0, t = 0; reg char ch = getchar();
while(ch > '9' || ch < '0') t |= ch == '-', ch = getchar();
while(ch >= '0' && ch <= '9') s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
return t ? -s : s;
}
int n,... | 0 |
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define PI 3.14159265359
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pa... | #include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) i... | 0 |
///not today
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef pair<long long, long long> pll;
#define SZ(x) (int)(x).size()
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ... | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000, mod = 998244353, inv2 = (mod + 1) / 2;
int n, m, s, w, d, w2, ans;
int fac[maxn + 10], ifac[maxn + 10], inv[maxn + 10];
inline int add(int x, int y) {
x += y; return x < mod ? x : x - mod;
}
inline int dec(int x, int y) {
x -= y; return x < 0 ? ... | 1 |
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstd... | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
string S;
cin >> N >> S;
vector<int> E(N + 1), W(N + 1);
for (int i = 1; i < N + 1; i++) {
E.at(i) = E.at(i - 1) + (S.at(i - 1) == 'E');
W.at(i) = W.at(i - 1) + (S.at(i - 1) == 'W');
}
int ans = 2e9;
for (int i = 0; i < N + 1; i+... | 1 |
#include <iostream>
using namespace std;
int main(){
while (true)
{
int n, a[5001] = {};
long long int ans = -100000, sum;
cin >> n;
if (n == 0) { break; }
for(int i = 0;i<n;i++){
cin >> a[i];
}
for(int i = 0;i<n;i++){
sum = 0;
for(int j = i;j<n;j++){
sum += a[j];
if(sum > ans){
... | #include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#incl... | 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;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
int N;
cin >> N;
vector<int>A(N);
vector<int>B(N);
vector<int>C(N);
for(int i = 0; i < N; i++) cin ... | 0 |
#include <iostream>
using namespace std;
int main()
{
string test;
getline(cin,test);
if (test[0] == 'A' && test[1] == 'C')
{
cout << "Yes" << endl;
}
else if(test[1] == 'A' && test[2] == 'C')
{
cout << "Yes" << endl;
}
else if(test[2] == 'A' && test[3] == 'C')
{
cout << "Yes" << endl;... | #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes... | 1 |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2000+10,mod=1e9+7;
ll f[maxn][maxn];
ll s[maxn*maxn+10],invs[maxn*maxn+10];
int n,m;
inline void read(int &x){
char c=getchar();
int f=1;
x=0;
while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0' && c<='9'){x=x*10+c-'0';c=g... | #pragma GCC optimize("Ofast,fast-math,unroll-loops")
#include <bits/stdc++.h>
#define int ll
//#define double long double
#define endl '\n'
#define all(C) (C).begin(), (C).end()
#define rall(C) (C).rbegin(), (C).rend()
#define mp make_pair
#define pb emplace_back
#define dbg(x) cerr << #x << " : " << x << endl
//#... | 1 |
#include <iostream>
int main(){
int n=0,A=0,B=0;
while(std::cin >> n, n){
for(int i=0;i<n;i++){
int a=0,b=0;
std::cin>>a>>b;
int ab=a+b;
if(a>b){
A+=ab;
}else{
if(a<b){
B+=ab;
}else{
A+=a;
B+=b;
}
}
}
std::cout<<A<<" "<<B<<std::endl;
A=0,B=0;
}
return 0;
} | #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
while(1){
int A,B,C,N;
cin>>A>>B>>C;
if(A==0&&B==0&&C==0)break;
cin>>N;
int lis[1000][4];
for(int i=0;i<N;i++)cin>>lis[i][0]>>lis[i][1]>>lis[i][2]>>lis[i][3];
... | 0 |
#include <bits/stdc++.h>
#define reg register
#define ll long long
#define ull unsigned long long
using namespace std;
const int MAXN = 110;
int n;
ll a[MAXN];
void work() {
scanf("%d", &n);
for(reg int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
int ans = 0;
for(reg int i = 1; i <= n; ++i) {
for(reg int j = ... | #include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF = 0x3f3f3f40;
const long long mod=1... | 1 |
#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 >> ... | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
void chmax(ll &a, const ll b) { if (a < b) a = b; return; }
const ll INF = 1ll<<60;
int main() {
int n; cin >> n;
vector<ll> a(n); for (int i = 0; i < n; i++) cin >> a[i];
if (n % 2 == 0) {
ll count = 0;
for (int i = 0; i ... | 1 |
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <iomanip>
using namespace std;
#define pi 3.1415926... | #include <bits/stdc++.h>
#define debug(...) fprintf(stderr, __VA_ARGS__)
#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif
namespace IO {
static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;
inline char myGetchar() {
static char buf[IN_BUF], *ps = buf, *pt = buf;
if... | 0 |
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
#include<list>
using namespace std;
typedef long long ll;
typedef pair<int,int... | #include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>
#define PI 3.... | 1 |
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int n; cin >> n; cout << n / 3;
} | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
if(n<3)
cout<<0;
else if (n%3==0)
cout<<n/3;
else if(n%3!=0){
while(true){
n++;
if(n%3==0){
cout<<n/3-1;
break;
}
}
}
return... | 1 |
#include<stdio.h>
#include<iostream>
#include<string>
#include<memory>
#include<cmath>
#include<algorithm>
#include<vector>
int main(){
int N;
std::vector<int> vec;
std::cin>>N;
if(N==0){
std::cout<<0<<std::endl;
return 0;
}
while(N!=0){
vec.emplace_back(abs(... | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define MOD 1000000007
typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typ... | 1 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false), cin.tie(0);
int n;
cin >> n;
if (n == 1) {
cout << "Hello World";
} else {
int a, b;
cin >> a >> b;
cout << a + b << '\n';
}
return 0;
} | #include<cstdio>
#include<iostream>
int main(){
int nowpoint,wran[3]={0},kran[3]={0},wsum=0,ksum=0;
for(int i=0;i<10;i++){
scanf("%d",&nowpoint);
if(wran[0]<nowpoint)
wran[2]=wran[1],wran[1]=wran[0],wran[0]=nowpoint;
else if(wran[1]<nowpoint)
wran[2]=wran[1],wran[... | 0 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ar array
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_u... | #include<bits/stdc++.h>
using namespace std;
//#pragma region atcoder
/*#include <atcoder/dsu>
using namespace atcoder;*/
//using mint = modint998244353;
//These are for segment tree
/*int op(int a, int b){return max(a, b);}
int e(){return -1;}
bool f(int v){ return v < target;}
*/
#pragma endregion
#pragma region macr... | 1 |
#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(10)
const ll MOD = 1000000007;
const ll INF = (ll) 1e15;
ll N, Q;
string S;
ll solve(ll k) {
ll ret = ... | #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();... | 0 |
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define... | #include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = lo... | 1 |
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#define _GLIBCXX_DEBUG
#include <iomanip>
using namespace std;
templa... | #include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
te... | 0 |
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<unordered_map>
#include<set>
#include<cmath>
#include<climits>
#include<random>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define endl '\n... | #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>;
const int MAX = 100000;
const int INF = 1e9;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define PI 3.14159265358979323846264338327950L
#define MOD 1000000007
//setp... | 0 |
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#include<algorithm>
//-... | #include<iostream>
#include<string>
using namespace std;
int main(){
string key;
while(getline(cin,key)){
if(key.size() > 80){
break;
}
for(int j=0; j<26; j++){
for(int i=0; i<key.size(); i++){
if(key[i] >= 'a' && key[i] <= 'z'){
if(key[i] == 'z')
key[i] = 'a';
else
key[i] +... | 0 |
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
// using ll = long long;
// using P = pair<int, int>;
int main() {
int k;
cin >> k;
vector<pair<int, int> > in(k);
rep(i, k) cin >> in[i].first >> in[i].second;
vector<int> p(8);
rep(i, 8) p[... | #include <bits/stdc++.h>
using namespace std;
bool flg;
void init(char field[8][8],bool can[8][8]){
flg = false;
for(int i = 0 ; i < 8 ; i++){
for(int j = 0 ; j < 8 ; j++){
field[i][j] = '.';
can[i][j] = true;
}
}
}
bool inField(int y,int x){
return 0 <= y && y < 8 && 0 <= x && x < 8... | 1 |
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
int memo[10001],color[10001];
stack<int> numb;
vector<int> connect[10001],rconnect[10001];
void dfs(int i){
if(memo[i]!=0) return;
memo[i]=1;
lp(j,connect[i].size()){
dfs(connect[i][j]);
}
numb.push(i);
return;
}
void rd... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1000000007;
struct edge
{
int to;
ll cost;
};
vector<vector<edge>> tree(100010);
vector<ll> depth(100010);
void dfs(int v, int p, ll d)
{ //vからの最短経路、現在地のいっこまえ、はじめからの距離
d... | 0 |
// https://atcoder.jp/contests/agc005/tasks/agc005_a
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#... | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n; cin >> n;
ll a = n/500;
n %= 500;
cout << (a*1000) + int(n/5)*5 << endl;
return 0;
} | 0 |
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
long long mod=(1e+9)+7;
long long n,m;
cin>>n>>m;
static long long sum_x,sum_y;
vector<long long> x(n+10),y(m+10);
for(ll i=1;i<=n;i++) cin>>x[i];
for(ll i=1;i<=m;i++) cin>>y[i];
for(ll xx=1;xx<=n;xx++){
sum_x+=(2*xx-n-1)*x[xx];
... | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
const int mod = 1e9 + 7, A = 5e5 + 2;
int main() {
ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int n, x;
cin >> n >> x;
ll a[n];
for (int i = 0; i < n; i++) cin >> a[i];... | 0 |
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2005;
const int ha=1000000007;
int jc[maxn*maxn],ni[maxn*maxn];
int n,k,f[maxn][maxn];
inline int add(int x,int y){
x+=y;
return x>=ha?x-ha:x;
}
inline int ksm(int x,int y){
int an=1;
for(;y;y>>=1,x=x*(ll)x%ha) if(y&1) ... | #include <stdio.h>
#include <string.h>
int x;
char y[101];
int main(){
scanf("%d",&x); scanf("%s",&y);
int len = strlen(y);
if(len<=x){
printf("%s\n",y);
return 0;
}
else{
for(int i=x; i<len; i++){
y[i]='\0';
}
for(int i=x; i<x+3; i++){
y[i]='.';
}
printf("%s\n",y);
r... | 0 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for (int i = 0; i < (a); i++ )
typedef pair<int,int> P;
typedef long long ll;
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);
char next_char(char now, char pre, string &s, int k) {
if (s[k]=='o') {
if (n... | #include<bits/stdc++.h>
using namespace std;
char str[100100];
int ty[4][100100];
main()
{
int n;
scanf("%d",&n);
scanf("%s",str);
ty[0][0]=ty[0][1]=ty[1][0]=ty[2][1]=0; // sheep
ty[1][1]=ty[2][0]=ty[3][0]=ty[3][1]=1; // wolf
for(int i=1;i<n;i++)
{
if(str[i]=='o')
{
... | 1 |
#include <iostream>
using namespace std;
int main(){
int n,count=0;
cin>> n;
int num[n];
for(int i= 0;i<n;i++)
cin>>num[i];
bool flag=true;
while(flag){
flag=false;
for(int j = n-1 ; j>0;j--){
if(num[j]<num[j-1]){
... | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typede... | 1 |
#include<iostream>
using namespace std;
int main()
{
int N;
int M;
int x[20];
int y[20];
char d;
int l;
while (cin >> N && N != 0)
{
int flag[21][21] = {};
int initX = 10;
int initY = 10;
int cnt = 0;
for (int i = 0; i < N; i++)
{
cin >> x[i];
cin >> y[i];
flag[y[i]][x[i]] = 1;
}
ci... | #include<iostream>
#include<vector>
using namespace std;
const int inf=1e8;
int main(){
while(1){
int n, m;
cin>> n>> m;
if(n==0&&m==0) break;
int a[m], b[m];
for(int i=0; i<m; i++){
cin>> a[i]>> b[i];
a[i]--; b[i]--;
}
int mtrx[n][... | 0 |
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
#include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int MOD = 1e9 + 7;
template<class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template<class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
return vector<decltype(make_vec... | #include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;
#define DEBUG 0
#if DEBUG
#define DLOG(...) fprintf(stderr, __VA_ARGS__)
#else
#define DLOG(...)
#endif
void debug(auto f) {
#if DEBUG
f();
#endif
}
ll mPrime = int(1e9) + 7;
ll bN, bX;
vector<ll> bS;
vector<ll> facts;
... | 1 |
#include <bits/stdc++.h>
using namespace std;
string s, rs;
int n, k;
vector<vector<vector<int>>> dp;
int solve();
int main() {
cin >> s >> k;
n = s.size();
rs = s;
reverse(rs.begin(), rs.end());
cout << solve() << endl;
return 0;
}
int solve() {
int res = 0;
dp.assign(n + 1, vector(n + 1, vector<in... | //Author:xht37
#include <bits/stdc++.h>
#define ui unsigned int
#define ll long long
#define ul unsigned ll
#define ld long double
#define pi pair <int, int>
#define fi first
#define se second
#define mp make_pair
#define ls (p << 1)
#define rs (ls | 1)
#define md ((t[p].l + t[p].r) >> 1)
#define vi vector <int>
#d... | 1 |
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
#define int ll
#define F first
#define S second
const int N = 1e5 + 10;
vector<int> g[N];
int p[N], dp[N], ans, k;
void dfs(int v) {
dp[... | #include <bits/stdc++.h>
using namespace std;
int main()
{
int64_t n;
cin >> n;
int64_t a[n+1];
for(int i = 0; i < n; i++){
cin >> a[i];
}
a[n] = 100000001;
sort(a,a+n);
int64_t ans = 0,count = 1;
for(int i = 0; i < n; i++){
if(a[i] == a[i+1]){
count++;
}else{
if( (cou... | 0 |
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS... | #include<bits/stdc++.h>
using namespace std;
#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fa... | 1 |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
co... | #include<bits/stdc++.h>
using namespace std;
long long read()
{
char ch=getchar();long long x=0,ff=1;
while(ch<'0'||ch>'9') {if(ch=='-') ff=-1;ch=getchar();}
while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
return x*ff;
}
void write(long long aa)
{
if(aa<0) putchar('-'),aa=-aa;
if(aa>9) write(aa/10);
putchar(... | 0 |
#include<bits/stdc++.h>
using namespace std;
using Weight = long long;
using Vertex = int;
struct Edge {Vertex from, to; Weight weight;};
using Graph = std::vector<std::vector<Edge>>;
std::vector<std::vector<Vertex>> connected_component(const Graph& G) {
std::vector<std::vector<Vertex>> cc;
std::vector<bool> used... | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
int v... | 0 |
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(ll i=a;i<=b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define N 101000
#define ll long long
using namespace std;
ll sum,n,a[N],g1[N],g2[N];
ll gcd(ll x,ll y)
{
if(x==-1||y==-1) return -x*y;
return y==0?x:gcd(y,x%y);
}
ll dg(ll x)
{
g1[1]=... | #include<bits/stdc++.h>
using namespace std;
#define N 305
double dp[N][N][N];
int n;
double fn(int x,int y,int z,int n) {
if(x<0 || y<0 || z<0) {return 0;}
if(!x && !y && !z) {return 0;}
if(dp[x][y][z]>0) {return dp[x][y][z];}
int t=x+y+z;
return dp[x][y][z]=(n+x*fn(x-1,y,z,n)+y*fn(x+1,y-1,z,n)+z*fn(x,y+1... | 0 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve(long long N, std::string S, long long Q, std::vector<long long> k)
{
for (ll i = 0; i < Q; i++) {
ll D = 0;
ll M = 0;
ll DM = 0;
ll DMC = 0;
ll ans = 0;
for (ll j = 0; j < N; j++) {
... | #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>;
ll sum[3][1000005];
ll combiDM[1000005];
int main() {
int N;
cin >> N;
string S;
cin >> S;
int Q;
cin >> Q;
vector<int> k(Q);
rep(i, Q) cin >> k... | 1 |
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vec... | #include<bits/stdc++.h>
using namespace std;
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target ("avx2,avx,fma")
#define ll long long int
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define rep(i,l,r) for(... | 0 |
//#include "debug.h"
#include <string.h>
#include <limits.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
const long long M=1000000007;
//typedef long T;
//#include "math/mod.h"
//#include "math/modulo.h"
template<class T, long long M>
struct modulo {
T n;
T gcd_ext(T a... | ///FUCKOUT
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
#define f(i,a,b) for(int i = a; i < b; i++)
//#define endl '\n'
using ll = long long;
using db = long double;
using row = vector<int>;
usin... | 0 |
#include <iostream>
#include <cstdio>
using namespace std;
int A[100000], n;
int Partition(int p, int r){
int x = A[r - 1], j = 0;
//printf("%d ", A[r - 1]);
for(int i = 0;i < n;i++){
if(A[i] <= x){
int tmp = A[j];
A[j++] = A[i];
A[i] = tmp;
}
}
return j - 1;
}
main(){
scanf("%d", &n);
for(... | #include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#define NILL 2000000010
using namespace std;
struct node{
node *p, *l,*r;
int key;
};
node *root;
node * mk_node(int key,node *l,node *r,node *p){
node *n=(node *)malloc(sizeof(node));
n->key=key;
n->r=r;
n->l=l;
n->p=p;
retur... | 0 |
#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;
bool block[6][110][110];
bool visit[110][110];
int main(){
int w, h;
int xs, ys, xg, yg;
int n, c, d, x, y;
while(scanf("%d%d%d%d%d%d%d", &w, &h, &xs, &ys, &xg, &yg, &n) == 7){
memset(block, 0, sizeof block);
memset(visit, 0, sizeof vi... | /*** Mysterious Gems ***/
#include <bits/stdc++.h>
using namespace std;
#define SIZE 21
#define REP(i, n) for(int i=0; i<n; ++i)
void create_map(int map[][SIZE], int n){
int x, y;
REP(j, SIZE){
REP(i, SIZE){
map[j][i]=0;
}
}
REP(i, n){
cin >> x >> y;
map[y][x]=1;
}
return;
}
int main(){
int N, M;
... | 0 |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define FASTIO ios_base::sync_with_stdio(0);cin.t... | #include <iostream>
#include <vector>
#include <queue>
#define to first
#define cost second
const int inf=1e9+7;
using namespace std;
int main(){
int n,tmp,r=0,flag[100]={},v=0;
cin>>n;
vector <pair<int,int> > gl[n];
priority_queue <pair<int,int> ,vector<pair<int,int> >, greater<pair<int,int> > >q;
//for(int... | 0 |
#include<iostream>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((... | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include... | 1 |
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a... | #include<bits/stdc++.h>
#define MN 100000
#define ll long long
using namespace std;
inline int read()
{
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
ll res,v[MN+5],V[MN+5],ans,g[MN+5],G[MN+5];
int n,X,L[MN+5],... | 1 |
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
int n,m; cin >> n >> m;
cout << max(n+m,max(n-m,n*m));
} | #include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
int main()
{
int a,b,c,d,e;
cin>>a>>b>>c;
e=c;
d=a;
a=b;
b=d;
c=a;
a=e;
cout<<a<<" "<<b<<" "<<c<<" "<<endl;
return 0;
}
| 0 |
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
int main(){
int n,tmp,row_sum,col_sum[11];
while(true){
scanf("%d",&n);
if(n == 0)break;
for(int i=0; i < 11; i++)col_sum[i] = 0;
for(int i=0; i < n; i++){
row_sum = 0;
for(int k=0; k < n; k++){
sc... | #include<iostream>
#include<algorithm>
#include<set>
using namespace std;
int cnt[10800];
int main(){
int n, q, m, d;
while(cin >> n >> q, n | q){
fill(cnt, cnt + 10800, 0);
int res = 0;
int mx = 0;
for(int i = 0;i < n;i++){
cin >> m;
for(int j = 0;j < m;j++){
cin >> d;
cnt[d]++;
mx = max(... | 0 |
#include<iostream>
using namespace std;
int main() {
int n;
while (cin >> n) {
if (n == 0) {
break;
}
int point_a = 0;
int point_b = 0;
for (int i = 0; i < n; ++i) {
int a, b;
cin >> a >> b;
if (a > b) {
point_a += a + b;
}
else if (a < b) {
point_b += a + b;
}
else {
... |
#include <iostream>
using namespace std;
int main()
{
int n, a, b, count = 0, pointX = 0, pointY = 0;
cin >> n;
do {
cin >> a >> b;
if (a > b) {
pointX += (a + b);
}
else if (a < b) {
pointY += (a + b);
}
else {
pointX += a;
pointY += b;
}
count++;
if (count == n) {
cout << pointX ... | 1 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int N, K, x;
x = 1;
cin >> N >> K;
int i=0;
while (2*x < x+K){
if (i>=N) {break;}
x*=2;
i++;
}
for (int j=0; j<N-i; j++){
x+=K;
}
cout << x << endl;
}
| #include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
typedef long long ll;
const int inf =2e9;
int N,top=0;
int st[maxn];
int main(){
cin>>N;
st[top]=-inf;
for(int i=1;i<=N;i++){
int x;
cin>>x;
x=-x;
if(x>=st[top])st[++top]=x;
else{
int l=1,r... | 0 |
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int... | /*
これを入れて実行
g++ code.cpp
./a.out
*/
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#inclu... | 0 |
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define ll long long
//#define cccgift
//#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
template<typename T>
inline void read(T &x)
{
static char ch;bool f=1;
for(x=0,ch=g... | #include <bits/stdc++.h>
using namespace std;
bool IsPrime(long long n){
if(n == 1) return false;
for(long long i = 2; i * i < n; i++){
if(n%i == 0) return false;
}
return true;
}
vector<pair<long long, long long>> PrimeFactorize(long long n){
vector<pair<long long, long long>> res;
long long a = 0;
... | 0 |
#include<iostream>
#include<vector>
using namespace std;
int main(){
long int n,sum=0;
cin>>n;
vector<int>v;
for(long int i=1;i<=n;i++){
v.push_back(i);
if(i%3==0||i%5==0)
v.pop_back();
}
for(long int i=0;i<v.size();i++){
sum+=v[i];
}
cout<<sum;
return 0;
} | #include<bits/stdc++.h>
using namespace std;
long long int math(long long int x)
{
long long int ans;
ans=x*(x+1)/2;
return ans;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long int ff,n,fv,th,total,totalff,totalfv,totalth,ans;
cin>>n;
total= math(n);
ff=n/15;
totalff... | 1 |
#include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#includ... | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fr first
#define sc second
typedef vector<int> Vi;
typedef pair<int,int> Pii;
typedef pair<int,Pii> Pip;
const int INF = (1<<30);
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
int main(){
int n, m;
int a[10000], b[10000];
while( cin >> n >>... | 1 |
#include <bits/stdc++.h>
using namespace std;
int main(){
int N; cin >> N;
for(int i=1;; i++) {
if(i*i>N) {
cout << (i-1)*(i-1) << endl;
break;
}
}
return 0;
} | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int n=sqrt(N);
cout << n*n << endl;
}
| 1 |
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstd... | #include <bits/stdc++.h>
using namespace std;
template <class T>
vector<pair<T, T>> prime_factorization(T n) {
vector<pair<T, T>> ret;
for (T i = 2; i * i <= n; i++) {
T cnt = 0;
while(n % i == 0) {
n /= i; cnt++;
}
if(cnt != 0) ret.emplace_back(i, cnt);
}
if... | 0 |
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iomanip>
#include<sstream>
#include<map>
#include<set>
#include<cmath>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
std::fill((T*)array, (T*)(array + N), val);
}
... | #include <bits/stdc++.h>
#if ((_WIN32 || __WIN32__) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif
//{{{
using namespace std;
typedef long long LL;
typedef vector<int> VI;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
// clang-format off
... | 1 |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi0 for(ll i=0;i<n;i++)
string s;
string strd(int n){
string x;
while(n){
int d=n%10;
x+=(d+'0');
n/=10;
}
reverse(x.begin(),x.end());
return x;
}
void digit()
{
cin>>s;
ll sum=0;
for(int... | #include<bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
if(N < 3){
cout << "0" << endl;
return 0;
}
vector<int> a(N);
for(int i = 0;i < N;i++){
cin >> a.at(i);
}
int count = 0;
for(int j = 2;j < N;j++){
for(int k = 1;k < j;k++){
for(int l = 0;l < k;l++){
... | 1 |
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
using namespace std;
int main()
{
string s;
int q;
cin >> s >> q;
cin.ignore();
string buf;
while (q)
{
getline(cin, buf);
//cout << "DEBUG:" << buf << endl;
if (buf.find("replace ")... | #include<iostream>
#include<string>
using namespace std;
int main()
{
string s1, com, s2;
int n,a,b;
cin >> s1 >> n;
for ( int i = 0; i < n; i++ )
{
cin >> com >> a >> b;
if ( com == "print" )
{
cout << s1.substr(a, b-a+1) <<endl;
}
else if ( com == "replace" )
{
cin >> s2;
s1 = s1.repla... | 1 |
//Misterious Gems
#include <iostream>
using namespace std;
enum Direction{
N = 1,//y+
E = 2,//x+
S = 3,//y-
W = 4///x-
};
struct Order{
Direction dir;
int length;
};
int main(){
int MaxN;//宝石最大数
bool GemField[21][21];//宝石の有無保持用フィールド[y][x]
bool RobotField[21][21];//ロボット通過情報保持用フィールド[y][x]
int MaxM;//命令数
Or... | #include <stdio.h>
typedef struct _Gem{
int x;
int y;
bool hit;
} Gem;
static void
pick_gem(Gem* g, int n, int x, int y)
{
for (int i = 0; i < n; i++) {
if (!g[i].hit && g[i].x == x && g[i].y == y) {
g[i].hit = true;
return;
}
}
}
static bool
check_gem(Gem* g, int n)
{
for (int i = 0; i < n; i++) {
... | 1 |
#include<bits/stdc++.h>
#include<string.h>
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
using namespace std;
int nxt() {
int x;
cin >> x;
return x;
}
ll nxtl(){
ll x;
cin>>x;
return x;
}
void SieveOfEratosthenes(int n,vector <int> &primes)
{
// Create a boole... | #include<iostream>
#include<vector>
#include<queue>
using namespace std;
int N,M;
vector<int>G[1000];
int cnt[1000];
main()
{
cin>>N>>M;
for(int i=0;i<M;i++)
{
int u,v;cin>>u>>v;u--,v--;
G[u].push_back(v);
cnt[v]++;
}
queue<int>P;
for(int i=0;i<N;i++)
{
if(cnt[i]==0)P.push(i);
}
int sz=0;
while(!P.emp... | 1 |
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'
#define si(... | #include<bits/stdc++.h>
#define Rint register int
using namespace std;
const int N = 300003, mod = 1e9 + 7, ch[8][2] = {{3, 1}, {5, 2}, {2, 2}, {4, 7}, {3, 3}, {6, 1}, {5, 5}, {3, 1}};
char str[N];
int n, dp[N][8];
inline void qmo(int &x){x += (x >> 31) & mod;}
int main(){
scanf("%s", str); n = strlen(str); dp[n][1... | 0 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n; cin >> n;
map<ll, ll> mp;
for (int i = 0; i < n; i++) {
ll a; cin >> a;
mp[a]++;
}
ll cnt = 0;
for (auto u : mp) {
if (1 < u.second) cnt++;
}
string ans = "YES";
if (1 <= cnt) ans = "NO";
cout << ans << endl;
re... | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define vec vector<int>
#define mii map<int,int>
#define pqb priority_queue<int>
#define inf ... | 1 |
#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;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
int main() {
int n,a,b;
cin >> n >> a >> b;
if(n==1) cout << "Hello World" << endl;
else cout << a+b << endl;
}
| 1 |
#include <iostream>
#include <vector>
#include <iterator>
#include <numeric>
#include <algorithm>
typedef long long ll;
using std::cin;
using std::cout;
const int MaxN = 100005;
int n, m; ll k;
int buk[MaxN];
ll arr[MaxN], tmp[MaxN];
bool vis[MaxN];
int main() {
cin >> n;
std::copy_n(std::istream_iterator<int>(c... | #include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;
#define DEBUG 0
#if DEBUG
#define DLOG(...) fprintf(stderr, __VA_ARGS__)
#else
#define DLOG(...)
#endif
void debug(auto f) {
#if DEBUG
f();
#endif
}
ll mPrime = 1000*1000*1000 + 7;
ll n, x;
vector<ll> s;
vector<ll> fact... | 0 |
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n;
while(cin>>n, n) {
int now, max;
cin>>now;
max=now;
for(int i=1; i<n; i++) {
int t;
cin>>t;
if(now<=0) now=t;
else now+=t... | #include <iostream>
int calcMaxSum(int amount_set);
int main()
{
while (true) {
int amount_set;
std::cin >> amount_set;
if(amount_set == 0) {
break;
}
std::cout << calcMaxSum(amount_set) << std::endl;
}
return 0;
}
int calcMaxSum(int amount_set)
{
... | 1 |
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cas... | #include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996)
typedef long long ll;
#define MIN(... | 0 |
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include<ra... | #include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;
int main() {
ll N, A, B;
cin >> N >> A >> B;
vec<ll> X(N);
rep(i, N) cin >> X[i];
ll ans =... | 0 |
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1000000007;
int H,W,K,dp[110][10],s[10][3];
signed main(){
cin>>H>>W>>K;
for(int bit=0;bit<(1<<(W-1));bit++){
bool b=false;
for(int i=0;i<W-2;i++)
if((bit>>i)&1&(bit>>(i+1)))b=true;
if(b)continue;
for(int i=0;i<W;... | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const int MOD = 1e9 + 7;
int H, W, K;
vector<int> fib;
ll ans;
void input() {
cin >> H >> W >> K;
}
int solve(int n) {
if (n < 0) return 1;
return fib[n];
}
int main() {
input... | 1 |
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define fillarray(array, value, begin, end) fill((array) + (begin), (array) +... | #include <bits/stdc++.h>
using namespace std;
/*
dp[i][j]=dp[i-1][j]+1; (j<L[i-1] or R[i-1]<j)
dp[i][j]=dp[i-1][L[i-1]-1]+1+(j-(L[i-1]-1)) (L[i-1]<=j<=R[i-1])
*/
const int M=2e5+5;
const int INF=0x3f3f3f3f;
struct SegT
{
struct TN
{
int mn,fi,add;
void app_add(int v)
{
add+=v;
mn+=v;
}
void app_se... | 1 |
#include<iostream>//itp14d.cpp
using namespace std;
int main(void)
{
long long int n,m,i,max=0,min=10000000,all=0;
cin>>n;
for(i=1;i<=n;i++){
cin>>m;
all=all+m;
if(max<=m) max=m;
if(min>=m) min=m;
}
if(n==1) cout<<m<<" "<<m<<" "<<m<<endl;
else cout<<min<<" "<<max<<" "<<all<<endl;
return 0;
}
| /*
?????§??§ 1000000 ??????????????§ 10000 ?????\?????????????????§?????????????????¨????¶??????????????????´?????????????????????1010 ????¨???????????????¨?????§??????????????????????????????????????????
int ??§????¶???????????????§???long long (??\?????¬??¬)????????¨??????
??¬??¬????????¬???????????????????????°?¢?... | 1 |
#include<bits/stdc++.h>
using namespace std;
inline int read(){
int s=0,w=1; char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
return s*w;
}
int n,m,q,a[2010][2010];
int po[2010][2010],ba[2010][2010];
int ob[2010][2010],zb[2010][2010];
int ma... | #include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main()
{
int N, M, Q; cin >> N >> M >> Q;
vector<string> S(N); for (auto &s : S) cin >> s;
vector<vector<int>> V(N+1, vector<int>(M+1)), Ex(N, vector<int>(M+1)), Ey(N+1, vector<int>(M));
for (int i = 0; i < N; i++) {
for (i... | 1 |
// 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;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_bac... | 0 |
#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 ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;
const int MOD = 1000000007;
int main() {
int n;
cin >> n;
vector<int> a(n);
vecto... | #include <bits/stdc++.h>
using namespace std;
int n, k;
int a[100010];
bitset<100010> al;
vector<int> adj[100010];
int ans = 0;
int dist[100010];
void dfs(int u){
al[u] = true;
dist[u] = 1;
for(auto v : adj[u]){
if(!al[v]){
dfs(v);
dist[u] = max(dist[u], dist[v] + 1);
... | 0 |
#include <stdio.h>
#include <string.h>
int main(){
int A, B, len;
scanf("%d %d", &A, &B);
char S[100];
scanf("%s", &S);
len = strlen(S);
if(len != A+B+1){
printf("No\n");
return 0;
}
if(S[A] == '-'){
for(int i=0; i<len; i++){
if(i != A){
if(S[i] < 48 || S[i] > 57){
printf("No\n");
return... | #include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
int main() {
int K = 0;
vector<int> in(5, 0);
for (int i = 0; i < 5; i++) cin >> in[i];
cin >> K;
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
if (max(in[i], in[j]) -... | 0 |
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
using namespace std;
#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(... | // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecis... | 0 |
#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>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } re... | #include<bits/stdc++.h>
using namespace std;
int main(){
int N,L;
cin>>N>>L;
int A;
A=L;
int R=A+N-1;
int eat;
if(R<=0){
eat=R;
}
else if(L>=0){
eat=L;
}
else{
eat=0;
}
int ans=(R+L)*(R-L+1)/2-eat;
cout<<ans<<endl;
}
| 1 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0, 0};
int dy[] = { 0, 0, 1, -1};
int main(){
int n;
cin >> n;
int odd[100002]={}, even[100002]={};
int omax=0, emax=0, io, ie;
for(int i=0; i<n; i++){
int a;
cin >> a;
if(i%2==0){
... | /*====Corycle====*/
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<cstdio>
#include<vector>
#include<cmath>
#include<ctime>
#include<stack>
#include<queue>
#include<map>
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const int... | 1 |
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
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 repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back
template<typename T>
void chmax(T &a, T b){ a = max(a, b)... | #include<bits/stdc++.h>
using namespace std;
inline int read()
{
register int x=0;
register char ch=getchar();
while(ch<'0'||ch>'9')
ch=getchar();
while(ch>='0'&&ch<='9')
x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
return x;
}
inline void write(int x)
{
register char st[10];
register int... | 1 |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;
#define rep(i,a,n) for(ll i =... | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
int main(){
... | 0 |
using namespace std;
#include <iostream>
#include <string>
#include <set>
#include <functional>
#include <vector>
#include <algorithm>
#include <stdio.h>
int CtoI(char c){
if(c=='I')return 1;
else if(c=='V')return 5;
else if(c=='X')return 10;
else if(c=='L')return 50;
else if(c=='C')return 100;
else if(c=='D')ret... | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RA... | 1 |
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
while(true){
int a, b, c, N, i, j, t1, t2, t3, r;
scanf("%d %d %d", &a, &b, &c);
if(a == 0 && b == 0 && c == 0) return 0;
scanf("%d", &N);
vector< vector<int> > results;
vector<int> ans(a+b+c+1, 2);
for(i =... | #include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;
#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a)... | 0 |
#include <bits/stdc++.h>
using namespace std;
// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ------------------------------... | #include <iostream>
#include <stdlib.h>
#include <iomanip>
using namespace std;
int main() {
int n;
cin >> n;
int num[n-1];
for (int i = 0; i < n; ++i)
{
cin >> num[i];
}
for (int i = 0; i < n; ++i)
{
if (i) cout << " ";
cout << num[n-1-i];
}
cout... | 0 |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define MOD 1000000007LL
#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(... | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
int a,b;
string s;
vector<char> lst(10);
cin>>a>>b>>s;
bool ans=true;
// for(int i=0;i<s.size();i++){
// cin>>lst.at(i);
// {
for(int i=0;i<s.size();i++){
if (i!=a && ... | 0 |
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_ba... | #include <cstdio>
#include <cstring>
#include <algorithm>
constexpr int STR_MAX_LEN = 1000;
int main(){
char s1[STR_MAX_LEN], s2[STR_MAX_LEN];
int dp[STR_MAX_LEN + 1][STR_MAX_LEN + 1];
scanf("%s%s", s1, s2);
int s1_len = strlen(s1), s2_len = strlen(s2);
for(int i = 1; i <= s1_len; ++i){
... | 0 |
#include<iostream>
using namespace std;
#include<cstdio>
#include<cstring>
//メイン関数
int main()
{
char str[81];
while(fgets(str,sizeof(str),stdin)!=NULL){
// while(scanf("%[^/n]s",str)!=EOF){
//strstrで探索
if((strstr(str,"the")) || (strstr(str,"this")) || (strstr(str,"that"))){
printf("%s",str);
cont... | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#defi... | 0 |
#define BUG
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fi first
#define se second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fore(i, a, b) for (int i = (a), _b = (b... | #include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long
#define sc second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define ... | 1 |
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ll long long
int main(){
int k;
string s;
cin >> k >> s;
if(s.length() <= k){
cout << s << endl;
}else if(s.length() > k){
rep(i,k){
cout << s[i] ;
}
cout << ".... | #include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int ... | 0 |
#include <stdio.h>
#include <vector>
int judge( const int* number_table1 , const int* number_table2 )
{
const int right_side_table[ 6 ][ 6 ] =
{
//front=
// 1 2 3 4 5 6
{ -1 , 3 , 5 , 2 , 4 , -1 }, //top=1
{ 4 , -1 , 1 , 6 , -1 , 3 }, //2
{ 2 , 6 , -1 , -1 , 1 , 5 }, //3
{ 5 ,... | #include <iostream>
#include <string>
using namespace std;
int main(){
string str;
while(getline(cin,str)){
int flg = 0;
while(true){
for(int i = 0 ; i < str.length() ; i++){
string key1 = str.substr(i,3),key2 = str.substr(i,4);
if(key1 == "the" || key2 == "that" || key2 == "this") flg = 1;
... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.