akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

void run (void) {
  i32 n, k;
  scanf ("%" SCNi32 "%" SCNi32, &n, &k);
  if (k >= (1 << n)) {
    puts ("-1");
    return;
  }
  if (n == 1 && k == 1) {
    puts ("-1");
    return;
  }
  if (k == 0) {
    for (i32 i = 0; i < (1 << n); ++i) {
      printf ("%" PRIi32 " ", i);
    }
    for (i32 i = (1 << n) - 1; i >= 0; --i) {
      printf ("%" PRIi32, i);
      putchar (i == 0 ? '\n' : ' ');
    }
    return;
  }
  printf ("%" PRIi32, 0);
  for (i32 i = 1; i < (1 << n); ++i) {
    if (i == k) continue;
    printf (" %" PRIi32, i);
  }
  printf (" %" PRIi32, k);
  for (i32 i = (1 << n) - 1; i >= 0; --i) {
    if (i == k) continue;
    printf (" %" PRIi32, i);
  }
  printf (" %" PRIi32 "\n", k);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 2e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    int h[n];
    rep(i, 0, n) cin >> h[i];
    vector<int> dp(n, INF);
    dp[0] = 0;
    rep(i, 1, n) {
        dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if (i >= 2) {
            dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
        }
    }
    cout << dp[n - 1] << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int ary[3];
    cin >> ary[0] >> ary[1] >> ary[2];
    sort(ary, ary+3);
    cout << (ary[2] * 10 + ary[1] + ary[0]) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>

using namespace std;
 
typedef long long i64;
typedef pair<i64, i64> P;

template<class T>
const T INF = numeric_limits<T>::max();
template<class T>
const T SINF = numeric_limits<T>::max() / 10;
static const i64 MOD = 1000000007;

//int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//int dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//int dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge {
	i64 from, to, cost;
	edge(i64 to, i64 cost) : from(-1), to(to), cost(cost) {}
	edge(i64 src, i64 to, i64 cost) : from(src), to(to), cost(cost) {}
};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}

//-----end of template-----//

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	string a, b, c;
	cin >> a >> b >> c;
	int ans = 0;
	for(int i = 0; i < n; ++i){
		if(a[i] == b[i] && a[i] == c[i]) continue;
		if(a[i] == b[i] || a[i] == c[i] || b[i] == c[i]) ans++;
		else ans += 2;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  cout << ((g*10+b)%4 ? "NO" : "YES") << endl;
  return 0;
}

