akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * 解説どおりに作成したソースコード
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int[] a = new int[n];
			IntStream.range(0, n).forEach(i -> a[i] = scanner.nextInt() - 1 - i);
			Arrays.sort(a);
			// 中央値を求める
			int middle = (0 == (1 & n)) ? (a[n / 2] + a[n / 2 - 1]) / 2 : a[n / 2];
			System.out.println(IntStream.range(0, n).mapToLong(i -> Math.abs(a[i] - middle)).sum());
		}
	}
}


Measured memory_bytes: 60440
N = int(input())
A = list(map(int, input().split()))
flag = True
ans = 0
while True:
  for i in range(len(A)):
    if A[i] % 2 != 0:
      flag = False
    A[i] = int(A[i] / 2)
  if flag == False:
    break
  ans += 1
print(ans)

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

int main(){
    int D;
    cin >> D;
    vector<int> c(26);
    rep(i,26) cin >> c[i];
    vector<vector<int>> s(D,vector<int>(26));
    rep(j,D) rep(i,26) cin >> s[j][i];

    vector<int> t(D,0);
    vector<vector<int>> last(D, vector<int>(26,0));
    rep(j,D) {
        int maxs = 0;
        rep(i,26) maxs = max(maxs, s[j][i]);
        vector<int> v(0); //s[j][i]が最も大きくなるようなiを入れる
        rep(i,26) {
            if (s[j][i] == maxs) {
                v.push_back(i+1);
            }
        }
        if (v.size() == 1) {
            t[j] = v[0];
            for (int k = j; k < D; k++) last[k][v[0]-1] = j;
        }
        else { //仮
            t[j] = v[0];
            for (int k = j; k < D; k++) last[k][v[0]-1] = j;
        }
    }

    rep(j,D) cout << t[j] << endl;
}

Measured memory_bytes: 3732
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  int n;
  scan(n);
  vector<string> s(n);
  vi times(n);
  rep (i, n) {
    scan(s[i]);
    scan(times[i]);
  }
  string x;
  scan(x);
  int ind = 0;
  rep (i, n) {
    if (s[i] == x) {
      ind = i + 1;
      break;
    }
  }
  int ans = 0;
  FOR (i, ind, n) {
    ans += times[i];
  }
  print(ans);
  return 0;
}


Measured memory_bytes: 888
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#A
def A():
    x, y = LI()
    print(x+y//2)
    return

#B
def B():
    II()
    t, a = LI()
    h = LI()
    ans = [0,inf]
    for num, i in enumerate(h):
        if ans[1] > abs(t - a - i * 0.006):
            ans = [num, abs(t - a - i * 0.006)]
    print(ans[0] + 1)
    return

#C
def C():
    n, m = LI()
    py = LIR(m)
    pya = py[::1]
    py.sort(key=lambda x: x[1])
    city = [1 for i in range(n)]
    dicity = {}
    for p, y in py:
        dicity[(p,y)] = city[p-1]
        city[p-1] += 1    
    for p, y in pya:
        a = "00000" + str(p)
        a = a[-6:]
        b = "00000" + str(dicity[(p, y)])
        b = b[-6:]
        print(a+b)

    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 40768
#include <bits/stdc++.h>
using namespace std;

#define int long long

#define times(n, i) uptil(0, n, i)
#define uptil(a, b, i) for(int i = a; i < b; ++i)
#define uptil_step(a, b, s, i) for(int i = a; i < b; i += s)

#define ln << "\n"
#define sp << " "

inline int S(int x) {
    int ans = 0;
    while(x) {
        ans += x % 10;
        x /= 10;
    }
    return ans;
}

inline int pow10(int x) {
    int ans = 1;
    times(x, o) ans *= 10;
    return ans;
}

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

    int K; cin >> K;

    times(16, t) {
        int s = t < 2 ? 0 : t-2;
        int p1 = pow10(t), p2 = pow10(t + 1), p3 = pow10(s);

        uptil_step(p1+p3-1, p2, p3, n) {
            int sn = S(n);
            uptil_step(n, n + p1, p3, m) {
                if(n * S(m) > m * sn) {
                    goto not_snuke;
                }
            }
            cout << n ln;
            K--;
            if(not K) return 0;

            not_snuke:;
        } 
    }

    return 0;
}



Measured memory_bytes: 256
//e
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
 
#define REP(i,b,n) for(int i=b;i<n;++i)
#define REPR(i,b,n) for(int i=n-1;i>=b;--i)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define BIT(n, b) ((n>>b) & 1)
#define PI acos(-1.0)

#define LIM 1000010

using namespace std;

static const double EPS = 1e-9;
typedef pair<int, int> pii;
typedef long long ll;

int h, w;
string str;

