akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	ll n,a,b,c; cin >> n >> a >> b >> c;
	vc ans(n);
	vs s(n);
	rep(i,n) cin >> s[i];
	if(a+b+c == 2){
		rep(i,n){
			if(s[i] == "AB"){
				if(!a && !b){
					puts("No");
					return 0;
				}
				if(a == 1 && b == 1){
					if(i < n-1 && s[i+1] == "BC"){
						b++; a--; ans[i] = 'B';
					}else{
						a++; b--; ans[i] = 'A';
					}
				}else{
					if(a >= b) a--, b++, ans[i] = 'B';
					else a++, b--, ans[i] = 'A';
				}
			}else if(s[i] == "AC"){
				if(!a && !c){
					puts("No");
					return 0;
				}
				if(a == 1 && c == 1){
					if(i < n-1 && s[i+1] == "BC"){
						c++; a--; ans[i] = 'C';
					}else{
						a++; c--; ans[i] = 'A';
					}
				}else{
					if(c >= a) c--, a++, ans[i] = 'A';
					else c++, a--, ans[i] = 'C';
				}
			}else{
				if(!b && !c){
					puts("No");
					return 0;
				}
				if(b == 1 && c == 1){
					if(i < n-1 && s[i+1] == "AC"){
						c++, b--; ans[i] = 'C';
					}else{
						b++, c--; ans[i] = 'B';
					}
				}else{
					if(b >= c) b--, c++, ans[i] = 'C';
					else b++, c--, ans[i] = 'B';
				}
			}
		}
		puts("Yes");
		rep(i,n) cout << ans[i] << "\n";
		return 0;
	}
	rep(i,n){
		if(s[i] == "AB"){
			if(!a && !b){
				puts("No");
				return 0;
			}
			if(a >= b) a--, b++, ans[i] = 'B';
			else a++, b--, ans[i] = 'A'; 
		}else if(s[i] == "BC"){
			if(!b && !c){
				puts("No");
				return 0;
			}
			if(b >= c) b--, c++, ans[i] = 'C';
			else b++, c--, ans[i] = 'B';
		}else{
			if(!c && !a){
				puts("No");
				return 0;
			}
			if(c >= a) c--, a++, ans[i] = 'A';
			else c++, a--, ans[i] = 'C';
		}
	}
	puts("Yes");
	rep(i,n) cout << ans[i] << "\n";
}

Measured memory_bytes: 6428
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		long K = sc.nextLong();
		if(K <= A) {
			A -= K;
			System.out.println(A + " " + B);
		}
		else {
			K -= A;
			B -= K;
			System.out.println(0 + " " + Math.max(0, B));
		}

	}

}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=998244353;
template<typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}
int pw(int n,int k){
  if(k<0)return pw(n,k+MOD-1);
  int res=1;
  while(k){
    if(k&1)res*=n;res%=MOD;
    n*=n;n%=MOD;
    k>>=1;
  }
  return res;
}
signed main(){
  int n;cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  if(v[0])fin(0);
  map<int,int> m;
  for(int i=0;i<n;i++)m[v[i]]++;
  if(m[0]!=1)fin(0);
  int ans=1;
  int M=1;
  for(auto p:m)M=p.first;
  for(auto p:m){
    if(p.first==0)continue;
    int a=p.second;
    int k=m[p.first-1];
    //cout<<a<<" "<<k<<endl;
    ans*=pw(k,a);ans%=MOD;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 7296
//#pragma Gbb optimize("Ofast") 
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<fstream>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<time.h>
#include<algorithm>
#define inf 0x3f3f3f3f
using namespace std;

long long a[200010];

int main()
{
	ios::sync_with_stdio(false);
	int n, m;
	long long ans;
	cin >> n >> m;
	for (int i = 1; i <= m; i++) cin >> a[i];
	ans = n - a[m] + a[1];
	for (int i = 2; i <= m; i++) ans = max(ans, a[i] - a[i - 1]);
	cout << n - ans;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int maxN = (int)1e5 + 100;
int gcd(int a, int b) {
    while (a > 0 && b > 0) {
        if (a < b) swap(a, b);
        a %= b;
    }
    return (a + b);
}
int pref[maxN], suf[maxN];
int n;
int a[maxN];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    srand(228);
    //freopen("input.txt", "r", stdin);
    cin >> n;
    pref[0] = 0;
    suf[n + 1] = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        pref[i] = gcd(pref[i - 1], a[i]);
    }
    for (int i = n; i >= 1; i--) {
        suf[i] = gcd(suf[i + 1], a[i]);
    }
    int mx = 0;
    for (int i = 1; i <= n; i++) {
        mx = max(mx, gcd(pref[i - 1], suf[i + 1]));
    }
    cout << mx;
    return 0;
}

Measured memory_bytes: 1408
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>

#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)

#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)
#define  ll_cout(X) printf("%lld\n",X)

typedef long long  ll;
#define rept(x, s, n) for (int x = s; x < n; x++)

#define S_RTN(S)  s_cout(S);return 0


#define _itoa(A,N) sprintf(A, "%d", N);

int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);