Measured memory_bytes: 3540
#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 _GLIBCXX_DEBUG
int main() {
    string s,t;
    cin>>s>>t;
    int l1,l2;
    l1=s.size();
    l2=t.size();
    int dp[l1+1][l2+1];
    rep(i,l1+1){
        dp[i][0]=0;
    }
    rep(i,l2+1){
        dp[0][i]=0;
    }
    for (int i=1 ;i<l1+1 ;i++){
        for (int j=1;j<l2+1;j++){
            if (s.at(i-1)==t.at(j-1)){
                dp[i][j]=dp[i-1][j-1]+1;
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    string ans="";
    while(l1>0 && l2>0){
        if (s.at(l1-1)==t.at(l2-1)){
            ans=s.at(l1-1)+ans;
            l1--;
            l2--;
        }
        else{
            if(dp[l1][l2]==dp[l1-1][l2]){
                l1--;
            }
            else{
                l2--;
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

using namespace std;
typedef long long int lli;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[i];

    int max_cnt = 0;
    int cnt = 0;
    repm(i,1,n){
        if(h[i] <= h[i-1]){
            cnt++;
            if(cnt > max_cnt) max_cnt = cnt;
        }
        else{
            cnt = 0;
        }
    }

    cout << max_cnt << endl;
}


Measured memory_bytes: 640
#include<stdio.h>
int main()
{
	int a,b,c,s=0;
	scanf("%d %d %d",&a,&b,&c);
	if(a !=b){
		if(a == c || b== c) s=2;
		else s=3;
	}
	else if(a == b){
		if(a == c) s=1;
		else s=2;
	}
	printf("%d\n",s);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>

int main()
{
    int n, w;
    std::cin >> n >> w;
    std::vector<int> w_arr(n), v_arr(n);
    for (int i = 0; i < n; ++i)
    {
        int tmp_w, tmp_v;
        std::cin >> tmp_w >> tmp_v;
        w_arr[i] = tmp_w;
        v_arr[i] = tmp_v;
    }

    std::vector<std::vector<int64_t>> values(4);
    for (int i = 0; i < n; ++i)
    {
        const int j = w_arr[i] - w_arr[0];
        values[j].push_back(v_arr[i]);
    }
    for (int i = 0; i < 4; ++i)
    {
        std::sort(values[i].begin(), values[i].end(), std::greater<>());
    }
    std::vector<int64_t> weights(4);
    for (int i = 0; i < 4; ++i)
    {
        weights[i] = w_arr[0] + i;
    }

    int max_value = 0;
    for (size_t i = 0; i <= values[0].size(); ++i)
    {
        const int64_t w0 = weights[0] * i;
        if (w0 > w)
        {
            break;
        }
        const int64_t v0 = std::accumulate(values[0].begin(), values[0].begin() + i, 0ll);
        for (size_t j = 0; j <= values[1].size(); ++j)
        {
            const int64_t w1 = weights[1] * j;
            if (w0 + w1 > w)
            {
                break;
            }
            const int64_t v1 = std::accumulate(values[1].begin(), values[1].begin() + j, 0ll);
            for (size_t k = 0; k <= values[2].size(); ++k)
            {
                const int64_t w2 = weights[2] * k;
                if (w0 + w1 + w2 > w)
                {
                    break;
                }
                const int64_t v2 = std::accumulate(values[2].begin(), values[2].begin() + k, 0ll);
                for (size_t l = 0; l <= values[3].size(); ++l)
                {
                    const int64_t w3 = weights[3] * l;
                    if (w0 + w1 + w2 + w3 > w)
                    {
                        break;
                    }
                    const int64_t v3 = std::accumulate(values[3].begin(), values[3].begin() + l, 0ll);
                    const int64_t v = v0 + v1 + v2 + v3;
                    if (v > max_value)
                    {
                        max_value = v;
                    }
                }
            }
        }
    }

    std::cout << max_value << std::endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

struct UnionFind{
    std::vector<int> parent, rank, cnt;

    UnionFind(int n) : parent(n), rank(n, 0), cnt(n, 1) {
        std::iota(parent.begin(), parent.end(), 0);
    }

    int find(int v){
        if(v == parent[v]){return v;}
        return parent[v] = find(parent[v]);
    }

    bool same(int v, int w){
        return find(v) == find(w);
    }

    void unite(int v, int w){
        v = find(v);
        w = find(w);

        if(v == w){return;}

        if(rank[v] > rank[w]){
            parent[w] = v;
            cnt[v] += cnt[w];
        }else{
            parent[v] = w;
            cnt[w] += cnt[v];
            if(rank[v] == rank[w]){rank[w] += 1;}
        }
    }

    int count(int v){
        return cnt[find(v)];
    }
};

UnionFind uf(200100);
int N, M;
int A, B;

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    std::cin >> N >> M;

    for(int i=0;i<M;++i){
        std::cin >> A >> B;

        uf.unite(A, B);
    }

    int res = 0;

    for(int i=1;i<=N;++i){
        res = std::max(res, uf.count(i));
    }

    std::cout << res << std::endl;
}


Measured memory_bytes: 5460
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons;

alias Prog = Tuple!(int, "c", int, "s", int, "t");

int N;
Prog[10^^5] PS;

void main()
{
    auto nc = readln.split.to!(int[]);
    N = nc[0];
    foreach (i; 0..N) {
        auto stc = readln.split.to!(int[]);
        PS[i] = Prog(stc[2], stc[0], stc[1]);
    }

    sort!"a.s < b.s"(PS[0..N]);

    Prog[] rs;
    foreach (p; PS[0..N]) {
        bool can;
        foreach (ref r; rs) {
            if (r.c == p.c && r.t == p.s) {
                can = true;
                r = p;
                break;
            }
            if (r.t < p.s) {
                can = true;
                r = p;
                break;
            }
        }
        if (!can) {
            rs ~= p;
        }
    }
    writeln(rs.length);
}

Measured memory_bytes: 2428
import java.util.Scanner;	//Scannerクラス：Java標準入力を取得する

class Main{
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			for(;;) {
				int n = sc.nextInt();
				int x = sc.nextInt();
				if(n==0&&x==0) break;
				int num = 0;	//出力
				for(int i=1;i < n - 1;i++) {
					for(int j = i+1;j < n;j++) {
						for(int k = j+1;k < n + 1;k++) {
							if((i+j+k)==x)
								num++;
						}
					}
				}
				System.out.println(num);
			}
		}
	}
}



Measured memory_bytes: 27268
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

int inf = 1e6;

int main()
{
    int n, m;
    cin >> n >> m;
    vvi g(n);
    for (int i = 0; i < m; i++)
    {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        g[u].push_back(v);
    }

    int s, t;
    cin >> s >> t;
    s--;
    t--;

    vvi sg(n);
    for (int i = 0; i < n; i++)
    {
        sg[i] = vi(3, inf);
    }

    queue<pii> q;
    q.push(make_pair(s, 0));
    sg[s][0] = 0;
    while (!q.empty())
    {
        int u = q.front().first;
        int st = q.front().second;
        q.pop();
        int nst = (st + 1) % 3;
        for (int v : g[u])
        {
            if (sg[v][nst] != inf)
            {
                // あとから最短ルートが出てくることってない？
                continue;
            }
            sg[v][nst] = sg[u][st] + 1;
            q.push(make_pair(v, nst));
        }
    }

    int ans = (sg[t][0] == inf) ? -1 : sg[t][0] / 3;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
using ll = long long;
using P = pair<ll, ll>;
using vl = vector<ll>;

ll calc(ll n, P p) { return n / p.first * p.second + n % p.first; }

ll f(ll n, vector<P> p) {
  ll m = p.size();
  if(m == 0)
    return n;
  else if(m == 1)
    return calc(n, p[0]);
  else if(m == 2) {
    ll res = n;
    rep(i, n + 1) {
      ll j = n - i;
      ll now = calc(i, p[0]) + calc(j, p[1]);
      res = max(res, now);
    }
    return res;
  } else {
    ll res = n;
    rep(i, n + 1) rep(j, n + 1) {
      ll k = n - i - j;
      if(k < 0) continue;
      ll now = calc(i, p[0]) + calc(j, p[1]) + calc(k, p[2]);
      res = max(res, now);
    }
    return res;
  }
}

int main() {
  ll n;
  vl a(3), b(3);
  cin >> n;
  rep(i, 3) cin >> a[i];
  rep(i, 3) cin >> b[i];
  vector<P> p1, p2;
  rep(i, 3) if(a[i] < b[i]) p1.push_back({a[i], b[i]});
  n = f(n, p1);
  rep(i, 3) if(a[i] > b[i]) p2.push_back({b[i], a[i]});
  cout << f(n, p2) << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define mod 1000000007
#define maxn 2000005
#define f(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rf(i,a,b) for(ll i=(ll)(a);i>=(ll)(b);i--)
#define pb push_back
#define pf(x) push_front((ll)(x))
#define nl cout << "\n";
 
// struct Data{
// 	ll hi,lo;
// };

void ini(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
}

// bool comp(Data &a,Data &b){
// 	return (a.val<b.val);
// }


int main(){
	ini();
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	ll n;
	cin >> n;
	ll ans=n+(n*n)+(n*n*n);
	cout << ans;
}

Measured memory_bytes: 3600
/*
AuThOr GaRyMr
技巧:
1.区别对待大数据&小数据！
2.Dp难推时算贡献！
3.long long (尤其乘法)！
4.long long INF 要大
5.Dp on trees: 换根法，每次清空当前的节点和换到的子节点
6.long double | 输出浮点数
7.注意特判!(prince and princess)
WISH ME GOOD LUCK
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	int n;
	cin>>n;
	int res=0;
	rb(i,1,n){
		int oth;
		oth=n-i;
		if(oth<=i) break;
		res++;
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 256
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define dup(x) x.erase(unique(x.begin(), x.end()),x.end())
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
// https://atcoder.jp/contests/abc170/tasks/abc170_a
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll ans = 0;
    ll x[5] = {0,};
    for(int i = 0 ;i<5;i++){
        cin >> x[i];
        if(x[i] == 0)
            ans = i+1;
    }
    cout << ans;

	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

const ll INF = 1e11;
const int MAX_V = 101;

int V, E;

// dp[i][j]: iから（kを通って）jまでの最短距離
// kの次元は使い回せるので省略できる
ll dp[MAX_V][MAX_V];

void wf() {
  rep(i, V) rep(j, V) rep(k, V) {
    if (dp[j][i] != INF && dp[i][k] != INF) dp[j][k] = min(dp[j][k], dp[j][i] + dp[i][k]);
  }
}

int main() {
  cin >> V >> E;
  rep(i, V) rep(j, V) if (i != j) dp[i][j] = INF;
  rep(i, E) {
    int s, t, d;
    cin >> s >> t >> d;
    dp[s][t] = d;
    // 無向グラフの場合は両方に追加
    // dp[t][s] = d;
  }
  wf();
  rep(i, V) {
    if (dp[i][i] < 0) {
      cout << "NEGATIVE CYCLE" << endl;
      return 0;
    }
  }
  rep(i, V) {
    rep(j, V) {
      string v = dp[i][j] == INF ? "INF" : to_string(dp[i][j]);
      cout << v;
      if (j != V - 1) cout << " ";
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3340
#include <iostream>
#include <vector>
#include <stack>

using namespace std;

long long inf = 1e18 + 5;

void min_self(long long& a, long long b) {
    a = min(a, b);
}

int main() {
    int n, w;
    cin >> n >> w;
    vector<long long> weight(n), value(n);
    for(int i = 0; i < n; i++) {
        cin >> weight[i] >> value[i];
    }
    long long sum_of_values = 0;
    for(int i = 0; i < n; i++) {
        sum_of_values += value[i];
    }
    vector<long long> dp(sum_of_values + 1, inf);
    dp[0] = 0;
    //dp[i] => minimum weight with value exactly i
    for(int i = 0; i < n; i++) {
        for(int value_already = sum_of_values - value[i]; value_already >= 0; value_already--) {
            min_self(dp[value_already + value[i]], dp[value_already] + weight[i]);
        }
    }
    for(int i = sum_of_values; i >= 0; i--) {
        if(dp[i] <= w) {
            cout << i;
            break;
        }
        //cout << dp[i];
    }
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    string sa;
    string sb;
    string sc;
    cin >> sa;
    cin >> sb;
    cin >> sc;
    map<char, string> all;
    all['a'] = sa;
    all['b'] = sb;
    all['c'] = sc;
    char i = 'a';
    while(true) {
        if(all[i].length() == 0) {
            char res = i - 'a' + 'A';
            cout << res << endl;
            return 0;
        }
        char tmp = all[i][0];
        all[i].erase(0, 1);
        i = tmp;
    }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int height[10];
	int i,j;
	for(i = 0; i < 10; i++){
		scanf("%d", &height[i]);
	}
	for(i = 0; i < 3; i++){
		for(j = i + 1; j < 10; j++){
			if(height[i] < height[j]){
				int tmp;
				tmp = height[i];
				height[i] = height[j];
				height[j] = tmp;
			}
		}
		printf("%d\n", height[i]);
	}
	
    return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#define MN 2000
#define mod 1000000007
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;
}
int f[2][MN+5][MN+5],n,K,g[2][MN*2+5];
inline void R(int&x,int y){x+=y;x>=mod?x-=mod:0;}
int main()
{
    n=read();K=read();R(g[0][n],1);
    for(int i=n;i;--i) for(int j=n-i;~j;--j)
    {
        for(int k=0;k<2;++k)
        {
            int id=n-(i-1+j);
            int nk=k|(id==K&&i==1);
            R(f[nk][i][j],(g[k][i+j]-f[k][i][j+1]+mod)%mod);
            R(f[k][i][j],f[k][i][j+1]);
        }
        for(int k=0;k<2;++k)
        {
            R(g[k][i+j-1],f[k][i][j]);
            if(i==1&&j>1) R(f[k][i][j-1],f[k][i][j]);
        }
    }
    int ans=0;
    for(int i=1;i<=n;++i) R(ans,f[1][i][0]);
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 31360
while true
  a, op, b = gets.split(" ")
  a = a.to_i; b = b.to_i
  case op
  when "+"
    puts "#{a + b}"
  when "-"
    puts "#{a - b}"
  when "*"
    puts "#{a * b}"
  when "/"
    puts "#{a / b}"
  when "?"
    break
  end
end

Measured memory_bytes: 8664
package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

func scanText() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	
	s, t := scanText(), scanText()

	ans := 0 

	for i := 0; i < 3; i++ {
		if s[i] == t[i] {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
//




#include <bits/stdc++.h>
using namespace std;


#define spdio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pp pop_back()
#define pf push_front
#define ppf pop_front()
#define ff first
#define ss second
#define mp make_pair
#define fr(i,j,n) for(ll i=j; i<n; i++)
#define rfr(i,j,n) for(ll i=n-1; i>=j; i--)
#define pll pair<ll,ll>
#define plb pair<ll,bool>
#define psl pair<string,ll>
#define psb pair<string,bool>
#define srt(v) sort((v).begin(),(v).end())
#define ub(v,val) upper_bound((v).begin(),(v).end(),(val))-(v).begin()
#define lb(v,val) lower_bound((v).begin(),(v).end(),(val))-(v).begin()


typedef long double ld;
typedef long long int ll;


//getline(cin,string);
const ll inf = (ll) 1e18 + 19;
const ll mod = (ll) 1e9  +  7;




ll lcs(vector <vector <ll> > &dp,string s1,string s2,ll i,ll j) {
    if(i>=s1.length() || j>=s2.length())
        return 0;
    if(dp[i][j]!=-1) return dp[i][j];
    if(s1[i]==s2[j])
        return dp[i][j]=1+lcs(dp,s1,s2,i+1,j+1);
    else
        return dp[i][j]=max(lcs(dp,s1,s2,i+1,j),lcs(dp,s1,s2,i,j+1));
}




void cazz() {
    ll t=1,i=0,j,n;
    //cin>>t;
    while(t--) {
        string s1,s2;
        cin>>s1>>s2;
        vector <vector <ll> > dp(s1.length()+1,vector <ll> (s2.length()+1));
        //lcs(dp,s1,s2,0,0);
        rfr(i,0,s1.length()) {
            rfr(j,0,s2.length()) {
                if(s1[i]==s2[j]) dp[i][j]=dp[i+1][j+1]+1;
                else dp[i][j]=max(dp[i+1][j],dp[i][j+1]);
            }
        }
        i=j=0;
        string s="";
        while(i<s1.length() && j<s2.length()) {
            if(s1[i]==s2[j]) {
                s+=s1[i];
                i+=1;
                j+=1;
            }
            else if(dp[i+1][j]>dp[i][j+1]) i+=1;
            else j+=1;
        }
        cout<<s<<"\n";
    }
}




int main() {
    spdio;
	cazz();
	return 0;
}


Measured memory_bytes: 73680
#include<stdio.h>

int main(void)
{
  int ans,d,n,i;

  scanf("%d %d",&d,&n);
  if(d == 0)
    {
      if(n == 100)
	{
	  ans = 101;
	}
      else
	{
	  ans = n;
	}
    }
  else
    {
      if(n == 100)
	{
	  ans = 101;
	 
	}
      else
	{
	  ans = n;
	}
      for(i=0;i<d;i++)
	{
	  ans *= 100;
	} 
    }
  printf("%d",ans);

  return 0;
}

Measured memory_bytes: 128
// In the name of God

#include <bits/stdc++.h>

#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define an size()

using namespace std;
const ll maxn=109;
int main()
{
    string s,t,saves;
    cin>>s;
    saves=s;
    ll ans=1e9;
    ll v=0;
    for(char i='a'; i<='z'; i++)
    {
        s=saves;
        v=0;
        while(1)
        {
              t="";
            bool ok=1;
            for(ll j=0; j<s.an; j++)
            {
                if(s[j]!=i)
                {
                    ok=0;
                    break;
                }
            }
            if(ok)
            {
                ans=min(ans,v);
                break;
            }

            v++;
            for(ll j=0; j<s.an-1; j++)
            {
                if(s[j]==i)
                {
                    t+=i;
                }
                else
                {
                    t+=(s[j+1]);
                }
            }
            s=t;
        }
    }
    cout<<ans;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//






int main() {

    ll N, P; cin >> N >> P;
    vector<vector<ll>> div;
    for (ll i = 2; i*i <= P; ++i) {
        ll c = 0;
        while(P%i == 0) {
            ++c;
            P /= i;
        }
        if (c != 0) {
            vector<ll> tmp(2);
            tmp[0] = i; tmp[1] = c;
            div.push_back(tmp);
        }
    }
    if (P != 1) {
        vector<ll> tmp(2);
        tmp[0] = P; tmp[1] = 1;
        div.push_back(tmp);
    }

    ll ans = 1;
    rep(i,div.size()) {
        div[i][1] /= N;
        ans *= pow(div[i][0], div[i][1]);
    }
    out(ans);
    

    return 0;
}









Measured memory_bytes: 256
#include<string>
#include<iostream>
using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;

    int len = s.length();
    int flag = 0;

    if(len == a + b + 1){
        for(int i = 0; i < a + b + 1; i++){
            if(i == a){
                if(s[i] != '-'){
                    flag = 1;
                    break;
                }
            }else{
                if(s[i] == '-'){
                    flag = 1;
                    break;
                }
            }
        }
        if(flag == 0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main(){
  int n,c[10001];
  unsigned short *a,*b;
  int i,k=0;
  scanf("%d",&n);
  a = malloc(sizeof(short)*n+1);
  b = malloc(sizeof(short)*n+1);

  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    if(k<a[i]) k=a[i];
  }

  for(i=0;i<=k;i++)
    c[i]=0;
  
  for(i=0;i<n;i++)
    c[a[i]]++;

  for(i=1;i<=k;i++)
    c[i]=c[i]+c[i-1];

  for(i=n-1;i>=0;i--){
    b[c[a[i]]]=a[i];
      c[a[i]]--;
  }
  
  for(i=1;i<n;i++)
    printf("%d ",b[i]);
  printf("%d\n",b[n]);
return 0;

}



Measured memory_bytes: 9544
#include<stdio.h>
#include<algorithm>
using namespace std;
int table[1000];
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a){
		int sum=0;
		for(int i=0;i<a;i++){
			scanf("%d",table+i);
			sum+=table[i];
		}
		std::sort(table,table+a);
		for(int j=a-b;j>=0;j-=b)sum-=table[j];
		printf("%d\n",sum);
	}
}

Measured memory_bytes: 0
def f(path)
  path = rotate(path)
  path[0][1..-1].size.times{|x|path[0][x + 1] += path[0][x]}
  for y in 1...path.size
    path[y][0] += path[y - 1][0]
    for x in 1...path[y].size
      path[y][x] += [path[y - 1][x], path[y][x - 1]].max
    end
  end
  return path[-1][-1]
end
def rotate(path)
  square = Array.new(path.size / 2 + 1){Array.new(path.size / 2 + 1)}
  path[0...path.size / 2].each_with_index{|row, idx|
    row.each_with_index{|n, i|
      square[idx - i][i] = n
    }
  }
  path[path.size / 2..-1].each_with_index{|row, idx|
    row.each_with_index{|n, i|
      square[path.size / 2 - i][idx + i] = n
    }
  }
  return square
end
def main(input = STDIN)
  path = []
  while arg = input.gets
    path << arg.split(",").map(&:to_i)
  end
  puts f(path)
end
main

Measured memory_bytes: 6120
// Aizu Vol-1 0179: Mysterious Worm
// 2017.8.22 bal4u@uu

#include <stdio.h>
#include <string.h>

#define MAX 0xaaaaa
#define QMAX 5000000
char chk[MAX+10];
int Q[QMAX+10], *top, *end, *qmax = Q + QMAX;
int N, K, mask;

int nxt[16] = { 0, 10, 5, 0, 10, 5, 0, 0, 5, 0, 10 };

int main()
{
	int s, r, g, b, step;
	int i, k;
	char buf[15], *bp;

	while (1) {
		scanf("%s", buf); if (buf[0] == '0') break;
		memset(chk, 0, sizeof(chk));
		for (N = s = 0, bp = buf; *bp; bp++, N += 2) {
			if      (*bp == 'r') k = 0;
			else if (*bp == 'g') k = 1;
			else                 k = 2;
			s = (s << 2) | k;
		}
		mask = (1 << N) - 1, r = 0, g = 0x55555 & mask, b = 0xaaaaa & mask;
		top = end = Q, qmax = Q+QMAX;
		*end++ = s, *end++ = -1, chk[s] = 1, step = 0, K = N-4;
		while (top < end) {
			s = *top; if (++top >= qmax) top = Q;
			if (s < 0) { step++, *end = -1; if (++end >= qmax) end = Q; continue; }
			if (s == r || s == g || s == b) { printf("%d\n", step); goto Done; }
			for (i = 0; i <= K; i += 2) {
				int s2, k2;
				k = (s >> i) & 0xf;
				k2 = nxt[k];
				if (k2 == k) continue;
				s2 = (s & ~(0xf << i)) | (k2 << i);
//				s2 &= mask;
				if (chk[s2]) continue;
				chk[s2] = 1;
				*end = s2; if (++end >= qmax) end = Q;
			}
		}
		if (top >= end) puts("NA");
		Done:;
	}
	return 0;
}

Measured memory_bytes: 20768
#include <bits/stdc++.h>
typedef unsigned long long ll;
using namespace std;


int main() {
    

    int a,b;
    cin>>a>>b;
    if(a>9||b>9||a<1||b<1){
        cout<<-1;
    }
    else{
        cout<<a*b;
    }

    int l ; cin>>l;

}

Measured memory_bytes: 256
#pragma once

#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;

#define rep(a,n) for(int a = 0;a < n;a++)
#define repi(a,b,n) for(int a = b;a < n;a++)

const ull mod = 1000000007;

struct edge {
	int from;
	int to;
	ll cost;
};

static const ll INVALID = 1e16;
static const ll INF = 1e15;

//有向グラフ、負の閉路がある場合の最短経路算出
struct BellmanFord {
	std::vector<edge> edges_;
	int vertexCount_;
	std::vector<ll> cost;

	BellmanFord(int vertexCount, std::vector<edge>&& edges) : edges_(std::move(edges)), vertexCount_(vertexCount) {
	}

	ll solve(int start, int goal, const std::vector<bool>& visit, const std::vector<bool>& visit2)
	{
		cost.resize(vertexCount_, INF);
		cost[start] = 0; //始点を0にする

		for (int i = 0; i < cost.size(); i++) {
			for (int j = 0; j < (int)edges_.size(); j++) {
				const auto& e = edges_[j];
				if (!visit[e.to] || !visit2[e.to]) continue;
				if (cost[e.to] > cost[e.from] + e.cost) {  //移動した後のコストが小さいと、頂点のコストを更新
					cost[e.to] = cost[e.from] + e.cost;
					if (i == cost.size() - 1) {         //頂点の数と同じ回数ループすると、負の閉路があるのでループをぬける
						return INVALID;
					}
				}
			}
		}
		return cost[goal];
	}
};

std::vector<bool> bfs(std::vector<std::vector<int>> g, int v, int start) {
	std::vector<bool> vs(v,false);
	queue<int> q;
	q.push(start);
	while (!q.empty()) {
		auto f = q.front(); q.pop();
		if (vs[f]) continue;
		vs[f] = true;
		for (auto e : g[f]) {
			if (vs[e]) continue;
			q.push(e);
		}
	}
	return vs;
}

int main(void)
{
	ll n, m, p;
	cin >> n >> m >> p;
	vector<edge> vs(m);
	vector<vector<int>> g(n);
	vector<vector<int>> rev_g(n);
	rep(i, m) { cin >> vs[i].from >> vs[i].to >> vs[i].cost; 
		vs[i].from--;
		vs[i].to--;
		vs[i].cost = p - vs[i].cost;
		rev_g[vs[i].to].push_back(vs[i].from);
		g[vs[i].from].push_back(vs[i].to);
	}
	auto v1 = bfs(rev_g, n, n-1);
	auto v2 = bfs(g, n, 0);
	BellmanFord bf(n, std::move(vs));
	auto cost = bf.solve(0, n - 1, v1, v2);
	if (cost == INVALID) {
		cout << -1 << endl;
		return 0;
	}
	cout << max(0LL, -cost) << endl;
	return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
typedef long long int lint;
using namespace std;

int main() {
    int n, q;
    string s;
    cin >> n >> q >> s;
    vector<int> cum(n + 1, 0);
    for (int i = 2; i < n + 1; i++) {
        cum[i] = cum[i - 1];
        if (s[i - 2] == 'A' && s[i - 1] == 'C') {
            cum[i]++;
        }
    }
    for (int i = 0; i < q; i++) {
        int l, r;
        cin >> l >> r;
        cout << cum[r] - cum[l] << endl;
    }
}

Measured memory_bytes: 1408
#include<stdio.h>
int main(void)
{
	int a,e,f,sum,i,x;
	x=100;
	sum=0;
	for(i=0;i<4;i++){
		scanf("%d",&a);
		sum+=a;
		if(x>a){
			x=a;
		}
	}
	sum=sum-x;
	scanf("%d %d",&e,&f);
	if(e>f){
		sum+=e;
	}
	else{
		sum+=f;
	}
	printf("%d\n",sum);
	return 0;
}


Measured memory_bytes: 2124
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  st s;
  ci(s);
  int a = 0;
  rep(i, 3){
    if(s.at(i) == '1'){
      a++;
    }
  }
  co(a);
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;

int n,m,v[1100],w[1100];
bool done[110][11000];
int memo[110][11000];

int search(int i,int h){
	
	if(done[i][h]) return memo[i][h];
	
	int res;
	if(i == n) res = 0;
	else if(w[i] > h) res = search(i + 1, h);
	else if(w[i] <= h){
		int res1 = search (i + 1, h);
		int res2 = search (i + 1, h - w[i]) + v[i];
		res = max(res1,res2);
	}
	done[i][h] = true;
	return memo[i][h] = res;
}

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) cin >> v[i] >> w[i];
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= m; j++){
			done[i][j] = false;
		}
	}
	cout << search(0,m) << endl;
}


Measured memory_bytes: 8312
#include <bits/stdc++.h>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int n;
string w[50];
bool ok(int idx) {
    int now = 0;
    vector<int> vec{5, 7, 5, 7, 7};
    rep(i, n) if (idx <= i) {
        vec[now] -= w[i].size();
        if (vec[now] == 0) {
            now++;
            if (now == vec.size()) return true;
        }
        if (vec[now] < 0) {
            break;
        }
    }
    return false;
}
void solve() {
    rep(i, n) {
        if (ok(i)) {
            cout << i + 1 << endl;
            break;
        }
    }
}
int main() {
    while (cin >> n, n) {
        rep(i, n) cin >> w[i];
        solve();
    }

    return 0;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
#define pi 3.14159265359
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p;
    ld d;
    cin >> x >> d;
    d = d*(ld)x;
    cout << fixed <<  (ll)trunc(d);


    return 0;
}


Measured memory_bytes: 3744
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    string s;
    cin >> s;
    int ret = 0, m = 0;
    rep(i, s.size() - 2){
        int a = 0;
        rep(j, 3){
            a = a * 10 + s[i + j] - '0';
        }
        if(abs(a - 753) < abs(m - 753)){
            m = a;
            ret = abs(a - 753);
        }
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 256
const lines: string[] = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line: string) {
  lines.push(line);
});

reader.on("close", function () {
  const rule = lines.shift().split(" ").map(Number);
  const tenNum = rule[0];
  const roadNum = rule[1];
  const heightArray = lines.shift().split(" ").map(Number);

  const roadArrays: any = lines.map((line) => {
    return line.split(" ").map((int) => parseInt(int));
  });
  const connect = new Array(tenNum).map((ele) => [0]);

  for (let i = 0; i < roadArrays.length; i++) {
    connect[roadArrays[i][0] - 1]
      ? connect[roadArrays[i][0] - 1].push(roadArrays[i][1])
      : (connect[roadArrays[i][0] - 1] = [roadArrays[i][1]]);
    connect[roadArrays[i][1] - 1]
      ? connect[roadArrays[i][1] - 1].push(roadArrays[i][0])
      : (connect[roadArrays[i][1] - 1] = [roadArrays[i][0]]);
  }

  let count = 0;
  for (let i = 0; i < connect.length; i++) {
    if (!connect[i]) {
      count++;
      continue;
    }
    let judge = true;
    connect[i].forEach((element) => {
      heightArray[i] > heightArray[element - 1] ? "" : (judge = false);
    });
    judge ? count++ : "";
  }
  console.log(count);
});


Measured memory_bytes: 94940
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    ll n; cin >> n;
    ll m = 0, a = 0, r = 0, c = 0, h = 0;
    REP(i, n){
        string s; cin >> s;
        if(s[0] == 'M') m++;
        else if(s[0] == 'A') a++;
        else if(s[0] == 'R') r++;
        else if(s[0] == 'C') c++;
        else if(s[0] == 'H') h++;
    }

    ll ans = 0;
    ans += m * a * r;
    ans += m * a * c;
    ans += m * a * h;
    ans += m * r * c;
    ans += m * r * h;
    ans += m * c * h;
    ans += a * r * c;
    ans += a * r * h;
    ans += a * c * h;
    ans += r * c * h;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
 	ll cost;
 };
using Graph = vector<vector<Edge>>;

const int MAX = 10000000;
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 3.1415926535897932;
const ll INF = LLONG_MAX;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
/****** define constant end ********/
/****** define variable start ******/
ll n, x, t;
/******* define variable end *******/
int solve() {
	cin >> n >> x >> t;
	ll kaisuu = n / x;
	if(n % x != 0){
		kaisuu++;
	}
	cout << t * kaisuu << endl;
	return 0;
}

int main() {
	// clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  string s;

  cin >> s;

  for(int i=0;i+1<s.size();i++){
    if(s[i] == 'A' && s[i+1] == 'C'){
      puts("Yes");
      return 0;
    }
  }

  puts("No");
  
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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; } return false; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  cin >> N;
  vector<ll> A(N);

  for(int i = 0; i < N; i++){
    cin >> A[i];
  }

  multiset<ll> ms;
  for(int i = 0; i < N; i++){
    ms.insert(A[i]);
  }

  sort(A.begin(), A.end(), greater<ll>());

  ll ans = 0;
  for(int i = 0; i < N; i++){
    ll base = 1;
    while(base <= A[i]){
      base = base * 2;
    }
    // baseをつくる
    // setから取り除く(なぜならばもう使われることはない)
    auto itr = ms.find(A[i]);
    if(itr != ms.end()){
      ms.erase(itr);
      auto nitr = ms.find(base - A[i]);
      if(nitr != ms.end()){
        ms.erase(nitr);
        ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 11264
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**13
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    l = I()
    if l < 60:
        r = ["2 {}".format(l)]
        for i in range(l):
            r.append("1 2 {}".format(i))
        return '\n'.join(r)
    n = 1
    l -= 1
    while 2**n-1 <= l:
        n += 1
    a = [2**(n-i-1) for i in range(n)] + [0]
    r = []
    for i in range(1,n):
        r.append("{} {} 0".format(i,i+1))
        r.append("{} {} {}".format(i,i+1,a[i]))
    t = sum(a) - a[0]
    l -= t
    for i in range(0,n):
        if l >= a[i]:
            r.append("1 {} {}".format(i+1,t+1))
            t += a[i]
            l -= a[i]

    return "{} {}\n".format(n,len(r)) + '\n'.join(r)


print(main())


Measured memory_bytes: 6868
/*
गिरते हैं शहसवार ही मैदान-ए-जंग में ।
वो तिफ़्ल क्या गिरे जो घुटनों के बल चले ।।
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
#define int     long long int
#define ull     unsigned int
#define ld      long double
#define pb      push_back
#define pa      pair<int,int>
#define ppa     pair<pair<int,int>,int>
#define pap     pair<int,pair<int,int>>
#define v1d     vector<int>
#define v2d     vector<vector<int> >
#define vpa     vector<pair<int,int>>
#define M       1000000007
#define MN      LLONG_MIN
#define MX      LLONG_MAX
#define ff      first
#define ss      second
#define endl    "\n"
#define v1s     vector<string>
#define all(v)  v.begin(),v.end()
#define S(v)    sort(v.begin(),v.end())
#define RS(v)   sort(v.rbegin(),v.rend())
#define R(v)    reverse(v.begin(),v.end())
#define mxpq(T)    priority_queue <T>
#define mnpq(T)    priority_queue<T,vector<T>,greater<T>>
#define T       int tc;cin>>tc;while(tc--)
#define p2d(v)     for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)      for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v)      for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define sz(v)       (int)(v.size())
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define qqq 400005


void Weapons19(){
    int n;cin>>n;
    v1d v(n);
    int a1=0,a2=0,ans;
    for(int i=0;i<n;i++){cin>>v[i];}
    for(int i=0;i<n;i++){
        if(i&1)a2+=v[i];
        else a1+=v[i];
    }
    v1d a(n),b(n);
        int x=0,y=0;
        for(int i=0;i<n;i++){
            if(i&1){x+=v[i];a[i]=max(x,y);}
            else {y+=v[i];a[i]=y;}
        }
        x=0,y=0;
        for(int i=n-1;i>=0;i--){
            if(i%2==0){x+=v[i];b[i]=max(x,y);}
            else {y+=v[i];b[i]=y;}
        }
    if(n%2==0){
        ans=max(a1,a2); 
        
        for(int i=1;i<n;i+=2){
            if((i+1)!=n){
                ans=max(ans,a[i-1]+b[i+2]);
            }
        }
        cout<<ans;return;
    }
    ans=a2;
    for(int i=0;i<n;i+=2){
        ans=max(ans,a1-v[i]);
    }
    // v1d a(n),b(n);
    for(int i=0;i<n;i++){
        int p=0;
        if(i>0)p+=a[i-1];
        if(i+2<n)p+=b[i+2];
        ans=max(ans,p);
    }
    v1d z(n);z[n-1]=v[n-1];
    v1d q(n);q[n-2]=-999999999999999;
    for(int i=n-3;i>=0;i--){
        if(i%2==0)
        z[i]=z[i+2]+v[i];
        if(i%2==1){
            q[i]=v[i]+max(q[i+2],z[i+3]);
            // cout<<i<<" "<<v[i]<<" "<<q[i]<<endl;
        }
    }
    // p1d(q)
    // cout<<ans;
    int w=0;
    for(int i=0;i<n;i+=2){
        w+=v[i];
        if(i+3<n)
        ans=max(ans,w+q[i+3]);
    }
    cout<<ans;











}

int32_t main(){

    /*
    त्यक्तवाधर्मं च लोभं च
    मोहंचो द्यमास्थिता।
    युद्ध्यध्वमनहंकारा
    यतो धर्मस्ततो जयः।।
    */

    cout<<fixed<<setprecision(16);
    cin.sync_with_stdio(false);
    cin.tie(0);cout.tie(0);

    

    Weapons19();
    
}


Measured memory_bytes: 11080
/**********************************
	author:  mariogzsl
**********************************/

#include <bits/stdc++.h>

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,b,a) for(int i=b-1;i>=a;i--)
#define f first
#define s second
#define puts(x) cout<<x<<endl
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin>>s;
	int N=s.size();
	int a=0, b=0;
	FOR(i,0,N){
		char auxA = ((i%2)?'0':'1');
		char auxB = ((i%2)?'1':'0');
		if(s[i]!=auxA)a++;
		if(s[i]!=auxB)b++;
	}
	cout<<min(a,b)<<endl;
	return 0;
}


Measured memory_bytes: 512