int main(){
	
	while(cin>>w>>h, (h||w)){
	
		vector< vector<pii> > pt(2560);
		vector< vector<int> > dist(2560);
		int glx, gly, mx = 0;
		
		REP(j,0,h){
			REP(i,0,w){
			
				cin>>str;
				
				if(str[0]=='S'){
					pt[0].push_back(make_pair(i, j));
					dist[0].push_back(0);
				}
				else if(str[0]=='G'){
					glx = i;
					gly = j;
				}
				else if('0' <= str[0] && str[0] <= '9'){
					
					int tmp = 0;
					
					REP(k,0,str.size()){
						tmp *= 10;
						tmp += (int)(str[k]-'0');
					}
					
					pt[tmp].push_back(make_pair(i, j));
					dist[tmp].push_back(0);
					mx = max(mx, tmp);
				}
			}
		}
			
		pt[mx+1].push_back(make_pair(glx, gly));
		dist[mx+1].push_back(0);
		
		/*
		for(int i=0; i<=mx; ++i){	
			for(int j=0; j<pt[i].size(); ++j){
				cout << pt[i][j].first << "," << pt[i][j].second << " " ;
			}
			
			cout << endl;
		}
		*/
		
		REPR(k, 0, mx+1){
			REP(i, 0, pt[k].size()){
				
				int tmp = INT_MAX;
				
				REP(j, 0, pt[k+1].size()){
					tmp = min(tmp, dist[k+1][j]
									+ abs(pt[k+1][j].first - pt[k][i].first)
										+ abs(pt[k+1][j].second - pt[k][i].second) );
				}
				
				dist[k][i] = tmp;
			}
		}
		
		cout << dist[0][0] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1476
#include <iostream>
#include <stack>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main(){
	stack<int> S1;
	stack<pair<int, int> > S2;
	char ch;
	int sum = 0;
	for(int i = 0; cin >> ch; i++){
		if(ch == '\\')	S1.push(i);
		else if(ch == '/' && S1.size() > 0){
			int j = S1.top(); S1.pop();
			sum += i - j;
			int a = i - j;
			while(S2.size() > 0 && S2.top().first > j){
				a += S2.top().second; S2.pop();	
			}	
			S2.push(make_pair(j, a));
		}
	}
	
	vector<int> ans;
	while(S2.size() > 0){
		ans.push_back(S2.top().second);
		S2.pop();	
	}
	reverse(ans.begin(), ans.end());
	cout << sum << endl;
	cout << ans.size();
	for(int i = 0; i < ans.size(); i++){
		cout << " ";
		cout << ans[i];	
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 3232
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    double t,x;
    cin>>t>>x;
    printf("%.10f\n",t/x);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
using namespace std;

typedef long long ll;
typedef long double ld;


int main(){
  ll a,b,c,d;
  cin >> a >> b >> c >> d;
  while(true){
    c-=b;
    if(c<=0){
      cout << "Yes";
      break;
    }
    a-=d;
    if(a<=0){
      cout << "No";
      break;
    }

  }
  
  
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}


int main() {
    int n,m;
    cin >> n >> m;
    int no[m+1];
    rep(i,m){
        cin >> no[i];
    }
    no[m] = 99999999;
    int count = 0;

    ll dp[n+1] = {};

    ll ans = 0;

    dp[0] = 1;
    dp[1] = 1;
    if(no[count]==1){
        dp[1] = 0;
        count++;
    }

    srep(i,2,n+1){
        dp[i] = (dp[i-1] + dp[i-2]) % 1000000007;
        if(no[count]==i){
            dp[i] = 0;
            count++;
        }
    }

    cout << dp[n] << endl;
    return 0;
}
 
 


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    int a;
    string s;
    cin >> a >> s;
    if(a >= 3200)cout << s;
    else cout << "red\n";
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

vector<vector<int>> g(mx);
vector<ll> dp(mx,-1);
map<P,int> mp;

int main(){
  int n; cin >> n;
  for(int i=1,a,b,c; i<n; i++){
    cin >> a >> b >> c;
    a--; b--;
    g[a].emplace_back(b);
    g[b].emplace_back(a);
    mp[make_pair(a,b)] = mp[make_pair(b,a)] = c;
  }
  int q,k; cin >> q >> k; k--;

  queue<int> que; que.emplace(k);
  dp[k]=0;

  while(!que.empty()){
    int v=que.front(); que.pop();
    for(int u:g[v]){
      if(dp[u] != -1){ continue; }
      dp[u] = dp[v] + mp[make_pair(u,v)];
      que.emplace(u);
    }
  }

  for(int i=0; i<q; i++){
      int x,y; 
      cin >> x >> y; x--; y--;
    cout << dp[x]+dp[y] << endl;
  }

  return 0;   
}


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

class UnionFind {
 public:
    int g_num;
    vector<int> rank, par;

    UnionFind() {}
    UnionFind(int size) {
        rank.resize(size, 0);
        par.resize(size, 0);
        for (int i = 0; i < size; i++) {
            par[i] = i;
            rank[i] = 0;
        }
        g_num = size;
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;

        g_num--;
        if (rank[x] > rank[y]) {
            par[y] = x;
        } else {
            par[x] = y;
            if (rank[x] == rank[y]) rank[y]++;
        }
    }

    int find(int x) {
        if (x == par[x]) return x;
        return par[x] = find(par[x]);
    }

    int group_num() {
        return g_num;
    }
};

int main(void) {
    int n, q;
    cin >> n >> q;
    UnionFind un(n);
    for (int i = 0; i < q; i++) {
        int c, a, b;
        cin >> c >> a >> b;
        if (c == 0) un.unite(a, b);
        else cout << (un.same(a, b) ? 1 : 0) << endl;
    }
    return 0;
}

Measured memory_bytes: 1280
//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<set>
#include<stack>
#include<iomanip>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<T>>;
template<typename T =ll,typename U =ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

void a(){
    ll s,w; cin >> s >> w;
    if(s<=w){
        cout << "unsafe" <<endl;
    }else{
        cout << "safe" << endl;
    }
}

void b(){
   ll a,b,c,d; cin >> a >> b >> c >> d;
   while(a>0&&c>0){
       c-=b;
       a-=d;
   }

    if(c<=0) {
        cout << "Yes" << endl;
        return;
    }else{
        cout << "No" << endl;
    }

}

void c(){
    
}

void d(){
    
}

void e(){

}

int main(){
    b();
    return 0;
}





Measured memory_bytes: 3636
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cmath>

using namespace std;

void solve()
{
	int n, m;
	while(scanf("%d %d", &n, &m), n || m)
	{
		long double data[101][101];
		for(int i = 0; i < n; ++i)
		{
			for(int j = 0; j < n; ++j)
			{
				scanf("%Lf", &data[i][j]);
			}
		}
		long double dp[101][101];
		for(int i = 0; i < m; ++i)
		{
			for(int j = 0; j < n; ++j)
			{
				dp[i][j] = 0;
			}
		}
		for(int i = 0; i < n; ++i)
		{
			dp[0][i] = 1;
		}
		for(int i = 1; i < m; ++i)
		{
			for(int j = 0; j < n; ++j)
			{
				for(int k = 0; k < n; ++k)
				{
					dp[i][j] = max(dp[i][j], dp[i - 1][k] * data[k][j]);
				}
			}
		}
		long double maximum = 0;
		for(int i = 0; i < n; ++i)
		{
			maximum = max(maximum, dp[m - 1][i]);
		}
		printf("%.2Lf\n", maximum);
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1572
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
  int N, x;
  cin >> N >> x;

  vector<int> v(N);
  for (int i = 0; i < N; ++i) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());

  int count = 0;
  for (int i = 0; i < N; ++i) {
    if (v[i] > x) break;
    if (i == N - 1 && v[i] < x) break;
    ++count;
    x -= v[i];
  }

  cout << count << endl;

  return 0;
}


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

using namespace std;
typedef long long ll;

int main(void)
{
    ll N,K,R,S,P;
    cin >>N>>K>>R>>S>>P;
    string str;
    cin >> str;

    ll res = 0;
    for(ll i=0;i<K;i++){
        ll loc = i;
        char before = 'z';
        while(loc<N){
            if(str.at(loc)!= before){
                if(str.at(loc)=='r') res+=P;
                if(str.at(loc)=='s') res+=R;
                if(str.at(loc)=='p') res+=S;
	            before = str.at(loc);
            }
            else{
                before = 'z';
            }
            loc +=K;
        }
    }

    cout<<res<<endl;

    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

string s;

int main(){
    cin >> s;
    int a = 0,b = 0;
    rep(i,2){
        a *= 10;
        b *= 10;
        a += (s[i] - '0');
        b += (s[i+2] - '0');
    }
    if(a >= 1 && a <= 12){
        if(b >= 1 && b <= 12)cout << "AMBIGUOUS" << endl;
        else cout << "MMYY" << endl;
    }
    else {
        if(b >= 1 && b <= 12)cout << "YYMM" << endl;
        else cout << "NA" << endl;
    }
}

Measured memory_bytes: 256
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
signed main()
{
    tezz
    
    map<string, int> m;
    m["SUN"] = 1;
    m["MON"]  = 2;
    m["TUE"]  = 3;
    m["WED"]  = 4;
    m["THU"]  = 5;
    m["FRI"]  = 6;
    m["SAT"]  = 7;

    string s;
    cin>>s;

    cout<<m["SUN"] - m[s] + 7;
} 

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
  int n;cin>>n;
  vector<int>a(n);
    for (int i = 0; i < n; ++i) {
        cin >>a[i];
    }
    sort(all(a));
    if(a.back()==0){
        puts("Yes");
        return 0;
    }
    if(n%3!=0){
        puts("No");
    }
    else {
        bool flg = true;
        int m=n/3;
        if (a[0]!=a[m-1])flg=false;
        if (a[m]!=a[2*m-1])flg=false;
        if (a[2*m]!=a[3*m-1])flg=false;
        if((a[0]^a[m])!=a[2*m])flg=false;
        if(flg)puts("Yes");
        else puts("No");
    }
}


Measured memory_bytes: 3764
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define int long long
using namespace std;
const int N = 2e3 + 5, mod = 1e9 + 7;
int read() {
	int x = 0, f = 1; char ch;
	while(! isdigit(ch = getchar())) (ch == '-') && (f = -f);
	for(x = ch ^ 48; isdigit(ch = getchar()); x = (x << 3) + (x << 1) + (ch ^ 48));
	return x * f;
}
template <class T> T Max(T a, T b) { return a > b ? a : b; }
template <class T> T Min(T a, T b) { return a < b ? a : b; }
int n, m, x, ans, res, fa[N], val[N];
int ksm(int x, int y) {
	int res = 1;
	for( ; y; x = x * x % mod, y >>= 1) {
		if(y & 1) res = res * x % mod;
	}
	return res;
}
struct Edge {int x, y, z;} e[N];
bool cmp(Edge a, Edge b) {return a.z < b.z;} 
void init() {for(int i = 1; i <= n; ++ i) fa[i] = i;}
int find(int x) {return x == fa[x] ? x : fa[x] = find(fa[x]);}
int get(int c) {
	int res = 0;
	for(int i = 1, fx, fy; i <= m; ++ i) {
		fx = find(e[i].x); fy = find(e[i].y);
		if(fx == fy) continue;
		fa[fx] = fy; res += e[i].z;
		if((++ c) == n - 1) break;
	}
	return res;
}
signed main() {
	n = read(); m = read(); x = read(); init();
	for(int i = 1; i <= m; ++ i) e[i].x = read(), e[i].y = read(), e[i].z = read();
	sort(e + 1, e + m + 1, cmp); ans = get(0);
	if(ans > x) return puts("0"), 0;
	if(ans == x) (res += (ksm(2, n - 1) - 2) * ksm(2, m - n + 1)) %= mod;
	for(int i = 1; i <= m; ++ i) init(), fa[e[i].x] = e[i].y, val[i] = get(1) + e[i].z;
	sort(val + 1, val + m + 1);
	for(int i = n; i <= m; ++ i) if(val[i] == x) (res += ksm(2, m - i + 1)) %= mod;
	printf("%lld\n", res);
	return 0;
}


Measured memory_bytes: 888
import sys
def input():
    return sys.stdin.readline()[:-1]


def main():
    n = int(input())
    d1 = [0] * n
    d2 = [0] * n
    c = [0] * n 
    for i in range(n):
        d1[i], d2[i] = map(int, input().split())
        if d1[i] == d2[i]:
            c[i] = 1
    ans = 0
    for i in range(n - 2):
        if c[i] == 1 and c[i + 1] == 1 and c[i + 2] == 1:
            ans += 1
    if ans != 0:
        print("Yes")
    else:
        print("No")
    

    
if __name__ == "__main__":
    main()

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

using namespace std;

string s, t;
bool pos;

int main(){
  cin >> s >> t;
  for(int i = s.size()-t.size(); i >= 0; i--){
    pos=1;
    for(int j = 0; j < t.size(); j++){
      if(s[i+j]!=t[j] && s[i+j]!='?'){
        pos=0;
      }
    }
    if(pos){
      for(int j = 0; j < t.size(); j++){
        s[i+j]=t[j];
      }
      for(int j = 0; j < s.size(); j++){
        if(s[j]=='?'){
          s[j]='a';
        }
      }
      cout << s;
      return 0;
    }
  }
  cout << "UNRESTORABLE";
}

Measured memory_bytes: 256
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#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 <limits>//setprecision
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set,multiset
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#include <numeric> //accumulate,,,
#define endl "\n";
using namespace std;

const long long INF = 4000000000000000001;
const int inf = 1001001001;
int MOD = 1000000007;
typedef pair<long long,long long> P;

void chmax(long long &a,long long b){if(a < b) a = b;}
void chmin(long long &a,long long b){if(a > b) a = b;}

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M,long long MOD) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2,MOD);
    //When end-of-a bit is 1, times simple N.
    if (M & 1) res = (res * N) % MOD;
    return res %= MOD;
}
long long gcd(long long a, long long b) {
    if (b == 0) return a; else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

//fac[]はn! inv[]はMODにおける逆元 finv[]はinv[]とfinv[]の累積積
const long long MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算(nCkをO(1)で)
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    COMinit();
    long long N,M;cin >> N >> M;
    map<long long,long long> fact;
    long long now = M;long long prv = M;
    while(true){
        for(long long i = 2;i<=sqrt(now);i++){
            if(now % i == 0){
                now /= i;
                fact[i]++;
                break;
            }
        }
        if(prv == now){
            if(prv != 1)fact[now]++;
            break;
        }
        prv = now;
    }
    long long ans = 1;
    for(auto F : fact){
        ans *= COM(F.second+N-1,F.second);
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 15604
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int a;
    scanf("%d",&a);
    if(a>=22 && a<=25){
        if(a==22) printf("Christmas Eve Eve Eve");
        if(a==23) printf("Christmas Eve Eve");
        if(a==24) printf("Christmas Eve");
        if(a==25) printf("Christmas");

    }


    return 0;
}


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

using namespace std;

#define allof(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 2e5 + 5;

int N;
ll arr[MAXN];

ll cost(int l, int r){
    return arr[r] - arr[l - 1];
}

int main(){
    cin.tie(0);
    cin.sync_with_stdio(0);

    cin >> N;
    for(int a = 1; a <= N; a++){
        cin >> arr[a];
        arr[a] += arr[a - 1];
    }

    ll ans = 1e18;
    for(int a = 2, ml = 1, mr = 3; a <= N - 2; a++){
        //[1...ml][ml+1...a][a+1...mr][mr+1...N]

        while(ml + 1 < a && abs(cost(1, ml + 1) - cost(ml + 2, a)) <= abs(cost(1, ml) - cost(ml + 1, a))){
            ml++;
        }

        mr = max(a, mr);
        while(mr + 1 < N && abs(cost(a + 1, mr + 1) - cost(mr + 2, N)) <= abs(cost(a + 1, mr) - cost(mr + 1, N))){
            mr++;
        }

        ll A = cost(1, ml), B = cost(ml + 1, a), C = cost(a + 1, mr), D = cost(mr + 1, N);

        ans = min(ans, max(max(A, B), max(C, D)) - min(min(A, B), min(C, D)));
    }
    cout << ans;
}


Measured memory_bytes: 1792
n, k = map(int, input().strip().split())
xs = list(map(int, input().strip().split()))


def min_for_interval(left, right):
    if left < 0:
        if right < 0:
            return abs(left)
        else:
            l_r = 2 * abs(left) + abs(right)
            r_l = 2 * abs(right) + abs(left)
            return min(l_r, r_l)
    else:
        return right


min_time = 1e9
for i in range(0, n - k + 1):
    left = xs[i]
    right = xs[i + k - 1]
    min_time = min(min_for_interval(left, right), min_time)

print(min_time)


Measured memory_bytes: 14224
package main

import "fmt"

func main() {
	in := make([]int, 4)
	for i := range in {
		fmt.Scan(&in[i])
	}
	fmt.Println(robo(in))
}

func robo(in []int) int {
	diff := min(in[1], in[3]) - max(in[0], in[2])
	if diff < 0 {
		return 0
	}
	return diff
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int a, b;
    cin >> a >> b;
    int x = max(a,b);
    int y = min(a,b);
    
    REP(i,x) cout << y;
    cout << endl;
}

Measured memory_bytes: 3588
program get_ac
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,q,i,l,r
    integer(int32), allocatable:: cs(:), ans(:)
    character(:),allocatable:: s

    read*, n,q
    allocate(cs(n),ans(q),source=0)
    allocate(character(n):: s)

    read*, s
    do i=2,n
        cs(i)=cs(i-1)
        if (s(i-1:i) == 'AC') cs(i)=cs(i)+1
    end do
    
    do i=1,q
        read*, l,r
        ans(i) = cs(r)-cs(l)
    end do

    do i=1,q
        print'(i0)', ans(i)
    end do
end program get_ac

Measured memory_bytes: 2024
#include <iostream>
using namespace std;
int main()
{
  int N;
  long long sum=0;
  cin>>N;
  
  for(int i=1;i<N+1;i++){
    if(i%3==0 or i%5==0){sum+=0;}
    else {sum+=i;}
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=100010;
int tt;
bool w[N];
int head[N],to[N*2],nxt[N*2],L[N],R[N],a[N];
inline int gi() {
    int x=0,o=1;
    char ch=getchar();
    while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
inline void dfs(int x,int fa) {
    if(w[x]) L[x]=R[x]=a[x];
    else L[x]=-1e6,R[x]=1e6;
    for(int i=head[x];i;i=nxt[i]) {
	int y=to[i];
	if(y!=fa) {
	    dfs(y,x);
	    if(R[y]<5e5&&R[x]<5e5&&(R[y]+1<L[x]||R[x]<L[y]-1))
		puts("No"),exit(0);
	    L[x]=max(L[x],L[y]-1),R[x]=min(R[x],R[y]+1);
	}
    }
    if(L[x]>R[x]) puts("No"),exit(0);
}
inline void solve(int x,int fa) {
    for(int i=head[x];i;i=nxt[i]) {
	int y=to[i];
	if(y!=fa) {
	    if(a[x]-1>=L[y]&&a[x]-1<=R[y]) a[y]=a[x]-1;
	    else if(a[x]+1>=L[y]&&a[x]+1<=R[y]) a[y]=a[x]+1;
	    else puts("No"),exit(0);
	    solve(y,x);
	}
    }
}
int main() {
    int n,k;
    cin>>n;
    for(int i=1;i<n;i++) {
	int x=gi(),y=gi();
	to[++tt]=y,nxt[tt]=head[x],head[x]=tt;
	to[++tt]=x,nxt[tt]=head[y],head[y]=tt;
    }
    cin>>k;
    while(k--) {
	int x=gi(),y=gi();
	w[x]=1,a[x]=y;
    }
    dfs(1,0);
    a[1]=L[1],solve(1,0);
    puts("Yes");
    for(int i=1;i<=n;i++) printf("%d\n",a[i]);
    return 0;
}

Measured memory_bytes: 6656
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

const int E = 1 << 20;
const int N = 500000;
int bit[30][E];

long long get(int i, int j)
{
	long long s = 0;
	while (i > 0) {
		s += bit[j][i];
		i -= i & (-i);
	}
	return s;
}
void upd(int i, int j, int v)
{
	while (i <= N) {
		bit[j][i] += v;
		i += i & (-i);
	}
}

int q, n;
string s;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> s >> q;
	for (int i = 0; i < n; i++) {
		upd(i + 1, s[i] - 'a', 1);
	}
	for (int i = 0; i < q; i++) {
		int tp;
		cin >> tp;
		if (tp == 1) {
			int pos;
			char c;
			cin >> pos >> c;
			upd(pos, s[pos - 1] - 'a', -1);
			s[pos - 1] = c;
			upd(pos, s[pos - 1] - 'a', 1);
		}
		else {
			int a, b;
			cin >> a >> b;
			int ans = 0;
			for (int i = 0; i < 26; i++) {
				long long tmp = 0;
				tmp += get(b, i);
				tmp -= get(a - 1, i);
				if (tmp > 0) ans++;
			}
			cout << ans << "\n";
		}
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 54044
x, a, b = input().split()
x = int(x)
a = int(a)
b = int(b)
#print("x =", x)
#print("a =", a)
#print("b =", b)

if x < a:
  xa = a - x
else:
  xa = x - a
  
if x < b:
  xb = b - x
else:
  xb = x - b

if xa > xb:
  print('B')
else:
  print('A')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int dp[100001];

void solve(long long N){
    REP(i, 100001) dp[i] = INF;
    dp[0] = 0;
    VI memo;
    memo.PB(1);
    LL tmp = 6;
    memo.PB(tmp);
    while(tmp * 6 <= 100000) {
        tmp *= 6;
        memo.PB(tmp);
    }
    tmp = 9;
    memo.PB(tmp);
    while(tmp * 9 <= 100000) {
        tmp *= 9;
        memo.PB(tmp);
    }
    sort(ALL(memo));

    REP(i, 100000) {
        REP(j, memo.size()) {
            int next = i + memo[j];
            if(next <= 100000) {
                dp[next] = min(dp[next], dp[i] + 1);
            }
        }
    }

    cout << dp[N] << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
	char S;
	cin >> S;
	if(S=='a'||S=='i'||S=='u'||S=='e'||S=='o'){
		cout << "vowel" << endl;
	}else{
		cout << "consonant" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<cctype>
#include<ctime>
#include<cstdlib>
#include<map>
#include<set>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<string>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define il inline
#define rg register
#define lch(x) ((x)<<1)
#define rch(x) ((x)<<1^1)
#define rep(i,st,ed) for(rg int i=(st);i<=(ed);++i)
#define per(i,ed,st) for(rg int i=(ed);i>=(st);--i)
#define rep0(i,n) for(rg int i=0;i<(n);++i)
#define per0(i,n) for(rg int i=(n)-1;i>=0;--i)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double dbl;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> il T qmin(const T &x,const T &y){return x<y?x:y;}
template<typename T> il T qmax(const T &x,const T &y){return x>y?x:y;}
template<typename T> il void getmin(T &x,const T &y){if(y<x) x=y;}
template<typename T> il void getmax(T &x,const T &y){if(y>x) x=y;}
il void fileio(const string &s){
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

const int inf=(int)1e9+7;
const ll linf=(ll)1e18+7;
const int N=305;

int f[N][N],sum[N][N],C[N][N];
int n,k,mod;

il void inc(int &x,const int &y){
	if((x+=y)>=mod) x-=mod;
}

int main(){
//	fileio("test");
	scanf("%d%d%d",&n,&k,&mod);
	rep0(i,N){
		C[i][0]=1;
		rep(j,1,i){
			C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
		}
	}
	per(i,k,0){
		f[1][i]=1;
		sum[1][i]=(sum[1][i+1]+f[1][i])%mod;
	}
	rep(i,2,n+1){
		per(j,k,0){
			int &cur=f[i][j];
			cur=0;
			rep(t,1,i-1) inc(cur,(ll)f[t][j]*sum[i-t][j+1]%mod*C[i-2][t-1]%mod);
		//	cerr<<i<<" "<<j<<" "<<cur<<endl;
			sum[i][j]=(sum[i][j+1]+cur)%mod;
		}
	}
	printf("%d\n",f[n+1][0]);
	return 0;
}

Measured memory_bytes: 1280
N,K,Q=map(int, input().split())
Start=[K-Q]*N
Winner=[int(input()) for t in range(Q)]
for i in Winner:
    Start[i-1]=Start[i-1]+1
Ans=['Yes' if j>0 else 'No' for j in Start]
for a in Ans:
    print(a)

Measured memory_bytes: 11304
#pragma GCC optimize("Ofast,unroll-loops")
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB push_back
#define PF push_front
#define FILL(a,b) memset(a,b,sizeof(a))
using namespace std;
int n,m;
string s;
V<int> can,ans;
int main(){
	ios::sync_with_stdio(0);
    cin.tie(0);
	cin>>n>>m;
	cin>>s;
	FOR(i,0,n){
		if(s[i]=='0')can.PB(i);
	}
	if(s[0]=='1'||s[n]=='1'){
		cout<<-1;RE 0;
	}
	rep(i,1,can.size()){
		if(can[i]-can[i-1]>m){
			cout<<-1;RE 0;
		}
	}
	int now=n;ans.PB(now);
	while(now){
		now=*lower_bound(ALL(can),now-m);ans.PB(now);
	}
//	rep(i,0,ans.size())cout<<ans[i]<<' ';cout<<'\n';
	for(int i=ans.size()-1;i>=1;i--)cout<<ans[i-1]-ans[i]<<' '; 
	RE 0;
}





Measured memory_bytes: 1480
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;


int main(){
    cin>>S>>T;
    ll ans = 0;
    rep(i,3) ans += S[i] == T[i];
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		
		int a = Integer.valueOf(s);
		
		int []x = new int [4];
		
		for(int i = 0; i < 4  ; i++) {
			x[3-i] = a % 10;
			a = a / 10;
		}
		int []c = new int [3];
		
		for(int i = 0; i < 8 ; i++) {
			int temp = x[0];
			for(int j = 0; j < 3; j++) {
			if((1 & i >> j) == 1) {
				temp += x[j+1];
				c[j] = 1;
			}
			else {
				temp -= x[j+1];
				c[j] = 0;
			}
		}
			if(temp == 7) {
				break;
			}
		}
		
		for(int i = 0 ; i < 3 ; i++) {
			if(c[i] == 1) {
			System.out.print(x[i] +""+"+");
			}
			else {
			System.out.print(x[i]+""+"-");
			}
		}
		System.out.print(x[3]+""+"=7");
	}

}


Measured memory_bytes: 23124
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

const bool ready = []() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define all(v) (v).begin(), (v).end()
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;

#define endl "\n"

set<int> fact(int i) {
    set<int> ans;
    for(int j=2; j*j<=i; j++) {
        while(i%j==0) {
            ans.insert(j);
            i/=j;
        }
    }
    if(i!=1)
        ans.insert(i);
    return ans;
}

void solve() {
    cini(n);
    cinai(a,n);

    int g=a[0];
    int pairwise=true;
    set<int> allf;
    for(int i=0; i<n; i++) {
        if(i>0)
            g=gcd(g,a[i]);

        if(pairwise) {
            set<int> f=fact(a[i]);
            for(int j : f) {
                if(allf.count(j)>0)
                    pairwise=false;
                allf.insert(j);
            }
        }
    }
    if(pairwise)
        cout<<"pairwise coprime"<<endl;
    else if(g==1)
        cout<<"setwise coprime"<<endl;
    else
        cout<<"not coprime"<<endl;

}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS


Measured memory_bytes: 11116
#include   <bits/stdc++.h>
#include   <stdio.h>
#include   <stdlib.h>
#define    pb push_back
#define    mp make_pair
#define    ii   int
#define    ll  long long
#define    ld  long double
#define    pii  pair<ii,ii>
#define    pll  pair<ll,ll>
#define    vcii   vector<ii>
#define    vcll   vector<ll>
#define    vcd     vector<double>
#define    vcs    vector<string>
#define    vpii   vector<pii>
#define    vpll   vector<pll>
#define    scll(x)  scanf("%lld",&x)
#define    pfll(x) printf("%lld\n",x)
#define    scd(x) scanf("%llf",&x)
#define    pfd(x) prinf("%0.5llf\n",x)
#define    pie acos(-1)

using namespace std;


int main()
{

   ll  t,n,a,b,d,i,j,c,m,tc,q,area,area2,x,y;
   cin>>n;
   string s;
   set<string>st;
   for(i=0;i<n;i++)
   {
   	  cin>>s;
   	  st.insert(s);
   }
   cout<<st.size()<<"\n";
    return 0;
}



Measured memory_bytes: 19176
#include <iostream>
 
int main()
{
  int n;
  std::cin >> n;
  int As[n], Bs[n], Cs[n-1];
  for(int i=0; i<n; i++)
    std::cin >> As[i];
  for(int i=0; i<n; i++)
    std::cin >> Bs[i];
  for(int i=0; i<n-1; i++)
    std::cin >> Cs[i];
  
  int satisfaction = 0;
  satisfaction += Bs[As[0] - 1];
  for(int i=1; i<n; i++){
    satisfaction += Bs[As[i] - 1];
    if(As[i] == As[i-1] + 1){
      satisfaction += Cs[As[i-1] - 1];
    }
  }
  
  std::cout << satisfaction;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int  main(void)
{
	
	int num[100],k,ans[100];
	int count=0;
	
	for(int i=0;i<5;i++){
		
		scanf("%d",&(num[i]));
		
	}
	
	scanf("%d",&k);
	
	for(int i=0;i<5;i++){
		
		for(int j=1;j<5;j++){
			
			ans[i]=abs(num[i]-num[j]);
			
		}
		
		if(ans[i]>k){
			
			count++;
			
		}
		
	}
	
	if(count!=0){
		
		printf(":(\n");
			
		}else{
			
			printf("Yay!\n");
			
		}
		
		return 0;
	}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main(){
    int n, cnt = 0;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        if((i % 2) == 0){
            if((a[i] % 2) == 1){
                cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;

int solve(int n,int *a[],int *dp[])
{
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            if(i==0)
            {
                dp[i][j]=a[i][j];
            }
            else if(j==0)
            {
                dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2]);
            }
            else if(j==1)
            {
                dp[i][1]=a[i][1]+max(dp[i-1][0],dp[i-1][2]);
            }
            else if(j==2)
            {
                dp[i][2]=a[i][2]+max(dp[i-1][1],dp[i-1][0]);
            }
        }
    }
    return max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2]);
}
int main()
{
  int n;
  cin>>n;
  int *a[n],*dp[n];
  for(int i=0;i<n;i++)
  {
      a[i]=new int[3];
      dp[i]=new int[3];
  }
  for(int i=0;i<n;i++)
  {
      for(int j=0;j<3;j++)
      {
          cin>>a[i][j];
          dp[i][j]=-1;
      }
  }
  int ans=0;
  ans=solve(n,a,dp);
  cout<<ans;
  return 0;
}


Measured memory_bytes: 8064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
  int num,i;
  long long int sum=0;
  (void)scanf("%d",&num);
  for(i=1;i<=num;i++){
    if(i%3!=0&&i%5!=0)
    sum+=i;
  }
  printf("%lld\n",sum);
  return 0;
}

Measured memory_bytes: 1732
def v():
 for e in iter(input,'0 0'):
  r=int(e.split()[0])
  d=[int(''.join(x),2)for x in zip(*[input().split()for _ in[0]*r])]
  a=0
  for m in range(1<<~-r):
   t=0
   for s in d:
    c=bin(m^s).count('1')
    t+=c if c>r/2 else r-c
   if a<t:a=t
  print(a)
if'__main__'==__name__:v()


Measured memory_bytes: 6924
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> p(n); for (int i = 0; i < n; ++i) cin >> p[i];

    vector<int> cp = p;
    sort(p.begin(), p.end());

    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        if (p[i] != cp[i]) cnt++;
    }

    if (cnt == 2 || cnt == 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
 int A = 0, B = 0, C = 0;
 cin >> A >> B >> C;
 int count = 0;
  if (A == C){
     cout << B;
 }
 else if(B == C){
     cout << A;
 }
 else{
     cout << C;
 }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int,int>;
using vi = vector<int>;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vpii = vector<pair<int,int>>;
using vivi = vector<vector<int>>;
using vbvb = vector<vector<bool>>;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int mod = 1000000007;
const int inf = 1001001001;



int main(void) {
  string s;
  cin >> s;
  int cnt = 0;
  ll ans = 0;
  int n = s.size()+1;
  vll a(n,0);
  
  
  rep(i,n-1){
    if(s[i]=='<')a[i+1] = a[i]+1;
    
  }
  for(int i = n-2;i>=0;i--){
    if(s[i]=='>')a[i] = max(a[i],a[i+1] +1);
  }
  
  rep(i,n)ans+=a[i];
  //rep(i,n)cout << a[i]<<endl;
  cout << ans << endl;
    
}






Measured memory_bytes: 4740
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

int main() {
    int a, b, c;

    cin >> a >> b >> c;

    if (a + b + c >= 22) {
        cout << "bust" << endl;
    }
    else {
        cout << "win" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

int solve(int a, int b)
{
  if (a <= 5) return 0;
  if (a >= 13) return b;
  return b / 2;
}

int main()
{
  int a;
  int b;
  std::cin >> a >> b;

  std::cout << solve(a, b) << std::endl;
}


Measured memory_bytes: 256