int s_asorts(const void* a, const void* b);

//昇順
int s_asorts(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
	int i;
	rept(i, 0, n) {
		l_cin2(*(a + i), *(b + i));
	}
	return 0;
}
int i_cins(int n, int* a) {
	int i;
	for (i = 0; i < n; i++) {
		i_cin(*(a + i));
	}

	return 0;
}
int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}

long _max(long a, long b) {
	return a > b ? a : b;
}
long _min(long a, long b) {
	return a < b ? a : b;
}
int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}

#pragma endregion

int _cknum(char* a, int n);

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0'  || a[i]>'9') return 1;
	}
	return 0;
}

int main(void) {
	int A,B,l,rc;
	char S[15];

	i_cin2(A, B);
	s_cin(S);

	l=strlen(S); S[l] = 0x00;

	if (S[A] != '-') { S_RTN("No"); }

	rc= _cknum(S,A);
	if (rc) { S_RTN("No"); }
	rc = _cknum(&S[A+1],B);
	if (rc) { S_RTN("No"); }
	S_RTN("Yes");
	
}



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

using namespace std;

typedef long long ll;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> a(3 * n);
	for (int i = 0; i < 3 * n; i++) {
		cin >> a[i];
	}
	vector<ll> L(3 * n);
	ll sum = 0;
	priority_queue<int, vector<int>, greater<int> > pq1;
	for (int i = 0; i < n; i++) {
		sum += a[i];
		pq1.push(a[i]);
	}
	L[n] = sum;
	for (int i = n + 1; i <= 2 * n; i++) {
		pq1.push(a[i - 1]);
		L[i] = L[i - 1] + a[i - 1] - pq1.top();
		pq1.pop();
	}
	vector<ll> R(3 * n);
	sum = 0;
	priority_queue<int> pq2;
	for (int i = 2 * n; i < 3 * n; i++) {
		sum += a[i];
		pq2.push(a[i]);
	}
	R[2 * n] = sum;
	for (int i = 2 * n - 1; i >= n; i--) {
		pq2.push(a[i]);
		R[i] = R[i + 1] + a[i] - pq2.top();
		pq2.pop();
	}
	ll ans = -1e15;
	for (int i = n; i <= 2 * n; i++) {
		ans = max(ans, L[i] - R[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8440
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.141592653589793238
#define dcout cout<<fixed<<setprecision(50)

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long
#define double long double

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

int dp[100010][2][2][2];

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

  int N, A[100000]; cin >> N;
  REP(i, N) cin >> A[i];
  map<int, int> mp;
  if(A[0] != 0){
    cout << 0 << endl;
    return 0;
  }
  int ans = 3;
  mp[0]++;
  REP(i, N-1){
    if(A[i+1] > 0){
      // ans *= mp[A[i+1]-1]; ans %= MOD;
      ans *= (mp[A[i+1]-1]-mp[A[i+1]]); ans %= MOD;
    }
    if(mp[A[i+1]] and A[i+1] == 0){
      ans *= (3-mp[A[i+1]]); ans %= MOD;
    }
    mp[A[i+1]]++;
  }
  cout << ans << endl;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>0;(i)--)
#define rrep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define rrepr(i,n,m) for(int (i)=(n);(i)>(m);(i)--)
#define esort(s) sort((s).begin(),(s).end())

typedef long long ll;
typedef pair<int,int> ipair;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;

const int INF = 1000000000;
const ll LINF = 1000000000000000000;
const double PI = acos(-1.0);
const double EPS = 1e-10;

const ll MOD = 1000000007ll;
const int MAX=510000;

ll N;

ll count_five(ll N){
    if(!(N/5)) return N;
    else return N+count_five(N/5ll);
}

void solve(){
    cin>>N;
    ll five=0;
    if(N%2) {cout<<0<<"\n";return;}

    N/=10;
    five=count_five(N);
    cout<<five<<"\n";
    return;
}

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

    solve();
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long ll;
int main(){
  ll n,k;
  cin>>n>>k;
  ll ans=0;
  do{
    ans++;
    n/=k;
  }while(n>0);
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;



int main(){
    char s[15];
    char tmp;
    int i = 0;
    while(cin >> tmp){
        if(tmp=='B'){
            if(i>0){
                s[i-1] ='\0';
                i--;
            }
        }
        else{
            s[i] = tmp;
            i++;
        }
    }
    for(int i=0;i<15;i++){
        if(s[i] == '0' || s[i] == '1'){
            cout << s[i];
        }
    }
    cout << endl;
}

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

static const int maxN = 8, maxM = 32;

bool checkPath(const vector<int>& node, const int edgeList[maxN][maxN]){
  //vectorの隣のパスが存在するかを調べる
  bool flag = true;
  for(int i = 0; i < node.size() - 1; i++){
    if(node[0] != 0){
      flag = false;
      break;
    }
    else if(edgeList[node[i]][node[i + 1]] == 0){
      flag = false;
      break;
    }
  }
  return flag;
}

int main(void){
  int N, M;
  int a[maxM], b[maxM];
  int edgeList[maxN][maxN];
  vector<int> node;
  cin >> N >> M;
  for(int i = 0; i < M; i++){
    cin >> a[i] >> b[i];
  }
  //0~N-1に添字を一個ずらす
  for(int i = 0; i < M; i++){
    a[i] = a[i] - 1, b[i] = b[i] - 1;
  }
  for(int i = 0; i < N; i++){
    node.push_back(i);//0~N-1をストックする。
  }
  //EdgeListでエッジの情報を管理
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      edgeList[i][j] = 0;
    }
  }
  for(int i = 0; i < M; i++){
    edgeList[a[i]][b[i]]++;
    edgeList[b[i]][a[i]]++;
    //cout << node[i] << endl;
  }
  /*for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(edgeList[i][j] != 0) cout << i << " " << j << " " << edgeList[i][j] << endl;
    }
  }*/

  //N個の並び替えを行なって，パスが存在するかをチェックしてみる。
  int cntPath = 0;
  do{
    if(checkPath(node, edgeList)) cntPath++;
  }while(next_permutation(node.begin(), node.end()));
  cout << cntPath << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
ll int Dis(ll int n,ll int *dp)
{
  if(n==0)
    return 1;
  if(n==1||n==2)
    return 0;
  ll int sum=0;
  if(dp[n]!=-1)
  return dp[n]%mod;
  for(ll int i=3;i<=n;i++)
      sum = (sum%mod +  Dis(n-i,dp)%mod + mod)%mod;
      
    return dp[n] = sum%mod;
 }
int main()
{
  ll int n;
  cin>>n;
  ll int dp[n+1];
  memset(dp,-1,sizeof(dp));
  cout<<Dis(n,dp)%mod;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <math.h>

using namespace std;
int main() {

	int ans;

	string s;

	cin >> s;

	if (s[0] == '1')ans++;
	if (s[1] == '1')ans++;
	if (s[2] == '1')ans++;
	cout << ans;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

/**
 * Created on 2018/03/02 19:31.
 */
public class Main {
    public static void main(String[] args) throws IOException {
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc = new Scanner(System.in);

        while (sc.hasNextInt()) {
            int N = sc.nextInt();
            int K = sc.nextInt();
            String notUse = "";
            for (int i = 0; i < K; i++) {
                notUse += sc.next();
            }
            int ans = -1;
            for (int i = 0; i <= N * 10; i++) {
                if (i < N) {
                    continue;
                }
                boolean yes = true;
                for (char ch : Integer.toString(i).toCharArray()) {
                    if (notUse.contains("" + ch)) {
                        yes = false;
                        break;
                    }
                }
                if (yes) {
                    ans = i;
                    break;
                }
            }
            System.out.println(ans);
        }
    }

}


Measured memory_bytes: 39252
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>

#ifdef _MSC_VER
#include <Windows.h>
#else
#include <unistd.h>
#endif

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD=(LL)1e9+7;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

#define INF 1LL << 50



int main(){
    LL N;cin>>N;
    LL A[100005];
    LL sum1=0,sum2=0;
    REP(i,N){
        cin>>A[i];
        sum1+=A[i];
        sum2+=(i+1LL);
    }
    if(sum1%sum2!=0){
        cout<<"NO"<<endl;return 0;
    }
    LL cnt=sum1/sum2;
    bool flag=true;
    REP(i,N)if((A[(i+1)%N]-A[i]-cnt)>0||(A[(i+1)%N]-A[i]-cnt)%N!=0)flag=false;
    if(flag){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> sum(string A, string B);
int main() {
  int n;
  cin>>n;
  string a,b;
  for(int i=0;i<n;i++) {
    cin>>a;
    cin>>b;
    if((int)a.size()>80 || (int)b.size()>80)
      cout<<"overflow\n";
    else{
      vector<int> tmp=sum(a,b);
      if(tmp.size()>80)
	cout<<"overflow\n";
      else {
	string S="";
	for(int i=0;i<(int)tmp.size();i++) {
	 S+=to_string(tmp[i]);
	}
	cout<<S<<endl;
      }
    }
  }   
  return 0;
}
vector<int> sum(string A, string B) {
  int  a_size=A.size()-1;
  int  b_size=B.size()-1;
  int end=-1;
  vector<int> tmp;
  int Dr=0;
  while(true) {
    if(a_size<0 ){
      end=0;
      break;
    }
    if(b_size<0){
      end=1;
      break;
    }
    int a=(int)A[a_size]-(int)'0';
    int b=(int)B[b_size]-(int)'0';
    int n=a+b+Dr;
    if(n>=10){
      tmp.push_back(n-10);
      Dr=1;
    }
    else{
      Dr=0;
      tmp.push_back(n);
    }
    a_size--;
    b_size--;
  }

  if(end==0) {
    for(int i= b_size;i>=0;i--){
      int n=(int)B[i]-int('0')+Dr;
      if(n>=10) {
	tmp.push_back(n-10);
	Dr=1;
      }
      else{
	tmp.push_back(n);
	Dr=0;
      }
    }
  }
  else if(end==1){
    for(int i=a_size;i>=0;i--){
      int n=(int)A[i]-int('0')+Dr;
      if(n>=10){
	tmp.push_back(n-10);
	Dr=1;
      }
      else{
	tmp.push_back(n);
	Dr=0;
      }
    }
  }
  if(Dr==1)
    tmp.push_back(1);
  reverse(tmp.begin(),tmp.end());
  return tmp;
}



Measured memory_bytes: 3260
import copy
n = int(input())
s = []
for i in range(n):
    s += [input()]
checker = copy.deepcopy(s)
checker += ['xxxxxxxxxxxxxxxxxxxx']

m = int(input())
t = []
for i in range(m):
    t += [input()]

r = 0
for ss in set(checker):
    buf = s.count(ss) - t.count(ss)
    if r < buf:
        r = buf
print(r)


Measured memory_bytes: 3444
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        w: i64,
        h: i64,
        x: i64,
        y: i64,
    }

    let ans = (w as f64 *h as f64)/2.0;
    let multi = if x*2==w && y*2==h {1} else {0};

    println!("{:.12} {}", ans, multi);
}


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

int linerSearch(int n, int s[], int t){
	s[n]=t;
	int i=0;
	while(s[i]!=t){
		i++;
	}
	if(i==n) return 0;
	return 1;
}

int main(){
	int n,q,s[10000],t,ans=0;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> s[i];
	}
	cin >> q;
	for(int i=0;i<q;i++){
		cin >> t;
		ans+=linerSearch(n,s,t);
	}
	cout << ans << endl;
	return 0;
}



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

using namespace std;

template<class T, class U>
void ckmin(T &a, U b)
{
	if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
	if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
#define SZ(x) ((int) ((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define INF 1000000007
#define LLINF 2696969696969696969ll
#define MAXN 100013

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

int N, M;
bitset<MAXN> vis;
int dp[MAXN];
vi edge[MAXN];
int ans;

int solve(int u)
{
	if (vis[u]) return dp[u];
	vis[u] = true;
	for (int v : edge[u])
	{
		ckmax(dp[u], solve(v) + 1);
	}
	return dp[u];
}

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> N >> M;
	FOR(i, 0, M)
	{
		int u, v; cin >> u >>v; u--; v--;
		edge[u].PB(v);
	}
	FOR(i, 0, N)
	{
		ckmax(ans, solve(i));
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 7552
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, m;
  cin >> n >> m;
  ll sum = 0;
  rep(i, m) {
    ll a;
    cin >> a;
    sum += a;
  }
  cout << (n >= sum ? n - sum : -1) << endl;
}

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

#define ll long long
#define db double
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ino freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);

#define fr(i,n) for(i=0;i<n;i++)
#define frs(i,a,n) for(i=a;i<n;i++)
#define frv(i,n) for(i=n-1;i>=0;i--)

#define ne cout<<"\n";
#define cas(i) cout<<"Case #"<<i<<": "

#define vi vector <int>
#define vpi vector <pair <int,int> >
#define vpin(v,a,b) v.push_back(make_pair(a,b))
#define vsort(v) sort(v.begin(),v.end());
#define all(v) ((v).begin()),((v).end())
#define sz(v) ((int)((v).size()))

#define todegree(rad) rad*(180.0/pi)
#define isnttriangle(a,b,c) (a+b<c||a+c<b||b+c<a)
#define pi acos(-1)
#define siz 1000


int main()
{
    ll H,W,ans,r,c;
    cin>>H>>W;
    if(H==1||W==1) ans=1;
    else if(H%2==0)
    {
        ans=(H/2)*W;
    }
    else if(W%2==0)
        ans=(W/2)*H;
    else
    {
        ans=(H/2)*W;
        ans+=(W/2)+1;
    }
    cout<<ans<<'\n';
    return 0;
}



Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define DIM 100007
#define INF 1000000000000000007LL
using namespace std;

long long n,w[107],v[107],W,d[107][DIM],res;

int main()
{
    cin>>n>>W;
    for(int i = 1; i <= n; ++i)
        cin>>w[i]>>v[i];

    for(int i = 1; i < DIM; ++i)
        d[0][i] = INF;

    for(int i = 1; i <= n; ++i)
        for(int j = 1; j < DIM; ++j)
    {
        d[i][j] = d[i-1][j];
        if(j>=v[i])
            d[i][j] = min(d[i][j],d[i-1][j-v[i]]+w[i]);
        if(d[i][j] <= W) res = max(res,(long long)j);
    }
    cout<<res;
    return 0;
}


Measured memory_bytes: 80256
#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 <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

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

    int l,r,d; cin >> l >> r >> d;
    int ans = 0;
    for(int i = l;i < r+1;i ++){
        if(i % d == 0) ans ++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#AGC032-B Balanced Neighbors
"""
まずnが偶数の場合を考える。
1...nの数列を考えた時に、
1+n,2+n-1,3+n-2…を１頂点として考えると、全てその値が等しいグラフになる。
次に奇数の場合を考える。
n-1までのグラフを偶数の場合と同じように構築した後、
nはn-1までの2頂点の合計と等しい値になる。
よって、最後に全頂点をnとつなぎ合わせると条件を満たすグラフに成る。
"""
import sys
from collections import defaultdict
dic1 = defaultdict(int)
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
ans = []
mid = 1+(n//2)*2
for i in range(1,(n//2)*2+1):
    dic1[i] = mid-i
for i in range(1,(n//2)*2):
    res = dic1[i]
    for j in range(i+1,(n//2)*2+1):
        if j == res:
            continue
        ans.append([i,j])

if not even(n):
    for i in range(1,n):
        ans.append([i,n])

print(len(ans))
for i in ans:
    print(*i)


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

const ll INF = 1001001001;

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

int main(){

  int a,b,c,d;
  cin>>a>>b>>c>>d;
  bool flag=true;
  int ans=0;
  while(flag){
    c-=b;
    if(c<=0){
      ans=1;
      break;
    }
    a-=d;
    if(a<=0){
      ans=2;
      break;
    }
  }
  if(ans==1){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}



Measured memory_bytes: 3676
N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
n = range(1,N + 1)
import itertools 
l = list(itertools.permutations(n))
a = 0
b = 0
for i in l:
    if i == tuple(P):
        a += 1
        break
    else:
        a += 1
for i in l:
    if  i == tuple(Q):
        b += 1
        break
    else:
        b += 1
print(abs(a - b))

Measured memory_bytes: 13936
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    int n = s.length();
    string last;
    last = {s[0]};
    int ans = 1;
    int mozisu = 1;
    rep(i,n)
    {
        // 1mozi zl kaburanakereba 1mozi: 2mozi
        // 2mozi zl 1mozi
        if (i==0)
        {
            last = {s[0]};
            ans = 1;
            mozisu = 1;
        }
        else
        {
            if (last.length() == 2)
            {
                last = {s[i]};
                ans += 1;
                mozisu = 1;
            }
            else if (last != string()+s[i])
            {
                last = {s[i]};
                ans += 1;
                mozisu = 1;
            }
            else
            {
                if (i==n-1) continue;
                last += s[i];
                mozisu = 2;
                ans += 1;
                i++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 720
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main()
{
    vector<int> ab(2);
    rep(i, 2) cin >> ab[i];
    cout << ab[0] * ab[1] << endl;
    return 0;
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }
template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	ll A, B, N; cin >> A >> B >> N;
	cout << A*min(B-1, N)/B << el;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define pb push_back
#define all(v) v.begin(),v.end()
#define sort_1(v) sort(v.begin(),v.end())
#define sort_2(v) sort(v.begin(),v.end(),greater<ll>())
#define reverse(v) reverse(v.begin(),v.end())
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
	string s,t;
    cin >> s >> t;
    int ct=0;
    rep(i,0,s.size()){
        if(s[i] != t[i]) ct++;
    }
    cout << ct << endl;
    
}

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

using namespace std;

int main() {
    long long N, W, V = 0;
    cin >> N >> W;

    vector<int> w(N), v(N);
    for (int i = 0; i < N; i++) {
        cin >> w[i] >> v[i];
        V += v[i];
    }

    vector<long long> ks(V + 1, INT_MAX);
    ks[0] = 0;

    for (int i = 0; i < N; i++)
        for (int j = V; j >= v[i]; j--) ks[j] = min(ks[j - v[i]] + w[i], ks[j]);

    for (int i = V; i >= 0; i--) {
        if (ks[i] <= W) {
            cout << i;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 4032
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>

int main() {
	int n, q; std::cin >> n >> q;
	std::vector<int> values(n); for (auto& v : values) std::cin >> v;
	std::sort(values.begin(), values.end());
	for (auto i = 0; i < q; ++i) {
		int left, right; std::cin >> left >> right;
		std::cout << std::distance(std::lower_bound(values.begin(), values.end(), left), std::upper_bound(values.begin(), values.end(), right)) << '\n';
	}
}


Measured memory_bytes: 3168
#include<iostream>
using namespace std;
int main(void)
{
    string s;
    int n;
    cin >> s;
    n=s.size();
    int cnt=0;
    for(int i=0;i<n/2;i++)
        if(s[i]==s[n-i-1])
            cnt++;
    if(cnt!=n/2)
    {
        cout << "No";
        return 0;
    }
    cnt=0;
    for(int i=0;i<((n-1)/2)/2;i++)
        if(s[i]==s[(n-1)/2-i-1])
            cnt++;
    if(cnt!=(n-1)/2/2)
    {
        cout << "No";
        return 0;
    }
    cnt=0;
    for(int i=(n+1)/2;i<n;i++)
        if(s[i]==s[n-i-1])
            cnt++;
    if(cnt!=(n-1)/2)
    {
        cout << "No";
        return 0;
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    int ac = 0, bc = 0;
    (s[0] == 'A' ? ac : bc)++;
    (s[1] == 'A' ? ac : bc)++;
    (s[2] == 'A' ? ac : bc)++;
    if (ac == 3 || bc == 3) cout << "No\n";
    else cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

  int d[n+1];
  d[0] = 0;
  int a;
  int cnt = 1;

  for (int i = 1; i < n+1; i++) {
    cin >> a;
    d[i] = d[i-1] + a;
    if (d[i] <= x){
      cnt++;
    }
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<limits>

using namespace std;

struct Node
{
	pair<int, int> previous = { -1,-1 };
	int distance = numeric_limits<int>::max();
	bool closed = false;
	bool visited = false;
};

int H, W;
char s[50][50];
Node nodes[50][50];

int main()
{
	cin >> H >> W;
	int blackNum = 0;
	for (int i = 0; i < H; i++)
	{
		for (int j = 0; j < W; j++)
		{
			cin >> s[i][j];
			if (s[i][j] == '#')
				blackNum++;
		}
	}

	pair<int, int> directions[4] = { {0, -1}, {1, 0}, {0, 1}, {-1, 0} };

	queue<pair<int, int>> nq;
	nq.emplace(make_pair(0, 0));
	nodes[0][0].distance = 0;
	nodes[0][0].visited = true;
	while (!nq.empty())
	{
		auto node = nq.front();
		nq.pop();
		if (node.first == H - 1 && node.second == W - 1)
			break;
		nodes[node.first][node.second].closed = true;

		for (auto dir : directions)
		{
			int i = node.first + dir.first;
			int j = node.second + dir.second;
			if (i < 0 || i >= H || j < 0 || j >= W || s[i][j] == '#')
			{
				continue;
			}

			if (nodes[i][j].visited)
				continue;

			nodes[i][j].previous = node;
			nodes[i][j].distance = nodes[node.first][node.second].distance + 1;
			nq.emplace(make_pair(i, j));
			nodes[i][j].visited = true;
		}
	}

	if (nodes[H - 1][W - 1].previous.first == -1)
	{
		cout << -1 << endl;
		return 0;
	}

	int ans = H * W - nodes[H - 1][W - 1].distance - 1 - blackNum;

	cout << ans << endl;

	return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
  ll X; cin >> X;
  ll ans = X / 500 * 1000;
  ans += (X % 500) / 5 * 5;
  cout << ans << endl;

  return 0;
}


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

#ifdef LOCAL
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define dbgv(x) cerr << #x << " = " << x << endl
#define dbga(arr, len) {cerr << #arr << " = "; for (int _ = 0; _ < len; _++)\
cerr << arr[_] << " "; cerr << endl;}
#define dbgi(it) {cerr << #it << " = "; for (const auto& _ : it)\
cerr << _ << " "; cerr << endl;}
#else
#define dbg(...) (void)0
#define dbgv(x) (void)0
#define dbga(arr, len) (void)0
#define dbgi(it) (void)0
#endif

using ll = long long;
using dbl = long double;
using pii = pair<int, int>;

const int N = 200500;

int n;
ll k;
ll a[N], f[N];

bool good(ll lim) {
    ll cost = 0;
    for (int i = 0; i < n; ++i) {
        ll p = lim / f[i];
        cost += max(0LL, a[i] - p);
    }
    return cost <= k;
}

void solve() {
    scanf("%d%lld", &n, &k);
    for (int i = 0; i < n; ++i) {
        scanf("%lld", &a[i]);
    }
    for (int i = 0; i < n; ++i) {
        scanf("%lld", &f[i]);
    }

    sort(a, a + n);
    sort(f, f + n);
    reverse(f, f + n);

    ll left = -1, right = (ll)1e13;
    while (right - left > 1) {
        ll mid = (left + right) / 2;
        if (good(mid)) {
            right = mid;
        } else {
            left = mid;
        }
    }

    printf("%lld\n", right);
}

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    solve();

    dbg("\n\ntime = %.3lf\n", (double)clock() / CLOCKS_PER_SEC);
}


Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

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


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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
//int dx[] = { 1, 0 };
//int dy[] = { 0, 1 };
#define mod7 1e9+7;
#define mod9 1e9+9;
const ll INFLL = 999999999999999;

//int nextInt(){
//	int a;	cin >> a;return a;
//}
//string next(){
//	string s;cin >> s;return s;
//}
//char nextChar(){
//	char c;cin >> c;return c;
//}
template<typename T>
T s2i(std::string str) {T ret;std::stringstream ss; ss << str;ss >> ret;return ret;}

void solve(){
	int a,b;
	cin >> a >> b;
	string s;
	cin >> s;
	rep(i,a){
		if(!(s[i] >= '0' and s[i] <= '9')){
			P("No");
			return;
		}
	}
	if(s[a] != '-'){
		P("No");
		return;
	}
	REP(i,a+1,a+b+1){
		if(!(s[i] >= '0' and s[i] <= '9')){
			P("No");
			return;
		}
	}
	P("Yes");
}

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


Measured memory_bytes: 384
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
ll MOD = 1000000007;
#define INF (1e9)

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll N;
    cin >> N;
    map<ll, ll> mp;
    vector<ll> A(N);
    rep(i, N){
        cin >> A[i];
        mp[A[i]] ++;
    } 
    ll count1 = 0;
    ll count2 = 0;
    for(P p : mp) {
        if (p.second % 2 == 0) {
            p.second = 2;
            count2 ++;
        } else {
            p.second = 1;
            count1++;
        }
    }
    count1 += count2;
    if (count2 % 2 == 1) count1--;
    cout << count1 << endl;
    return 0;
}


Measured memory_bytes: 7296
n = int(input())
a = list(map(int, input().split()))

i = 0
per = True
while per == True:
    for index in range(n):
        num = a[index]
        ans = divmod(num, 2)
        if num == 0 or ans[1] != 0:
            per = False
            break
        a[index] = ans[0]
    if per == True:
        i += 1
print(i)

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

#define INF INT_MAX/2
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long ;

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

   int N,i;
   cin>>N>>i;
   cout<<N-i+1;
   return 0;
}


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

using namespace std;


using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
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);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  auto dp = make_v< int >(4, 10, 10, 10);
  dp[0][0][0][0] = true;
  for(int i = 0; i < S.size(); i++) {
    for(int j = 2; j >= 0; j--) {
      for(int k = 0; k < 10; k++) {
        for(int l = 0; l < 10; l++) {
          for(int m = 0; m < 10; m++) {
            if(j == 0) {
              dp[j + 1][S[i] - '0'][l][m] |= dp[j][k][l][m];
            } else if(j == 1) {
              dp[j + 1][k][S[i] - '0'][m] |= dp[j][k][l][m];
            } else {
              dp[j + 1][k][l][S[i] - '0'] |= dp[j][k][l][m];
            }
          }
        }
      }
    }
  }
  int ret = 0;
  for(int i = 0; i < 10; i++) {
    for(int j = 0; j < 10; j++) {
      for(int k = 0; k < 10; k++) {
        ret += dp[3][i][j][k];
      }
    }
  }
  cout << ret << endl;
}


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

typedef long long ll;

using namespace std;

int main(){
    string n;
    cin >> n;
    for(int i=0;i<=2 ; i++){
         if(n[i] == '7'){
             cout << "Yes" << endl;
             return 0;
         }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define randome_generate srand(std::chrono::high_resolution_clock::now().time_since_epoch().count())
using namespace std;
int t;
long long a,b,c,d,g,yu;
void solve(){
	cin>>a>>b>>c>>d;
	if(b>a){
		cout<<"No"<<endl;
		return;
	}
	if(b>d){
		cout<<"No"<<endl;
		return;
	}
	g=__gcd(b,d);
	yu=a%g;
	//MIN mod g ...yu,MIN>=c-b+1
	long long kk=(c-b+1LL)/g;
	if((c-b+1LL)<0LL)
		kk--; 
	long long mm=kk*g+yu;
	if(mm<(c-b+1LL))
		mm+=g;
	assert((mm%g+g)%g==yu);
	if(mm>=0){
		cout<<"Yes"<<endl;
		return;
	}
	cout<<"No"<<endl;
}
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>t;
	while(t--)
		solve();
	return 0;
}


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

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

	cin >> a >> b >> c >> d;

	int x = a * b;
	int y = c * d;

	if (x > y)
		cout << x << '\n';
	else
		cout << y << '\n';

	return 0;
}


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

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

    int ans=0;
    vector<int> v(3);
    for(int i=0; i<N-2; ++i){
        for(int j=i+1; j<N-1; ++j){
            if(L[i]==L[j]) continue;
            for(int k=j+1; k<N; ++k){
                if(L[i]==L[k] || L[j]==L[k]) continue;
                v[0]=L[i];
                v[1]=L[j];
                v[2]=L[k];
                sort(v.begin(), v.end());
                if(v[0]+v[1]>v[2]) ++ans;
            }
        }
    }
    cout<<ans<<endl;
}


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

int main(){
  int N;
  cin >> N;
  long long H[N];
  long long max = 0;
  int max_i;
  string ans = "Yes";
  for(int i = 0; i < N; i++){
    cin >> H[i];
    if( max < H[i] ){
      max = H[i];
      max_i = i;
    }
    if( max_i < i && max - H[i] >= 2 ){
      ans = "No";
    }
  }


  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  string s;
  cin >> s;
  int n = s.size();
  ll sum = 0;
  for (int i = 0; i < n; ++i) {
    ll v = s[i] - '0';
    sum += v;
  }
  cout << (sum % 9 == 0 ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 3704